1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8603],{93719:function(t){"use strict";function e(t,e,u){u=u||2;var d,p,g,_,x,v,y,b=e&&e.length,T=b?e[0]*u:t.length,E=r(t,0,T,u,!0),A=[];if(!E||E.next===E.prev)return A;if(b&&(E=function(t,e,n,h){var l,u,d,p,m,g=[];for(l=0,u=e.length;l<u;l++)d=e[l]*h,p=l<u-1?e[l+1]*h:t.length,(m=r(t,d,p,h,!1))===m.next&&(m.steiner=!0),g.push(function(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}(m));for(g.sort(s),l=0;l<g.length;l++)n=function(t,e){var r=function(t,e){var r,i,s,n=e,h=t.x,l=t.y,u=-1/0;do{if(l<=n.y&&l>=n.next.y&&n.next.y!==n.y){var d=n.x+(l-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(d<=h&&d>u&&(u=d,s=n.x<n.next.x?n:n.next,d===h))return s}n=n.next}while(n!==e);if(!s)return null;var f,p=s,m=s.x,g=s.y,_=1/0;n=s;do h>=n.x&&n.x>=m&&h!==n.x&&a(l<g?h:u,l,m,g,l<g?u:h,l,n.x,n.y)&&(f=Math.abs(l-n.y)/(h-n.x),c(n,t)&&(f<_||f===_&&(n.x>s.x||n.x===s.x&&(r=s,i=n,0>o(r.prev,r,i.prev)&&0>o(i.next,r,r.next))))&&(s=n,_=f)),n=n.next;while(n!==p);return s}(t,e);if(!r)return e;var s=f(r,t);return i(s,s.next),i(r,r.next)}(g[l],n);return n}(t,e,E,u)),t.length>80*u){d=g=t[0],p=_=t[1];for(var w=u;w<T;w+=u)x=t[w],v=t[w+1],x<d&&(d=x),v<p&&(p=v),x>g&&(g=x),v>_&&(_=v);y=0!==(y=Math.max(g-d,_-p))?32767/y:0}return function t(e,r,s,u,d,p,g){if(e){!g&&p&&function(t,e,r,i){var s=t;do 0===s.z&&(s.z=n(s.x,s.y,e,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,r,i,s,n,a,o,h,l=1;do{for(r=t,t=null,n=null,a=0;r;){for(a++,i=r,o=0,e=0;e<l&&(o++,i=i.nextZ);e++);for(h=l;o>0||h>0&&i;)0!==o&&(0===h||!i||r.z<=i.z)?(s=r,r=r.nextZ,o--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=i}n.nextZ=null,l*=2}while(a>1)}(s)}(e,u,d,p);for(var _,x,v=e;e.prev!==e.next;){if(_=e.prev,x=e.next,p?function(t,e,r,i){var s=t.prev,h=t.next;if(o(s,t,h)>=0)return!1;for(var l=s.x,u=t.x,d=h.x,c=s.y,f=t.y,p=h.y,m=l<u?l<d?l:d:u<d?u:d,g=c<f?c<p?c:p:f<p?f:p,_=l>u?l>d?l:d:u>d?u:d,x=c>f?c>p?c:p:f>p?f:p,v=n(m,g,e,r,i),y=n(_,x,e,r,i),b=t.prevZ,T=t.nextZ;b&&b.z>=v&&T&&T.z<=y;){if(b.x>=m&&b.x<=_&&b.y>=g&&b.y<=x&&b!==s&&b!==h&&a(l,c,u,f,d,p,b.x,b.y)&&o(b.prev,b,b.next)>=0||(b=b.prevZ,T.x>=m&&T.x<=_&&T.y>=g&&T.y<=x&&T!==s&&T!==h&&a(l,c,u,f,d,p,T.x,T.y)&&o(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;b&&b.z>=v;){if(b.x>=m&&b.x<=_&&b.y>=g&&b.y<=x&&b!==s&&b!==h&&a(l,c,u,f,d,p,b.x,b.y)&&o(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;T&&T.z<=y;){if(T.x>=m&&T.x<=_&&T.y>=g&&T.y<=x&&T!==s&&T!==h&&a(l,c,u,f,d,p,T.x,T.y)&&o(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}(e,u,d,p):function(t){var e=t.prev,r=t.next;if(o(e,t,r)>=0)return!1;for(var i=e.x,s=t.x,n=r.x,h=e.y,l=t.y,u=r.y,d=i<s?i<n?i:n:s<n?s:n,c=h<l?h<u?h:u:l<u?l:u,f=i>s?i>n?i:n:s>n?s:n,p=h>l?h>u?h:u:l>u?l:u,m=r.next;m!==e;){if(m.x>=d&&m.x<=f&&m.y>=c&&m.y<=p&&a(i,h,s,l,n,u,m.x,m.y)&&o(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(e)){r.push(_.i/s|0),r.push(e.i/s|0),r.push(x.i/s|0),m(e),e=x.next,v=x.next;continue}if((e=x)===v){g?1===g?t(e=function(t,e,r){var s=t;do{var n=s.prev,a=s.next.next;!h(n,a)&&l(n,s,s.next,a)&&c(n,a)&&c(a,n)&&(e.push(n.i/r|0),e.push(s.i/r|0),e.push(a.i/r|0),m(s),m(s.next),s=t=a),s=s.next}while(s!==t);return i(s)}(i(e),r,s),r,s,u,d,p,2):2===g&&function(e,r,s,n,a,u){var d=e;do{for(var p,m,g=d.next.next;g!==d.prev;){if(d.i!==g.i&&(p=d,m=g,p.next.i!==m.i&&p.prev.i!==m.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&l(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(p,m)&&(c(p,m)&&c(m,p)&&function(t,e){var r=t,i=!1,s=(t.x+e.x)/2,n=(t.y+e.y)/2;do r.y>n!=r.next.y>
1n&&r.next.y!==r.y&&s<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}(p,m)&&(o(p.prev,p,m.prev)||o(p,m.prev,m))||h(p,m)&&o(p.prev,p,p.next)>0&&o(m.prev,m,m.next)>0))){var _=f(d,g);d=i(d,d.next),_=i(_,_.next),t(d,r,s,n,a,u,0),t(_,r,s,n,a,u,0);return}g=g.next}d=d.next}while(d!==e)}(e,r,s,u,d,p):t(i(e),r,s,u,d,p,1);break}}}}(E,A,u,d,p,y,0),A}function r(t,e,r,i,s){var n,a;if(s===_(t,e,r,i)>0)for(n=e;n<r;n+=i)a=p(n,t[n],t[n+1],a);else for(n=r-i;n>=e;n-=i)a=p(n,t[n],t[n+1],a);return a&&h(a,a.next)&&(m(a),a=a.next),a}function i(t,e){if(!t)return t;e||(e=t);var r,i=t;do if(r=!1,!i.steiner&&(h(i,i.next)||0===o(i.prev,i,i.next))){if(m(i),(i=e=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==e);return e}function s(t,e){return t.x-e.x}function n(t,e,r,i,s){return(t=((t=((t=((t=((t=(t-r)*s|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=(e-i)*s|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function a(t,e,r,i,s,n,a,o){return(s-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(i-o)>=(r-a)*(e-o)&&(r-a)*(n-o)>=(s-a)*(i-o)}function o(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function h(t,e){return t.x===e.x&&t.y===e.y}function l(t,e,r,i){var s=d(o(t,e,r)),n=d(o(t,e,i)),a=d(o(r,i,t)),h=d(o(r,i,e));return!!(s!==n&&a!==h||0===s&&u(t,r,e)||0===n&&u(t,i,e)||0===a&&u(r,t,i)||0===h&&u(r,e,i))}function u(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function d(t){return t>0?1:t<0?-1:0}function c(t,e){return 0>o(t.prev,t,t.next)?o(t,e,t.next)>=0&&o(t,t.prev,e)>=0:0>o(t,e,t.prev)||0>o(t,t.next,e)}function f(t,e){var r=new g(t.i,t.x,t.y),i=new g(e.i,e.x,e.y),s=t.next,n=e.prev;return t.next=e,e.prev=t,r.next=s,s.prev=r,i.next=r,r.prev=i,n.next=i,i.prev=n,i}function p(t,e,r,i){var s=new g(t,e,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function m(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function g(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _(t,e,r,i){for(var s=0,n=e,a=r-i;n<r;n+=i)s+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return s}t.exports=e,t.exports.default=e,e.deviation=function(t,e,r,i){var s=e&&e.length,n=s?e[0]*r:t.length,a=Math.abs(_(t,0,n,r));if(s)for(var o=0,h=e.length;o<h;o++){var l=e[o]*r,u=o<h-1?e[o+1]*r:t.length;a-=Math.abs(_(t,l,u,r))}var d=0;for(o=0;o<i.length;o+=3){var c=i[o]*r,f=i[o+1]*r,p=i[o+2]*r;d+=Math.abs((t[c]-t[p])*(t[f+1]-t[c+1])-(t[c]-t[f])*(t[p+1]-t[c+1]))}return 0===a&&0===d?0:Math.abs((d-a)/a)},e.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,s=0;s<t.length;s++){for(var n=0;n<t[s].length;n++)for(var a=0;a<e;a++)r.vertices.push(t[s][n][a]);s>0&&(i+=t[s-1].length,r.holes.push(i))}return r}},77625:function(t){"use strict";var e=Object.prototype.hasOwnProperty,r="~";function i(){}function s(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function n(t,e,i,n,a){if("function"!=typeof i)throw TypeError("The listener must be a function");var o=new s(i,n||t,a),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),o.prototype.eventNames=function(){var t,i,s=[];if(0===this._eventsCount)return s;for(i in t=this._events)e.call(t,i)&&s.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,n=i.length,a=Array(n);s<n;s++)a[s]=i[s].fn;return a},o.prototype.listenerCount=function(t){var e=r?r+t:t,i=this._events[e];return i?i.fn?1:i.length:0},o.prototype.emit=function(t,e,i,s,n,a){var o=r?r+t:t;if(!this._events[o])return!1;var h,l,u=this._events[o],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;
1case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,s),!0;case 5:return u.fn.call(u.context,e,i,s,n),!0;case 6:return u.fn.call(u.context,e,i,s,n,a),!0}for(l=1,h=Array(d-1);l<d;l++)h[l-1]=arguments[l];u.fn.apply(u.context,h)}else{var c,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(t,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,e);break;case 3:u[l].fn.call(u[l].context,e,i);break;case 4:u[l].fn.call(u[l].context,e,i,s);break;default:if(!h)for(c=1,h=Array(d-1);c<d;c++)h[c-1]=arguments[c];u[l].fn.apply(u[l].context,h)}}return!0},o.prototype.on=function(t,e,r){return n(this,t,e,r,!1)},o.prototype.once=function(t,e,r){return n(this,t,e,r,!0)},o.prototype.removeListener=function(t,e,i,s){var n=r?r+t:t;if(!this._events[n])return this;if(!e)return a(this,n),this;var o=this._events[n];if(o.fn)o.fn!==e||s&&!o.once||i&&o.context!==i||a(this,n);else{for(var h=0,l=[],u=o.length;h<u;h++)(o[h].fn!==e||s&&!o[h].once||i&&o[h].context!==i)&&l.push(o[h]);l.length?this._events[n]=1===l.length?l[0]:l:a(this,n)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,t.exports=o},93813:function(t,e,r){!function(){var e={452:function(t){"use strict";t.exports=r(85605)}},i={};function s(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}},a=!0;try{e[t](n,n.exports,s),a=!1}finally{a&&delete i[t]}return n.exports}s.ab="//";var n={};!function(){var t,e=(t=s(452))&&"object"==typeof t&&"default"in t?t.default:t,r=/https?|ftp|gopher|file/;function i(t){"string"==typeof t&&(t=_(t));var i,s,n,a,o,h,l,u,d,c=(s=(i=t).auth,n=i.hostname,a=i.protocol||"",o=i.pathname||"",h=i.hash||"",l=i.query||"",u=!1,s=s?encodeURIComponent(s).replace(/%3A/i,":")+"@":"",i.host?u=s+i.host:n&&(u=s+(~n.indexOf(":")?"["+n+"]":n),i.port&&(u+=":"+i.port)),l&&"object"==typeof l&&(l=e.encode(l)),d=i.search||l&&"?"+l||"",a&&":"!==a.substr(-1)&&(a+=":"),i.slashes||(!a||r.test(a))&&!1!==u?(u="//"+(u||""),o&&"/"!==o[0]&&(o="/"+o)):u||(u=""),h&&"#"!==h[0]&&(h="#"+h),d&&"?"!==d[0]&&(d="?"+d),{protocol:a,host:u,pathname:o=o.replace(/[?#]/g,encodeURIComponent),search:d=d.replace("#","%23"),hash:h});return""+c.protocol+c.host+c.pathname+c.search+c.hash}var a="http://",o=a+"w.w",h=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,l=/https?|ftp|gopher|file/;function u(t,e){var r="string"==typeof t?_(t):t;t="object"==typeof t?i(t):t;var s=_(e),n="";r.protocol&&!r.slashes&&(n=r.protocol,t=t.replace(r.protocol,""),n+="/"===e[0]||"/"===t[0]?"/":""),n&&s.protocol&&(n="",s.slashes||(n=s.protocol,e=e.replace(s.protocol,"")));var u=t.match(h);u&&!s.protocol&&(t=t.substr((n=u[1]+(u[2]||"")).length),/^\/\/[^/]/.test(e)&&(n=n.slice(0,-1)));var d=new URL(t,o+"/"),c=new URL(e,d).toString().replace(o,""),f=s.protocol||r.protocol;return f+=r.slashes||s.slashes?"//":"",!n&&f?c=c.replace(a,f):n&&(c=c.replace(a,"")),l.test(c)||~e.indexOf(".")||"/"===t.slice(-1)||"/"===e.slice(-1)||"/"!==c.slice(-1)||(c=c.slice(0,-1)),n&&(c=n+("/"===c[0]?c.substr(1):c)),c}function d(){}d.prototype.parse=_,d.prototype.format=i,d.prototype.resolve=u,d.prototype.resolveObject=u;var c=/^https?|ftp|gopher|file/,f=/^(.*?)([#?].*)/,p=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,g=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function _(t,r,s){if(void 0===r&&(r=!1),void 0===s&&(s=!1),t&&"object"==typeof t&&t instanceof d)return t;var n=(t=t.trim()).match(f);t=n?n[1].replace(/\\/g,"/")+n[2]:t.replace(/\\/g,"/"),g.test(t)&&"/"!==t.slice(-1)&&(t+="/");var a=!/(^javascript)/.test(t)&&t.match(p),h=m.test(t),l="";a&&(c.test(a[1])||(l=a[1].toLowerCase(),t=""+a[2]+a[3]),a[2]||(h=!1,c.test(a[1])?(l=a[1],t=""+a[3]):t="//"+a[3]),3!==a[2].length&&1!==a[2].length||(l=a[1],t="/"+a[3]));var u,_=(n?n[1]:t).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),x=_&&_[1],v=new d,y="",b="";try{u=new URL(t)}catch(e){y=e,l||s||!/^\/\//.test(t)||/^\/\/.+[@.]/.test(t)||(b="/",t=t.substr(1));try{u=new URL(t,o)}catch(t){return v.protocol=l,v.href=l,v}}v.slashes=h&&!b,v.host="w.w"===u.host?"":u.host,v.hostname="w.w"===u.hostname?"":u.hostname.replace(/(\[|\])/g,""),v.protocol=y?l||null:u.protocol,v.search=u.search.replace(/\\/g,"%5C"),v.hash=u.hash.replace(/\\/g,"%5C");var T=t.split("#");!v.search&&~T[0].indexOf("?")&&(v.search="?"),v.hash||""!==T[1]||(v.hash="#"),v.query=r?e.decode(u.search.substr(1)):v.search.substr(1),v.pathname=b+(a?u.pathname.replace(/['^|`]/g,function(t){return"%"+t.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(t,e){try{return decodeURIComponent(e).split("").map(function(t){var e=t.charCodeAt();return e>256||/^[a-z0-9]$/i.test(t)?t:"%"+e.toString(16).toUpperCase()}).join("")}catch(t){return e}}):u.pathname),"about:"===v.protocol&&"blank"===v.pathname&&(v.protocol="",v.pathname=""),y&&"/"!==t[0]&&(v.pathname=v.pathname.substr(1)),l&&!c.test(l)&&"/"!==t.slice(-1)&&"/"===v.pathname&&(v.pathname=""),v.path=v.pathname+v.search,v.auth=[u.username,u.password].map(decodeURIComponent).filter(
1Boolean).join(":"),v.port=u.port,x&&!v.host.endsWith(x)&&(v.host+=x,v.port=x.slice(1)),v.href=b?""+v.pathname+v.search+v.hash:i(v);var E=/^(file)/.test(v.href)?["host","hostname"]:[];return Object.keys(v).forEach(function(t){~E.indexOf(t)||(v[t]=v[t]||null)}),v}n.parse=_,n.format=i,n.resolve=u,n.resolveObject=function(t,e){return _(u(t,e))},n.Url=d}(),t.exports=n}()},85605:function(t){!function(){"use strict";var e={815:function(t){t.exports=function(t,r,i,s){r=r||"&",i=i||"=";var n={};if("string"!=typeof t||0===t.length)return n;var a=/\+/g;t=t.split(r);var o=1e3;s&&"number"==typeof s.maxKeys&&(o=s.maxKeys);var h=t.length;o>0&&h>o&&(h=o);for(var l=0;l<h;++l){var u,d,c,f,p=t[l].replace(a,"%20"),m=p.indexOf(i);(m>=0?(u=p.substr(0,m),d=p.substr(m+1)):(u=p,d=""),c=decodeURIComponent(u),f=decodeURIComponent(d),Object.prototype.hasOwnProperty.call(n,c))?e(n[c])?n[c].push(f):n[c]=[n[c],f]:n[c]=f}return n};var e=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},577:function(t){var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,n,a,o){return(n=n||"&",a=a||"=",null===t&&(t=void 0),"object"==typeof t)?i(s(t),function(s){var o=encodeURIComponent(e(s))+a;return r(t[s])?i(t[s],function(t){return o+encodeURIComponent(e(t))}).join(n):o+encodeURIComponent(e(t[s]))}).join(n):o?encodeURIComponent(e(o))+a+encodeURIComponent(e(t)):""};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(t,e){if(t.map)return t.map(e);for(var r=[],i=0;i<t.length;i++)r.push(e(t[i],i));return r}var s=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}}},r={};function i(t){var s=r[t];if(void 0!==s)return s.exports;var n=r[t]={exports:{}},a=!0;try{e[t](n,n.exports,i),a=!1}finally{a&&delete r[t]}return n.exports}i.ab="//";var s={};s.decode=s.parse=i(815),s.encode=s.stringify=i(577),t.exports=s}()},24882:function(t,e,r){"use strict";let i,s,n,a,o,h,l,u,d,c,f,p,m,g,_,x,v,y,b,T,E,A,w,S,R,I,C;r.d(e,{iw:function(){return V},M4:function(){return sl},$N:function(){return su},ah:function(){return eK},T$:function(){return N},V0:function(){return B},mr:function(){return K},YP:function(){return rj},bg:function(){return rJ},jd:function(){return rQ},VL:function(){return e$},a$:function(){return ej},JZ:function(){return e2},Bv:function(){return rX},Zk:function(){return rO},Sj:function(){return rY},Ie:function(){return rL},ZQ:function(){return Z},lW:function(){return eq},qm:function(){return eV},P:function(){return sn},yl:function(){return W},V3:function(){return Y},Y8:function(){return sd},Cd:function(){return rt},Il:function(){return t4},lH:function(){return rK},TA:function(){return sf},ZX:function(){return e5},lg:function(){return F},Vi:function(){return M},Pj:function(){return re},nw:function(){return eM},I2:function(){return O},wn:function(){return r$},jV:function(){return r9},kV:function(){return ir},AI:function(){return rZ},WB:function(){return ia},UN:function(){return z},tT:function(){return ii},Ei:function(){return iD},fy:function(){return i0},zV:function(){return iR},wG:function(){return e1},TO:function(){return ih},W1:function(){return iM},e_:function(){return ek},_w:function(){return sp},PA:function(){return r0},A7:function(){return j},KI:function(){return X},G5:function(){return q},HI:function(){return im},zj:function(){return ig},y3:function(){return rs},XR:function(){return si},bO:function(){return rU},i0:function(){return sa},AB:function(){return rf},_b:function(){return e3},cB:function(){return $},hN:function(){return iE},E9:function(){return e8},mg:function(){return rr},$r:function(){return rD},NW:function(){return iA},lD:function(){return r8},ud:function(){return r7},jl:function(){return e4},N3:function(){return D},Ae:function(){return e9},TI:function(){return r5},uW:function(){return r6},J$:function(){return iP},Th:function(){return sh},_z:function(){return eX},c9:function(){return ri},RC:function(){return eH},oT:function(){return k},aH:function(){return G},HS:function(){return e6},pX:function(){return sg},id:function(){return ib},ex:function(){return rF},p:function(){return ij},z9:function(){return ip},fD:function(){return iY},ZM:function(){return eU},zI:function(){return iK},Ld:function(){return iT},Od:function(){return iZ},sp:function(){return L},vK:function(){return U},xE:function(){return r4},wr:function(){return iJ},UX:function(){return iu},CT:function(){return i1},aF:function(){return r1},vB:function(){return i8},Sb:function(){return i7},wx:function(){return rm},k7:function(){return sy},oR:function(){return i2},uF:function(){return i4},oo:function(){return rN},q4:function(){return sb},eH:function(){return sv},ls:function(){return i3},Rv:function(){return eF},Nt:function(){return H},e6:function(){return st},pb:function(){return eG},a7:function(){return eL},TF:function(){return iH},Y9:function(){return sr},kP:function(){return se},Rw:function(){return eN},qw:function(){return iL},K0:function(){return iV},Kc:function(){return rE},DL:function(){return iX},Lv:function(){return rc},tq:function(){return tg},Xd:function(){return Q},sg:function(){return rx},O2:function(){return iW},P6:function(){return P}});var P={};r.r(P),r.d(P,{BaseTextureCache:function(){return ey},BoundingBox:function(){return e_},CanvasRenderTarget:function(){return eE},DATA_URI:function(){return es},EventEmitter:function(){return t_},ProgramCache:function(){return ex},TextureCache:function(){return ev},clearTextureCache:function(){return eT},correctBlendMode:function(){return et},createIndicesForQuads:function(){return en},decomposeDataUri:function(){return eI},deprecation:function(){return tb},destroyTextureCache:function(){return eb},detectVideoAlphaMode:function(){return tS},determineCrossOrigin:function(){return eC},earcut:function(){return tx},getBufferType:function(){return ea},getCanvasBoundingBox:function(){return eS},getResolutionOfUrl:function(){return eP},hex2rgb:function(){return t5},hex2string:function(){return t6},interleaveTypedArrays:function(){return eh},isMobile:function(){return tg},isPow2:function(){return eu}
1,isWebGLSupported:function(){return tC},log2:function(){return ed},nextPow2:function(){return el},path:function(){return tw},premultiplyBlendMode:function(){return t9},premultiplyRgba:function(){return ee},premultiplyTint:function(){return er},premultiplyTintToRgba:function(){return ei},removeItems:function(){return ec},rgb2hex:function(){return t7},sayHello:function(){return tI},sign:function(){return ef},skipHello:function(){return tR},string2hex:function(){return t8},trimCanvas:function(){return eR},uid:function(){return em},url:function(){return tT}});var M=((o=M||{})[o.WEBGL_LEGACY=0]="WEBGL_LEGACY",o[o.WEBGL=1]="WEBGL",o[o.WEBGL2=2]="WEBGL2",o),D=((h=D||{})[h.UNKNOWN=0]="UNKNOWN",h[h.WEBGL=1]="WEBGL",h[h.CANVAS=2]="CANVAS",h),B=((l=B||{})[l.COLOR=16384]="COLOR",l[l.DEPTH=256]="DEPTH",l[l.STENCIL=1024]="STENCIL",l),N=((u=N||{})[u.NORMAL=0]="NORMAL",u[u.ADD=1]="ADD",u[u.MULTIPLY=2]="MULTIPLY",u[u.SCREEN=3]="SCREEN",u[u.OVERLAY=4]="OVERLAY",u[u.DARKEN=5]="DARKEN",u[u.LIGHTEN=6]="LIGHTEN",u[u.COLOR_DODGE=7]="COLOR_DODGE",u[u.COLOR_BURN=8]="COLOR_BURN",u[u.HARD_LIGHT=9]="HARD_LIGHT",u[u.SOFT_LIGHT=10]="SOFT_LIGHT",u[u.DIFFERENCE=11]="DIFFERENCE",u[u.EXCLUSION=12]="EXCLUSION",u[u.HUE=13]="HUE",u[u.SATURATION=14]="SATURATION",u[u.COLOR=15]="COLOR",u[u.LUMINOSITY=16]="LUMINOSITY",u[u.NORMAL_NPM=17]="NORMAL_NPM",u[u.ADD_NPM=18]="ADD_NPM",u[u.SCREEN_NPM=19]="SCREEN_NPM",u[u.NONE=20]="NONE",u[u.SRC_OVER=0]="SRC_OVER",u[u.SRC_IN=21]="SRC_IN",u[u.SRC_OUT=22]="SRC_OUT",u[u.SRC_ATOP=23]="SRC_ATOP",u[u.DST_OVER=24]="DST_OVER",u[u.DST_IN=25]="DST_IN",u[u.DST_OUT=26]="DST_OUT",u[u.DST_ATOP=27]="DST_ATOP",u[u.ERASE=26]="ERASE",u[u.SUBTRACT=28]="SUBTRACT",u[u.XOR=29]="XOR",u),F=((d=F||{})[d.POINTS=0]="POINTS",d[d.LINES=1]="LINES",d[d.LINE_LOOP=2]="LINE_LOOP",d[d.LINE_STRIP=3]="LINE_STRIP",d[d.TRIANGLES=4]="TRIANGLES",d[d.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",d[d.TRIANGLE_FAN=6]="TRIANGLE_FAN",d),O=((c=O||{})[c.RGBA=6408]="RGBA",c[c.RGB=6407]="RGB",c[c.RG=33319]="RG",c[c.RED=6403]="RED",c[c.RGBA_INTEGER=36249]="RGBA_INTEGER",c[c.RGB_INTEGER=36248]="RGB_INTEGER",c[c.RG_INTEGER=33320]="RG_INTEGER",c[c.RED_INTEGER=36244]="RED_INTEGER",c[c.ALPHA=6406]="ALPHA",c[c.LUMINANCE=6409]="LUMINANCE",c[c.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",c[c.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",c[c.DEPTH_STENCIL=34041]="DEPTH_STENCIL",c),L=((f=L||{})[f.TEXTURE_2D=3553]="TEXTURE_2D",f[f.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",f[f.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",f[f.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",f[f.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",f[f.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",f[f.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",f[f.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",f[f.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",f),U=((p=U||{})[p.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",p[p.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",p[p.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",p[p.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",p[p.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",p[p.UNSIGNED_INT=5125]="UNSIGNED_INT",p[p.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",p[p.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",p[p.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",p[p.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",p[p.BYTE=5120]="BYTE",p[p.SHORT=5122]="SHORT",p[p.INT=5124]="INT",p[p.FLOAT=5126]="FLOAT",p[p.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",p[p.HALF_FLOAT=36193]="HALF_FLOAT",p),k=((m=k||{})[m.FLOAT=0]="FLOAT",m[m.INT=1]="INT",m[m.UINT=2]="UINT",m),G=((g=G||{})[g.NEAREST=0]="NEAREST",g[g.LINEAR=1]="LINEAR",g),H=((_=H||{})[_.CLAMP=33071]="CLAMP",_[_.REPEAT=10497]="REPEAT",_[_.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",_),X=((x=X||{})[x.OFF=0]="OFF",x[x.POW2=1]="POW2",x[x.ON=2]="ON",x[x.ON_MANUAL=3]="ON_MANUAL",x),V=((v=V||{})[v.NPM=0]="NPM",v[v.UNPACK=1]="UNPACK",v[v.PMA=2]="PMA",v[v.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",v[v.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",v[v.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",v),W=((y=W||{})[y.NO=0]="NO",y[y.YES=1]="YES",y[y.AUTO=2]="AUTO",y[y.BLEND=0]="BLEND",y[y.CLEAR=1]="CLEAR",y[y.BLIT=2]="BLIT",y),z=((b=z||{})[b.AUTO=0]="AUTO",b[b.MANUAL=1]="MANUAL",b),$=((T=$||{}).LOW="lowp",T.MEDIUM="mediump",T.HIGH="highp",T),j=((E=j||{})[E.NONE=0]="NONE",E[E.SCISSOR=1]="SCISSOR",E[E.STENCIL=2]="STENCIL",E[E.SPRITE=3]="SPRITE",E[E.COLOR=4]="COLOR",E),Y=((A=Y||{})[A.RED=1]="RED",A[A.GREEN=2]="GREEN",A[A.BLUE=4]="BLUE",A[A.ALPHA=8]="ALPHA",A),q=((w=q||{})[w.NONE=0]="NONE",w[w.LOW=2]="LOW",w[w.MEDIUM=4]="MEDIUM",w[w.HIGH=8]="HIGH",w),K=((S=K||{})[S.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",S[S.ARRAY_BUFFER=34962]="ARRAY_BUFFER",S[S.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",S);let Z={createCanvas:(t,e)=>{let r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")},Q={ADAPTER:Z,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};
1var J=/iPhone/i,tt=/iPod/i,te=/iPad/i,tr=/\biOS-universal(?:.+)Mac\b/i,ti=/\bAndroid(?:.+)Mobile\b/i,ts=/Android/i,tn=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ta=/Silk/i,to=/Windows Phone/i,th=/\bWindows(?:.+)ARM\b/i,tl=/BlackBerry/i,tu=/BB10/i,td=/Opera Mini/i,tc=/\b(CriOS|Chrome)(?:.+)Mobile/i,tf=/Mobile(?:.+)Firefox\b/i,tp=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};function tm(t){var e,r={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?r.userAgent=t:t&&t.userAgent&&(r={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):r={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var i=r.userAgent,s=i.split("[FBAN");void 0!==s[1]&&(i=s[0]),void 0!==(s=i.split("Twitter"))[1]&&(i=s[0]);var n=(e=i,function(t){return t.test(e)}),a={apple:{phone:n(J)&&!n(to),ipod:n(tt),tablet:!n(J)&&(n(te)||tp(r))&&!n(to),universal:n(tr),device:(n(J)||n(tt)||n(te)||n(tr)||tp(r))&&!n(to)},amazon:{phone:n(tn),tablet:!n(tn)&&n(ta),device:n(tn)||n(ta)},android:{phone:!n(to)&&n(tn)||!n(to)&&n(ti),tablet:!n(to)&&!n(tn)&&!n(ti)&&(n(ta)||n(ts)),device:!n(to)&&(n(tn)||n(ta)||n(ti)||n(ts))||n(/\bokhttp\b/i)},windows:{phone:n(to),tablet:n(th),device:n(to)||n(th)},other:{blackberry:n(tl),blackberry10:n(tu),opera:n(td),firefox:n(tf),chrome:n(tc),device:n(tl)||n(tu)||n(td)||n(tf)||n(tc)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}let tg=(tm.default??tm)(globalThis.navigator);Q.RETINA_PREFIX=/@([0-9\.]+)x/,Q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var t_=r(77625),tx=r(93719),tv=r(93813);let ty={};function tb(t,e,r=3){if(ty[e])return;let i=Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} 2Deprecated since v${t}`):(i=i.split(` 3`).splice(r).join(` 4`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e} 5Deprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} 6Deprecated since v${t}`),console.warn(i))),ty[e]=!0}let tT={get parse(){return tb("7.3.0","utils.url.parse is deprecated, use native URL API instead."),tv.parse},get format(){return tb("7.3.0","utils.url.format is deprecated, use native URL API instead."),tv.format},get resolve(){return tb("7.3.0","utils.url.resolve is deprecated, use native URL API instead."),tv.resolve}};function tE(t){if("string"!=typeof t)throw TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function tA(t){return t.split("?")[0].split("#")[0]}let tw={toPosix:t=>t.replace(RegExp("\\".replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),"/"),isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),isBlobUrl:t=>t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){tE(t),t=this.toPosix(t);let e=/^file:\/\/\//.exec(t);if(e)return e[0];let r=/^[^/:]+:\/{0,2}/.exec(t);return r?r[0]:""},toAbsolute(t,e,r){if(tE(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let i=tA(this.toPosix(e??Q.ADAPTER.getBaseUrl())),s=tA(this.toPosix(r??this.rootname(i)));return(t=this.toPosix(t)).startsWith("/")?tw.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(tE(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="",r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let i=t.endsWith("/");return(t=function(t,e){let r="",i=0,s=-1,n=0,a=-1;for(let o=0;o<=t.length;++o){if(o<t.length)a=t.charCodeAt(o);else{if(47===a)break;a=47}if(47===a){if(!(s===o-1||1===n)){if(s!==o-1&&2===n){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2)){if(r.length>2){let t=r.lastIndexOf("/");if(t!==r.length-1){-1===t?(r="",i=0):i=(r=r.slice(0,t)).length-1-r.lastIndexOf("/"),s=o,n=0;continue}}else if(2===r.length||1===r.length){r="",i=0,s=o,n=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+=`/${t.slice(s+1,o)}`:r=t.slice(s+1,o),i=o-s-1}s=o,n=0}else 46===a&&-1!==n?++n:n=-1}return r}(t,!1)).length>0&&i&&(t+="/"),r?`/${t}`:e+t},isAbsolute(t){return tE(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){let e;if(0===t.length)return".";for(let r=0;r<t.length;++r){let i=t[r];
6if(tE(i),i.length>0){if(void 0===e)e=i;else{let s=t[r-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}}return void 0===e?".":this.normalize(e)},dirname(t){if(tE(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0),r=47===e,i=-1,s=!0,n=this.getProtocol(t),a=t;t=t.slice(n.length);for(let r=t.length-1;r>=1;--r)if(47===(e=t.charCodeAt(r))){if(!s){i=r;break}}else s=!1;return -1===i?r?"/":this.isUrl(a)?n+t:n:r&&1===i?"//":n+t.slice(0,i)},rootname(t){tE(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){let r=t.indexOf("/",e.length);(e=-1!==r?t.slice(0,r):t).endsWith("/")||(e+="/")}return e},basename(t,e){tE(t),e&&tE(e),t=tA(this.toPosix(t));let r=0,i=-1,s=!0,n;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(n=t.length-1;n>=0;--n){let h=t.charCodeAt(n);if(47===h){if(!s){r=n+1;break}}else -1===o&&(s=!1,o=n+1),a>=0&&(h===e.charCodeAt(a)?-1==--a&&(i=n):(a=-1,i=o))}return r===i?i=o:-1===i&&(i=t.length),t.slice(r,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!s){r=n+1;break}}else -1===i&&(s=!1,i=n+1);return -1===i?"":t.slice(r,i)},extname(t){tE(t),t=tA(this.toPosix(t));let e=-1,r=0,i=-1,s=!0,n=0;for(let a=t.length-1;a>=0;--a){let o=t.charCodeAt(a);if(47===o){if(!s){r=a+1;break}continue}-1===i&&(s=!1,i=a+1),46===o?-1===e?e=a:1!==n&&(n=1):-1!==e&&(n=-1)}return -1===e||-1===i||0===n||1===n&&e===i-1&&e===r+1?"":t.slice(e,i)},parse(t){let e;tE(t);let r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;let i=(t=tA(this.toPosix(t))).charCodeAt(0),s=this.isAbsolute(t);r.root=this.rootname(t),e=s||this.hasProtocol(t)?1:0;let n=-1,a=0,o=-1,h=!0,l=t.length-1,u=0;for(;l>=e;--l){if(47===(i=t.charCodeAt(l))){if(!h){a=l+1;break}continue}-1===o&&(h=!1,o=l+1),46===i?-1===n?n=l:1!==u&&(u=1):-1!==n&&(u=-1)}return -1===n||-1===o||0===u||1===u&&n===o-1&&n===a+1?-1!==o&&(0===a&&s?r.base=r.name=t.slice(1,o):r.base=r.name=t.slice(a,o)):(0===a&&s?(r.name=t.slice(1,n),r.base=t.slice(1,o)):(r.name=t.slice(a,n),r.base=t.slice(a,o)),r.ext=t.slice(n,o)),r.dir=this.dirname(t),r},sep:"/",delimiter:":",joinExtensions:[".html"]};async function tS(){return i??(i=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return V.UNPACK;let e=await new Promise(t=>{let e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()});if(!e)return V.UNPACK;let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,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);let s=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,s),t.deleteFramebuffer(i),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),s[0]<=s[3]?V.PMA:V.UNPACK})()),i}function tR(){tb("7.0.0","skipHello is deprecated, please use settings.RENDER_OPTIONS.hello")}function tI(){tb("7.0.0",'sayHello is deprecated, please use Renderer\'s "hello" option')}function tC(){return typeof s>"u"&&(s=function(){let t={stencil:!0,failIfMajorPerformanceCaveat:Q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Q.ADAPTER.getWebGLRenderingContext())return!1;let e=Q.ADAPTER.createCanvas(),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!!r?.getContextAttributes()?.stencil;if(r){let t=r.getExtension("WEBGL_lose_context");t&&t.loseContext()}return r=null,i}catch{return!1}}()),s}var tP={grad:.9,turn:360,rad:360/(2*Math.PI)},tM=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},tD=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},tB=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=1),t>r?r:t>e?t:e},tN=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},tF=function(t){return{r:tB(t.r,0,255),g:tB(t.g,0,255),b:tB(t.b,0,255),a:tB(t.a)}},tO=function(t){return{r:tD(t.r),g:tD(t.g),b:tD(t.b),a:tD(t.a,3)}},tL=/^#([0-9a-f]{3,8})$/i,tU=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},tk=function(t){var e=t.r,r=t.g,i=t.b,s=t.a,n=Math.max(e,r,i),a=n-Math.min(e,r,i),o=a?n===e?(r-i)/a:n===r?2+(i-e)/a:4+(e-r)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:s}},tG=function(t){var e=t.h,r=t.s,i=t.v,s=t.a;e=e/360*6,r/=100,i/=100;var n=Math.floor(e),a=i*(1-r),o=i*(1-(e-n)*r),h=i*(1-(1-e+n)*r),l=n%6;return{r:255*[i,o,a,a,h,i][l],g:255*[h,i,i,o,a,a][l],b:255*[a,a,h,i,i,o][l],a:s}},tH=function(t){return{h:tN(t.h),s:tB(t.s,0,100),l:tB(t.l,0,100),a:tB(t.a)}},tX=function(t){return{h:tD(t.h),s:tD(t.s),l:tD(t.l),a:tD(t.a,3)}},tV=function(t){var e,r;return tG((e=t.s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}))},tW=function(t){var e,r,i,s;
6return{h:(e=tk(t)).h,s:(s=(200-(r=e.s))*(i=e.v)/100)>0&&s<200?r*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a}},tz=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,t$=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tj=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tY=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tq={string:[[function(t){var e=tL.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?tD(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?tD(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=tj.exec(t)||tY.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:tF({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e,r,i=tz.exec(t)||t$.exec(t);return i?tV(tH({h:(e=i[1],void 0===(r=i[2])&&(r="deg"),Number(e)*(tP[r]||1)),s:Number(i[3]),l:Number(i[4]),a:void 0===i[5]?1:Number(i[5])/(i[6]?100:1)})):null},"hsl"]],object:[[function(t){var e=t.r,r=t.g,i=t.b,s=t.a;return tM(e)&&tM(r)&&tM(i)?tF({r:Number(e),g:Number(r),b:Number(i),a:Number(void 0===s?1:s)}):null},"rgb"],[function(t){var e=t.h,r=t.s,i=t.l,s=t.a;return tM(e)&&tM(r)&&tM(i)?tV(tH({h:Number(e),s:Number(r),l:Number(i),a:Number(void 0===s?1:s)})):null},"hsl"],[function(t){var e,r=t.h,i=t.s,s=t.v,n=t.a;return tM(r)&&tM(i)&&tM(s)?tG({h:tN((e={h:Number(r),s:Number(i),v:Number(s),a:Number(void 0===n?1:n)}).h),s:tB(e.s,0,100),v:tB(e.v,0,100),a:tB(e.a)}):null},"hsv"]]},tK=function(t,e){for(var r=0;r<e.length;r++){var i=e[r][0](t);if(i)return[i,e[r][1]]}return[null,void 0]},tZ=function(t,e){var r=tW(t);return{h:r.h,s:tB(r.s+100*e,0,100),l:r.l,a:r.a}},tQ=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},tJ=function(t,e){var r=tW(t);return{h:r.h,s:r.s,l:tB(r.l+100*e,0,100),a:r.a}},t0=function(){function t(t){this.parsed=("string"==typeof t?tK(t.trim(),tq.string):"object"==typeof t&&null!==t?tK(t,tq.object):[null,void 0])[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return tD(tQ(this.rgba),2)},t.prototype.isDark=function(){return .5>tQ(this.rgba)},t.prototype.isLight=function(){return tQ(this.rgba)>=.5},t.prototype.toHex=function(){var t,e,r,i,s,n;return e=(t=tO(this.rgba)).r,r=t.g,i=t.b,n=(s=t.a)<1?tU(tD(255*s)):"","#"+tU(e)+tU(r)+tU(i)+n},t.prototype.toRgb=function(){return tO(this.rgba)},t.prototype.toRgbString=function(){var t,e,r,i,s;return e=(t=tO(this.rgba)).r,r=t.g,i=t.b,(s=t.a)<1?"rgba("+e+", "+r+", "+i+", "+s+")":"rgb("+e+", "+r+", "+i+")"},t.prototype.toHsl=function(){return tX(tW(this.rgba))},t.prototype.toHslString=function(){var t,e,r,i,s;return e=(t=tX(tW(this.rgba))).h,r=t.s,i=t.l,(s=t.a)<1?"hsla("+e+", "+r+"%, "+i+"%, "+s+")":"hsl("+e+", "+r+"%, "+i+"%)"},t.prototype.toHsv=function(){var t;return{h:tD((t=tk(this.rgba)).h),s:tD(t.s),v:tD(t.v),a:tD(t.a,3)}},t.prototype.invert=function(){var t;return t1({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a})},t.prototype.saturate=function(t){return void 0===t&&(t=.1),t1(tZ(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),t1(tZ(this.rgba,-t))},t.prototype.grayscale=function(){return t1(tZ(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),t1(tJ(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),t1(tJ(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){var e;return"number"==typeof t?t1({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):tD(this.rgba.a,3)},t.prototype.hue=function(t){var e=tW(this.rgba);return"number"==typeof t?t1({h:t,s:e.s,l:e.l,a:e.a}):tD(e.h)},t.prototype.isEqual=function(t){return this.toHex()===t1(t).toHex()},t}(),t1=function(t){return t instanceof t0?t:new t0(t)},t2=[];!function(t){t.forEach(function(t){0>t2.indexOf(t)&&(t(t0,tq),t2.push(t))})}([function(t,e){var r={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",s
6andybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in r)i[r[s]]=s;var n={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var s,a=i[this.toHex()];if(a)return a;if(null==e?void 0:e.closest){var o=this.toRgb(),h=1/0,l="black";if(!n.length)for(var u in r)n[u]=new t(r[u]).toRgb();for(var d in r){var c=(s=n[d],Math.pow(o.r-s.r,2)+Math.pow(o.g-s.g,2)+Math.pow(o.b-s.b,2));c<h&&(h=c,l=d)}return l}},e.string.push([function(e){var i=e.toLowerCase(),s="transparent"===i?"#0000":r[i];return s?new t(s).toRgb():null},"name"])}]);let t3=class t{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(e){if(e instanceof t)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw Error("Cannot set PIXI.Color#value to null");null!==this._value&&this.isSourceEqual(this._value,e)||(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if("number"===r||"string"===r||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every((t,r)=>t===e[r]);if(null!==t&&null!==e){let r=Object.keys(t),i=Object.keys(e);return r.length===i.length&&r.every(r=>t[r]===e[r])}return t===e}toRgba(){let[t,e,r,i]=this._components;return{r:t,g:e,b:r,a:i}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,i]=this._components;return(t=t??[])[0]=Math.round(255*e),t[1]=Math.round(255*r),t[2]=Math.round(255*i),t}toRgbArray(t){t=t??[];let[e,r,i]=this._components;return t[0]=e,t[1]=r,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){let[r,i,s,n]=t.temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=i,this._components[2]*=s,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(1===t)return -16777216+this._int;if(0===t)return e?0:this._int;let r=this._int>>16&255,i=this._int>>8&255,s=255&this._int;return e&&(r=r*t+.5|0,i=i*t+.5|0,s=s*t+.5|0),(255*t<<24)+(r<<16)+(i<<8)+s}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,r,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(r*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,r,i,s]=this._components;return t[0]=e,t[1]=r,t[2]=i,t[3]=s,t}normalize(e){let r,i,s,n;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){let t=e;r=(t>>16&255)/255,i=(t>>8&255)/255,s=(255&t)/255,n=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[r,i,s,n=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,i,s,n=255]=e,r/=255,i/=255,s/=255,n/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){let r=t.HEX_PATTERN.exec(e);r&&(e=`#${r[2]}
6`)}let a=t1(e);a.isValid()&&({r,g:i,b:s,a:n}=a.rgba,r/=255,i/=255,s/=255)}if(void 0!==r)this._components[0]=r,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*r|0)}_clamp(t,e=0,r=1){return"number"==typeof t?Math.min(Math.max(t,e),r):(t.forEach((i,s)=>{t[s]=Math.min(Math.max(i,e),r)}),t)}};t3.shared=new t3,t3.temp=new t3,t3.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let t4=t3;function t5(t,e=[]){return tb("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),t4.shared.setValue(t).toRgbArray(e)}function t6(t){return tb("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),t4.shared.setValue(t).toHex()}function t8(t){return tb("7.2.0","utils.string2hex is deprecated, use Color#toNumber instead"),t4.shared.setValue(t).toNumber()}function t7(t){return tb("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),t4.shared.setValue(t).toNumber()}let t9=function(){let t=[],e=[];for(let r=0;r<32;r++)t[r]=r,e[r]=r;t[N.NORMAL_NPM]=N.NORMAL,t[N.ADD_NPM]=N.ADD,t[N.SCREEN_NPM]=N.SCREEN,e[N.NORMAL]=N.NORMAL_NPM,e[N.ADD]=N.ADD_NPM,e[N.SCREEN]=N.SCREEN_NPM;let r=[];return r.push(e),r.push(t),r}();function et(t,e){return t9[e?1:0][t]}function ee(t,e,r,i=!0){return tb("7.2.0","utils.premultiplyRgba has moved to Color.premultiply"),t4.shared.setValue(t).premultiply(e,i).toArray(r??new Float32Array(4))}function er(t,e){return tb("7.2.0","utils.premultiplyTint has moved to Color.toPremultiplied"),t4.shared.setValue(t).toPremultiplied(e)}function ei(t,e,r,i=!0){return tb("7.2.0","utils.premultiplyTintToRgba has moved to Color.premultiply"),t4.shared.setValue(t).premultiply(e,i).toArray(r??new Float32Array(4))}let es=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function en(t,e=null){let r=6*t;if((e=e||new Uint16Array(r)).length!==r)throw Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let t=0,i=0;t<r;t+=6,i+=4)e[t+0]=i+0,e[t+1]=i+1,e[t+2]=i+2,e[t+3]=i+0,e[t+4]=i+2,e[t+5]=i+3;return e}function ea(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}let eo={Float32Array,Uint32Array,Int32Array,Uint8Array};function eh(t,e){let r=0,i=0,s={};for(let s=0;s<t.length;s++)i+=e[s],r+=t[s].length;let n=new ArrayBuffer(4*r),a=null,o=0;for(let r=0;r<t.length;r++){let h=e[r],l=t[r],u=ea(l);s[u]||(s[u]=new eo[u](n)),a=s[u];for(let t=0;t<l.length;t++)a[(t/h|0)*i+o+t%h]=l[t];o+=h}return new Float32Array(n)}function el(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function eu(t){return!(t&t-1)&&!!t}function ed(t){let e=(t>65535?1:0)<<4,r=((t>>>=e)>255?1:0)<<3;return t>>>=r,e|=r,r=(t>15?1:0)<<2,t>>>=r,e|=r,r=(t>3?1:0)<<1,t>>>=r,(e|=r)|t>>1}function ec(t,e,r){let i;let s=t.length;if(e>=s||0===r)return;r=e+r>s?s-e:r;let n=s-r;for(i=e;i<n;++i)t[i]=t[i+r];t.length=n}function ef(t){return 0===t?0:t<0?-1:1}let ep=0;function em(){return++ep}let eg=class{constructor(t,e,r,i){this.left=t,this.top=e,this.right=r,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};eg.EMPTY=new eg(0,0,0,0);let e_=eg,ex={},ev=Object.create(null),ey=Object.create(null);function eb(){let t;for(t in ev)ev[t].destroy();for(t in ey)ey[t].destroy()}function eT(){let t;for(t in ev)delete ev[t];for(t in ey)delete ey[t]}class eE{constructor(t,e,r){this._canvas=Q.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=r||Q.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(null===this._canvas)throw TypeError("The CanvasRenderTarget has already been destroyed")}}function eA(t,e,r){for(let i=0,s=4*r*e;i<e;++i,s+=4)if(0!==t[s+3])return!1;return!0}function ew(t,e,r,i,s){let n=4*e;for(let e=i,a=i*n+4*r;e<=s;++e,a+=n)if(0!==t[a+3])return!1;return!0}function eS(t){let{width:e,height:r}=t,i=t.getContext("2d",{willReadFrequently:!0});if(null===i)throw TypeError("Failed to get canvas 2D context");let s=i.getImageData(0,0,e,r).data,n=0,a=0,o=e-1,h=r-1;for(;a<r&&eA(s,e,a);)++a;if(a===r)return e_.EMPTY;for(;eA(s,e,h);)--h;for(;ew(s,e,n,a,h);)++n;for(;ew(s,e,o,a,h);)--o;return new e_(n,a,++o,++h)}function eR(t){let e=eS(t),{width:r,height:i}=e,s=null;if(!e.isEmpty()){let n=t.getContext("2d");if(null===n)throw TypeError("Failed to get canvas 2D context");s=n.getImageData(e.left,e.top,r,i)}return{width:r,height:i,data:s}}function eI(t){let e=es.exec(t);if(e)return{mediaType:e[1]?e[1].toLowerCase():void 0,subType:e[2]?e[2].toLowerCase():void 0,charset:e[3]?e[3].toLowerCase():void 0,encoding:e[4]?e[4].toLowerCase():void 0,data:e[5]}}function eC(t,e=globalThis.location){if(t.startsWith("data:"))return"";e=e||globalThis.location;let r=new URL(t,document.baseURI);return r.hostname!==e.hostname||r.port!==e.port||r.protocol!==e.protocol?"anonymous":""}function eP(t,e=1){let r=Q.RETINA_PREFIX?.exec(t);return r?parseFloat(r[1]):e}var eM=((R=eM||{}).Renderer="renderer",R.Application="application",R.RendererSystem="renderer-webgl-system",R.RendererPlugin="renderer-webgl-plugin",R.CanvasRendererSystem="renderer-canvas-system",R.CanvasRendererPlugin="renderer-canvas-plugin",R.Asset="asset",R.LoadParser="load-parser",R.ResolveParser="resolve-parser",R.CacheParser="cache-parser",R.DetectionParser="detection-parser",R);let eD=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"==typeof t)t={...t};else throw Error("Invalid extension type");return"string"==typeof t.type&&(t.type=[t.type]),t},eB=(t,e)=>eD(t).priority??e,eN={_addHandlers:{},_removeHandlers:{},_queue:{}
6,remove(...t){return t.map(eD).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...t){return t.map(eD).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,i=this._queue;r[e]?r[e]?.(t):(i[e]=i[e]||[],i[e]?.push(t))})}),this},handle(t,e,r){let i=this._addHandlers,s=this._removeHandlers;if(i[t]||s[t])throw Error(`Extension type ${t} already has a handler`);i[t]=e,s[t]=r;let n=this._queue;return n[t]&&(n[t]?.forEach(t=>e(t)),delete n[t]),this},handleByMap(t,e){return this.handle(t,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(t,e,r=-1){return this.handle(t,t=>{e.includes(t.ref)||(e.push(t.ref),e.sort((t,e)=>eB(e,r)-eB(t,r)))},t=>{let r=e.indexOf(t.ref);-1!==r&&e.splice(r,1)})}};class eF{constructor(t){"number"==typeof t?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 Error(`${t} isn't a valid view type`)}}}let eO=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` 7`);function eL(t,e){if(0===t)throw Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let r=e.createShader(e.FRAGMENT_SHADER);for(;;){let i=eO.replace(/%forloop%/gi,function(t){let e="";for(let r=0;r<t;++r)r>0&&(e+=` 8else `),r<t-1&&(e+=`if(test == ${r}.0){}`);return e}(t));if(e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))break;t=t/2|0}return t}class eU{constructor(){this.data=0,this.blendMode=N.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==N.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new eU;return t.depthTest=!1,t.blend=!0,t}}eU.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};let ek=[];function eG(t,e){if(!t)return null;let r="";if("string"==typeof t){let e=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);e&&(r=e[1].toLowerCase())}for(let i=ek.length-1;i>=0;--i){let s=ek[i];if(s.test&&s.test(t,r))return new s(t,e)}throw Error("Unrecognized source type to auto-detect Resource")}class eH{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,i,s,n,a,o){if(arguments.length>8)throw Error("max arguments reached");let{name:h,items:l}=this;this._aliasCount++;for(let u=0,d=l.length;u<d;u++)l[u][h](t,e,r,i,s,n,a,o);return l===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>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){let e=this.items.indexOf(t);return -1!==e&&(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 0===this.items.length}get name(){return this._name}}Object.defineProperties(eH.prototype,{dispatch:{value:eH.prototype.emit},run:{value:eH.prototype.emit}});class eX{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new eH("setRealSize"),this.onUpdate=new eH("update"),this.onError=ne
8w eH("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,r){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 eV extends eX{constructor(t,e){let{width:r,height:i}=e||{};if(!r||!i)throw Error("BufferResource width or height invalid");super(r,i),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){let i=t.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===V.UNPACK);let s=e.realWidth,n=e.realHeight;return r.width===s&&r.height===n?i.texSubImage2D(e.target,0,0,0,s,n,e.format,r.type,this.data):(r.width=s,r.height=n,i.texImage2D(e.target,0,r.internalFormat,s,n,0,e.format,r.type,this.data)),!0}dispose(){this.data=null}static test(t){return null===t||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}let eW={scaleMode:G.NEAREST,alphaMode:V.NPM},ez=class t extends t_{constructor(e=null,r=null){super();let{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:d,target:c,resolution:f,resourceOptions:p}=r=Object.assign({},t.defaultOptions,r);
8!e||e instanceof eX||((e=eG(e,p)).internal=!0),this.resolution=f||Q.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=d,this.target=c,this.alphaMode=i,this.uid=em(),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(e)}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 r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=eu(this.realWidth)&&eu(this.realHeight)}setResolution(t){let e=this.resolution;return e===t||(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 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 ey[this.cacheId],delete ev[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,r,i=Q.STRICT_TEXTURE_CACHE){let s="string"==typeof e,n=null;if(s)n=e;else{if(!e._pixiId){let t=r?.pixiIdPrefix||"pixiid";e._pixiId=`${t}_${em()}`}n=e._pixiId}let a=ey[n];if(s&&i&&!a)throw Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||((a=new t(e,r)).cacheId=n,t.addToCache(a,n)),a}static fromBuffer(e,r,i,s){let n,a;let o=new eV(e=e||new Float32Array(r*i*4),{width:r,height:i,...s?.resourceOptions});return e instanceof Float32Array?(n=O.RGBA,a=U.FLOAT):e instanceof Int32Array?(n=O.RGBA_INTEGER,a=U.INT):e instanceof Uint32Array?(n=O.RGBA_INTEGER,a=U.UNSIGNED_INT):e instanceof Int16Array?(n=O.RGBA_INTEGER,a=U.SHORT):e instanceof Uint16Array?(n=O.RGBA_INTEGER,a=U.UNSIGNED_SHORT):e instanceof Int8Array?(n=O.RGBA,a=U.BYTE):(n=O.RGBA,a=U.UNSIGNED_BYTE),o.internal=!0,new t(o,Object.assign({},eW,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),ey[e]&&ey[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),ey[e]=t)}static removeFromCache(t){if("string"==typeof t){let e=ey[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete ey[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete ey[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};ez.defaultOptions={mipmap:X.POW2,anisotropicLevel:0,scaleMode:G.LINEAR,wrapMode:H.CLAMP,alphaMode:V.UNPACK,target:L.TEXTURE_2D,format:O.RGBA,type:U.UNSIGNED_BYTE},ez._globalBatch=0;let e$=ez;class ej{constructor(){this.texArray=null,this.blend=0,this.type=F.TRIANGLES,this.start=0,this.size=0,this.data=null}}let eY=0;class eq{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=eY++,this.disposeRunner=new eH("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?K.ELEMENT_ARRAY_BUFFER:K.ARRAY_BUFFER}get index(){return this.type===K.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new eq(t)}}class eK{constructor(t,e=0,r=!1,i=U.FLOAT,s,n,a,o=1){this.buffer=t,this.size=e,this.normalized=r,this.type=i,this.stride=s,this.start=n,this.instance=a,this.divisor=o}destroy(){this.buffer=null}static from(t,e,r,i,s){return new eK(t,e,r,i,s)}}let eZ={Float32Array,Uint32Array,Int32Array,Uint8Array},eQ={5126:4,5123:2,5121:1},eJ=0,e0={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class e1{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=eJ++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new eH("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,i=!1,s,n,a,o=!1){if(!e)throw Error("You must pass a buffer when creating an attribute");e instanceof eq||(e instanceof Array&&(e=new Float32Array(e)),e=new eq(e));let h=t.split("|");if(h.length>1){for(let t=0;t<h.length;t++)this.addAttribute(h[t],e,r,i,s);return this}let l=this.buffers.indexOf(e);return -1===l&&(this.buffers.push(e),l=this.buffers.length-1),this.attributes[t]=new eK(l,r,i,s,n,a,o),this.instanced=this.instanced||o,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof eq||(t instanceof Array&&(t=new Uint16Array(t)),t=new eq(t)),t.type=K.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){let t;if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;let e=[],r=[],i=new eq;for(t in this.attributes){let i=this.attributes[t],s=this.buffers[i.buffer];e.push(s.data),r.push(i.size*eQ[i.type]/4),i.buffer=0}for(i.data=function(t,e){let r=0,i=0,s={};for(let s=0;s<t.length;s++)i+=e[s],r+=t[s].length;let n=new ArrayBuffer(4*r),a=null,o=0;for(let r=0;r<t.length;r++){let h=e[r],l=t[r],u=ea(l);s[u]||(s[u]=new eZ[u](n)),a=s[u];for(let t=0;t<l.length;t++)a[(t/h|0)*i+o+t%h]=l[t];o+=h}return new Float32Array(n)}(e,r),t=0;t<this.buffers.length;t++)this.buffers[t]!==this.indexBuffer&&this.buffers[t].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new e1;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new eq(this.buffers[e].data.slice(0));for(let e in this.attributes){let r=this.attributes[e];t.attributes[e]=new eK(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=K.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e;let r=new e1,i=[],s=[],n=[];for(let r=0;r<t.length;r++){e=t[r];for(let t=0;t<e.buffers.length;t++)s[t]=s[t]||0,s[t]+=e.buffers[t].data.length,n[t]=0}for(let t=0;t<e.buffers.length;t++)i[t]=new e0[ea(e.buffers[t].data)](s[t]),r.buffers[t]=new eq(i[t]);for(let r=0;r<t.length;r++){e=t[r];for(let t=0;t<e.buffers.length;t++)i[t].set(e.buffers[t].data,n[t]),n[t]+=e.buffers[t].data.length}if(r.attributes=e.attributes,e.indexBuffer){r.indexBuffer=r.buffers[e.buffers.indexOf(e.indexBuffer)],r.indexBuffer.type=K.ELEMENT_ARRAY_BUFFER;let i=0,s=0,n=0,a=0;for(let t=0;t<e.buffers.length;t++)if(e.buffers[t]!==e.indexBuffer){a=t;break}for(let t in e.attributes){let r=e.attributes[t];(0|r.buffer)===a&&(s+=r.size*eQ[r.type]/4)}for(let e=0;e<t.length;e++){let o=t[e].indexBuffer.data;for(let t=0;t<o.length;t++)r.indexBuffer.data[t+n]+=i;i+=t[e].buffers[a].data.length/s,n+=o.length}}return r}}class e2 extends e1{constructor(t=!1){super(),this._buffer=new eq(null,t,!1),this._indexBuffer=new eq(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,U.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,U.FLOAT).addAttribute("aColor",this._buffer,4,!0,U.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,U.FLOAT).addIndex(this._indexBuffer)}}let e3=2*Math.PI,e4=180/Math.PI,e5=Math.PI/180;var e6=((I=e6||{})[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);class e8{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new e8(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}}e8.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};let e7=[new e8,new e8,new e8,new e8];class e9{constructor(t=0,e=0,r=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(i),this.type=e6.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 e9(0,0,0,0)}clone(){return new e9(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)&&t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;let r=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>r}let r=this.left,i=this.right,s=this.top,n=this.bottom;if(i<=r||n<=s)return!1;let a=e7[0].set(t.left,t.top),o=e7[1].set(t.left,t.bottom),h=e7[2].set(t.right,t.top),l=e7[3].set(t.right,t.bottom);if(h.x<=a.x||o.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(0===u||(e.apply(a,a),e.apply(o,o),e.apply(h,h),e.apply(l,l),Math.max(a.x,o.x,h.x,l.x)<=r||Math.min(a.x,o.x,h.x,l.x)>=i||Math.max(a.y,o.y,h.y,l.y)<=s||Math.min(a.y,o.y,h.y,l.y)>=n))return!1;let d=u*(o.y-a.y),c=u*(a.x-o.x),f=d*r+c*s,p=d*i+c*s,m=d*r+c*n,g=d*i+c*n;if(Math.max(f,p,m,g)<=d*a.x+c*a.y||Math.min(f,p,m,g)>=d*l.x+c*l.y)return!1;let _=u*(a.y-h.y),x=u*(h.x-a.x),v=_*r+x*s,y=_*i+x*s,b=_*r+x*n,T=_*i+x*n;return!(Math.max(v,y,b,T)<=_*a.x+x*a.y||Math.min(v,y,b,T)>=_*l.x+x*l.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=i,this.height=Math.max(s-i,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,i=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=r-this.x,this.height=i-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=i,this.height=s-i,this}}e9.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class rt{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=e6.CIRC}clone(){return new rt(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,i=this.x-t,s=this.y-e;return i*=i,s*=s,i+s<=r}getBounds(){return new e9(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}}rt.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class re{constructor(t=0,e=0,r=0,i=0){this.x=t,this.y=e,this.width=r,this.height=i,this.type=e6.ELIP}clone(){return new re(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,i=(e-this.y)/this.height;return r*=r,i*=i,r+i<=1}getBounds(){return new e9(this.x-this.width,this.y-this.height,this.width,this.height)}}re.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class rr{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){let t=[];for(let r=0,i=e.length;r<i;r++)t.push(e[r].x,e[r].y);e=t}this.points=e,this.type=e6.POLY,this.closeStroke=!0}clone(){let t=new rr(this.points.slice());return t.closeStroke=this.closeStroke,t}contains(t,e){let r=!1,i=this.points.length/2;for(let s=0,n=i-1;s<i;n=s++){let i=this.points[2*s],a=this.points[2*s+1],o=this.points[2*n],h=this.points[2*n+1];a>e!=h>e&&t<(e-a)/(h-a)*(o-i)+i&&(r=!r)}return r}}rr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`};class ri{constructor(t=0,e=0,r=0,i=0,s=20){this.x=t,this.y=e,this.width=r,this.height=i,this.radius=s,this.type=e6.RREC}clone(){return new ri(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){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let i=t-(this.x+r),s=e-(this.y+r),n=r*r;if(i*i+s*s<=n||(i=t-(this.x+this.width-r))*i+s*s<=n||i*i+(s=e-(this.y+this.height-r))*s<=n||(i=t-(this.x+r))*i+s*s<=n)return!0}return!1}}ri.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class rs{constructor(t=1,e=0,r=0,i=1,s=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=i,this.tx=s,this.ty=n}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,r,i,s,n){return this.a=t,this.b=e,this.c=r,this.d=i,this.tx=s,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0),r[8]=1,r}apply(t,e){e=e||new e8;let r=t.x,i=t.y;return e.x=this.a*r+this.c*i+this.tx,e.y=this.b*r+this.d*i+this.ty,e}applyInverse(t,e){e=e||new e8;let r=1/(this.a*this.d+-(this.c*this.b)),i=t.x,s=t.y;return e.x=this.d*r*i+-this.c*r*s+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*s+-this.b*r*i+(-this.ty*this.a+this.tx*this.b)*r,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){let e=Math.cos(t),r=Math.sin(t),i=this.a,s=this.c,n=this.tx;return this.a=i*e-this.b*r,this.b=i*r+this.b*e,this.c=s*e-this.d*r,this.d=s*r+this.d*e,this.tx=n*e-this.t
8y*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,i=this.c,s=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*r+t.b*s,this.c=t.c*e+t.d*i,this.d=t.c*r+t.d*s,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*r+t.ty*s+this.ty,this}setTransform(t,e,r,i,s,n,a,o,h){return this.a=Math.cos(a+h)*s,this.b=Math.sin(a+h)*s,this.c=-Math.sin(a-o)*n,this.d=Math.cos(a-o)*n,this.tx=t-(r*this.a+i*this.c),this.ty=e-(r*this.b+i*this.d),this}prepend(t){let e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){let e=this.a,r=this.c;this.a=e*t.a+this.b*t.c,this.b=e*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){let e=this.a,r=this.b,i=this.c,s=this.d,n=t.pivot,a=-Math.atan2(-i,s),o=Math.atan2(r,e),h=Math.abs(a+o);return h<1e-5||1e-5>Math.abs(e3-h)?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=o),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(i*i+s*s),t.position.x=this.tx+(n.x*e+n.y*i),t.position.y=this.ty+(n.x*r+n.y*s),t}invert(){let t=this.a,e=this.b,r=this.c,i=this.d,s=this.tx,n=t*i-e*r;return this.a=i/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-i*s)/n,this.ty=-(t*this.ty-e*s)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new rs;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 rs}static get TEMP_MATRIX(){return new rs}}rs.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};let rn=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ra=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ro=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],rh=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],rl=[],ru=[],rd=Math.sign;!function(){for(let t=0;t<16;t++){let e=[];rl.push(e);for(let r=0;r<16;r++){let i=rd(rn[t]*rn[r]+ro[t]*ra[r]),s=rd(ra[t]*rn[r]+rh[t]*ra[r]),n=rd(rn[t]*ro[r]+ro[t]*rh[r]),a=rd(ra[t]*ro[r]+rh[t]*rh[r]);for(let t=0;t<16;t++)if(rn[t]===i&&ra[t]===s&&ro[t]===n&&rh[t]===a){e.push(t);break}}}for(let t=0;t<16;t++){let e=new rs;e.set(rn[t],ra[t],ro[t],rh[t],0,0),ru.push(e)}}();let rc={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:t=>rn[t],uY:t=>ra[t],vX:t=>ro[t],vY:t=>rh[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>rl[t][e],sub:(t,e)=>rl[t][rc.inv(e)],rotate180:t=>4^t,isVertical:t=>(3&t)==2,byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?rc.S:rc.N:2*Math.abs(e)<=Math.abs(t)?t>0?rc.E:rc.W:e>0?t>0?rc.SE:rc.SW:t>0?rc.NE:rc.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{let s=ru[rc.inv(e)];s.tx=r,s.ty=i,t.append(s)}};class rf{constructor(t,e,r=0,i=0){this._x=r,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new rf(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))}}rf.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};let rp=class{constructor(){this.worldTransform=new rs,this.localTransform=new rs,this.position=new rf(this.onChange,this,0,0),this.scale=new rf(this.onChange,this,1,1),this.pivot=new rf(this.onChange,this,0,0),this.skew=new rf(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(){let 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){let 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){let r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.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())}};rp.IDENTITY=new rp;let rm=rp;rm.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var rg=`varying vec2 vTextureCoord; 9 10uniform sampler2D uSampler; 11 12void main(void){ 13 gl_FragColor *= texture2D(uSampler, vTextureCoord); 14}`,r_=`attribute vec2 aVertexPosition; 15attribute vec2 aTextureCoord; 16 17uniform mat3 projectionMatrix; 18 19varying vec2 vTextureCoord; 20 21void main(void){ 22 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
22)).xy, 0.0, 1.0); 23 vTextureCoord = aTextureCoord; 24} 25`;let rx=[{test:t=>"float"===t.type&&1===t.size&&!t.isArray,code:t=>` 26 if(uv["${t}"] !== ud["${t}"].value) 27 { 28 ud["${t}"].value = uv["${t}"] 29 gl.uniform1f(ud["${t}"].location, uv["${t}"]) 30 } 31 `},{test:(t,e)=>("sampler2D"===t.type||"samplerCube"===t.type||"sampler2DArray"===t.type)&&1===t.size&&!t.isArray&&(null==e||void 0!==e.castToBaseTexture),code:t=>`t = syncData.textureCount++; 32 33 renderer.texture.bind(uv["${t}"], t); 34 35 if(ud["${t}"].value !== t) 36 { 37 ud["${t}"].value = t; 38 gl.uniform1i(ud["${t}"].location, t); 39; // eslint-disable-line max-len 40 }`},{test:(t,e)=>"mat3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.a,code:t=>` 41 gl.uniformMatrix3fv(ud["${t}"].location, false, uv["${t}"].toArray(true)); 42 `,codeUbo:t=>` 43 var ${t}_matrix = uv.${t}.toArray(true); 44 45 data[offset] = ${t}_matrix[0]; 46 data[offset+1] = ${t}_matrix[1]; 47 data[offset+2] = ${t}_matrix[2]; 48 49 data[offset + 4] = ${t}_matrix[3]; 50 data[offset + 5] = ${t}_matrix[4]; 51 data[offset + 6] = ${t}_matrix[5]; 52 53 data[offset + 8] = ${t}_matrix[6]; 54 data[offset + 9] = ${t}_matrix[7]; 55 data[offset + 10] = ${t}_matrix[8]; 56 `},{test:(t,e)=>"vec2"===t.type&&1===t.size&&!t.isArray&&void 0!==e.x,code:t=>` 57 cv = ud["${t}"].value; 58 v = uv["${t}"]; 59 60 if(cv[0] !== v.x || cv[1] !== v.y) 61 { 62 cv[0] = v.x; 63 cv[1] = v.y; 64 gl.uniform2f(ud["${t}"].location, v.x, v.y); 65 }`,codeUbo:t=>` 66 v = uv.${t}; 67 68 data[offset] = v.x; 69 data[offset+1] = v.y; 70 `},{test:t=>"vec2"===t.type&&1===t.size&&!t.isArray,code:t=>` 71 cv = ud["${t}"].value; 72 v = uv["${t}"]; 73 74 if(cv[0] !== v[0] || cv[1] !== v[1]) 75 { 76 cv[0] = v[0]; 77 cv[1] = v[1]; 78 gl.uniform2f(ud["${t}"].location, v[0], v[1]); 79 } 80 `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.width,code:t=>` 81 cv = ud["${t}"].value; 82 v = uv["${t}"]; 83 84 if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) 85 { 86 cv[0] = v.x; 87 cv[1] = v.y; 88 cv[2] = v.width; 89 cv[3] = v.height; 90 gl.uniform4f(ud["${t}"].location, v.x, v.y, v.width, v.height) 91 }`,codeUbo:t=>` 92 v = uv.${t}; 93 94 data[offset] = v.x; 95 data[offset+1] = v.y; 96 data[offset+2] = v.width; 97 data[offset+3] = v.height; 98 `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>` 99 cv = ud["${t}"].value; 100 v = uv["${t}"]; 101 102 if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) 103 { 104 cv[0] = v.red; 105 cv[1] = v.green; 106 cv[2] = v.blue; 107 cv[3] = v.alpha; 108 gl.uniform4f(ud["${t}"].location, v.red, v.green, v.blue, v.alpha) 109 }`,codeUbo:t=>` 110 v = uv.${t}; 111 112 data[offset] = v.red; 113 data[offset+1] = v.green; 114 data[offset+2] = v.blue; 115 data[offset+3] = v.alpha; 116 `},{test:(t,e)=>"vec3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>` 117 cv = ud["${t}"].value; 118 v = uv["${t}"]; 119 120 if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) 121 { 122 cv[0] = v.red; 123 cv[1] = v.green; 124 cv[2] = v.blue; 125 126 gl.uniform3f(ud["${t}"].location, v.red, v.green, v.blue) 127 }`,codeUbo:t=>` 128 v = uv.${t}; 129 130 data[offset] = v.red; 131 data[offset+1] = v.green; 132 data[offset+2] = v.blue; 133 `},{test:t=>"vec4"===t.type&&1===t.size&&!t.isArray,code:t=>` 134 cv = ud["${t}"].value; 135 v = uv["${t}"]; 136 137 if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 138 { 139 cv[0] = v[0]; 140 cv[1] = v[1]; 141 cv[2] = v[2]; 142 cv[3] = v[3]; 143 144 gl.uniform4f(ud["${t}"].location, v[0], v[1], v[2], v[3]) 145 }`}],rv={float:` 146 if (cv !== v) 147 { 148 cu.value = v; 149 gl.uniform1f(location, v); 150 }`,vec2:` 151 if (cv[0] !== v[0] || cv[1] !== v[1]) 152 { 153 cv[0] = v[0]; 154 cv[1] = v[1]; 155 156 gl.uniform2f(location, v[0], v[1]) 157 }`,vec3:` 158 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 159 { 160 cv[0] = v[0]; 161 cv[1] = v[1]; 162 cv[2] = v[2]; 163 164 gl.uniform3f(location, v[0], v[1], v[2]) 165 }`,vec4:` 166 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 167 { 168 cv[0] = v[0]; 169 cv[1] = v[1]; 170 cv[2] = v[2]; 171 cv[3] = v[3]; 172 173 gl.uniform4f(location, v[0], v[1], v[2], v[3]); 174 }`,int:` 175 if (cv !== v) 176 { 177 cu.value = v; 178 179 gl.uniform1i(location, v); 180 }`,ivec2:` 181 if (cv[0] !== v[0] || cv[1] !== v[1]) 182 { 183 cv[0] = v[0]; 184 cv[1] = v[1]; 185 186 gl.uniform2i(location, v[0], v[1]); 187 }`,ivec3:` 188 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 189 { 190 cv[0] = v[0]; 191 cv[1] = v[1]; 192 cv[2] = v[2]; 193 194 gl.uniform3i(location, v[0], v[1], v[2]); 195 }`,ivec4:` 196 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 197 { 198 cv[0] = v[0]; 199 cv[1] = v[1]; 200 cv[2] = v[2]; 201 cv[3] = v[3]; 202 203 gl.uniform4i(location, v[0], v[1], v[2], v[3]); 204 }`,uint:` 205 if (cv !== v) 206 { 207 cu.value = v; 208 209 gl.uniform1ui(location, v); 210 }`,uvec2:` 211 if (cv[0] !== v[0] || cv[1] !== v[1]) 212 { 213 cv[0] = v[0]; 214 cv[1] = v[1]; 215 216 gl.uniform2ui(location, v[0], v[1]); 217 }`,uvec3:` 218 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 219 { 220 cv[0] = v[0]; 221 cv[1] = v[1]; 222 cv[2] = v[2]; 223 224 gl.uniform3ui(location, v[0], v[1], v[2]); 225 }`,uvec4:` 226 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 227 { 228 cv[0] = v[0]; 229 cv[1] = v[1]; 230 cv[2] = v[2]; 231 cv[3] = v[3]; 232 233 gl.uniform4ui(location, v[0], v[1], v[2], v[3]); 234 }`,bool:` 235 if (cv !== v) 236 { 237 cu.value = v; 238 gl.uniform1i(location, v); 239 }`,bvec2:` 240 if (cv[0] != v[0] || cv[1] != v[1]) 241 { 242 cv[0] = v[0]; 243 cv[1] = v[1]; 244 245 gl.uniform2i(location, v[0], v[1]); 246 }`,bvec3:` 247 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 248 { 249 cv[0] = v[0]; 250 cv[1] = v[1]; 251 cv[2] = v[2]; 252 253 gl.uniform3i(location, v[0], v[1], v[2]); 254 }`,bvec4:` 255 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 256 { 257 cv[0] = v[0]; 258 cv[1] = v[1]; 259 cv[2] = v[2]; 260 cv[3] = v[3]; 261 262 gl.uniform4i(location, v[0], v[1], v[2], v[3]); 263 }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` 264 if (cv !== v) 265 { 266 cu.value = v; 267 268 gl.uniform1i(location, v); 269 }`,samplerCube:` 270 if (cv !== v) 271 { 272 cu.value = v; 273 274 gl.uniform1i(location, v); 275 }`,sampler2DArray:` 276 if (cv !== v) 277 { 278 cu.value = v; 279 280 gl.uniform1i(location, v); 281 }`},ry={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)"},rb={},rT=rb;function rE(){if(rT===rb||rT?.isContextLost()){let t;let e=Q.ADAPTER.createCanvas();Q.PREFER_ENV>=M.WEBGL2&&(t=e.getContext("webgl2",{})),t||((t=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?t.getExtension("WEBGL_draw_buffers"):t=null),rT=t}return rT}let rA={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},rw=null,rS={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 rR(t,e){if(!rw){let e=Object.keys(rS);rw={};for(let r=0;r<e.length;++r){let i=e[r];rw[t[i]]=rS[i]}}return rw[e]}function rI(t,e,r){if("precision"!==t.substring(0,9)){let i=e;return e===$.HIGH&&r!==$.HIGH&&(i=$.MEDIUM),`precision ${i} float; 282${t}`}return r!==$.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}let rC=0,rP={},rM=class t{constructor(e,r,i="pixi-shader",s={}){this.extra={},this.id=rC++,this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=r||t.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,"#version"!==this.vertexSrc.substring(0,8)&&(rP[i=i.replace(/\s+/g,"-")]?(rP[i]++,i+=`-${rP[i]}`):rP[i]=1,this.vertexSrc=`#define SHADER_NAME ${i} 283${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i} 284${this.fragmentSrc}`,this.vertexSrc=rI(this.vertexSrc,t.defaultVertexPrecision,$.HIGH),this.fragmentSrc=rI(this.fragmentSrc,t.defaultFragmentPrecision,function(){if(!n){n=$.MEDIUM;let t=rE();if(t&&t.getShaderPrecisionFormat){let e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);e&&(n=e.precision?$.HIGH:$.MEDIUM)}}return n}())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return r_}static get defaultFragmentSrc(){return rg}static from(e,r,i){let s=e+r,n=ex[s];return n||(ex[s]=n=new t(e,r,i)),n}};rM.defaultVertexPrecision=$.HIGH,rM.defaultFragmentPrecision=tg.apple.device?$.HIGH:$.MEDIUM;let rD=rM,rB=0;class rN{constructor(t,e,r){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=rB++,this.static=!!e,this.ubo=!!r,t instanceof eq?(this.buffer=t,this.buffer.type=K.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new eq(new Float32Array(1)),this.buffer.type=K.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update(
284)}add(t,e,r){if(this.ubo)throw Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[t]=new rN(e,r)}static from(t,e,r){return new rN(t,e,r)}static uboFrom(t,e){return new rN(t,e??!0,!0)}}class rF{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof rN?this.uniformGroup=e:this.uniformGroup=new rN(e):this.uniformGroup=new rN({}),this.disposeRunner=new eH("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let r in e.uniforms){let i=e.uniforms[r];if(!0===i.group&&this.checkUniformExists(t,i))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,r){return new rF(rD.from(t,e),r)}}class rO{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=r;this.defaultGroupCache[t]=rN.from({uSamplers:e},!0);let r=this.fragTemplate;r=(r=r.replace(/%count%/gi,`${t}`)).replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new rD(this.vertexSrc,r)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new rs,default:this.defaultGroupCache[t]};return new rF(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=` 285 286`;for(let r=0;r<t;r++)r>0&&(e+=` 287else `),r<t-1&&(e+=`if(vTextureId < ${r}.5)`),e+=` 288{ 289 color = texture2D(uSamplers[${r}], vTextureCoord); 290}`;return e+` 291 292`}}class rL{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}class rU{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var rk=`varying vec2 vTextureCoord; 293varying vec4 vColor; 294varying float vTextureId; 295uniform sampler2D uSamplers[%count%]; 296 297void main(void){ 298 vec4 color; 299 %forloop% 300 gl_FragColor = color * vColor; 301} 302`,rG=`precision highp float; 303attribute vec2 aVertexPosition; 304attribute vec2 aTextureCoord; 305attribute vec4 aColor; 306attribute float aTextureId; 307 308uniform mat3 projectionMatrix; 309uniform mat3 translationMatrix; 310uniform vec4 tint; 311 312varying vec2 vTextureCoord; 313varying vec4 vColor; 314varying float vTextureId; 315 316void main(void){ 317 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
317)).xy, 0.0, 1.0); 318 319 vTextureCoord = aTextureCoord; 320 vTextureId = aTextureId; 321 vColor = aColor * tint; 322} 323`;let rH=class t extends rU{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=e2,this.vertexSize=6,this.state=eU.for2d(),this.size=4*t.defaultBatchSize,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),e.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??function(t){let e=!0,r=Q.ADAPTER.getNavigator();if(tg.tablet||tg.phone){if(tg.apple.device){let t=r.userAgent.match(/OS (\d+)_(\d+)?/);t&&11>parseInt(t[1],10)&&(e=!1)}if(tg.android.device){let t=r.userAgent.match(/Android\s([0-9.]*)/);t&&7>parseInt(t[1],10)&&(e=!1)}}return e?32:4}(0),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??!tg.apple.device,this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return tb("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return rG}static get defaultFragmentTemplate(){return rk}setShaderGenerator({vertex:e=t.defaultVertexSrc,fragment:r=t.defaultFragmentTemplate}={}){this.shaderGenerator=new rO(e,r)}contextChange(){let e=this.renderer.gl;Q.PREFER_ENV===M.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),t.defaultMaxTextures),this.maxTextures=eL(this.maxTextures,e)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:e,_textureArrayPool:r}=t,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;e.length<i;)e.push(new ej);for(;r.length<s;)r.push(new rL);for(let t=0;t<this.maxTextures;t++)this._tempBoundTextures[t]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>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(){let{_bufferedTextures:e,maxTextures:r}=this,i=t._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count,o=++e$._globalBatch,h=0,l=i[0],u=0;s.copyBoundTextures(n,r);for(let t=0;t<this._bufferSize;++t){let d=e[t];e[t]=null,d._batchEnabled!==o&&(l.count>=r&&(s.boundArray(l,n,o,r),this.buildDrawCalls(l,u,t),u=t,l=i[++h],++o),d._batchEnabled=o,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,n,o,r),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let t=0;t<n.length;t++)n[t]=null;e$._globalBatch=o}buildDrawCalls(e,r,i){let{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:a,vertexSize:o}=this,h=t._drawCallPool,l=this._dcIndex,u=this._aIndex,d=this._iIndex,c=h[l];c.start=this._iIndex,c.texArray=e;for(let t=r;t<i;++t){let i=s[t],f=t9[i._texture.baseTexture.alphaMode?1:0][i.blendMode];s[t]=null,r<t&&c.blend!==f&&(c.size=d-c.start,r=t,(c=h[++l]).texArray=e,c.start=d),this.packInterleavedGeometry(i,n,a,u,d),u+=i.vertexData.length/2*o,d+=i.indices.length,c.blend=f}r<i&&(c.size=d-c.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=d}bindAndClearTexArray(t){let e=this.renderer.texture;for(let r=0;r<t.count;r++)e.bind(t.elements[r],t.ids[r]),t.elements[r]=null;t.count=0}updateGeometry(){let{_packedGeometries:e,_attributeBuffer:r,_indexBuffer:i}=this;t.canUploadSameBuffer?(e[this._flushId]._buffer.update(r.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(r.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let e=this._dcIndex,{gl:r,state:i}=this.renderer,s=t._drawCallPool,n=null;for(let t=0;t<e;t++){let{texArray:e,type:a,size:o,start:h,blend:l}=s[t];n!==e&&(n=e,this.bindAndClearTexArray(e)),this.state.blendMode=l,i.set(this.state),r.drawElements(a,o,r.UNSIGNED_SHORT,2*h)}}flush(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),t.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){let e=el(Math.ceil(t/8)),r=ed(e),i=8*e;this._aBuffers.length<=r&&(this._iBuffers.length=r+1);let s=this._aBuffers[i];return s||(this._aBuffers[i]=s=new eF(i*this.vertexSize*4)),s}getIndexBuffer(t){let e=el(Math.ceil(t/12)),r=ed(e);this._iBuffers.length<=r&&(this._iBuffers.length=r+1);let i=this._iBuffers[r];
323return i||(this._iBuffers[r]=i=new Uint16Array(12*e)),i}packInterleavedGeometry(t,e,r,i,s){let{uint32View:n,float32View:a}=e,o=i/this.vertexSize,h=t.uvs,l=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,c=Math.min(t.worldAlpha,1),f=t4.shared.setValue(t._tintRGB).toPremultiplied(c,t._texture.baseTexture.alphaMode>0);for(let t=0;t<u.length;t+=2)a[i++]=u[t],a[i++]=u[t+1],a[i++]=h[t],a[i++]=h[t+1],n[i++]=f,a[i++]=d;for(let t=0;t<l.length;t++)r[s++]=o+l[t]}};rH.defaultBatchSize=4096,rH.extension={name:"batch",type:eM.RendererPlugin},rH._drawCallPool=[],rH._textureArrayPool=[];let rX=rH;eN.add(rX);var rV=`varying vec2 vTextureCoord; 324 325uniform sampler2D uSampler; 326 327void main(void){ 328 gl_FragColor = texture2D(uSampler, vTextureCoord); 329} 330`,rW=`attribute vec2 aVertexPosition; 331 332uniform mat3 projectionMatrix; 333 334varying vec2 vTextureCoord; 335 336uniform vec4 inputSize; 337uniform vec4 outputFrame; 338 339vec4 filterVertexPosition( void ) 340{ 341 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 342 343 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 344} 345 346vec2 filterTextureCoord( void ) 347{ 348 return aVertexPosition * (outputFrame.zw * inputSize.zw); 349} 350 351void main(void) 352{ 353 gl_Position = filterVertexPosition(); 354 vTextureCoord = filterTextureCoord(); 355} 356`;let rz=class t extends rF{constructor(e,r,i){super(rD.from(e||t.defaultVertexSrc,r||t.defaultFragmentSrc),i),this.padding=0,this.resolution=t.defaultResolution,this.multisample=t.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new eU}apply(t,e,r,i,s){t.applyFilter(this,e,r,i)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return rW}static get defaultFragmentSrc(){return rV}};rz.defaultResolution=1,rz.defaultMultisample=q.NONE;let r$=rz;class rj{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new t4(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:r,backgroundAlpha:i}=t,s=r??e;void 0!==s&&(this.color=s),this.alpha=i}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}rj.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},rj.extension={type:[eM.RendererSystem,eM.CanvasRendererSystem],name:"background"},eN.add(rj);class rY{constructor(t){this.renderer=t,this.emptyRenderer=new rU(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:r}=this.renderer.texture;for(let i=e-1;i>=0;--i)t[i]=r[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,r,i){let{elements:s,ids:n,count:a}=t,o=0;for(let t=0;t<a;t++){let a=s[t],h=a._batchLocation;if(h>=0&&h<i&&e[h]===a){n[t]=h;continue}for(;o<i;){let i=e[o];if(i&&i._batchEnabled===r&&i._batchLocation===o){o++;continue}n[t]=o,a._batchLocation=o,e[o]=a;break}}}destroy(){this.renderer=null}}rY.extension={type:eM.RendererSystem,name:"batch"},eN.add(rY);let rq=0;class rK{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=rq++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=rq++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;void 0!==e.addEventListener&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let r;if(Q.PREFER_ENV>=M.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,!(r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)))throw Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl}getExtensions(){let{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")};1===this.webGLVersion?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")}):2===this.webGLVersion&&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(){let t=this.renderer.view;this.renderer=null,void 0!==t.removeEventListener&&(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){let e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}rK.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},rK.extension={type:eM.RendererSystem,name:"context"},eN.add(rK);class rZ{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw 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 eH("disposeFramebuffer"),this.multisample=q.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new e$(null,{scaleMode:G.NEAREST,resolution:1,mipmap:X.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new e$(null,{scaleMode:G.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:X.OFF,format:O.DEPTH_COMPONENT,type:U.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 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 r=0;r<this.colorTextures.length;r++){let i=this.colorTextures[r],s=i.resolution;i.setSize(t/s,e/s)}if(this.depthTexture){let r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class rQ extends e${constructor(t={}){if("number"==typeof t){let e=arguments[0],r=arguments[1],i=arguments[2],s=arguments[3];t={width:e,height:r,scaleMode:i,resolution:s}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=q.NONE),super(null,t),this.mipmap=X.OFF,this.valid=!0,this._clear=new t4([0,0,0,0]),this.framebuffer=new rZ(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.he
356ight)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class rJ extends eX{constructor(t){super(t.naturalWidth||t.videoWidth||t.displayWidth||t.width,t.naturalHeight||t.videoHeight||t.displayHeight||t.height),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){void 0!==r||e.startsWith("data:")?!1!==r&&(t.crossOrigin="string"==typeof r?r:"anonymous"):t.crossOrigin=eC(e)}upload(t,e,r,i){let s=t.gl,n=e.realWidth,a=e.realHeight;if(i=i||this.source,"u">typeof HTMLImageElement&&i instanceof HTMLImageElement){if(!i.complete||0===i.naturalWidth)return!1}else if("u">typeof HTMLVideoElement&&i instanceof HTMLVideoElement&&i.readyState<=1)return!1;return s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===V.UNPACK),this.noSubImage||e.target!==s.TEXTURE_2D||r.width!==n||r.height!==a?(r.width=n,r.height=a,s.texImage2D(e.target,0,r.internalFormat,e.format,r.type,i)):s.texSubImage2D(s.TEXTURE_2D,0,0,0,e.format,r.type,i),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}}class r0 extends rJ{constructor(t,e){if(e=e||{},"string"==typeof t){let r=new Image;rJ.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??Q.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.bitmap=null,this._load=null,!1!==e.autoLoad&&this.load()}load(t){return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise((t,e)=>{let r=this.source;this.url=r.src;let i=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};r.complete&&r.src?i():(r.onload=i,r.onerror=t=>{e(t),this.onError.emit(t)})})),this._load}process(){let t=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,r=!t.crossOrigin||"anonymous"===t.crossOrigin;return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(t=>t.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===V.UNPACK?"premultiply":"none"})).then(t=>this.destroyed?Promise.reject():(this.bitmap=t,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,r){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let t=!0,i=e._glTextures;for(let s in i){let n=i[s];if(n!==r&&n.dirtyId!==e.dirtyId){t=!1;break}}t&&(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"u">typeof HTMLImageElement&&("string"==typeof t||t instanceof HTMLImageElement)}}class r1{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,r){let i=e.width,s=e.height;if(r){let e=t.width/2/i,n=t.height/2/s,a=t.x/i+e,o=t.y/s+n;r=rc.add(r,rc.NW),this.x0=a+e*rc.uX(r),this.y0=o+n*rc.uY(r),r=rc.add(r,2),this.x1=a+e*rc.uX(r),this.y1=o+n*rc.uY(r),r=rc.add(r,2),this.x2=a+e*rc.uX(r),this.y2=o+n*rc.uY(r),r=rc.add(r,2),this.x3=a+e*rc.uX(r),this.y3=o+n*rc.uY(r)}else this.x0=t.x/i,this.y0=t.y/s,this.x1=(t.x+t.width)/i,this.y1=t.y/s,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/s,this.x3=t.x/i,this.y3=(t.y+t.height)/s;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}}r1.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};let r2=new r1;function r3(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}class r4 extends t_{constructor(t,e,r,i,s,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new e9(0,0,1,1)),t instanceof r4&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this.destroyed=!1,this._uvs=r2,this.uvMatrix=null,this.orig=r||e,this._rotate=Number(s||0),!0===s)this._rotate=2;else if(this._rotate%2!=0)throw Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new e8(n.x,n.y):new e8(0,0),this.defaultBorders=a,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(
356)}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){let{resource:t}=this.baseTexture;t?.url&&ev[t.url]&&r4.removeFromCache(t.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,r4.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),r=new r4(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===r2&&(this._uvs=new r1),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=Q.STRICT_TEXTURE_CACHE){let i="string"==typeof t,s=null;if(i)s=t;else if(t instanceof e$){if(!t.cacheId){let r=e?.pixiIdPrefix||"pixiid";t.cacheId=`${r}-${em()}`,e$.addToCache(t,t.cacheId)}s=t.cacheId}else{if(!t._pixiId){let r=e?.pixiIdPrefix||"pixiid";t._pixiId=`${r}_${em()}`}s=t._pixiId}let n=ev[s];if(i&&r&&!n)throw Error(`The cacheId "${s}" does not exist in TextureCache.`);return n||t instanceof e$?!n&&t instanceof e$&&(n=new r4(t),r4.addToCache(n,s)):(e.resolution||(e.resolution=eP(t)),(n=new r4(new e$(t,e))).baseTexture.cacheId=s,e$.addToCache(n.baseTexture,s),r4.addToCache(n,s)),n}static fromURL(t,e){let r=Object.assign({autoLoad:!1},e?.resourceOptions),i=r4.from(t,Object.assign({resourceOptions:r},e),!1),s=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):s.load().then(()=>Promise.resolve(i))}static fromBuffer(t,e,r,i){return new r4(e$.fromBuffer(t,e,r,i))}static fromLoader(t,e,r,i){let s=new e$(t,Object.assign({scaleMode:e$.defaultOptions.scaleMode,resolution:eP(e)},i)),{resource:n}=s;n instanceof r0&&(n.url=e);let a=new r4(s);return r||(r=e),e$.addToCache(a.baseTexture,r),r4.addToCache(a,r),r!==e&&(e$.addToCache(a.baseTexture,e),r4.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(t=>{a.baseTexture.once("loaded",()=>t(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),ev[e]&&ev[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),ev[e]=t)}static removeFromCache(t){if("string"==typeof t){let e=ev[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete ev[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)ev[t.textureCacheIds[e]]===t&&delete ev[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:r,width:i,height:s}=t,n=e+i>this.baseTexture.width,a=r+s>this.baseTexture.height;if(n||a){let t=`X: ${e} + ${i} = ${e+i} > ${this.baseTexture.width}`,o=`Y: ${r} + ${s} = ${r+s} > ${this.baseTexture.height}`;throw Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${t} ${n&&a?"and":"or"} ${o}`)}this.valid=i&&s&&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 r4._EMPTY||(r4._EMPTY=new r4(new e$),r3(r4._EMPTY),r3(r4._EMPTY.baseTexture)),r4._EMPTY}static get WHITE(){if(!r4._WHITE){let t=Q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),r4._WHITE=new r4(e$.from(t)),r3(r4._WHITE),r3(r4._WHITE.baseTexture)}return r4._WHITE}}class r5 extends r4{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,r=!0){let i=this.baseTexture.resolution,s=Math.round(t*i)/i,n=Math.round(e*i)/i;this.valid=s>0&&n>0,this._frame.width=this.orig.width=s,this._frame.height=this.orig.height=n,r&&this.baseTexture.resize(s,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new r5(new rQ(t))}}class r6{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=q.NONE){return new r5(new rQ(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions)))}getOptimalTexture(t,e,r=1,i=q.NONE){let s;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?s=i>1?-i:-1:(t=el(t),e=el(e),s=((65535&t)<<16|65535&e)>>>0,i>1&&(s+=4294967296*i)),this.texturePool[s]||(this.texturePool[s]=[]);let n=this.texturePool[s].pop();return n||(n=this.createTexture(t,e,i)),n.filterPoolKey=s,n.setResolution(r),n}getFilterTexture(t,e,r){let i=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||q.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=!1!==t)for(let t in this.texturePool){let e=this.texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){for(let e in this.enableFullScreen=t.width>0&&t.height>0,this.texturePool){if(!(0>Number(e)))continue;let t=this.texturePool[e];if(t)for(let e=0;e<t.length;e++)t[e].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}r6.SCREEN_KEY=-1;class r8 extends e1{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class r7 extends e1{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new eq(this.vertices),this.uvBuffer=new eq(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,i=0;return this.uvs[0]=r,this.uvs[1]=i,this.uvs[2]=r+e.width/t.width,this.uvs[3]=i,this.uvs[4]=r+e.width/t.width,this.uvs[5]=i+e.height/t.height,this.uvs[6]=r,this.uvs[7]=i+e.height/t.height,r=e.x,i=e.y,this.vertices[0]=r,this.vertices[1]=i,this.vertices[2]=r+e.width,this.vertices[3]=i,this.vertices[4]=r+e.width,this.vertices[5]=i+e.height,this.vertices[6]=r,this.vertices[7]=i+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class r9{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=q.NONE,this.sourceFrame=new e9,this.destinationFrame=new e9,this.bindingSourceFrame=new e9,this.bindingDestinationFrame=new e9,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}let it=[new e8,new e8,new e8,new e8],ie=new rs;class ir{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new r6,this.statePool=[],this.quad=new r8,this.quadUv=new r7,this.tempRect=new e9,this.activeState={},this.globalUniforms=new rN({outputFrame:new e9,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}
356init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let r,i;let s=this.renderer,n=this.defaultFilterStack,a=this.statePool.pop()||new r9,o=s.renderTexture;if(o.current){let t=o.current;r=t.resolution,i=t.multisample}else r=s.resolution,i=s.multisample;let h=e[0].resolution||r,l=e[0].multisample??i,u=e[0].padding,d=e[0].autoFit,c=e[0].legacy??!0;for(let t=1;t<e.length;t++){let s=e[t];h=Math.min(h,s.resolution||r),l=Math.min(l,s.multisample??i),u=this.useMaxPadding?Math.max(u,s.padding):u+s.padding,d=d&&s.autoFit,c=c||(s.legacy??!0)}1===n.length&&(this.defaultFilterStack[0].renderTexture=o.current),n.push(a),a.resolution=h,a.multisample=l,a.legacy=c,a.target=t,a.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),a.sourceFrame.pad(u);let f=this.tempRect.copyFrom(o.sourceFrame);s.projection.transform&&this.transformAABB(ie.copyFrom(s.projection.transform).invert(),f),d?(a.sourceFrame.fit(f),(a.sourceFrame.width<=0||a.sourceFrame.height<=0)&&(a.sourceFrame.width=0,a.sourceFrame.height=0)):a.sourceFrame.intersects(f)||(a.sourceFrame.width=0,a.sourceFrame.height=0),this.roundFrame(a.sourceFrame,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),a.renderTexture=this.getOptimalFilterTexture(a.sourceFrame.width,a.sourceFrame.height,h,l),a.filters=e,a.destinationFrame.width=a.renderTexture.width,a.destinationFrame.height=a.renderTexture.height;let p=this.tempRect;p.x=0,p.y=0,p.width=a.sourceFrame.width,p.height=a.sourceFrame.height,a.renderTexture.filterFrame=a.sourceFrame,a.bindingSourceFrame.copyFrom(o.sourceFrame),a.bindingDestinationFrame.copyFrom(o.destinationFrame),a.transform=s.projection.transform,s.projection.transform=null,o.bind(a.renderTexture,a.sourceFrame,p),s.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;let i=this.globalUniforms.uniforms;i.outputFrame=e.sourceFrame,i.resolution=e.resolution;let s=i.inputSize,n=i.inputPixel,a=i.inputClamp;if(s[0]=e.destinationFrame.width,s[1]=e.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],n[0]=Math.round(s[0]*e.resolution),n[1]=Math.round(s[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*s[2]-.5*n[2],a[3]=e.sourceFrame.height*s[3]-.5*n[3],e.legacy){let t=i.filterArea;t[0]=e.destinationFrame.width,t[1]=e.destinationFrame.height,t[2]=e.sourceFrame.x,t[3]=e.sourceFrame.y,i.filterClamp=i.inputClamp}this.globalUniforms.update();let o=t[t.length-1];if(this.renderer.framebuffer.blit(),1===r.length)r[0].apply(this,e.renderTexture,o.renderTexture,W.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let t=e.renderTexture,i=this.getOptimalFilterTexture(t.width,t.height,e.resolution);i.filterFrame=t.filterFrame;let s=0;for(s=0;s<r.length-1;++s){1===s&&e.multisample>1&&((i=this.getOptimalFilterTexture(t.width,t.height,e.resolution)).filterFrame=t.filterFrame),r[s].apply(this,t,i,W.CLEAR,e);let n=t;t=i,i=n}r[s].apply(this,t,o.renderTexture,W.BLEND,e),s>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(t),this.returnFilterTexture(i)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=W.CLEAR){let{renderTexture:r,state:i}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let e=this.tempRect;e.x=0,e.y=0,e.width=t.filterFrame.width,e.height=t.filterFrame.height,r.bind(t,t.filterFrame,e)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let s=1&i.stateId||this.forceClear;(e===W.CLEAR||e===W.BLIT&&s)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,i){let s=this.renderer;s.state.set(t.state),this.bindAndClear(r,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(F.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(F.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:r,destinationFrame:i}=this.activeState,{orig:s}=e._texture,n=t.set(i.width,0,0,i.height,r.x,r.y),a=e.worldTransform.copyTo(rs.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/s.width,1/s.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,i=q.NONE){return this.texturePool.getOptimalTexture(t,e,r,i)}getFilterTexture(t,e,r){if("number"==typeof t){let r=t;t=e,e=r}t=t||this.activeState.renderTexture;let i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||q.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}
356resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let r=it[0],i=it[1],s=it[2],n=it[3];r.set(e.left,e.top),i.set(e.left,e.bottom),s.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(r,r),t.apply(i,i),t.apply(s,s),t.apply(n,n);let a=Math.min(r.x,i.x,s.x,n.x),o=Math.min(r.y,i.y,s.y,n.y),h=Math.max(r.x,i.x,s.x,n.x),l=Math.max(r.y,i.y,s.y,n.y);e.x=a,e.y=o,e.width=h-a,e.height=l-o}roundFrame(t,e,r,i,s){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(s){let{a:t,b:e,c:r,d:i}=s;if((Math.abs(e)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(i)>1e-4))return}(s=s?ie.copyFrom(s):ie.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}}}ir.extension={type:eM.RendererSystem,name:"filter"},eN.add(ir);class ii{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=q.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}let is=new e9;class ia{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new rZ(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new e9,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;Q.PREFER_ENV===M.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=t=>e.drawBuffersWEBGL(t):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){let{gl:i}=this;if(t){let s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=r),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):s.dirtySize!==t.dirtySize&&(s.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let e=0;e<t.colorTextures.length;e++){let r=t.colorTextures[e];this.renderer.texture.unbind(r.parentTextureArray||r)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let t=e.width>>r,i=e.height>>r,s=t/e.width;this.setViewport(e.x*s,e.y*s,t,i)}else{let e=t.width>>r,i=t.height>>r;this.setViewport(0,0,e,i)}}else this.current&&(this.current=null,i.bindFramebuffer(i.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,r,i){let s=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),i=Math.round(i),(s.width!==r||s.height!==i||s.x!==t||s.y!==e)&&(s.x=t,s.y=e,s.width=r,s.height=i,this.gl.viewport(t,e,r,i))}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,r,i,s=B.COLOR|B.DEPTH){let{gl:n}=this;n.clearColor(t,e,r,i),n.clear(s)}initFramebuffer(t){let{gl:e}=this,r=new ii(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){let{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){let i;e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),i=1===this.renderer.context.webGLVersion?e.DEPTH_STENCIL:t.depth&&t.stencil?e.DEPTH24_STENCIL8:t.depth?e.DEPTH_COMPONENT24:e.STENCIL_INDEX8,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,i,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,i,t.width,t.height)}let i=t.colorTextures,s=i.length;e.drawBuffers||(s=Math.min(s,1));for(let n=0;n<s;n++){let s=i[n],a=s.parentTextureArray||s;this.renderer.texture.bind(a,0),0===n&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,a._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:r}=this,i=t.glFramebuffers[this.CONTEXT_UID],s=t.colorTextures,n=s.length;r.drawBuffers||(n=Math.min(n,1)),i.multisample>
3561&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||r.createRenderbuffer():i.msaaBuffer&&(r.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));let a=[];for(let o=0;o<n;o++){let n=s[o],h=n.parentTextureArray||n;this.renderer.texture.bind(h,0),0===o&&i.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,i.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+o,n.target,h._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+o))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let i=t.depthTexture;this.renderer.texture.bind(i,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,i._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){let e,s;i.stencil=i.stencil||r.createRenderbuffer(),1===this.renderer.context.webGLVersion?(e=r.DEPTH_STENCIL_ATTACHMENT,s=r.DEPTH_STENCIL):t.depth&&t.stencil?(e=r.DEPTH_STENCIL_ATTACHMENT,s=r.DEPTH24_STENCIL8):t.depth?(e=r.DEPTH_ATTACHMENT,s=r.DEPTH_COMPONENT24):(e=r.STENCIL_ATTACHMENT,s=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,i.stencil),i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,s,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,s,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,e,r.RENDERBUFFER,i.stencil)}else i.stencil&&(r.deleteRenderbuffer(i.stencil),i.stencil=null)}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,r=q.NONE;if(t<=1||null===e)return r;for(let i=0;i<e.length;i++)if(e[i]<=t){r=e[i];break}return 1===r&&(r=q.NONE),r}blit(t,e,r){let{current:i,renderer:s,gl:n,CONTEXT_UID:a}=this;if(2!==s.context.webGLVersion||!i)return;let o=i.glFramebuffers[a];if(!o)return;if(!t){if(!o.msaaBuffer)return;let e=i.colorTextures[0];if(!e)return;o.blitFramebuffer||(o.blitFramebuffer=new rZ(i.width,i.height),o.blitFramebuffer.addColorTexture(0,e)),(t=o.blitFramebuffer).colorTextures[0]!==e&&(t.colorTextures[0]=e,t.dirtyId++,t.dirtyFormat++),(t.width!==i.width||t.height!==i.height)&&(t.width=i.width,t.height=i.height,t.dirtyId++,t.dirtySize++)}e||((e=is).width=i.width,e.height=i.height),r||(r=e);let h=e.width===r.width&&e.height===r.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,o.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,n.COLOR_BUFFER_BIT,h?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let r=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(!r)return;delete t.glFramebuffers[this.CONTEXT_UID];let s=this.managedFramebuffers.indexOf(t);s>
356=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&i.deleteRenderbuffer(r.msaaBuffer),r.stencil&&i.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)}forceStencil(){let t,e;let r=this.current;if(!r)return;let i=r.glFramebuffers[this.CONTEXT_UID];if(!i||i.stencil&&r.stencil)return;r.stencil=!0;let s=r.width,n=r.height,a=this.gl,o=i.stencil=a.createRenderbuffer();a.bindRenderbuffer(a.RENDERBUFFER,o),1===this.renderer.context.webGLVersion?(t=a.DEPTH_STENCIL_ATTACHMENT,e=a.DEPTH_STENCIL):r.depth?(t=a.DEPTH_STENCIL_ATTACHMENT,e=a.DEPTH24_STENCIL8):(t=a.STENCIL_ATTACHMENT,e=a.STENCIL_INDEX8),i.msaaBuffer?a.renderbufferStorageMultisample(a.RENDERBUFFER,i.multisample,e,s,n):a.renderbufferStorage(a.RENDERBUFFER,e,s,n),a.framebufferRenderbuffer(a.FRAMEBUFFER,t,a.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new e9}destroy(){this.renderer=null}}ia.extension={type:eM.RendererSystem,name:"framebuffer"},eN.add(ia);let io={5126:4,5123:2,5121:1};class ih{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==e.webGLVersion){let e=this.renderer.context.extensions.vertexArrayObject;Q.PREFER_ENV===M.WEBGL_LEGACY&&(e=null),e?(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=t=>e.bindVertexArrayOES(t),t.deleteVertexArray=t=>e.deleteVertexArrayOES(t)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(2!==e.webGLVersion){let e=t.getExtension("ANGLE_instanced_arrays");e?(t.vertexAttribDivisor=(t,r)=>e.vertexAttribDivisorANGLE(t,r),t.drawElementsInstanced=(t,r,i,s,n)=>e.drawElementsInstancedANGLE(t,r,i,s,n),t.drawArraysInstanced=(t,r,i,s)=>e.drawArraysInstancedANGLE(t,r,i,s)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:r}=this,i=t.glVertexArrayObjects[this.CONTEXT_UID],s=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},s=!0);let n=i[e.program.id]||this.initGeometryVao(t,e,s);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){let i=t.buffers[r];e.update(i)}}checkCompatibility(t,e){let r=t.attributes,i=e.attributeData;for(let t in i)if(!r[t])throw Error(`shader and geometry incompatible, geometry missing the "${t}" attribute`)}getSignature(t,e){let r=t.attributes,i=e.attributeData,s=["g",t.id];for(let t in r)i[t]&&s.push(t,i[t].location);return s.join("-")}initGeometryVao(t,e,r=!0){let i=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[s]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let o=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID],l=h[o];if(l)return h[a.id]=l,l;let u=t.buffers,d=t.attributes,c={},f={};for(let t in u)c[t]=0,f[t]=0;for(let t in d)!d[t].size&&a.attributeData[t]?d[t].size=a.attributeData[t].size:d[t].size||console.warn(`PIXI Geometry attribute '${t}' size cannot be determined (likely the bound shader does not have the attribute)`),c[d[t].buffer]+=d[t].size*io[d[t].type];for(let t in d){let e=d[t],r=e.size;void 0===e.stride&&(c[e.buffer]===r*io[e.type]?e.stride=0:e.stride=c[e.buffer]),void 0===e.start&&(e.start=f[e.buffer],f[e.buffer]+=r*io[e.type])}l=i.createVertexArray(),i.bindVertexArray(l);for(let t=0;t<u.length;t++){let e=u[t];n.bind(e),r&&e._glBuffers[s].refCount++}return this.activateVao(t,a),h[a.id]=l,h[o]=l,i.bindVertexArray(null),n.unbind(K.ARRAY_BUFFER),l}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let r=t.glVertexArrayObjects[this.CONTEXT_UID],i=this.gl,s=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),r){if(n)for(let t=0;t<s.length;t++){let r=s[t]._glBuffers[this.CONTEXT_UID];r&&(r.refCount--,0!==r.refCount||e||n.dispose(s[t],e))}if(!e){for(let t in r)if("g"===t[0]){let e=r[t];this._activeVao===e&&this.unbind(),i.deleteVertexArray(e)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){let r=this.gl,i=this.CONTEXT_UID,s=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let o=null;for(let t in a){let h=a[t],l=n[h.buffer],u=l._glBuffers[i];if(e.attributeData[t]){o!==u&&(s.bind(l),o=u);let i=e.attributeData[t].location;if(r.enableVertexAttribArray(i),r.vertexAttribPointer(i,h.size,h.type||r.FLOAT,h.normalized,h.stride,h.start),h.instance){if(this.hasInstance)r.vertexAttribDivisor(i,h.divisor);else throw Error("geometry error, GPU Instancing is not supported on this device")}}}}draw(t,e,r,i){let{gl:s}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,o=2===a?s.UNSIGNED_SHORT:s.UNSIGNED_INT;2===a||4===a&&this.canUseUInt32ElementIndex?n.instanced?s.drawElementsInstanced(t,e||n.indexBuffer.data.length,o,(r||0)*a,i||1):s.drawElements(t,e||n.indexBuffer.data.length,o,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?s.drawArraysInstanced(t,r,e||n.getSize(),i||1):s.drawArrays(t,r,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}ih.extension={type:eM.RendererSystem,name:"geometry"},eN.add(ih);let il=new rs;class iu{constructor(t,e){this._texture=t,this.mapCoord=new rs,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){void 0===e&&(e=t);let r=this.mapCoord;for(let i=0;i<t.length;i+=2){let s=t[i],n=t[i+1];e[i]=s*r.a+n*r.c+r.tx,e[i+1]=s*r.b+n*r.d+r.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let i=e.orig,s=e.trim;s&&(il.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(il));let n=e.baseTexture,a=this.uClampFrame,o=this.clampMargin/n.resolution,h=this.clampOffset;return a[0]=(e._frame.x+o+h)/n.width,a[1]=(e._frame.y+o+h)/n.height,a[2]=(e._frame.x+e._frame.width-o+h)/n.width,a[3]=(e._frame.y+e._frame.height-o+h)/n.height,this.uClampOffset[0]=h/n.realWidth,this.uClampOffset[1]=h/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&0===e.rotate,!0}}var id=`varying vec2 vMaskCoord; 357varying vec2 vTextureCoord; 358 359uniform sampler2D uSampler; 360uniform sampler2D mask; 361uniform float alpha; 362uniform float npmAlpha; 363uniform vec4 maskClamp; 364 365void main(void) 366{ 367 float clip = step(3.5, 368 step(maskClamp.x, vMaskCoord.x) + 369 step(maskClamp.y, vMaskCoord.y) + 370 step(vMaskCoord.x, maskClamp.z) + 371 step(vMaskCoord.y, maskClamp.w)); 372 373 vec4 original = texture2D(uSampler, vTextureCoord);
374 vec4 masky = texture2D(mask, vMaskCoord); 375 float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); 376 377 original *= (alphaMul * masky.r * alpha * clip); 378 379 gl_FragColor = original; 380} 381`,ic=`attribute vec2 aVertexPosition; 382attribute vec2 aTextureCoord; 383 384uniform mat3 projectionMatrix; 385uniform mat3 otherMatrix; 386 387varying vec2 vMaskCoord; 388varying vec2 vTextureCoord; 389 390void main(void) 391{ 392 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); 393 394 vTextureCoord = aTextureCoord; 395 vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy; 396} 397`;class ip extends r${constructor(t,e,r){let i=null;"string"!=typeof t&&void 0===e&&void 0===r&&(i=t,t=void 0,e=void 0,r=void 0),super(t||ic,e||id,r),this.maskSprite=i,this.maskMatrix=new rs}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,r,i){let s=this._maskSprite,n=s._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new iu(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,s).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=s.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,r,i))}}class im{constructor(t=null){this.type=j.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=r$.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=j.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class ig{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let r=e;if(!r.isMaskData){let t=this.maskDataPool.pop()||new im;t.pooled=!0,t.maskObject=e,r=t}let i=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(i),r._colorMask=i?i._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==j.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case j.SCISSOR:this.renderer.scissor.push(r);break;case j.STENCIL:this.renderer.stencil.push(r);break;case j.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case j.COLOR:this.pushColorMask(r)}r.type===j.SPRITE&&this.maskStack.push(r)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case j.SCISSOR:this.renderer.scissor.pop(e);break;case j.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case j.SPRITE:this.popSpriteMask(e);break;case j.COLOR:this.popColorMask(e)}if(e.reset(),e.pooled&&this.maskDataPool.push(e),0!==this.maskStack.length){let t=this.maskStack[this.maskStack.length-1];t.type===j.SPRITE&&t._filters&&(t._filters[0].maskSprite=t.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=j.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=j.SCISSOR:t.type=j.STENCIL:t.type=j.COLOR}pushSpriteMask(t){let{maskObject:e}=t,r=t._target,i=t._filters;i||(i=this.alphaMaskPool[this.alphaMaskIndex])||(i=this.alphaMaskPool[this.alphaMaskIndex]=[new ip]),i[0].resolution=t.resolution,i[0].multisample=t.multisample,i[0].maskSprite=e;let s=r.filterArea;r.filterArea=e.getBounds(!0),this.renderer.filter.push(r,i),r.filterArea=s,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask((1&r)!=0,(2&r)!=0,(4&r)!=0,(8&r)!=0)}popColorMask(t){let e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask((1&r)!=0,(2&r)!=0,(4&r)!=0,(8&r)!=0)}destroy(){this.renderer=null}}ig.extension={type:eM.RendererSystem,name:"mask"},eN.add(ig);class i_{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;let i=this.getStackLength();i!==r&&(0===i?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}let ix=new rs,iv=[],iy=class t extends i_{constructor(t){super(t),this.glConst=Q.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}
397calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:r}=t,{renderer:i}=this,s=i.renderTexture,n=r.getBounds(!0,iv.pop()??new e9);this.roundFrameToPixels(n,s.current?s.current.resolution:i.resolution,s.sourceFrame,s.destinationFrame,i.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:r,c:i,d:s}=t;return(Math.abs(r)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(s)>1e-4)}testScissor(e){let{maskObject:r}=e;if(!r.isFastRect||!r.isFastRect()||t.isMatrixRotated(r.worldTransform)||t.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);let i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,r,i,s,n){t.isMatrixRotated(n)||((n=n?ix.copyFrom(n):ix.identity()).translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,e),e.fit(s),e.x=Math.round(e.x*r),e.y=Math.round(e.y*r),e.width=Math.round(e.width*r),e.height=Math.round(e.height*r))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&iv.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t;let e=this.maskStack[this.maskStack.length-1]._scissorRect;t=this.renderer.renderTexture.current?e.y:this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)}};iy.extension={type:eM.RendererSystem,name:"scissor"};let ib=iy;eN.add(ib);class iT extends i_{constructor(t){super(t),this.glConst=Q.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:r}=this.renderer,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;let s=t._colorMask;0!==s&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,i,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==s&&(t._colorMask=s,r.colorMask((1&s)!=0,(2&s)!=0,(4&s)!=0,(8&s)!=0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{let r=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=r?r._colorMask:15;0!==i&&(r._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,0!==i&&(r._colorMask=i,e.colorMask((1&i)!=0,(2&i)!=0,(4&i)!=0,(8&i)!=0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}iT.extension={type:eM.RendererSystem,name:"stencil"},eN.add(iT);class iE{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get:()=>(tb("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract)},prepare:{enumerable:!1,get:()=>(tb("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare)},interaction:{enumerable:!1,get:()=>(tb("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events)}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}iE.extension={type:[eM.RendererSystem,eM.CanvasRendererSystem],name:"_plugin"},eN.add(iE);class iA{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new rs,this.transform=null}update(t,e,r,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,i),this.transform&&this.projectionMatrix.append(this.transform);let s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)}calculateProjection(t,e,r,i){let s=this.projectionMatrix,n=i?-1:1;s.identity(),s.a=1/e.width*2,s.d=1/e.height*2*n,s.tx=-1-e.x*s.a,s.ty=-n-e.y*s.d}setTransform(t){}destroy(){this.renderer=null}}iA.extension={type:eM.RendererSystem,name:"projection"},eN.add(iA);let iw=new rm,iS=new e9;class iR{constructor(t){this.renderer=t,this._tempMatrix=new rs}generateTexture(t,e){let{region:r,...i}=e||{},s=r?.copyTo(iS)||t.getLocalBounds(iS,!0),n=i.resolution||this.renderer.resolution;s.width=Math.max(s.width,1/n),s.height=Math.max(s.height,1/n),i.width=s.width,i.height=s.height,i.resolution=n,i.multisample??(i.multisample=this.renderer.multisample);let a=r5.create(i);this._tempMatrix.tx=-s.x,this._tempMatrix.ty=-s.y;let o=t.transform;return t.transform=iw,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,a}destroy(){}}iR.extension={type:[eM.RendererSystem,eM.CanvasRendererSystem],name:"textureGenerator"},eN.add(iR);let iI=new e9,iC=new e9;class iP{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new e9,this.destinationFrame=new e9,this.viewportFrame=new e9}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,r){let i,s,n;let a=this.renderer;this.current=t,t?(n=(i=t.baseTexture).resolution,e||(iI.width=t.frame.width,iI.height=t.frame.height,e=iI),r||(iC.x=t.frame.x,iC.y=t.frame.y,iC.width=e.width,iC.height=e.height,r=iC),s=i.framebuffer):(n=a.resolution,e||(iI.width=a._view.screen.width,iI.height=a._view.screen.height,e=iI),r||((r=iI).width=e.width,r.height=e.height));let o=this.viewportFrame;o.x=r.x*n,o.y=r.y*n,o.width=r.width*n,o.height=r.height*n,t||(o.y=a.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(s,o),this.renderer.projection.update(r,e,n,!s),t?this.renderer.mask.setMaskStack(i.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){let r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,i=t4.shared.setValue(t||r);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);let s=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=s.width!==n.width||s.height!==n.height;if(a){let{x:t,y:e,width:r,height:i}=this.viewportFrame;t=Math.round(t),e=Math.round(e),r=Math.round(r),i=Math.round(i),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(t,e,r,i)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}iP.extension={type:eM.RendererSystem,name:"renderTexture"},eN.add(iP);class iM{}class iD{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 iB(t,e,r){let i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),i}function iN(t){let e=Array(t);for(let t=0;t<e.length;t++)e[t]=!1;return e}function iF(t,e){switch(t){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return iN(2*e);case"bvec3":return iN(3*e);case"bvec4":return iN(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}function iO(t,e){let r=t.getShaderSource(e).split(` 398`).map((t,e)=>`${e}: ${t}`),i=t.getShaderInfoLog(e),s=i.split(` 399`),n={},a=s.map(t=>
399parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(t=>!!t&&!n[t]&&(n[t]=!0,!0)),o=[""];a.forEach(t=>{r[t-1]=`%c${r[t-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let h=r.join(` 400`);o[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function iL(t,e){let r=iB(t,t.VERTEX_SHADER,e.vertexSrc),i=iB(t,t.FRAGMENT_SHADER,e.fragmentSrc),s=t.createProgram();t.attachShader(s,r),t.attachShader(s,i);let n=e.extra?.transformFeedbackVaryings;if(n&&("function"!=typeof t.transformFeedbackVaryings?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(s,n.names,"separate"===n.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||t.getProgramParameter(s,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||iO(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||iO(t,i),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(s)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(s))),e.attributeData=function(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let i=e.getActiveAttrib(t,s);if(i.name.startsWith("gl_"))continue;let n=rR(e,i.type),a={type:n,name:i.name,size:rA[n],location:e.getAttribLocation(t,i.name)};r[i.name]=a}return r}(s,t),e.uniformData=function(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let i=e.getActiveUniform(t,s),n=i.name.replace(/\[.*?\]$/,""),a=!!i.name.match(/\[.*?\]$/),o=rR(e,i.type);r[n]={name:n,index:s,type:o,size:i.size,isArray:a,value:iF(o,i.size)}}return r}(s,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){let r=Object.keys(e.attributeData);r.sort((t,e)=>t>e?1:-1);for(let i=0;i<r.length;i++)e.attributeData[r[i]].location=i,t.bindAttribLocation(s,i,r[i]);t.linkProgram(s)}t.deleteShader(r),t.deleteShader(i);let a={};for(let r in e.uniformData){let i=e.uniformData[r];a[r]={location:t.getUniformLocation(s,r),value:iF(i.type,i.size)}}return new iD(s,a)}function iU(t,e,r,i,s){r.buffer.update(s)}let ik={float:` 401 data[offset] = v; 402 `,vec2:` 403 data[offset] = v[0]; 404 data[offset+1] = v[1]; 405 `,vec3:` 406 data[offset] = v[0]; 407 data[offset+1] = v[1]; 408 data[offset+2] = v[2]; 409 410 `,vec4:` 411 data[offset] = v[0]; 412 data[offset+1] = v[1]; 413 data[offset+2] = v[2]; 414 data[offset+3] = v[3]; 415 `,mat2:` 416 data[offset] = v[0]; 417 data[offset+1] = v[1]; 418 419 data[offset+4] = v[2]; 420 data[offset+5] = v[3]; 421 `,mat3:` 422 data[offset] = v[0]; 423 data[offset+1] = v[1]; 424 data[offset+2] = v[2]; 425 426 data[offset + 4] = v[3]; 427 data[offset + 5] = v[4]; 428 data[offset + 6] = v[5]; 429 430 data[offset + 8] = v[6]; 431 data[offset + 9] = v[7]; 432 data[offset + 10] = v[8]; 433 `,mat4:` 434 for(var i = 0; i < 16; i++) 435 { 436 data[offset + i] = v[i]; 437 } 438 `},iG={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function iH(t){let e=t.map(t=>({data:t,offset:0,dataLen:0,dirty:0})),r=0,i=0,s=0;for(let t=0;t<e.length;t++){let n=e[t];if(r=iG[n.data.type],n.data.size>1&&(r=Math.max(r,16)*n.data.size),n.dataLen=r,i%r!=0&&i<16){let t=i%r%16;i+=t,s+=t}i+r>16?(s=16*Math.ceil(s/16),n.offset=s,s+=r,i=r):(n.offset=s,i+=r,s+=r)}return{uboElements:e,size:s=16*Math.ceil(s/16)}}function iX(t,e){let r=[];for(let i in t)e[i]&&r.push(e[i]);return r.sort((t,e)=>t.index-e.index),r}function iV(t,e){if(!t.autoManage)return{size:0,syncFunc:iU};let{uboElements:r,size:i}=iH(iX(t.uniforms,e)),s=[` 439 var v = null; 440 var v2 = null; 441 var cv = null; 442 var t = 0; 443 var gl = renderer.gl 444 var index = 0; 445 var data = buffer.data; 446 `];for(let e=0;e<r.length;e++){let i=r[e],n=t.uniforms[i.data.name],a=i.data.name,o=!1;for(let t=0;t<rx.length;t++){let e=rx[t];if(e.codeUbo&&e.test(i.data,n)){s.push(`offset = ${i.offset/4};`,rx[t].codeUbo(i.data.name,n)),o=!0;break}}if(!o){if(i.data.size>1){let t=rA[i.data.type],e=Math.max(iG[i.data.type]/16,1),r=t/e,n=(4-r%4)%4;s.push(` 447 cv = ud.${a}.value; 448 v = uv.${a}; 449 offset = ${i.offset/4}; 450 451 t = 0; 452 453 for(var i=0; i < ${i.data.size*e}; i++) 454 { 455 for(var j = 0; j < ${r}; j++) 456 { 457 data[offset++] = v[t++]; 458 } 459 offset += ${n}; 460 } 461 462 `)}else{let t=ik[i.data.type];s.push(` 463 cv = ud.${a}.value; 464 v = uv.${a}; 465 offset = ${i.offset/4}; 466 ${t}; 467 `)}}}return s.push(` 468 renderer.buffer.update(buffer); 469 `),{size:i,syncFunc:Function("ud","uv","renderer","syncData","buffer",s.join(` 470`))}}function iW(){if("boolean"==typeof a)return a;try{a=!0===Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")}catch{a=!1}return a}let iz=0,i$={textureCount:0,uboCount:0};class ij{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=iz++}systemCheck(){if(!iW())throw 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;let r=t.program,i=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(i.program)),e||(i$.textureCount=0,i$.uboCount=0,this.syncUniformGroup(t.uniformGroup,i$)),i}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();t.static&&t.dirtyId===r.uniformDirtyGroups[t.id]||(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function(t,e){let r=[` 471 var v = null; 472 var cv = null; 473 var cu = null; 474 var t = 0; 475 var gl = renderer.gl; 476 `];for(let i in t.uniforms){let s=e[i];if(!s){t.uniforms[i]?.group===!0&&(t.uniforms[i].ubo?r.push(` 477 renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}'); 478 `):r.push(` 479 renderer.shader.syncUniformGroup(uv.${i}, syncData); 480 `));continue}let n=t.uniforms[i],a=!1;for(let t=0;t<rx.length;t++)if(rx[t].test(s,n)){r.push(rx[t].code(i,n)),a=!0;break}if(!a){let t=(1!==s.size||s.isArray?ry:rv)[s.type].replace("location",`ud["${i}"].location`);r.push(` 481 cu = ud["${i}"]; 482 cv = cu.value; 483 v = uv["${i}"]; 484 ${t};`)}}return Function("ud","uv","renderer","syncData",r.join(` 485`))}(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||0!==t.dirtyId||!r.uniformGroups[t.id]){t.dirtyId=0;let i=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);
485t.buffer.update(),i(r.uniformData,t.uniforms,this.renderer,i$,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:i}=this.renderer;this.renderer.buffer.bind(t.buffer);let s=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,s,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=iV(t,this.shader.program.uniformData)),t.autoManage){let e=new Float32Array(a.size/4);t.buffer.update(e)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let i=t.uniforms,s=[`${r}-`];for(let t in i)s.push(t),e[t]&&s.push(e[t].type);return s.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,i=iL(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=i,i}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}ij.extension={type:eM.RendererSystem,name:"shader"},eN.add(ij);class iY{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}iY.defaultOptions={hello:!1},iY.extension={type:[eM.RendererSystem,eM.CanvasRendererSystem],name:"startup"},eN.add(iY);let iq=class t{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=N.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new eU,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=function(t,e=[]){return e[N.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.ADD]=[t.ONE,t.ONE],e[N.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.NONE]=[0,0],e[N.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[N.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[N.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[N.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[N.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[N.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[N.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[N.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[N.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[N.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[N.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)1&e&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],r=this.gl;2===e.length?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let r=this.checks.indexOf(t);e&&-1===r?this.checks.push(t):e||-1===r||this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};iq.extension={type:eM.RendererSystem,name:"state"};let iK=iq;eN.add(iK);class iZ extends t_{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(e=>t.systems[e]);for(let r of[...e,...Object.keys(t.systems).filter(t=>!e.includes(t))])this.addSystem(t.systems[r],r)}addRunners(...t){t.forEach(t=>{this.runners[t]=new eH(t)})}addSystem(t,e){let r=new t(this);if(this[e])throw Error(`Whoops! The name "${e}" is already in use`);for(let t in this[e]=r,this._systemsHash[e]=r,this.runners)this.runners[t].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);
485t.items.forEach(i=>{let s=r.find(t=>this._systemsHash[t]===i);i[t.name](e[s])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}let iQ=class t{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=t.defaultMaxIdle,this.checkCountMax=t.defaultCheckCountMax,this.mode=t.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==z.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!1;for(let i=0;i<e.length;i++){let s=e[i];s.resource&&this.count-s.touched>this.maxIdle&&(t.destroyTexture(s,!0),e[i]=null,r=!0)}if(r){let t=0;for(let r=0;r<e.length;r++)null!==e[r]&&(e[t++]=e[r]);e.length=t}}unload(t){let e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let e=t.children.length-1;e>=0;e--)this.unload(t.children[e])}destroy(){this.renderer=null}};iQ.defaultMode=z.AUTO,iQ.defaultMaxIdle=3600,iQ.defaultCheckCountMax=600,iQ.extension={type:eM.RendererSystem,name:"textureGC"};let iJ=iQ;eN.add(iJ);class i0{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=U.UNSIGNED_BYTE,this.internalFormat=O.RGBA,this.samplerType=0}}class i1{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new e$,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?{[U.UNSIGNED_BYTE]:{[O.RGBA]:t.RGBA8,[O.RGB]:t.RGB8,[O.RG]:t.RG8,[O.RED]:t.R8,[O.RGBA_INTEGER]:t.RGBA8UI,[O.RGB_INTEGER]:t.RGB8UI,[O.RG_INTEGER]:t.RG8UI,[O.RED_INTEGER]:t.R8UI,[O.ALPHA]:t.ALPHA,[O.LUMINANCE]:t.LUMINANCE,[O.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[U.BYTE]:{[O.RGBA]:t.RGBA8_SNORM,[O.RGB]:t.RGB8_SNORM,[O.RG]:t.RG8_SNORM,[O.RED]:t.R8_SNORM,[O.RGBA_INTEGER]:t.RGBA8I,[O.RGB_INTEGER]:t.RGB8I,[O.RG_INTEGER]:t.RG8I,[O.RED_INTEGER]:t.R8I},[U.UNSIGNED_SHORT]:{[O.RGBA_INTEGER]:t.RGBA16UI,[O.RGB_INTEGER]:t.RGB16UI,[O.RG_INTEGER]:t.RG16UI,[O.RED_INTEGER]:t.R16UI,[O.DEPTH_COMPONENT]:t.DEPTH_COMPONENT16},[U.SHORT]:{[O.RGBA_INTEGER]:t.RGBA16I,[O.RGB_INTEGER]:t.RGB16I,[O.RG_INTEGER]:t.RG16I,[O.RED_INTEGER]:t.R16I},[U.UNSIGNED_INT]:{[O.RGBA_INTEGER]:t.RGBA32UI,[O.RGB_INTEGER]:t.RGB32UI,[O.RG_INTEGER]:t.RG32UI,[O.RED_INTEGER]:t.R32UI,[O.DEPTH_COMPONENT]:t.DEPTH_COMPONENT24},[U.INT]:{[O.RGBA_INTEGER]:t.RGBA32I,[O.RGB_INTEGER]:t.RGB32I,[O.RG_INTEGER]:t.RG32I,[O.RED_INTEGER]:t.R32I},[U.FLOAT]:{[O.RGBA]:t.RGBA32F,[O.RGB]:t.RGB32F,[O.RG]:t.RG32F,[O.RED]:t.R32F,[O.DEPTH_COMPONENT]:t.DEPTH_COMPONENT32F},[U.HALF_FLOAT]:{[O.RGBA]:t.RGBA16F,[O.RGB]:t.RGB16F,[O.RG]:t.RG16F,[O.RED]:t.R16F},[U.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:t.RGB565},[U.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:t.RGBA4},[U.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:t.RGB5_A1},[U.UNSIGNED_INT_2_10_10_10_REV]:{[O.RGBA]:t.RGB10_A2,[O.RGBA_INTEGER]:t.RGB10_A2UI},[U.UNSIGNED_INT_10F_11F_11F_REV]:{[O.RGB]:t.R11F_G11F_B10F},[U.UNSIGNED_INT_5_9_9_9_REV]:{[O.RGB]:t.RGB9_E5},[U.UNSIGNED_INT_24_8]:{[O.DEPTH_STENCIL]:t.DEPTH24_STENCIL8},[U.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[O.DEPTH_STENCIL]:t.DEPTH32F_STENCIL8}}:{[U.UNSIGNED_BYTE]:{[O.RGBA]:t.RGBA,[O.RGB]:t.RGB,[O.ALPHA]:t.ALPHA,[O.LUMINANCE]:t.LUMINANCE,[O.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[U.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:t.RGB},[U.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:t.RGBA},[U.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:t.RGBA}},this.samplerTypes="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?{[t.RGB]:k.FLOAT,[t.RGBA]:k.FLOAT,[t.ALPHA]:k.FLOAT,[t.LUMINANCE]:k.FLOAT,[t.LUMINANCE_ALPHA]:k.FLOAT,[t.R8]:k.FLOAT,[t.R8_SNORM]:k.FLOAT,[t.RG8]:k.FLOAT,[t.RG8_SNORM]:k.FLOAT,[t.RGB8]:k.FLOAT,[t.RGB8_SNORM]:k.FLOAT,[t.RGB565]:k.FLOAT,[t.RGBA4]:k.FLOAT,[t.RGB5_A1]:k.FLOAT,[t.RGBA8]:k.FLOAT,[t.RGBA8_SNORM]:k.FLOAT,[t.RGB10_A2]:k.FLOAT,[t.RGB10_A2UI]:k.FLOAT,[t.SRGB8]:k.FLOAT,[t.SRGB8_ALPHA8]:k.FLOAT,[t.R16F]:k.FLOAT,[t.RG16F]:k.FLOAT,[t.RGB16F]:k.FLOAT,[t.RGBA16F]:k.FLOAT,[t.R32F]:k.FLOAT,[t.RG32F]:k.FLOAT,[t.RGB32F]:k.FLOAT,[t.RGBA32F]:k.FLOAT,[t.R11F_G11F_B10F]:k.FLOAT,[t.RGB9_E5]:k.FLOAT,[t.R8I]:k.INT,[t.R8UI]:k.UINT,[t.R16I]:k.INT,[t.R16UI]:k.UINT,[t.R32I]:k.INT,[t.R32UI]:k.UINT,[t.RG8I]:k.INT,[t.RG8UI]:k.UINT,[t.RG16I]:k.INT,[t.RG16UI]:k.UINT,[t.RG32I]:k.INT,[t.RG32UI]:k.UINT,[t.RGB8I]:k.INT,[t.RGB8UI]:k.UINT,[t.RGB16I]:k.INT,[t.RGB16UI]:k.UINT,[t.RGB32I]:k.INT,[t.RGB32UI]:k.UINT,[t.RGBA8I]:k.INT,[t.RGBA8UI]:k.UINT,[t.RGBA16I]:k.INT,[t.RGBA16UI]:k.UINT,[t.RGBA32I]:k.INT,[t.RGBA32UI]:k.UINT,[t.DEPTH_COMPONENT16]:k.FLOAT,[t.DEPTH_COMPONENT24]:k.FLOAT,[t.DEPTH_COMPONENT32F]:k.FLOAT,[t.DEPTH_STENCIL]:k.FLOAT,[t.DEPTH24_STENCIL8]:k.FLOAT,[t.DEPTH32F_STENCIL8]:k.FLOAT}:{[t.RGB]:k.FLOAT,[t.RGBA]:k.FLOAT,[t.ALPHA]:k.FLOAT,[t.LUMINANCE]:k.FLOAT,[t.LUMINANCE_ALPHA]:k.FLOAT,[t.DEPTH_STENCIL]:k.FLOAT};let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let t=0;t<e;t++)this.boundTextures[t]=null;this.emptyTextures={};let r=new i0(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new i0(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let e=0;e<6;e++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let t=0;t<this.boundTextures.length;t++)this.bind(null,t)}bind(t,e=0){let{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let i=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,i.texture)),i.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):i.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let t=0;t<r.length;t++)r[t]===this.unknownTexture&&this.bind(null,t)}for(let i=0;i<r.length;i++)r[i]===t&&(this.currentLocation!==i&&(e.activeTexture(e.TEXTURE0+i),this.currentLocation=i),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[i]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:i}=this;if(r)for(let r=t-1;r>=0;--r){let t=e[r];t&&t._glTextures[i].samplerType!==k.FLOAT&&this.renderer.texture.unbind(t)}}initTexture(t){let e=new i0(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){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??k.FLOAT,2===this.webGLVersion&&t.type===U.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==k.FLOAT&&(this.hasIntegerTextures=!0);else{let i=t.realWidth,s=t.realHeight,n=r.gl;(e.width!==i||e.height!==s||e.dirtyId<0)&&(e.width=i,e.height=s,n.texImage2D(t.target,0,e.internalFormat,i,s,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:r}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let e=this.managedTextures.indexOf(t);-1!==e&&ec(this.managedTextures,e,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==X.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=H.CLAMP,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==X.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===G.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let e=this.renderer.context.extensions.anisotropicFiltering;if(e&&t.anisotropicLevel>0&&t.scaleMode===G.LINEAR){let i=Math.min(t.anisotropicLevel,r.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY_EXT,i)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===G.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===G.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}}i1.extension={type:eM.RendererSystem,name:"texture"},eN.add(i1);class i2{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,i=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:r,renderer:i}=this;e&&i.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,CONTEXT_UID:i}=this,s=e.createTransformFeedback();t._glTransformFeedbacks[i]=s,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s);for(let s=0;s<t.buffers.length;s++){let n=t.buffers[s];n&&(r.buffer.update(n),n._glBuffers[i].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,s,n._glBuffers[i].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),s}disposeTransformFeedback(t,e){let r=t._glTransformFeedbacks[this.CONTEXT_UID],i=this.gl;
485t.disposeRunner.remove(this);let s=this.renderer.buffer;if(s)for(let r=0;r<t.buffers.length;r++){let i=t.buffers[r];if(!i)continue;let n=i._glBuffers[this.CONTEXT_UID];n&&(n.refCount--,0!==n.refCount||e||s.dispose(i,e))}r&&(e||i.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}i2.extension={type:eM.RendererSystem,name:"transformFeedback"},eN.add(i2);class i3{constructor(t){this.renderer=t}init(t){this.screen=new e9(0,0,t.width,t.height),this.element=t.view||Q.ADAPTER.createCanvas(),this.resolution=t.resolution||Q.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let r=this.element.width/this.resolution,i=this.element.height/this.resolution;this.screen.width=r,this.screen.height=i,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${i}px`),this.renderer.emit("resize",r,i),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}}i3.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},i3.extension={type:[eM.RendererSystem,eM.CanvasRendererSystem],name:"_view"},eN.add(i3),Q.PREFER_ENV=M.WEBGL2,Q.STRICT_TEXTURE_CACHE=!1,Q.RENDER_OPTIONS={...rK.defaultOptions,...rj.defaultOptions,...i3.defaultOptions,...iY.defaultOptions},Object.defineProperties(Q,{WRAP_MODE:{get:()=>e$.defaultOptions.wrapMode,set(t){tb("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),e$.defaultOptions.wrapMode=t}},SCALE_MODE:{get:()=>e$.defaultOptions.scaleMode,set(t){tb("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),e$.defaultOptions.scaleMode=t}},MIPMAP_TEXTURES:{get:()=>e$.defaultOptions.mipmap,set(t){tb("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),e$.defaultOptions.mipmap=t}},ANISOTROPIC_LEVEL:{get:()=>e$.defaultOptions.anisotropicLevel,set(t){tb("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),e$.defaultOptions.anisotropicLevel=t}},FILTER_RESOLUTION:{get:()=>(tb("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),r$.defaultResolution),set(t){r$.defaultResolution=t}},FILTER_MULTISAMPLE:{get:()=>(tb("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),r$.defaultMultisample),set(t){r$.defaultMultisample=t}},SPRITE_MAX_TEXTURES:{get:()=>rX.defaultMaxTextures,set(t){tb("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),rX.defaultMaxTextures=t}},SPRITE_BATCH_SIZE:{get:()=>rX.defaultBatchSize,set(t){tb("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),rX.defaultBatchSize=t}},CAN_UPLOAD_SAME_BUFFER:{get:()=>rX.canUploadSameBuffer,set(t){tb("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),rX.canUploadSameBuffer=t}},GC_MODE:{get:()=>iJ.defaultMode,set(t){tb("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),iJ.defaultMode=t}},GC_MAX_IDLE:{get:()=>iJ.defaultMaxIdle,set(t){tb("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),iJ.defaultMaxIdle=t}},GC_MAX_CHECK_COUNT:{get:()=>iJ.defaultCheckCountMax,set(t){tb("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),iJ.defaultCheckCountMax=t}},PRECISION_VERTEX:{get:()=>rD.defaultVertexPrecision,set(t){tb("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),rD.defaultVertexPrecision=t}},PRECISION_FRAGMENT:{get:()=>rD.defaultFragmentPrecision,set(t){tb("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),rD.defaultFragmentPrecision=t}}});var i4=((C=i4||{})[C.INTERACTION=50]="INTERACTION",C[C.HIGH=25]="HIGH",C[C.NORMAL=0]="NORMAL",C[C.LOW=-25]="LOW",C[C.UTILITY=-50]="UTILITY",C);class i5{constructor(t,e=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=i}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));let 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.
485next,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);let e=this.next;return this.next=t?null:e,this.previous=null,e}}let i6=class t{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 i5(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=i4.NORMAL){return this._addListener(new i5(t,e,r))}addOnce(t,e,r=i4.NORMAL){return this._addListener(new i5(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r=r.match(t,e)?r.destroy():r.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(e=performance.now()){let r;if(e>this.lastTime){if((r=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let t=e-this._lastFrame|0;if(t<this._minElapsedMS)return;this._lastFrame=e-t%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*t.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let r=Math.min(Math.max(0,Math.min(this.maxFPS,e))/1e3,t.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(0===t)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!t._shared){let e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){let e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};i6.targetFPMS=.06;let i8=i6;Object.defineProperties(Q,{TARGET_FPMS:{get:()=>i8.targetFPMS,set(t){tb("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),i8.targetFPMS=t}}});class i7{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,i4.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?i8.shared:new i8,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}}i7.extension=eM.Application,eN.add(i7);let i9=[];function st(t){for(let e of i9)if(e.test(t))return new e(t);throw Error("Unable to auto-detect a suitable renderer.")}eN.handleByList(eM.Renderer,i9);let se=`attribute vec2 aVertexPosition; 486attribute vec2 aTextureCoord; 487 488uniform mat3 projectionMatrix; 489 490varying vec2 vTextureCoord; 491 492void main(void) 493{ 494 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
494)).xy, 0.0, 1.0); 495 vTextureCoord = aTextureCoord; 496}`,sr=`attribute vec2 aVertexPosition; 497 498uniform mat3 projectionMatrix; 499 500varying vec2 vTextureCoord; 501 502uniform vec4 inputSize; 503uniform vec4 outputFrame; 504 505vec4 filterVertexPosition( void ) 506{ 507 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 508 509 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 510} 511 512vec2 filterTextureCoord( void ) 513{ 514 return aVertexPosition * (outputFrame.zw * inputSize.zw); 515} 516 517void main(void) 518{ 519 gl_Position = filterVertexPosition(); 520 vTextureCoord = filterTextureCoord(); 521} 522`;class si{constructor(t){this.renderer=t}contextChange(t){let e;if(1===this.renderer.context.webGLVersion){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=q.HIGH?this.multisample=q.HIGH:e>=q.MEDIUM?this.multisample=q.MEDIUM:e>=q.LOW?this.multisample=q.LOW:this.multisample=q.NONE}destroy(){}}si.extension={type:eM.RendererSystem,name:"_multisample"},eN.add(si);class ss{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class sn{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){let{gl:e,CONTEXT_UID:r}=this,i=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){let s=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,s.buffer)}}bindBufferRange(t,e,r){let{gl:i,CONTEXT_UID:s}=this;r=r||0;let n=t._glBuffers[s]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,n.buffer,256*r,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,i=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==i.updateID){if(i.updateID=t._updateID,e.bindBuffer(t.type,i.buffer),i.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let r=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,r)}}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let r=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),r&&(e||i.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new ss(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}sn.extension={type:eM.RendererSystem,name:"buffer"},eN.add(sn);class sa{constructor(t){this.renderer=t}render(t,e){let r,i,s,n;let a=this.renderer;if(e&&(r=e.renderTexture,i=e.clear,s=e.transform,n=e.skipUpdateTransform),this.renderingToScreen=!r,a.runners.prerender.emit(),a.emit("prerender"),a.projection.transform=s,!a.context.isLost){if(r||(this.lastObjectRendered=t),!n){let e=t.enableTempParent();t.updateTransform(),t.disableTempParent(e)}a.renderTexture.bind(r),a.batch.currentRenderer.start(),(i??a.background.clearBeforeRender)&&a.renderTexture.clear(),t.render(a),a.batch.currentRenderer.flush(),r&&(e.blit&&a.framebuffer.blit(),r.baseTexture.update()),a.runners.postrender.emit(),a.projection.transform=null,a.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}sa.extension={type:eM.RendererSystem,name:"objectRenderer"},eN.add(sa);let so=class t extends iZ{constructor(e){super(),this.type=D.WEBGL,e=Object.assign({},Q.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new rN({projectionMatrix:new rs},!0);let r={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:t.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};
522this.setup(r),"useContextAlpha"in e&&(tb("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&"notMultiplied"!==e.useContextAlpha,e.backgroundAlpha=!1===e.useContextAlpha?1:e.backgroundAlpha),this._plugin.rendererPlugins=t.__plugins,this.options=e,this.startup.run(this.options)}static test(t){return!t?.forceCanvas&&tC()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return tb("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return tb("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return tb("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return tb("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){tb("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return tb("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){tb("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return tb("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};so.extension={type:eM.Renderer,priority:1},so.__plugins={},so.__systems={};let sh=so;eN.handleByMap(eM.RendererPlugin,sh.__plugins),eN.handleByMap(eM.RendererSystem,sh.__systems),eN.add(sh);class sl extends eX{constructor(t,e){let{width:r,height:i}=e||{};super(r,i),this.items=[],this.itemDirtyIds=[];for(let e=0;e<t;e++){let t=new e$;this.items.push(t),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof eX?this.addResourceAt(t[r],r):this.addResourceAt(eG(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(null!==this.baseTexture)throw Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(t=>t.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(t).then(()=>{let{realWidth:t,realHeight:e}=this.items[0];return this.resize(t,e),this.update(),Promise.resolve(this)}),this._load}}class su extends sl{constructor(t,e){let r,i;let{width:s,height:n}=e||{};Array.isArray(t)?(r=t,i=t.length):i=t,super(i,{width:s,height:n}),r&&this.initFromArray(r,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);
522else throw Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=L.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:i,itemDirtyIds:s,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,i,0,e.format,r.type,null);for(let t=0;t<i;t++){let i=n[t];s[t]<i.dirtyId&&(s[t]=i.dirtyId,i.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,t,i.resource.width,i.resource.height,1,e.format,r.type,i.resource.source))}return!0}}class sd extends rJ{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return!!e&&t instanceof e||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}let sc=class t extends sl{constructor(e,r){let{width:i,height:s,autoLoad:n,linkBaseTexture:a}=r||{};if(e&&e.length!==t.SIDES)throw Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let e=0;e<t.SIDES;e++)this.items[e].target=L.TEXTURE_CUBE_MAP_POSITIVE_X+e;this.linkBaseTexture=!1!==a,e&&this.initFromArray(e,r),!1!==n&&this.load()}bind(t){super.bind(t),t.target=L.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(void 0===r&&(r=this.linkBaseTexture),!this.items[e])throw Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0){if(t.resource)this.addResourceAt(t.resource,e);else throw Error("CubeResource does not support copying of renderTexture.")}else t.target=L.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(e,r,i){let s=this.itemDirtyIds;for(let n=0;n<t.SIDES;n++){let t=this.items[n];(s[n]<t.dirtyId||i.dirtyId<r.dirtyId)&&(t.valid&&t.resource?(t.resource.upload(e,t,i),s[n]=t.dirtyId):s[n]<-1&&(e.gl.texImage2D(t.target,0,i.internalFormat,r.realWidth,r.realHeight,0,r.format,i.type,null),s[n]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===t.SIDES}};sc.SIDES=6;let sf=sc;class sp extends rJ{constructor(t,e){let r,i,s;e=e||{},"string"==typeof t?(r=sp.EMPTY,i=t,s=!0):(r=t,i=null,s=!1),super(r),this.url=i,this.crossOrigin=e.crossOrigin??!0,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??s,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise(async(t,e)=>{if(null===this.url){t(this);return}try{let e=await Q.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let r=await e.blob();if(this.destroyed)return;let i=await createImageBitmap(r,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===V.UNPACK?"premultiply":"none"});if(this.destroyed){i.close();return}this.source=i,this.update(),t(this)}catch(t){if(this.destroyed)return;e(t),this.onError.emit(t)}})),this._load}upload(t,e,r){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&"u">typeof ImageBitmap&&("string"==typeof t||t instanceof ImageBitmap)}static get EMPTY(){return sp._EMPTY=sp._EMPTY??Q.ADAPTER.createCanvas(0,0),sp._EMPTY}}let sm=class t extends rJ{constructor(t,e){e=e||{},super(Q.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,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},t.SVG_XML.test(this.svg.trim())){if(!btoa)throw 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(){let t=new Image;rJ.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>
522{if(!this._resolve)return;let e=t.width,r=t.height;if(!e||!r)throw Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=e*this.scale,s=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/r*e,s=this._overrideHeight||this._overrideWidth/e*r),i=Math.round(i),s=Math.round(s);let n=this.source;n.width=i,n.height=s,n._pixiId=`canvas_${em()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,i,s),this._resolve(),this._resolve=null}}static getSize(e){let r=t.SVG_SIZE.exec(e),i={};return r&&(i[r[1]]=Math.round(parseFloat(r[3])),i[r[5]]=Math.round(parseFloat(r[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,r){return"svg"===r||"string"==typeof e&&e.startsWith("data:image/svg+xml")||"string"==typeof e&&t.SVG_XML.test(e)}};sm.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,sm.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let sg=sm;class s_ extends rJ{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}let sx=class t extends rJ{constructor(e,r){if(r=r||{},!(e instanceof HTMLVideoElement)){let i=document.createElement("video");!1!==r.autoLoad&&i.setAttribute("preload","auto"),!1!==r.playsinline&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),!0===r.muted&&(i.setAttribute("muted",""),i.muted=!0),!0===r.loop&&i.setAttribute("loop",""),!1!==r.autoPlay&&i.setAttribute("autoplay",""),"string"==typeof e&&(e=[e]);let s=e[0].src||e[0];rJ.crossOrigin(i,s,r.crossorigin);for(let r=0;r<e.length;++r){let s=document.createElement("source"),{src:n,mime:a}=e[r];if((n=n||e[r]).startsWith("data:"))a=n.slice(5,n.indexOf(";"));else if(!n.startsWith("blob:")){let e=n.split("?").shift().toLowerCase(),r=e.slice(e.lastIndexOf(".")+1);a=a||t.MIME_TYPES[r]||`video/${r}`}s.src=n,a&&(s.type=a),i.appendChild(s)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=r.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==r.autoPlay,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==r.autoLoad&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let t=i8.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(i8.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(i8.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(i8.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,r){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.includes(r)}};sx.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],sx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let sv=sx;ek.push(sp,r0,sd,sv,s_,sg,eV,sf,su);class sy{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new eH("disposeTransformFeedback")}bindBuffer(t,e){this.buffers[t]=e}destroy(){this.disposeRunner.emit(this,!1)}}let sb="7.4.3"},33829:function(t,e,r){"use strict";r.d(e,{YZ:function(){return s},W2:function(){return u},s$:function(){return n},Ql:function(){return a}});var i=r(24882);class s{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?i.Ae.EMPTY:((t=t||new i.Ae(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){let{a:r,b:i,c:s,d:n,tx:a,ty:o}=t,h=r*e.x+s*e.y+a,l=i*e.x+n*e.y+o;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)}addQuad(t){let e=this.minX,r=this.minY,i=this.maxX,s=this.maxY,n=t[0],a=t[1];e=n<e?n:e,r=a<r?a:r,i=n>i?n:i,s=a>s?a:s,n=t[2],a=t[3],e=n<e?n:e,r=a<r?a:r,i=n>i?n:i,s=a>s?a:s,n=t[4],a=t[5],e=n<e?n:e,r=a<r?a:r,i=n>i?n:i,s=a>s?a:s,n=t[6],a=t[7],e=n<e?n:e,r=a<r?a:r,i=n>i?n:i,s=a>s?a:s,this.minX=e,this.minY=r,this.maxX=i,this.maxY=s}addFrame(t,e,r,i,s){this.addFrameMatrix(t.worldTransform,e,r,i,s)}addFrameMatrix(t,e,r,i,s){let n=t.a,a=t.b,o=t.c,h=t.d,l=t.tx,u=t.ty,d=this.minX,c=this.minY,f=this.maxX,p=this.maxY,m=n*e+o*r+l,g=a*e+h*r+u;d=m<d?m:d,c=g<c?g:c,f=m>f?m:f,p=g>p?g:p,m=n*i+o*r+l,g=a*i+h*r+u,d=m<d?m:d,c=g<c?g:c,f=m>f?m:f,p=g>p?g:p,m=n*e+o*s+l,g=a*e+h*s+u,d=m<d?m:d,c=g<c?g:c,f=m>f?m:f,p=g>p?g:p,m=n*i+o*s+l,g=a*i+h*s+u,d=m<d?m:d,c=g<c?g:c,f=m>f?m:f,p=g>p?g:p,this.minX=d,this.minY=c,this.maxX=f,this.maxY=p}
522addVertexData(t,e,r){let i=this.minX,s=this.minY,n=this.maxX,a=this.maxY;for(let o=e;o<r;o+=2){let e=t[o],r=t[o+1];i=e<i?e:i,s=r<s?r:s,n=e>n?e:n,a=r>a?r:a}this.minX=i,this.minY=s,this.maxX=n,this.maxY=a}addVertices(t,e,r,i){this.addVerticesMatrix(t.worldTransform,e,r,i)}addVerticesMatrix(t,e,r,i,s=0,n=s){let a=t.a,o=t.b,h=t.c,l=t.d,u=t.tx,d=t.ty,c=this.minX,f=this.minY,p=this.maxX,m=this.maxY;for(let t=r;t<i;t+=2){let r=e[t],i=e[t+1],g=a*r+h*i+u,_=l*i+o*r+d;c=Math.min(c,g-s),p=Math.max(p,g+s),f=Math.min(f,_-n),m=Math.max(m,_+n)}this.minX=c,this.minY=f,this.maxX=p,this.maxY=m}addBounds(t){let e=this.minX,r=this.minY,i=this.maxX,s=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<r?t.minY:r,this.maxX=t.maxX>i?t.maxX:i,this.maxY=t.maxY>s?t.maxY:s}addBoundsMask(t,e){let r=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,s=t.maxX<e.maxX?t.maxX:e.maxX,n=t.maxY<e.maxY?t.maxY:e.maxY;if(r<=s&&i<=n){let t=this.minX,e=this.minY,a=this.maxX,o=this.maxY;this.minX=r<t?r:t,this.minY=i<e?i:e,this.maxX=s>a?s:a,this.maxY=n>o?n:o}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){let r=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,s=t.maxX<e.x+e.width?t.maxX:e.x+e.width,n=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(r<=s&&i<=n){let t=this.minX,e=this.minY,a=this.maxX,o=this.maxY;this.minX=r<t?r:t,this.minY=i<e?i:e,this.maxX=s>a?s:a,this.maxY=n>o?n:o}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,r,i,s,n){t-=s,e-=n,r+=s,i+=n,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>r?this.maxX:r,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>i?this.maxY:i}}class n extends i.P6.EventEmitter{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new i.wx,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new s,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){let e=Object.keys(t);for(let r=0;r<e.length;++r){let i=e[r];Object.defineProperty(n.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new i.Ae),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new i.Ae),t=this._localBoundsRect),this._localBounds||(this._localBounds=new s);let e=this.transform,r=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=r?.worldAlpha??1,this.transform=this._tempDisplayObjectParent.transform;let n=this._bounds,a=this._boundsID;this._bounds=this._localBounds;let o=this.getBounds(!1,t);return this.parent=r,this.transform=e,this._bounds=n,this._bounds.updateID+=this._boundsID-a,o}toGlobal(t,e,r=!1){return r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,r,i){return e&&(t=e.toGlobal(t,r,i)),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,r)}setParent(t){if(!t||!t.addChild)throw Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){this.parent?.removeChild(this)}setTransform(t=0,e=0,r=1,i=1,s=0,n=0,a=0,o=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=r||1,this.scale.y=i||1,this.rotation=s,this.skew.x=n,this.skew.y=a,this.pivot.x=o,this.pivot.y=h,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit
522("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new a),this.tempDisplayObjectParent}enableTempParent(){let t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*i.jl}set angle(t){this.transform.rotation=t*i.ZX}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){let t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount--,0===t._maskRefCount&&(t.renderable=!0,t.isMask=!1))}if(this._mask=t,this._mask){let t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(0===t._maskRefCount&&(t.renderable=!1,t.isMask=!0),t._maskRefCount++)}}}}class a extends n{constructor(){super(...arguments),this.sortDirty=null}}n.prototype.displayObjectUpdateTransform=n.prototype.updateTransform;let o=new i.y3;function h(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}let l=class t extends n{constructor(){super(),this.children=[],this.sortableChildren=t.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{let e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;let r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t,this.onChildrenChange(r<i?r:i)}getChildIndex(t){let e=this.children.indexOf(t);if(-1===e)throw Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw Error(`The index ${e} supplied is out of bounds ${this.children.length}`);let r=this.getChildIndex(t);i.P6.removeItems(this.children,r,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{let e=t[0],r=this.children.indexOf(e);if(-1===r)return null;e.parent=null,e.transform._parentID=-1,i.P6.removeItems(this.children,r,1),this._boundsID++,this.onChildrenChange(r),e.emit("removed",this),this.emit("childRemoved",e,this,r)}return t[0]}removeChildAt(t){let e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,i.P6.removeItems(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){let r;let i=e-t;if(i>0&&i<=e){r=this.children.splice(t,i);for(let t=0;t<r.length;++t)r[t].parent=null,r[t].transform&&(r[t].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let t=0;t<r.length;
522++t)r[t].emit("removed",this),this.emit("childRemoved",r[t],this,t);return r}if(0===i&&0===this.children.length)return[];throw RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,r=this.children.length;e<r;++e){let r=this.children[e];r._lastSortedIndex=e,t||0===r.zIndex||(t=!0)}t&&this.children.length>1&&this.children.sort(h),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){let e=this.children[t];e.visible&&e.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){let e=this.children[t];if(!(!e.visible||!e.renderable)){if(e.calculateBounds(),e._mask){let t=e._mask.isMaskData?e._mask.maskObject:e._mask;t?(t.calculateBounds(),this._bounds.addBoundsMask(e._bounds,t._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){let r=super.getLocalBounds(t);if(!e)for(let t=0,e=this.children.length;t<e;++t){let e=this.children[t];e.visible&&e.updateTransform()}return r}_calculateBounds(){}_renderWithCulling(e){let r,i;let s=e.renderTexture.sourceFrame;if(!(s.width>0&&s.height>0))return;this.cullArea?(r=this.cullArea,i=this.worldTransform):this._render!==t.prototype._render&&(r=this.getBounds(!0));let n=e.projection.transform;if(n&&(i?(i=o.copyFrom(i)).prepend(n):i=n),r&&s.intersects(r,i))this._render(e);else if(this.cullArea)return;for(let t=0,r=this.children.length;t<r;++t){let r=this.children[t],i=r.cullable;r.cullable=i||!this.cullArea,r.render(e),r.cullable=i}}render(t){if(!(!this.visible||this.worldAlpha<=0||!this.renderable)){if(this._mask||this.filters?.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,r=this.children.length;e<r;++e)this.children[e].render(t)}}}renderAdvanced(t){let e=this.filters,r=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let t=0;t<e.length;t++)e[t].enabled&&this._enabledFilters.push(e[t])}let s=e&&this._enabledFilters?.length||r&&(!r.isMaskData||r.enabled&&(r.autoDetect||r.type!==i.A7.NONE));if(s&&t.batch.flush(),e&&this._enabledFilters?.length&&t.filter.push(this,this._enabledFilters),r&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,r=this.children.length;e<r;++e)this.children[e].render(t)}s&&t.batch.flush(),r&&t.mask.pop(this),e&&this._enabledFilters?.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;let e="boolean"==typeof t?t:t?.children,r=this.removeChildren(0,this.children.length);if(e)for(let e=0;e<r.length;++e)r[e].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){let e=this.getLocalBounds().width;0!==e?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){let e=this.getLocalBounds().height;0!==e?this.scale.y=t/e:this.scale.y=1,this._height=t}};l.defaultSortableChildren=!1;let u=l;u.prototype.containerUpdateTransform=u.prototype.updateTransform,Object.defineProperties(i.Xd,{SORTABLE_CHILDREN:{get:()=>u.defaultSortableChildren,set(t){i.P6.deprecation("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),u.defaultSortableChildren=t}}})},15734:function(t,e,r){"use strict";r.d(e,{N:function(){return a}});var i=r(24882);let s={vec3(t,e,r,i){(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2])&&(r[0]=i[0],r[1]=i[1],r[2]=i[2],t.uniform3f(e,i[0],i[1],i[2]))},int(t,e,r,i){t.uniform1i(e,i)},ivec2(t,e,r,i){t.uniform2i(e,i[0],i[1])},ivec3(t,e,r,i){t.uniform3i(e,i[0],i[1],i[2])},ivec4(t,e,r,i){t.uniform4i(e,i[0],i[1],i[2],i[3])},uint(t,e,r,i){t.uniform1ui(e,i)},uvec2(t,e,r,i){t.uniform2ui(e,i[0],i[1])},uvec3(t,e,r,i){t.uniform3ui(e,i[0],i[1],i[2])},uvec4(t,e,r,i){t.uniform4ui(e,i[0],i[1],i[2],i[3])},bvec2(t,e,r,i){t.uniform2i(e,i[0],i[1])},bvec3(t,e,r,i){t.uniform3i(e,i[0],i[1],i[2])},bvec4(t,e,r,i){t.uniform4i(e,i[0],i[1],i[2],i[3])},mat2(t,e,r,i){t.uniformMatrix2fv(e,!1,i)},mat4(t,e,r,i){t.uniformMatrix4fv(e,!1,i)}},n={float(t,e,r,i){t.uniform1fv(e,i)},vec2(t,e,r,i){t.uniform2fv(e,i)},vec3(t,e,r,i){t.uniform3fv(e,i)},vec4(t,e,r,i){t.uniform4fv(e,i)}
522,int(t,e,r,i){t.uniform1iv(e,i)},ivec2(t,e,r,i){t.uniform2iv(e,i)},ivec3(t,e,r,i){t.uniform3iv(e,i)},ivec4(t,e,r,i){t.uniform4iv(e,i)},uint(t,e,r,i){t.uniform1uiv(e,i)},uvec2(t,e,r,i){t.uniform2uiv(e,i)},uvec3(t,e,r,i){t.uniform3uiv(e,i)},uvec4(t,e,r,i){t.uniform4uiv(e,i)},bool(t,e,r,i){t.uniform1iv(e,i)},bvec2(t,e,r,i){t.uniform2iv(e,i)},bvec3(t,e,r,i){t.uniform3iv(e,i)},bvec4(t,e,r,i){t.uniform4iv(e,i)},sampler2D(t,e,r,i){t.uniform1iv(e,i)},samplerCube(t,e,r,i){t.uniform1iv(e,i)},sampler2DArray(t,e,r,i){t.uniform1iv(e,i)}};function a(t){i.P6.deprecation("7.1.0","install() has been deprecated, @pixi/unsafe-eval is self-installed since 7.1.0")}Object.assign(i.p.prototype,{systemCheck(){},syncUniforms(t,e){let{shader:r,renderer:i}=this;!function(t,e,r,i,a){let o=0,h=null,l=null,u=a.gl;for(let d in t.uniforms){let c=e[d],f=i[d],p=r[d],m=t.uniforms[d];if(!c){!0===m.group&&a.shader.syncUniformGroup(f);continue}"float"!==c.type||1!==c.size||c.isArray?"bool"!==c.type||1!==c.size||c.isArray?"sampler2D"!==c.type&&"samplerCube"!==c.type&&"sampler2DArray"!==c.type||1!==c.size||c.isArray?"mat3"!==c.type||1!==c.size||c.isArray?"vec2"!==c.type||1!==c.size||c.isArray?"vec4"!==c.type||1!==c.size||c.isArray?(1!==c.size||c.isArray?n:s)[c.type].call(null,u,p.location,p.value,f):void 0!==m.width?(l=p.value,h=f,(l[0]!==h.x||l[1]!==h.y||l[2]!==h.width||l[3]!==h.height)&&(l[0]=h.x,l[1]=h.y,l[2]=h.width,l[3]=h.height,u.uniform4f(p.location,h.x,h.y,h.width,h.height))):(l=p.value,h=f,(l[0]!==h[0]||l[1]!==h[1]||l[2]!==h[2]||l[3]!==h[3])&&(l[0]=h[0],l[1]=h[1],l[2]=h[2],l[3]=h[3],u.uniform4f(p.location,h[0],h[1],h[2],h[3]))):void 0!==m.x?(l=p.value,h=f,(l[0]!==h.x||l[1]!==h.y)&&(l[0]=h.x,l[1]=h.y,u.uniform2f(p.location,h.x,h.y))):(l=p.value,h=f,(l[0]!==h[0]||l[1]!==h[1])&&(l[0]=h[0],l[1]=h[1],u.uniform2f(p.location,h[0],h[1]))):void 0!==m.a?u.uniformMatrix3fv(p.location,!1,f.toArray(!0)):u.uniformMatrix3fv(p.location,!1,f):(a.texture.bind(f,o),p.value!==o&&(p.value=o,u.uniform1i(p.location,o)),o++):f!==p.value&&(p.value=f,u.uniform1i(p.location,Number(f))):f!==p.value&&(p.value=f,u.uniform1f(p.location,f))}}(t,r.program.uniformData,e.uniformData,t.uniforms,i)}})},66738:function(t,e,r){"use strict";let i,s,n,a,o,h,l;r.r(e),r.d(e,{ALPHA_MODES:function(){return u.iw},AbstractMultiResource:function(){return u.M4},AccessibilityManager:function(){return K},AlphaFilter:function(){return x},AnimatedSprite:function(){return rR},Application:function(){return Q},ArrayResource:function(){return u.$N},Assets:function(){return tH},AssetsClass:function(){return tG},Attribute:function(){return u.ah},BLEND_MODES:function(){return u.T$},BUFFER_BITS:function(){return u.V0},BUFFER_TYPE:function(){return u.mr},BackgroundSystem:function(){return u.YP},BaseImageResource:function(){return u.bg},BasePrepare:function(){return rb},BaseRenderTexture:function(){return u.jd},BaseTexture:function(){return u.VL},BatchDrawCall:function(){return u.a$},BatchGeometry:function(){return u.JZ},BatchRenderer:function(){return u.Bv},BatchShaderGenerator:function(){return u.Zk},BatchSystem:function(){return u.Sj},BatchTextureArray:function(){return u.Ie},BitmapFont:function(){return rK},BitmapFontData:function(){return rH},BitmapText:function(){return r3},BlobResource:function(){return t5},BlurFilter:function(){return E},BlurFilterPass:function(){return T},Bounds:function(){return d.YZ},BrowserAdapter:function(){return u.ZQ},Buffer:function(){return u.lW},BufferResource:function(){return u.qm},BufferSystem:function(){return u.P},CLEAR_MODES:function(){return u.yl},COLOR_MASK_BITS:function(){return u.V3},Cache:function(){return tn},CanvasResource:function(){return u.Y8},Circle:function(){return u.Cd},Color:function(){return u.Il},ColorMatrixFilter:function(){return w},CompressedTextureResource:function(){return t6},Container:function(){return d.W2},ContextSystem:function(){return u.lH},CountLimiter:function(){return rc},CubeResource:function(){return u.TA},DEG_TO_RAD:function(){return u.ZX},DRAW_MODES:function(){return u.lg},DisplacementFilter:function(){return I},DisplayObject:function(){return d.s$},ENV:function(){return u.Vi},Ellipse:function(){return u.Pj},EventBoundary:function(){return V},EventSystem:function(){return $},ExtensionType:function(){return u.nw},Extract:function(){return ep},FORMATS:function(){return u.I2},FORMATS_TO_COMPONENTS:function(){return en},FXAAFilter:function(){return M},FederatedDisplayObject:function(){return Y},FederatedEvent:function(){return L},FederatedMouseEvent:function(){return U},FederatedPointerEvent:function(){return k},FederatedWheelEvent:function(){return G},FillStyle:function(){return eU},Filter:function(){return u.wn},FilterState:function(){return u.jV},FilterSystem:function(){return u.kV},Framebuffer:function(){return u.AI},FramebufferSystem:function(){return u.WB},GC_MODES:function(){return u.UN},GLFramebuffer:function(){return u.tT},GLProgram:function(){return u.Ei},GLTexture:function(){return u.fy},GRAPHICS_CURVES:function(){return eE},GenerateTextureSystem:function(){return u.zV},Geometry:function(){return u.wG},GeometrySystem:function(){return u.TO},Graphics:function(){return eX},GraphicsData:function(){return eB},GraphicsGeometry:function(){return eL},HTMLText:function(){return r9},HTMLTextStyle:function(){return r8},IGLUniformData:function(){return u.W1},INSTALLED:function(){return u.e_}
522,INTERNAL_FORMATS:function(){return t1},INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:function(){return t2},ImageBitmapResource:function(){return u._w},ImageResource:function(){return u.PA},LINE_CAP:function(){return eb},LINE_JOIN:function(){return ey},LineStyle:function(){return ek},LoaderParserPriority:function(){return th},MASK_TYPES:function(){return u.A7},MIPMAP_MODES:function(){return u.KI},MSAA_QUALITY:function(){return u.G5},MaskData:function(){return u.HI},MaskSystem:function(){return u.zj},Matrix:function(){return u.y3},Mesh:function(){return eY},MeshBatchUvs:function(){return eW},MeshGeometry:function(){return eq},MeshMaterial:function(){return eQ},MultisampleSystem:function(){return u.XR},NineSlicePlane:function(){return e2},NoiseFilter:function(){return B},ObjectRenderer:function(){return u.bO},ObjectRendererSystem:function(){return u.i0},ObservablePoint:function(){return u.AB},PI_2:function(){return u._b},PRECISION:function(){return u.cB},ParticleContainer:function(){return e5},ParticleRenderer:function(){return e9},PlaneGeometry:function(){return eJ},PluginSystem:function(){return u.hN},Point:function(){return u.E9},Polygon:function(){return u.mg},Prepare:function(){return rw},Program:function(){return u.$r},ProjectionSystem:function(){return u.NW},Quad:function(){return u.lD},QuadUv:function(){return u.ud},RAD_TO_DEG:function(){return u.jl},RENDERER_TYPE:function(){return u.N3},Rectangle:function(){return u.Ae},RenderTexture:function(){return u.TI},RenderTexturePool:function(){return u.uW},RenderTextureSystem:function(){return u.J$},Renderer:function(){return u.Th},ResizePlugin:function(){return J},Resource:function(){return u._z},RopeGeometry:function(){return e0},RoundedRectangle:function(){return u.c9},Runner:function(){return u.RC},SAMPLER_TYPES:function(){return u.oT},SCALE_MODES:function(){return u.aH},SHAPES:function(){return u.HS},SVGResource:function(){return u.pX},ScissorSystem:function(){return u.id},Shader:function(){return u.ex},ShaderSystem:function(){return u.p},SimpleMesh:function(){return e3},SimplePlane:function(){return e1},SimpleRope:function(){return e4},Sprite:function(){return p},SpriteMaskFilter:function(){return u.z9},Spritesheet:function(){return rU},StartupSystem:function(){return u.fD},State:function(){return u.ZM},StateSystem:function(){return u.zI},StencilSystem:function(){return u.Ld},SystemManager:function(){return u.Od},TARGETS:function(){return u.sp},TEXT_GRADIENT:function(){return rt},TYPES:function(){return u.vK},TYPES_TO_BYTES_PER_COMPONENT:function(){return es},TYPES_TO_BYTES_PER_PIXEL:function(){return ea},TemporaryDisplayObject:function(){return d.Ql},Text:function(){return rd},TextFormat:function(){return rX},TextMetrics:function(){return ri},TextStyle:function(){return ra},Texture:function(){return u.xE},TextureGCSystem:function(){return u.wr},TextureMatrix:function(){return u.UX},TextureSystem:function(){return u.CT},TextureUvs:function(){return u.aF},Ticker:function(){return u.vB},TickerPlugin:function(){return u.Sb},TilingSprite:function(){return rC},TilingSpriteRenderer:function(){return rO},TimeLimiter:function(){return rS},Transform:function(){return u.wx},TransformFeedback:function(){return u.k7},TransformFeedbackSystem:function(){return u.oR},UPDATE_PRIORITY:function(){return u.uF},UniformGroup:function(){return u.oo},VERSION:function(){return u.q4},VideoResource:function(){return u.eH},ViewSystem:function(){return u.ls},ViewableBuffer:function(){return u.Rv},WRAP_MODES:function(){return u.Nt},XMLFormat:function(){return rV},XMLStringFormat:function(){return rW},accessibleTarget:function(){return q},autoDetectFormat:function(){return r$},autoDetectRenderer:function(){return u.e6},autoDetectResource:function(){return u.pb},cacheTextureArray:function(){return tX},checkDataUrl:function(){return tl},checkExtension:function(){return tr},checkMaxIfStatementsInShader:function(){return u.a7},convertToList:function(){return ti},copySearchParams:function(){return t0},createStringVariations:function(){return tU},createTexture:function(){return tC},createUBOElements:function(){return u.TF},curves:function(){return eT},defaultFilterVertex:function(){return u.Y9},defaultVertex:function(){return u.kP},detectAvif:function(){return tW},detectCompressedTextures:function(){return t4},detectDefaults:function(){return tj},detectMp4:function(){return tZ},detectOgv:function(){return tQ},detectWebm:function(){return tK},detectWebp:function(){return tz},extensions:function(){return u.Rw},filters:function(){return N},generateProgram:function(){return u.qw},generateUniformBufferSync:function(){return u.K0},getFontFamilyName:function(){return tg},getTestContext:function(){return u.Kc},getUBOData:function(){return u.DL},graphicsUtils:function(){return eV},groupD8:function(){return u.Lv},isMobile:function(){return u.tq},isSingleItem:function(){return ta},loadBitmapFont:function(){return r5},loadDDS:function(){return eh},loadImageBitmap:function(){return tD},loadJson:function(){return tu},loadKTX:function(){return el},loadSVG:function(){return tN},loadTextures:function(){return tB},loadTxt:function(){return td},loadVideo:function(){return tL},loadWebFont:function(){return tx},parseDDS:function(){return ee},parseKTX:function(){return eo},resolveCompressedTextureUrl:function(){return ed},resolveTextureUrl:function(){return tJ},settings:function(){return u.Xd},spritesheetAsset:function(){return rG},uniformParsers:function(){return u.sg},unsafeEvalSupported:function(){return u.O2},utils:function(){return u.P6}});
522var u=r(24882),d=r(33829);let c=new u.E9,f=new Uint16Array([0,1,2,0,2,3]);class p extends d.W2{constructor(t){super(),this._anchor=new u.AB(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new u.Il(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=u.T$.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||u.xE.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=f,this.pluginName="batch",this.isSprite=!0,this._roundPixels=u.Xd.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=u.P6.sign(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=u.P6.sign(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){let t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;let e=this.transform.worldTransform,r=e.a,i=e.b,s=e.c,n=e.d,a=e.tx,o=e.ty,h=this.vertexData,l=t.trim,d=t.orig,c=this._anchor,f=0,p=0,m=0,g=0;if(l?(f=(p=l.x-c._x*d.width)+l.width,m=(g=l.y-c._y*d.height)+l.height):(f=(p=-c._x*d.width)+d.width,m=(g=-c._y*d.height)+d.height),h[0]=r*p+s*g+a,h[1]=n*g+i*p+o,h[2]=r*f+s*g+a,h[3]=n*g+i*f+o,h[4]=r*f+s*m+a,h[5]=n*m+i*f+o,h[6]=r*p+s*m+a,h[7]=n*m+i*p+o,this._roundPixels){let t=u.Xd.RESOLUTION;for(let e=0;e<h.length;++e)h[e]=Math.round(h[e]*t)/t}}calculateTrimmedVertices(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;let t=this._texture,e=this.vertexTrimmedData,r=t.orig,i=this._anchor,s=this.transform.worldTransform,n=s.a,a=s.b,o=s.c,h=s.d,l=s.tx,d=s.ty,c=-i._x*r.width,f=c+r.width,p=-i._y*r.height,m=p+r.height;if(e[0]=n*c+o*p+l,e[1]=h*p+a*c+d,e[2]=n*f+o*p+l,e[3]=h*p+a*f+d,e[4]=n*f+o*m+l,e[5]=h*m+a*f+d,e[6]=n*c+o*m+l,e[7]=h*m+a*c+d,this._roundPixels){let t=u.Xd.RESOLUTION;for(let r=0;r<e.length;++r)e[r]=Math.round(e[r]*t)/t}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){let t=this._texture.trim,e=this._texture.orig;t&&(t.width!==e.width||t.height!==e.height)?(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)):(this.calculateVertices(),this._bounds.addQuad(this.vertexData))}getLocalBounds(t){return 0===this.children.length?(this._localBounds||(this._localBounds=new d.YZ),this._localBounds.minX=-(this._texture.orig.width*this._anchor._x),this._localBounds.minY=-(this._texture.orig.height*this._anchor._y),this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new u.Ae),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,c);let e=this._texture.orig.width,r=this._texture.orig.height,i=-e*this.anchor.x,s=0;return c.x>=i&&c.x<i+e&&(s=-r*this.anchor.y,c.y>=s&&c.y<s+r)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof t?t:t?.texture){let e="boolean"==typeof t?t:t?.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){return new p(t instanceof u.xE?t:u.xE.from(t,e))}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){let e=u.P6.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){let e=u.P6.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}
522set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||u.xE.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}let m=new u.y3;d.s$.prototype._cacheAsBitmap=!1,d.s$.prototype._cacheData=null,d.s$.prototype._cacheAsBitmapResolution=null,d.s$.prototype._cacheAsBitmapMultisample=null;class g{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(d.s$.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(t){let e;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new g),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea))}}}),d.s$.prototype._renderCached=function(t){this.visible&&!(this.worldAlpha<=0)&&this.renderable&&(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},d.s$.prototype._initCachedDisplayObject=function(t){if(this._cacheData?.sprite)return;let e=this.alpha;this.alpha=1,t.batch.flush();let r=this.getLocalBounds(new u.Ae,!0);if(this.filters?.length){let t=this.filters[0].padding;r.pad(t)}let i=this.cacheAsBitmapResolution||t.resolution;r.ceil(i),r.width=Math.max(r.width,1/i),r.height=Math.max(r.height,1/i);let s=t.renderTexture.current,n=t.renderTexture.sourceFrame.clone(),a=t.renderTexture.destinationFrame.clone(),o=t.projection.transform,h=u.TI.create({width:r.width,height:r.height,resolution:i,multisample:this.cacheAsBitmapMultisample??t.multisample}),l=`cacheAsBitmap_${u.P6.uid()}`;this._cacheData.textureCacheId=l,u.VL.addToCache(h.baseTexture,l),u.xE.addToCache(h,l);let d=this.transform.localTransform.copyTo(m).invert().translate(-r.x,-r.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:h,clear:!0,transform:d,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=o,t.renderTexture.bind(s,n,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;let c=new p(h);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(r.x/r.width),c.anchor.y=-(r.y/r.height),c.alpha=e,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},d.s$.prototype._renderCachedCanvas=function(t){this.visible&&!(this.worldAlpha<=0)&&this.renderable&&(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},d.s$.prototype._initCachedDisplayObjectCanvas=function(t){if(this._cacheData?.sprite)return;let e=this.getLocalBounds(new u.Ae,!0),r=this.alpha;this.alpha=1;let i=t.canvasContext.activeContext,s=t._projTransform,n=this.cacheAsBitmapResolution||t.resolution;e.ceil(n),e.width=Math.max(e.width,1/n),e.height=Math.max(e.height,1/n);let a=u.TI.create({width:e.width,height:e.height,resolution:n}),o=`cacheAsBitmap_${u.P6.uid()}`;this._cacheData.textureCacheId=o,u.VL.addToCache(a.baseTexture,o),u.xE.addToCache(a,o),this.transform.localTransform.copyTo(m),m.invert(),m.tx-=e.x,m.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:a,clear:!0,transform:m,skipUpdateTransform:!1}),t.canvasContext.activeContext=i,t._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;let h=new p(a);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-(e.x/e.width),h.anchor.y=-(e.y/e.height),h.alpha=r,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)},d.s$.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},d.s$.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},d.s$.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,u.VL.removeFromCache(this._cacheData.textureCacheId),u.xE.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},d.s$.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},d.s$.prototype.name=null,d.W2.prototype.getChildByName=function(t,e){for(let e=0,r=this.children.length;e<r;e++)if(this.children[e].name===t)return this.children[e];if(e)for(let e=0,r=this.children.length;e<r;e++){let r=this.children[e];if(!r.getChildByName)continue;let i=r.getChildByName(t,!0);if(i)return i}return null},d.s$.prototype.getGlobalPosition=function(t=new u.E9,e=!1){return this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};var _=`varying vec2 vTextureCoord; 523 524uniform sampler2D uSampler; 525uniform float uAlpha; 526 527void main(void) 528{ 529 gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha; 530} 531`;class x extends u.wn{constructor(t=1){super(u.kP,_,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}let v={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},y=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(` 532`),b=` 533 attribute vec2 aVertexPosition; 534 535 uniform mat3 projectionMatrix; 536 537 uniform float strength; 538 539 varying vec2 vBlurTexCoords[%size%]; 540 541 uniform vec4 inputSize; 542 uniform vec4 outputFrame; 543 544 vec4 filterVertexPosition( void ) 545 { 546 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 547
548 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 549 } 550 551 vec2 filterTextureCoord( void ) 552 { 553 return aVertexPosition * (outputFrame.zw * inputSize.zw); 554 } 555 556 void main(void) 557 { 558 gl_Position = filterVertexPosition(); 559 560 vec2 textureCoord = filterTextureCoord(); 561 %blur% 562 }`;class T extends u.wn{constructor(t,e=8,r=4,i=u.wn.defaultResolution,s=5){super(function(t,e){let r=Math.ceil(t/2),i=b,s="",n;n=e?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let e=0;e<t;e++){let t=n.replace("%index%",e.toString());s+=(t=t.replace("%sampleIndex%",`${e-(r-1)}.0`))+` 563`}return(i=i.replace("%blur%",s)).replace("%size%",t.toString())}(s,t),function(t){let e;let r=v[t],i=r.length,s=y,n="";for(let s=0;s<t;s++){let a="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",s.toString());e=s,s>=i&&(e=t-s-1),n+=(a=a.replace("%value%",r[e].toString()))+` 564`}return(s=s.replace("%blur%",n)).replace("%size%",t.toString())}(s)),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=r,this.blur=e}apply(t,e,r,i){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{let s=t.getFilterTexture(),n=t.renderer,a=e,o=s;this.state.blend=!1,t.applyFilter(this,a,o,u.yl.CLEAR);for(let e=1;e<this.passes-1;e++){t.bindAndClear(a,u.yl.BLIT),this.uniforms.uSampler=o;let e=o;o=a,a=e,n.shader.bind(this),n.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,o,r,i),t.returnFilterTexture(s)}}get blur(){return this.strength}set blur(t){this.padding=1+2*Math.abs(t),this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class E extends u.wn{constructor(t=8,e=4,r=u.wn.defaultResolution,i=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new T(!0,t,e,r,i),this.blurYFilter=new T(!1,t,e,r,i),this.resolution=r,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,r,i){let s=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(s&&n){let s=t.getFilterTexture();this.blurXFilter.apply(t,e,s,u.yl.CLEAR),this.blurYFilter.apply(t,s,r,i),t.returnFilterTexture(s)}else n?this.blurYFilter.apply(t,e,r,i):this.blurXFilter.apply(t,e,r,i)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}var A=`varying vec2 vTextureCoord; 565uniform sampler2D uSampler; 566uniform float m[20]; 567uniform float uAlpha; 568 569void main(void) 570{ 571 vec4 c = texture2D(uSampler, vTextureCoord); 572 573 if (uAlpha == 0.0) { 574 gl_FragColor = c; 575 return; 576 } 577 578 // Un-premultiply alpha before applying the color matrix. See issue #3539. 579 if (c.a > 0.0) { 580 c.rgb /= c.a; 581 } 582 583 vec4 result; 584 585 result.r = (m[0] * c.r); 586 result.r += (m[1] * c.g); 587 result.r += (m[2] * c.b); 588 result.r += (m[3] * c.a); 589 result.r += m[4]; 590 591 result.g = (m[5] * c.r); 592 result.g += (m[6] * c.g); 593 result.g += (m[7] * c.b); 594 result.g += (m[8] * c.a); 595 result.g += m[9]; 596 597 result.b = (m[10] * c.r); 598 result.b += (m[11] * c.g); 599 result.b += (m[12] * c.b); 600 result.b += (m[13] * c.a); 601 result.b += m[14]; 602 603 result.a = (m[15] * c.r); 604 result.a += (m[16] * c.g); 605 result.a += (m[17] * c.b); 606 result.a += (m[18] * c.a); 607 result.a += m[19]; 608 609 vec3 rgb = mix(c.rgb, result.rgb, uAlpha); 610 611 // Premultiply alpha again. 612 rgb *= result.a; 613 614 gl_FragColor = vec4(rgb, result.a); 615} 616`;class w extends u.wn{constructor(){super(u.Y9,A,{m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1}),this.alpha=1}_loadMatrix(t,e=!1){let r=t;e&&(this._multiply(r,this.uniforms.m,t),r=this._colorMatrix(r)),this.uniforms.m=r}_multiply(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10
616]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[19]+e[19],t}_colorMatrix(t){let e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){this._loadMatrix([t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0],e)}tint(t,e){let[r,i,s]=u.Il.shared.setValue(t).toArray();this._loadMatrix([r,0,0,0,0,0,i,0,0,0,0,0,s,0,0,0,0,0,1,0],e)}greyscale(t,e){this._loadMatrix([t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0],e)}blackAndWhite(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){let r=Math.cos(t=(t||0)/180*Math.PI),i=Math.sin(t),s=1/3,n=(0,Math.sqrt)(1/3);this._loadMatrix([r+(1-r)*s,s*(1-r)-n*i,s*(1-r)+n*i,0,0,s*(1-r)+n*i,r+s*(1-r),s*(1-r)-n*i,0,0,s*(1-r)-n*i,s*(1-r)+n*i,r+s*(1-r),0,0,0,0,0,1,0],e)}contrast(t,e){let r=(t||0)+1,i=-.5*(r-1);this._loadMatrix([r,0,0,0,i,0,r,0,0,i,0,0,r,0,i,0,0,0,1,0],e)}saturate(t=0,e){let r=2*t/3+1,i=-((r-1)*.5);this._loadMatrix([r,i,i,0,0,i,r,i,0,0,i,i,r,0,0,0,0,0,1,0],e)}desaturate(){this.saturate(-1)}negative(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,r,i,s){t=t||.2,e=e||.15,r=r||16770432,i=i||3375104;let n=u.Il.shared,[a,o,h]=n.setValue(r).toArray(),[l,d,c]=n.setValue(i).toArray(),f=[.3,.59,.11,0,0,a,o,h,t,0,l,d,c,e,0,a-l,o-d,h-c,0,0];this._loadMatrix(f,s)}night(t,e){let r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}predator(t,e){this._loadMatrix([11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0],e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}w.prototype.grayscale=w.prototype.greyscale;var S=`varying vec2 vFilterCoord; 617varying vec2 vTextureCoord; 618 619uniform vec2 scale; 620uniform mat2 rotation; 621uniform sampler2D uSampler; 622uniform sampler2D mapSampler; 623 624uniform highp vec4 inputSize; 625uniform vec4 inputClamp; 626 627void main(void) 628{ 629 vec4 map = texture2D(mapSampler, vFilterCoord); 630 631 map -= 0.5; 632 map.xy = scale * inputSize.zw * (rotation * map.xy); 633 634 gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw)); 635} 636`,R=`attribute vec2 aVertexPosition; 637 638uniform mat3 projectionMatrix; 639uniform mat3 filterMatrix; 640 641varying vec2 vTextureCoord; 642varying vec2 vFilterCoord; 643 644uniform vec4 inputSize; 645uniform vec4 outputFrame; 646 647vec4 filterVertexPosition( void ) 648{ 649 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 650
651 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 652} 653 654vec2 filterTextureCoord( void ) 655{ 656 return aVertexPosition * (outputFrame.zw * inputSize.zw); 657} 658 659void main(void) 660{ 661 gl_Position = filterVertexPosition(); 662 vTextureCoord = filterTextureCoord(); 663 vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy; 664} 665`;class I extends u.wn{constructor(t,e){let r=new u.y3;t.renderable=!1,super(R,S,{mapSampler:t._texture,filterMatrix:r,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=r,null==e&&(e=20),this.scale=new u.E9(e,e)}apply(t,e,r,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;let s=this.maskSprite.worldTransform,n=Math.sqrt(s.a*s.a+s.b*s.b),a=Math.sqrt(s.c*s.c+s.d*s.d);0!==n&&0!==a&&(this.uniforms.rotation[0]=s.a/n,this.uniforms.rotation[1]=s.b/n,this.uniforms.rotation[2]=s.c/a,this.uniforms.rotation[3]=s.d/a),t.applyFilter(this,e,r,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var C=`varying vec2 v_rgbNW; 666varying vec2 v_rgbNE; 667varying vec2 v_rgbSW; 668varying vec2 v_rgbSE; 669varying vec2 v_rgbM; 670 671varying vec2 vFragCoord; 672uniform sampler2D uSampler; 673uniform highp vec4 inputSize; 674 675 676/** 677 Basic FXAA implementation based on the code on geeks3d.com with the 678 modification that the texture2DLod stuff was removed since it's 679 unsupported by WebGL. 680 681 -- 682 683 From: 684 https://github.com/mitsuhiko/webgl-meincraft 685 686 Copyright (c) 2011 by Armin Ronacher. 687 688 Some rights reserved. 689 690 Redistribution and use in source and binary forms, with or without 691 modification, are permitted provided that the following conditions are 692 met: 693 694 * Redistributions of source code must retain the above copyright 695 notice, this list of conditions and the following disclaimer. 696 697 * Redistributions in binary form must reproduce the above 698 copyright notice, this list of conditions and the following 699 disclaimer in the documentation and/or other materials provided 700 with the distribution. 701 702 * The names of the contributors may not be used to endorse or 703 promote products derived from this software without specific 704 prior written permission. 705 706 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 707 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 708 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 709 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 710 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 711 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 712 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 713 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 714 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 715 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 716 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 717 */ 718 719#ifndef FXAA_REDUCE_MIN 720#define FXAA_REDUCE_MIN (1.0/ 128.0) 721#endif 722#ifndef FXAA_REDUCE_MUL 723#define FXAA_REDUCE_MUL (1.0 / 8.0) 724#endif 725#ifndef FXAA_SPAN_MAX 726#define FXAA_SPAN_MAX 8.0 727#endif 728 729//optimized version for mobile, where dependent 730//texture reads can be a bottleneck 731vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP, 732 vec2 v_rgbNW, vec2 v_rgbNE, 733 vec2 v_rgbSW, vec2 v_rgbSE, 734 vec2 v_rgbM) { 735 vec4 color; 736 vec3 rgbNW = texture2D(tex, v_rgbNW).xyz; 737 vec3 rgbNE = texture2D(tex, v_rgbNE).xyz; 738 vec3 rgbSW = texture2D(tex, v_rgbSW).xyz; 739 vec3 rgbSE = texture2D(tex, v_rgbSE).xyz; 740 vec4 texColor = texture2D(tex, v_rgbM); 741 vec3 rgbM = texColor.xyz; 742 vec3 luma = vec3(0.299, 0.587, 0.114); 743 float lumaNW = dot(rgbNW, luma); 744 float lumaNE = dot(rgbNE, luma); 745 float lumaSW = dot(rgbSW, luma); 746 float lumaSE = dot(rgbSE, luma); 747 float lumaM = dot(rgbM, luma); 748 float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); 749 float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); 750 751 mediump vec2 dir; 752 dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); 753 dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); 754
755 float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * 756 (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); 757 758 float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); 759 dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), 760 max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), 761 dir * rcpDirMin)) * inverseVP; 762 763 vec3 rgbA = 0.5 * ( 764 texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + 765 texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); 766 vec3 rgbB = rgbA * 0.5 + 0.25 * ( 767 texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + 768 texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz); 769 770 float lumaB = dot(rgbB, luma); 771 if ((lumaB < lumaMin) || (lumaB > lumaMax)) 772 color = vec4(rgbA, texColor.a); 773 else 774 color = vec4(rgbB, texColor.a); 775 return color; 776} 777 778void main() { 779 780 vec4 color; 781 782 color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); 783 784 gl_FragColor = color; 785} 786`,P=` 787attribute vec2 aVertexPosition; 788 789uniform mat3 projectionMatrix; 790 791varying vec2 v_rgbNW; 792varying vec2 v_rgbNE; 793varying vec2 v_rgbSW; 794varying vec2 v_rgbSE; 795varying vec2 v_rgbM; 796 797varying vec2 vFragCoord; 798 799uniform vec4 inputSize; 800uniform vec4 outputFrame; 801 802vec4 filterVertexPosition( void ) 803{ 804 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 805 806 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 807} 808 809void texcoords(vec2 fragCoord, vec2 inverseVP, 810 out vec2 v_rgbNW, out vec2 v_rgbNE, 811 out vec2 v_rgbSW, out vec2 v_rgbSE, 812 out vec2 v_rgbM) { 813 v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; 814 v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; 815 v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; 816 v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; 817 v_rgbM = vec2(fragCoord * inverseVP); 818} 819 820void main(void) { 821 822 gl_Position = filterVertexPosition(); 823 824 vFragCoord = aVertexPosition * outputFrame.zw; 825 826 texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); 827} 828`;class M extends u.wn{constructor(){super(P,C)}}var D=`precision highp float; 829 830varying vec2 vTextureCoord; 831varying vec4 vColor; 832 833uniform float uNoise; 834uniform float uSeed; 835uniform sampler2D uSampler; 836 837float rand(vec2 co) 838{ 839 return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); 840} 841 842void main() 843{ 844 vec4 color = texture2D(uSampler, vTextureCoord); 845 float randomValue = rand(gl_FragCoord.xy * uSeed); 846 float diff = (randomValue - 0.5) * uNoise; 847 848 // Un-premultiply alpha before applying the color matrix. See issue #3539. 849 if (color.a > 0.0) { 850 color.rgb /= color.a; 851 } 852 853 color.r += diff; 854 color.g += diff; 855 color.b += diff; 856 857 // Premultiply alpha again. 858 color.rgb *= color.a; 859 860 gl_FragColor = color; 861} 862`;class B extends u.wn{constructor(t=.5,e=Math.random()){super(u.Y9,D,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}let N={AlphaFilter:x,BlurFilter:E,BlurFilterPass:T,ColorMatrixFilter:w,DisplacementFilter:I,FXAAFilter:M,NoiseFilter:B};
862Object.entries(N).forEach(([t,e])=>{Object.defineProperty(N,t,{get:()=>(u.P6.deprecation("7.1.0",`filters.${t} has moved to ${t}`),e)})});class F{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(u.vB.system.add(this.tickerUpdate,this,u.uF.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(u.vB.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&"touch"===t.pointerType||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())}}let O=new F;class L{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=L.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new u.E9,this.page=new u.E9,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,i,s){throw Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class U extends L{constructor(){super(...arguments),this.client=new u.E9,this.movement=new u.E9,this.offset=new u.E9,this.global=new u.E9,this.screen=new u.E9}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,i,s,n,a,o,h,l,u,d,c,f,p){throw Error("Method not implemented.")}}class k extends U{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw Error("getPredictedEvents is not supported!")}}class G extends U{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}G.DOM_DELTA_PIXEL=0,G.DOM_DELTA_LINE=1,G.DOM_DELTA_PAGE=2;let H=new u.E9,X=new u.E9;class V{constructor(t){this.dispatch=new u.P6.EventEmitter,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((t,e)=>t.priority-e.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.prop
862agate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,i=e.length;r<i;r++)e[r].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){O.pauseUpdate=!0;let r=this[this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive"](this.rootTarget,this.rootTarget.eventMode,H.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,s=r.length-1;i<s;i++)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let i=r.length-2;i>=0;i--)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(0===r.length)return;t.eventPhase=t.BUBBLING_PHASE;let i=Array.isArray(e)?e:[e];for(let e=r.length-1;e>=0;e--)i.forEach(i=>{t.currentTarget=r[e],this.notifyTarget(t,i)})}propagationPath(t){let e=[t];for(let r=0;r<2048&&t!==this.rootTarget;r++){if(!t.parent)throw Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,i,s,n=!1){let a=!1;if(this._interactivePrune(t))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(O.pauseUpdate=!1),t.interactiveChildren&&t.children){let o=t.children;for(let h=o.length-1;h>=0;h--){let l=o[h],u=this.hitTestMoveRecursive(l,this._isInteractive(e)?e:l.eventMode,r,i,s,n||s(t,r));if(u){if(u.length>0&&!u[u.length-1].parent)continue;let e=t.isInteractive();(u.length>0||e)&&(e&&this._allInteractiveElements.push(t),u.push(t)),0===this._hitElements.length&&(this._hitElements=u),a=!0}}}let o=this._isInteractive(e),h=t.isInteractive();return o&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:o&&!s(t,r)&&i(t,r)?h?[t]:[]:null}hitTestRecursive(t,e,r,i,s){if(this._interactivePrune(t)||s(t,r))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(O.pauseUpdate=!1),t.interactiveChildren&&t.children){let n=t.children;for(let a=n.length-1;a>=0;a--){let o=n[a],h=this.hitTestRecursive(o,this._isInteractive(e)?e:o.eventMode,r,i,s);if(h){if(h.length>0&&!h[h.length-1].parent)continue;let e=t.isInteractive();
862return(h.length>0||e)&&h.push(t),h}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&i(t,r)?a?[t]:[]:null}_isInteractive(t){return"static"===t||"dynamic"===t}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||"none"===t.eventMode||"passive"===t.eventMode&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,X),!t.hitArea.contains(X.x,X.y)))return!0;if(t._mask){let r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!r.containsPoint?.(e))return!0}return!1}hitTestFn(t,e){return"passive"!==t.eventMode&&(!!t.hitArea||!!t.containsPoint&&t.containsPoint(e))}notifyTarget(t,e){e=e??t.type;let r=`on${e}`;t.currentTarget[r]?.(t);let i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof k)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){let t=2===e.button;this.dispatchEvent(e,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof k)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r="mouse"===e.pointerType||"pen"===e.pointerType,i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.overTargets);if(i.overTargets?.length>0&&s!==e.target){let i="mousemove"===t.type?"mouseout":"pointerout",n=this.createPointerEvent(t,i,s);if(this.dispatchEvent(n,"pointerout"),r&&this.dispatchEvent(n,"mouseout"),!e.composedPath().includes(s)){let i=this.createPointerEvent(t,"pointerleave",s);for(i.eventPhase=i.AT_TARGET;i.target&&!e.composedPath().includes(i.target);)i.currentTarget=i.target,this.notifyTarget(i),r&&this.notifyTarget(i,"mouseleave"),i.target=i.target.parent;this.freeEvent(i)}this.freeEvent(n)}if(s!==e.target){let i="mousemove"===t.type?"mouseover":"pointerover",n=this.clonePointerEvent(e,i);this.dispatchEvent(n,"pointerover"),r&&this.dispatchEvent(n,"mouseover");let a=s?.parent;for(;a&&a!==this.rootTarget.parent&&a!==e.target;)a=a.parent;if(!a||a===this.rootTarget.parent){let t=this.clonePointerEvent(e,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==s&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(n)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),"touch"===e.pointerType&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof k)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),i="mouse"===r.pointerType||"pen"===r.pointerType;this.dispatchEvent(r,"pointerover"),i&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=r.target?.cursor);let s=this.clonePointerEvent(r,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),i&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(s)}mapPointerOut(t){if(!(t instanceof k)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r="mouse"===t.pointerType||"pen"===t.pointerType,i=this.findMountedTarget(e.overTargets),s=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(s),r&&this.dispatchEvent(s,"mouseout");let n=this.createPointerEvent(t,"pointerleave",i);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(s),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof k)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),"touch"===r.pointerType)this.dispatchEvent(r,"touchend");else if("mouse"===r.pointerType||"pen"===r.pointerType){let t=2===r.button;this.dispatchEvent(r,t?"rightup":"mouseup")}let i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=s;
862if(s&&!r.composedPath().includes(s)){let e=s;for(;e&&!r.composedPath().includes(e);){if(r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType)this.notifyTarget(r,"touchendoutside");else if("mouse"===r.pointerType||"pen"===r.pointerType){let t=2===r.button;this.notifyTarget(r,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete i.pressTargetsByButton[t.button],n=e}if(n){let s=this.clonePointerEvent(r,"click");s.target=n,s.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:s.target,timeStamp:e});let a=i.clicksByButton[t.button];if(a.target===s.target&&e-a.timeStamp<200?++a.clickCount:a.clickCount=1,a.target=s.target,a.timeStamp=e,s.detail=a.clickCount,"mouse"===s.pointerType){let t=2===s.button;this.dispatchEvent(s,t?"rightclick":"click")}else"touch"===s.pointerType&&this.dispatchEvent(s,"tap");this.dispatchEvent(s,"pointertap"),this.freeEvent(s)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof k)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(r){let s=r;for(;s;)i.currentTarget=s,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType?this.notifyTarget(i,"touchendoutside"):("mouse"===i.pointerType||"pen"===i.pointerType)&&this.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),s=s.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof G)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let i=this.allocateEvent(k);return this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=r??this.hitTest(i.global.x,i.global.y)??this._hitElements[0],"string"==typeof e&&(i.type=e),i}createWheelEvent(t){let e=this.allocateEvent(G);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(k);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof k&&e instanceof k&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof U&&e instanceof U&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){let r=t.currentTarget._events[e];if(r&&t.currentTarget.isInteractive()){if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let i=0,s=r.length;i<s&&!t.propagationImmediatelyStopped;i++)r[i].once&&t.currentTarget.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(r[i].context,t)}}}let W={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},z=class t{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new V(null),O.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=ne
862w k(null),this.rootWheelEvent=new G(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...t.defaultEventFeatures},{set:(t,e,r)=>("globalMove"===e&&(this.rootBoundary.enableGlobalMoveEvents=r),t[e]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){let{view:r,resolution:i}=this.renderer;this.setTargetElement(r),this.resolution=i,t._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,r=e.length;t<r;t++){let r=e[t],i=this.bootstrapEvent(this.rootPointerEvent,r);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,O.pointerMoved();let e=this.normalizeToPointerData(t);for(let t=0,r=e.length;t<r;t++){let r=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,e=i.length;t<e;t++){let e=this.bootstrapEvent(this.rootPointerEvent,i[t]);e.type+=r,this.rootBoundary.mapEvent(e)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this.normalizeToPointerData(t);for(let t=0,r=e.length;t<r;t++){let r=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,O.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;O.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;O.removeTickerListener();let t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,r){let i=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;t.x=(e-i.left)*(this.domElement.width/i.width)*s,t.y=(r-i.top)*(this.domElement.height/i.height)*s}normalizeToPointerData(t){let e=[];
862if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,i=t.changedTouches.length;r<i;r++){let i=t.changedTouches[r];typeof i.button>"u"&&(i.button=0),typeof i.buttons>"u"&&(i.buttons=1),typeof i.isPrimary>"u"&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),typeof i.width>"u"&&(i.width=i.radiusX||1),typeof i.height>"u"&&(i.height=i.radiusY||1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="touch"),typeof i.pointerId>"u"&&(i.pointerId=i.identifier||0),typeof i.pressure>"u"&&(i.pressure=i.force||.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),typeof i.layerX>"u"&&(i.layerX=i.offsetX=i.clientX),typeof i.layerY>"u"&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent)))&&(typeof t.isPrimary>"u"&&(t.isPrimary=!0),typeof t.width>"u"&&(t.width=1),typeof t.height>"u"&&(t.height=1),typeof t.tiltX>"u"&&(t.tiltX=0),typeof t.tiltY>"u"&&(t.tiltY=0),typeof t.pointerType>"u"&&(t.pointerType="mouse"),typeof t.pointerId>"u"&&(t.pointerId=1),typeof t.pressure>"u"&&(t.pressure=.5),typeof t.twist>"u"&&(t.twist=0),typeof t.tangentialPressure>"u"&&(t.tangentialPressure=0),t.isNormalized=!0),e.push(t);return e}normalizeWheelEvent(t){let e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=W[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};z.extension={name:"events",type:[u.nw.RendererSystem,u.nw.CanvasRendererSystem]},z.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let $=z;function j(t){return"dynamic"===t||"static"===t}u.Rw.add($);let Y={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??j($.defaultEventMode)},set interactive(value){u.P6.deprecation("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=value,this.eventMode=value?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??$.defaultEventMode},set eventMode(value){this._internalInteractive=j(value),this._internalEventMode=value},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(t,e,r){let i="boolean"==typeof r&&r||"object"==typeof r&&r.capture,s="object"==typeof r?r.signal:void 0,n="object"==typeof r&&!0===r.once,a="function"==typeof e?void 0:e;t=i?`${t}capture`:t;let o="function"==typeof e?e:e.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(t,o,a)}),n?h.once(t,o,a):h.on(t,o,a)},removeEventListener(t,e,r){let i="boolean"==typeof r&&r||"object"==typeof r&&r.capture,s="function"==typeof e?void 0:e;t=i?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,s)},dispatchEvent(t){if(!(t instanceof L))throw Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};d.s$.mixin(Y);let q={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};d.s$.mixin(q);class K{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(u.P6.isMobile.tablet||u.P6.isMobile.phone)&&this.createTouchHook();let e=document.createElement("div");
862e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex="2",this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){let t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex="2",t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode?.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);let e=t.children;if(e)for(let t=0;t<e.length;t++)this.updateAccessibleObjects(e[t])}update(){let t=performance.now();if(u.P6.isMobile.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);let{x:e,y:r,width:i,height:s}=this.renderer.view.getBoundingClientRect(),{width:n,height:a,resolution:o}=this.renderer,h=i/n*o,l=s/a*o,d=this.div;d.style.left=`${e}px`,d.style.top=`${r}px`,d.style.width=`${n}px`,d.style.height=`${a}px`;for(let t=0;t<this.children.length;t++){let e=this.children[t];if(e.renderId!==this.renderId)e._accessibleActive=!1,u.P6.removeItems(this.children,t,1),this.div.removeChild(e._accessibleDiv),this.pool.push(e._accessibleDiv),e._accessibleDiv=null,t--;else{d=e._accessibleDiv;let t=e.hitArea,r=e.worldTransform;e.hitArea?(d.style.left=`${(r.tx+t.x*r.a)*h}px`,d.style.top=`${(r.ty+t.y*r.d)*l}px`,d.style.width=`${t.width*r.a*h}px`,d.style.height=`${t.height*r.d*l}px`):(t=e.getBounds(),this.capHitArea(t),d.style.left=`${t.x*h}px`,d.style.top=`${t.y*l}px`,d.style.width=`${t.width*h}px`,d.style.height=`${t.height*l}px`,d.title!==e.accessibleTitle&&null!==e.accessibleTitle&&(d.title=e.accessibleTitle),d.getAttribute("aria-label")!==e.accessibleHint&&null!==e.accessibleHint&&d.setAttribute("aria-label",e.accessibleHint)),(e.accessibleTitle!==d.title||e.tabIndex!==d.tabIndex)&&(d.title=e.accessibleTitle,d.tabIndex=e.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}addChild(t){let e=this.pool.pop();e||((e=document.createElement("button")).style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex="2",e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){let{displayObject:r}=t.target,i=this.renderer.events.rootBoundary,s=Object.assign(new L(i),{target:r});i.rootTarget=this.renderer.lastObjectRendered,e.forEach(t=>i.dispatchEvent(s,t))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this.activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}K.extension={name:"accessibility",type:[u.nw.RendererPlugin,u.nw.CanvasRendererPlugin]},u.Rw.add(K);let Z=class t{constructor(e){this.stage=new d.W2,e=Object.assign({forceCanvas:!1},e),this.renderer=(0,u.e6)(e),t._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer?.view}get screen(){return this.renderer?.screen}destroy(e,r){let i=t._plugins.slice(0);
862i.reverse(),i.forEach(t=>{t.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Z._plugins=[];let Q=Z;u.Rw.handleByList(u.nw.Application,Q._plugins);class J{static init(t){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{let t,e;if(this._resizeTo){if(this.cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{let{clientWidth:r,clientHeight:i}=this._resizeTo;t=r,e=i}this.renderer.resize(t,e),this.render()}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}J.extension=u.nw.Application,u.Rw.add(J);let tt={loader:u.nw.LoadParser,resolver:u.nw.ResolveParser,cache:u.nw.CacheParser,detection:u.nw.DetectionParser};u.Rw.handle(u.nw.Asset,t=>{let e=t.ref;Object.entries(tt).filter(([t])=>!!e[t]).forEach(([t,r])=>u.Rw.add(Object.assign(e[t],{extension:e[t].extension??r})))},t=>{let e=t.ref;Object.keys(tt).filter(t=>!!e[t]).forEach(t=>u.Rw.remove(e[t]))});class te{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function tr(t,e){let r=t.split("?")[0],i=u.P6.path.extname(r).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}let ti=(t,e,r=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(t=>"string"==typeof t||r?e(t):t):t);class ts{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r;let i=ti(t);for(let t=0;t<this.parsers.length;t++){let s=this.parsers[t];if(s.test(e)){r=s.getCacheableAssets(i,e);break}}r||(r={},i.forEach(t=>{r[t]=e}));let s=Object.keys(r),n={cacheKeys:s,keys:i};i.forEach(t=>{this._cacheMap.set(t,n)}),s.forEach(t=>{let i=r?r[t]:e;this._cache.has(t)&&this._cache.get(t)!==i&&console.warn("[Cache] already has key:",t),this._cache.set(t,r[t])}),e instanceof u.xE&&i.forEach(t=>{e.baseTexture!==u.xE.EMPTY.baseTexture&&u.VL.addToCache(e.baseTexture,t),u.xE.addToCache(e,t)})}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(t=>{this._cache.delete(t)}),e.keys.forEach(t=>{this._cacheMap.delete(t)})}get parsers(){return this._parsers}}let tn=new ts,ta=t=>!Array.isArray(t);class to{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let i=null,s=null;if(e.loadParser&&((s=this._parserHash[e.loadParser])||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!s){for(let r=0;r<this.parsers.length;r++){let i=this.parsers[r];if(i.load&&i.test?.(t,e,this)){s=i;break}}if(!s)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}i=await s.load(t,e,this),r.parser=s;for(let t=0;t<this.parsers.length;t++){let s=this.parsers[t];s.parse&&s.parse&&await s.testParse?.(i,e,this)&&(i=await s.parse(i,e,this)||i,r.parser=s)}return i})(),r}
862async load(t,e){this._parsersValidated||this._validateParsers();let r=0,i={},s=ta(t),n=ti(t,t=>({alias:[t],src:t})),a=n.length,o=n.map(async t=>{let s=u.P6.path.toAbsolute(t.src);if(!i[t.src])try{this.promiseCache[s]||(this.promiseCache[s]=this._getLoadPromiseAndParser(s,t)),i[t.src]=await this.promiseCache[s].promise,e&&e(++r/a)}catch(e){throw delete this.promiseCache[s],delete i[t.src],Error(`[Loader.load] Failed to load ${s}. 863${e}`)}});return await Promise.all(o),s?i[n[0].src]:i}async unload(t){let e=ti(t,t=>({alias:[t],src:t})).map(async t=>{let e=u.P6.path.toAbsolute(t.src),r=this.promiseCache[e];if(r){let i=await r.promise;delete this.promiseCache[e],r.parser?.unload?.(i,t,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var th=((n=th||{})[n.Low=0]="Low",n[n.Normal=1]="Normal",n[n.High=2]="High",n);function tl(t,e){if(Array.isArray(e)){for(let r of e)if(t.startsWith(`data:${r}`))return!0;return!1}return t.startsWith(`data:${e}`)}let tu={extension:{type:u.nw.LoadParser,priority:th.Low},name:"loadJson",test:t=>tl(t,"application/json")||tr(t,".json"),load:async t=>await (await u.Xd.ADAPTER.fetch(t)).json()};u.Rw.add(tu);let td={name:"loadTxt",extension:{type:u.nw.LoadParser,priority:th.Low},test:t=>tl(t,"text/plain")||tr(t,".txt"),load:async t=>await (await u.Xd.ADAPTER.fetch(t)).text()};u.Rw.add(td);let tc=["normal","bold","100","200","300","400","500","600","700","800","900"],tf=[".ttf",".otf",".woff",".woff2"],tp=["font/ttf","font/otf","font/woff","font/woff2"],tm=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function tg(t){let e=u.P6.path.extname(t),r=u.P6.path.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)),i=r.length>0;for(let t of r)if(!t.match(tm)){i=!1;break}let s=r.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}let t_=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/,tx={extension:{type:u.nw.LoadParser,priority:th.Low},name:"loadWebFont",test:t=>tl(t,tp)||tr(t,tf),async load(t,e){let r=u.Xd.ADAPTER.getFontFaceSet();if(r){let i=[],s=e.data?.family??tg(t),n=e.data?.weights?.filter(t=>tc.includes(t))??["normal"],a=e.data??{};for(let e=0;e<n.length;e++){let o=n[e],h=new FontFace(s,`url(${t_.test(t)?t:encodeURI(t)})`,{...a,weight:o});await h.load(),r.add(h),i.push(h)}return 1===i.length?i[0]:i}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(t){(Array.isArray(t)?t:[t]).forEach(t=>u.Xd.ADAPTER.getFontFaceSet().delete(t))}};u.Rw.add(tx);let tv=`(function() { 864 "use strict"; 865 const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII="; 866 async function checkImageBitmap() { 867 try { 868 if (typeof createImageBitmap != "function") 869 return !1; 870 const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob); 871 return imageBitmap.width === 1 && imageBitmap.height === 1; 872 } catch { 873 return !1; 874 } 875 } 876 checkImageBitmap().then((result) => { 877 self.postMessage(result); 878 }); 879})(); 880`,ty=null;class tb{constructor(){ty||(ty=URL.createObjectURL(new Blob([tv],{type:"application/javascript"}))),this.worker=new Worker(ty)}}tb.revokeObjectURL=function(){ty&&(URL.revokeObjectURL(ty),ty=null)};let tT=`(function() { 881 "use strict"; 882 async function loadImageBitmap(url) { 883 const response = await fetch(url); 884 if (!response.ok) 885 throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`); 886 const imageBlob = await response.blob(); 887 return await createImageBitmap(imageBlob); 888 } 889 self.onmessage = async (event) => { 890 try { 891 const imageBitmap = await loadImageBitmap(event.data.data[0]); 892 self.postMessage({ 893 data: imageBitmap, 894 uuid: event.data.uuid, 895 id: event.data.id 896 }, [imageBitmap]); 897 } catch (e) { 898 self.postMessage({ 899 error: e, 900 uuid: event.data.uuid, 901 id: event.data.id 902 }); 903 } 904 }; 905})(); 906`,tE=null;class tA{constructor(){tE||(tE=URL.createObjectURL(new Blob([tT],{type:"application/javascript"}))),this.worker=new Worker(tE)}}tA.revokeObjectURL=function(){tE&&(URL.revokeObjectURL(tE),tE=null)};let tw=0,tS;class tR{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new tb;e.addEventListener("message",r=>{e.terminate(),tb.revokeObjectURL(),t(r.data)})})),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===tS&&(tS=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<tS&&(this._createdWorkers++,(t=new tA().worker).addEventListener("message",t=>{this.complete(t.data),this.returnWorker(t.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((r,i)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:i})});return this.next(),r}next(){if(!this.queue.length)return;let t=this.getWorker();if(!t)return;let e=this.queue.pop(),r=e.id;this.resolveHash[tw]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:tw++,id:r})}}let tI=new tR;function tC(t,e,r){t.resource.internal=!0;let i=new u.xE(t),s=()=>{delete e.promiseCache[r],tn.has(r)&&tn.remove(r)};return i.baseTexture.once("destroyed",()=>{r in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),i.once("destroyed",()=>{t.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}let tP=[".jpeg",".jpg",".png",".webp",".avif"],tM=["image/jpeg","image/png","image/webp","image/avif"];async function tD(t){let e=await u.Xd.ADAPTER.fetch(t);if(!e.ok)throw Error(`[loadImageBitmap] Failed to fetch ${t}: ${e.status} ${e.statusText}`);let r=await e.blob();return await createImageBitmap(r)}let tB={name:"loadTextures",extension:{type:u.nw.LoadParser,priority:th.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:t=>tl(t,tM)||tr(t,tP),async load(t,e,r){let i;let s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;i=s?this.config.preferWorkers&&await tI.isImageBitmapSupported()?await tI.loadImageBitmap(t):await tD(t):await new Promise((e,r)=>{let i=new Image;i.crossOrigin=this.config.crossOrigin,i.src=t,i.complete?e(i):(i.onload=()=>e(i),i.onerror=t=>r(t))});let n={...e.data};n.resolution??(n.resolution=u.P6.getResolutionOfUrl(t)),s&&n.resourceOptions?.ownsImageBitmap===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);let a=new u.VL(i,n);return a.resource.src=t,tC(a,r,t)},unload(t){t.destroy(!0)}};u.Rw.add(tB);let tN={extension:{type:u.nw.LoadParser,priority:th.High},name:"loadSVG",test:t=>tl(t,"image/svg+xml")||tr(t,".svg"),testParse:async t=>u.pX.test(t),async parse(t,e,r){let i=new u.pX(t,e?.data?.resourceOptions);await i.load();let s=new u.VL(i,{resolution:u.P6.getResolutionOfUrl(t),...e?.data});return s.resource.src=e.src,tC(s,r,e.src)},load:async(t,e)=>(await u.Xd.ADAPTER.fetch(t)).text(),unload:tB.unload};u.Rw.add(tN);let tF=[".mp4",".m4v",".webm",".ogv"],tO=["video/mp4","video/webm","video/ogg"],tL={name:"loadVideo",extension:{type:u.nw.LoadParser,priority:th.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test:t=>tl(t,tO)||tr(t,tF),async load(t,e,r){let i;let s=await (await u.Xd.ADAPTER.fetch(t)).blob(),n=URL.createObjectURL(s);try{let s={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...e?.data?.resourceOptions,autoLoad:!0},a=new u.eH(n,s);await a.load();let o=new u.VL(a,{alphaMode:await u.P6.detectVideoAlphaMode(),resolution:u.P6.getResolutionOfUrl(t),...e?.data});o.resource.src=t,(i=tC(o,r,t)).baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(t){throw URL.revokeObjectURL(n),t}return i},unload(t){t.destroy(!0)}};function tU(t){let e=t.match(/\{(.*?)\}/g),r=[];if(e){let i=[];e.forEach(t=>{let e=t.substring(1,t.length-1).split(",");i.push(e)}),function t(e,r,i,s,n){let a=r[i];for(let o=0;o<a.length;o++){let h=a[o];i<r.length-1?t(e.replace(s[i],h),r,i+1,s,n):n.push(e.replace(s[i],h))}}(t,i,0,e,r)}else r.push(t);return r}u.Rw.add(tL);class tk{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){"string"==typeof t?this._defaultSearchParams=t:this._defaultSearchParams=Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}getAlias(t){let{alias:e,name:r,src:i,srcs:s}=t;return ti(e||r||i||s,t=>"string"==typeof t?t:Array.isArray(t)?t.map(t=>t?.src??t?.srcs??t):t?.src||t?.srcs?t.src??t.srcs:t,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEac
906h(t=>{this.addBundle(t.name,t.assets)})}addBundle(t,e){let r=[];Array.isArray(e)?e.forEach(e=>{let i;let s=e.src??e.srcs,n=e.alias??e.name;if("string"==typeof n){let e=this._createBundleAssetId(t,n);r.push(e),i=[n,e]}else{let e=n.map(e=>this._createBundleAssetId(t,e));r.push(...e),i=[...n,...e]}this.add({...e,alias:i,src:s})}):Object.keys(e).forEach(i=>{let s=[i,this._createBundleAssetId(t,i)];if("string"==typeof e[i])this.add({alias:s,src:e[i]});else if(Array.isArray(e[i]))this.add({alias:s,src:e[i]});else{let t=e[i],r=t.src??t.srcs;this.add({...t,alias:s,src:Array.isArray(r)?r:[r]})}r.push(...s)}),this._bundles[t]=r}add(t,e,r,i,s){let n;let a=[];"string"==typeof t||Array.isArray(t)&&"string"==typeof t[0]?(u.P6.deprecation("7.2.0",`Assets.add now uses an object instead of individual parameters. 907Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:r,format:i,loadParser:s})):Array.isArray(t)?a.push(...t):a.push(t),n=t=>{this.hasKey(t)&&console.warn(`[Resolver] already has key: ${t} overwriting`)},ti(a).forEach(t=>{let{src:e,srcs:r}=t,{data:i,format:s,loadParser:a}=t,o=ti(e||r).map(t=>"string"==typeof t?tU(t):Array.isArray(t)?t:[t]),h=this.getAlias(t);Array.isArray(h)?h.forEach(n):n(h);let l=[];o.forEach(t=>{t.forEach(t=>{let e={};if("object"!=typeof t){e.src=t;for(let r=0;r<this._parsers.length;r++){let i=this._parsers[r];if(i.test(t)){e=i.parse(t);break}}}else i=t.data??i,s=t.format??s,a=t.loadParser??a,e={...e,...t};if(!h)throw Error(`[Resolver] alias is undefined for this asset: ${e.src}`);e=this.buildResolvedAsset(e,{aliases:h,data:i,format:s,loadParser:a}),l.push(e)})}),h.forEach(t=>{this._assetMap[t]=l})})}resolveBundle(t){let e=ta(t);t=ti(t);let r={};return t.forEach(t=>{let e=this._bundles[t];if(e){let i=this.resolve(e),s={};for(let e in i){let r=i[e];s[this._extractAssetIdFromBundle(t,e)]=r}r[t]=s}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if("string"!=typeof t){let t={};for(let r in e)t[r]=e[r].src;return t}return e.src}resolve(t){let e=ta(t);t=ti(t);let r={};return t.forEach(t=>{if(!this._resolverHash[t]){if(this._assetMap[t]){let e=this._assetMap[t],r=e[0],i=this._getPreferredOrder(e);i?.priority.forEach(t=>{i.params[t].forEach(r=>{let i=e.filter(e=>!!e[t]&&e[t]===r);i.length&&(e=i)})}),this._resolverHash[t]=e[0]??r}else this._resolverHash[t]=this.buildResolvedAsset({alias:[t],src:t},{})}r[t]=this._resolverHash[t]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let e=t[0],r=this._preferredOrder.find(t=>t.params.format.includes(e.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){let{aliases:r,data:i,loadParser:s,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=u.P6.path.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=s??t.loadParser,t.format=n??t.format??u.P6.path.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class tG{constructor(){this._detections=[],this._initialized=!1,this.resolver=new tk,this.loader=new to,this.cache=tn,this._backgroundLoader=new te(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let e=t.manifest;"string"==typeof e&&(e=await this.load(e)),this.resolver.addManifest(e)}let e=t.texturePreference?.resolution??1,r=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:"number"==typeof e?[e]:e}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,r,i,s){this.resolver.add(t,e,r,i,s)}async load(t,e){this._initialized||await this.init();let r=ta(t),i=ti(t).map(t=>{if("string"!=typeof t){let e=this.resolver.getAlias(t);return e.some(t=>!this.resolver.hasKey(t))&&this.add(t),Array.isArray(e)?e[0]:e}return this.resolver.hasKey(t)||this.add({alias:t,src:t}),t}),s=this.resolver.resolve(i),n=await this._mapLoadToResolve(s,e);return r?n[i[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;"string"==typeof t&&(r=!0,t=[t]);let i=this.resolver.resolveBundle(t),s={},n=Object.keys(i),a=0,o=0,h=()=>{e?.(++a/o)},l=n.map(t=>{let e=i[t];return o+=Object.keys(e).length,this._mapLoadToResolve(e,h).then(e=>{s[t]=e})});return await Promise.all(l),r?s[t[0]]:s}
907async backgroundLoad(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]),Object.values(this.resolver.resolveBundle(t)).forEach(t=>{this._backgroundLoader.add(Object.values(t))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return tn.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=tn.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=Object.values(t),i=Object.keys(t);this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let n={};return r.forEach((t,e)=>{let r=s[t.src],a=[t.src];t.alias&&a.push(...t.alias),n[i[e]]=r,tn.set(a,r)}),n}async unload(t){this._initialized||await this.init();let e=ti(t).map(t=>"string"!=typeof t?t.src:t),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=ti(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(t=>this._unloadFromResolved(e[t]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(t=>{tn.remove(t.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];for(let r of(t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]),t.detections))t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((t,r)=>e.indexOf(t)===r)}get detections(){return this._detections}get preferWorkers(){return tB.config.preferWorkers}set preferWorkers(t){u.P6.deprecation("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(e=>e in t).forEach(r=>{e.config[r]=t[r]})})}}let tH=new tG;u.Rw.handleByList(u.nw.LoadParser,tH.loader.parsers).handleByList(u.nw.ResolveParser,tH.resolver.parsers).handleByList(u.nw.CacheParser,tH.cache.parsers).handleByList(u.nw.DetectionParser,tH.detections);let tX={extension:u.nw.CacheParser,test:t=>Array.isArray(t)&&t.every(t=>t instanceof u.xE),getCacheableAssets:(t,e)=>{let r={};return t.forEach(t=>{e.forEach((e,i)=>{r[t+(0===i?"":i+1)]=e})}),r}};async function tV(t){if("Image"in globalThis)return new Promise(e=>{let r=new Image;r.onload=()=>{e(!0)},r.onerror=()=>{e(!1)},r.src=t});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await (await fetch(t)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}u.Rw.add(tX);let tW={extension:{type:u.nw.DetectionParser,priority:1},test:async()=>tV("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async t=>[...t,"avif"],remove:async t=>t.filter(t=>"avif"!==t)};u.Rw.add(tW);let tz={extension:{type:u.nw.DetectionParser,priority:0},test:async()=>tV("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async t=>[...t,"webp"],remove:async t=>t.filter(t=>"webp"!==t)};u.Rw.add(tz);let t$=["png","jpg","jpeg"],tj={extension:{type:u.nw.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...t$],remove:async t=>t.filter(t=>!t$.includes(t))};u.Rw.add(tj);let tY="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function tq(t){return!tY&&""!==document.createElement("video").canPlayType(t)}let tK={extension:{type:u.nw.DetectionParser,priority:0},test:async()=>tq("video/webm"),add:async t=>[...t,"webm"],remove:async t=>t.filter(t=>"webm"!==t)};u.Rw.add(tK);let tZ={extension:{type:u.nw.DetectionParser,priority:0},test:async()=>tq("video/mp4"),add:async t=>[...t,"mp4","m4v"],remove:async t=>t.filter(t=>"mp4"!==t&&"m4v"!==t)};u.Rw.add(tZ);let tQ={extension:{type:u.nw.DetectionParser,priority:0},test:async()=>tq("video/ogg"),add:async t=>[...t,"ogv"],remove:async t=>t.filter(t=>"ogv"!==t)};u.Rw.add(tQ);let tJ={extension:u.nw.ResolveParser,test:tB.test,parse:t=>({resolution:parseFloat(u.Xd.RETINA_PREFIX.exec(t)?.[1]??"1"),format:u.P6.path.extname(t).slice(1),src:t})};u.Rw.add(tJ);let t0=(t,e)=>{let r=e.split("?")[1];return r&&(t+=`?${r}`),t};var t1=((a=t1||{})[a.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",a[a.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",a[a.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",a[a.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",a[a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",a[a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",a[a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",a[a.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",a[a.COMPRESSED_R11_
907EAC=37488]="COMPRESSED_R11_EAC",a[a.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",a[a.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",a[a.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",a[a.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",a[a.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",a[a.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",a[a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",a[a.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",a[a.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",a[a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",a[a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",a[a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",a[a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",a[a.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",a[a.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",a[a.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",a[a.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",a[a.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",a[a.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",a[a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",a[a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",a[a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",a);let t2={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};function t3(){s={bptc:i.getExtension("EXT_texture_compression_bptc"),astc:i.getExtension("WEBGL_compressed_texture_astc"),etc:i.getExtension("WEBGL_compressed_texture_etc"),s3tc:i.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:i.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:i.getExtension("WEBGL_compressed_texture_etc1"),atc:i.getExtension("WEBGL_compressed_texture_atc")}}let t4={extension:{type:u.nw.DetectionParser,priority:2},test:async()=>{let t=u.Xd.ADAPTER.createCanvas().getContext("webgl");return t?(i=t,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async t=>{s||t3();let e=[];for(let t in s)s[t]&&e.push(t);return[...e,...t]},remove:async t=>(s||t3(),t.filter(t=>!(t in s)))};u.Rw.add(t4);class t5 extends u.qm{constructor(t,e={width:1,height:1,autoLoad:!0}){let r,i;"string"==typeof t?(r=t,i=new Uint8Array):(r=null,i=t),super(i,e),this.origin=r,this.buffer=i?new u.Rv(i):null,this._load=null,this.loaded=!1,null!==this.origin&&!1!==e.autoLoad&&this.load(),null===this.origin&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load||(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new u.Rv(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this))),this._load}}class t6 extends t5{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=t6._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||t6._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,r){let i=t.gl;if(!t.context.extensions[this._extension])throw Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;i.pixelStorei(i.UNPACK_ALIGNMENT,4);for(let t=0,e=this.levels;t<e;t++){let{levelID:e,levelWidth:r,levelHeight:s,levelBuffer:n}=this._levelBuffers[t];i.compressedTexImage2D(i.TEXTURE_2D,e,this.format,r,s,0,n)}return!0}onBlobLoaded(){this._levelBuffers=t6._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(36196===t)return"etc1";
907if(35986===t||35987===t||34798===t)return"atc";if(t>=36492&&t<=36495)return"bptc";if(37808===t)return"astc";throw Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,r,i,s,n,a){let o=Array(r),h=t.byteOffset,l=n,u=a,d=l+i-1&~(i-1),c=u+s-1&~(s-1),f=d*c*t2[e];for(let n=0;n<r;n++)o[n]={levelID:n,levelWidth:r>1?l:d,levelHeight:r>1?u:c,levelBuffer:new Uint8Array(t.buffer,h,f)},h+=f,u=u>>1||1,f=(d=(l=l>>1||1)+i-1&~(i-1))*(c=u+s-1&~(s-1))*t2[e];return o}}let t8={FOURCC:2},t7={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},t9={827611204:t1.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:t1.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:t1.COMPRESSED_RGBA_S3TC_DXT5_EXT},et={70:t1.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:t1.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:t1.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:t1.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:t1.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:t1.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:t1.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:t1.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:t1.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:t1.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:t1.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:t1.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:t1.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function ee(t){let e=new Uint32Array(t);if(542327876!==e[0])throw Error("Invalid DDS file magic word");let r=new Uint32Array(t,0,124/Uint32Array.BYTES_PER_ELEMENT),i=r[3],s=r[4],n=r[7],a=new Uint32Array(t,19*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),o=a[1];if(4&o){let r=a[t8.FOURCC];if(808540228!==r){let e=t9[r];return[new t6(new Uint8Array(t,128),{format:e,width:s,height:i,levels:n})]}let o=new Uint32Array(e.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),h=o[t7.DXGI_FORMAT],l=o[t7.RESOURCE_DIMENSION],u=o[t7.MISC_FLAG],d=o[t7.ARRAY_SIZE],c=et[h];if(void 0===c)throw Error(`DDSParser cannot parse texture data with DXGI format ${h}`);if(4===u)throw Error("DDSParser does not support cubemap textures");if(6===l)throw Error("DDSParser does not supported 3D texture data");let f=[];if(1===d)f.push(new Uint8Array(t,148));else{let e=t2[c],r=0,a=s,o=i;for(let t=0;t<n;t++)r+=Math.max(1,a+3&-4)*Math.max(1,o+3&-4)*e,a>>>=1,o>>>=1;let h=148;for(let e=0;e<d;e++)f.push(new Uint8Array(t,h,r)),h+=r}return f.map(t=>new t6(t,{format:c,width:s,height:i,levels:n}))}throw 64&o?Error("DDSParser does not support uncompressed texture data."):512&o?Error("DDSParser does not supported YUV uncompressed texture data."):131072&o?Error("DDSParser does not support single-channel (lumninance) texture data!"):2&o?Error("DDSParser does not support single-channel (alpha) texture data!"):Error("DDSParser failed to load a texture file due to an unknown reason!")}let er=[171,75,84,88,32,49,49,187,13,10,26,10],ei={ENDIANNESS:12,GL_TYPE:16,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},es={[u.vK.UNSIGNED_BYTE]:1,[u.vK.UNSIGNED_SHORT]:2,[u.vK.INT]:4,[u.vK.UNSIGNED_INT]:4,[u.vK.FLOAT]:4,[u.vK.HALF_FLOAT]:8},en={[u.I2.RGBA]:4,[u.I2.RGB]:3,[u.I2.RG]:2,[u.I2.RED]:1,[u.I2.LUMINANCE]:1,[u.I2.LUMINANCE_ALPHA]:2,[u.I2.ALPHA]:1},ea={[u.vK.UNSIGNED_SHORT_4_4_4_4]:2,[u.vK.UNSIGNED_SHORT_5_5_5_1]:2,[u.vK.UNSIGNED_SHORT_5_6_5]:2};function eo(t,e,r=!1){let i;let s=new DataView(e);if(!function(t,e){for(let r=0;r<er.length;r++)if(e.getUint8(r)!==er[r])return console.error(`${t} is not a valid *.ktx file!`),!1;return!0}(t,s))return null;let n=67305985===s.getUint32(ei.ENDIANNESS,!0),a=s.getUint32(ei.GL_TYPE,n),o=s.getUint32(ei.GL_FORMAT,n),h=s.getUint32(ei.GL_INTERNAL_FORMAT,n),l=s.getUint32(ei.PIXEL_WIDTH,n),d=s.getUint32(ei.PIXEL_HEIGHT,n)||1,c=s.getUint32(ei.PIXEL_DEPTH,n)||1,f=s.getUint32(ei.NUMBER_OF_ARRAY_ELEMENTS,n)||1,p=s.getUint32(ei.NUMBER_OF_FACES,n),m=s.getUint32(ei.NUMBER_OF_MIPMAP_LEVELS,n),g=s.getUint32(ei.BYTES_OF_KEY_VALUE_DATA,n);if(0===d||1!==c)throw Error("Only 2D textures are supported");if(1!==p)throw Error("CubeTextures are not supported by KTXLoader yet!");if(1!==f)throw Error("WebGL does not support array textures");let _=l+3&-4,x=d+3&-4,v=Array(f),y=l*d;if(0===a&&(y=_*x),void 0===(i=0!==a?es[a]?es[a]*en[o]:ea[a]:t2[h]))throw Error("Unable to resolve the pixel format stored in the *.ktx file!");let b=r?function(t,e,r){let i=new Map,s=0;for(;s<e;){let n=t.getUint32(64+s,r),a=64+s+4,o=3-(n+3)%4;if(0===n||n>e-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&0!==t.getUint8(a+h);h++);if(-1===h){console.error("KTXLoader: Failed to find null byte terminating
907kvData key");break}let l=new TextDecoder().decode(new Uint8Array(t.buffer,a,h)),u=new DataView(t.buffer,a+h+1,n-h-1);i.set(l,u),s+=4+n+o}return i}(s,g,n):null,T=y*i,E=l,A=d,w=_,S=x,R=64+g;for(let t=0;t<m;t++){let r=s.getUint32(R,n),o=R+4;for(let r=0;r<f;r++){let i=v[r];i||(i=v[r]=Array(m)),i[t]={levelID:t,levelWidth:m>1||0!==a?E:w,levelHeight:m>1||0!==a?A:S,levelBuffer:new Uint8Array(e,o,T)},o+=T}R+=r+4,R=R%4!=0?R+4-R%4:R,A=A>>1||1,T=(w=(E=E>>1||1)+4-1&-4)*(S=A+4-1&-4)*i}return 0!==a?{uncompressed:v.map(t=>{let e=t[0].levelBuffer,r=!1;return a===u.vK.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):a===u.vK.UNSIGNED_INT?(r=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):a===u.vK.INT&&(r=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new u.qm(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:a,format:r?function(t){switch(t){case u.I2.RGBA:return u.I2.RGBA_INTEGER;case u.I2.RGB:return u.I2.RGB_INTEGER;case u.I2.RG:return u.I2.RG_INTEGER;case u.I2.RED:return u.I2.RED_INTEGER;default:return t}}(o):o}}),kvData:b}:{compressed:v.map(t=>new t6(null,{format:h,width:l,height:d,levels:m,levelBuffers:t})),kvData:b}}let eh={extension:{type:u.nw.LoadParser,priority:th.High},name:"loadDDS",test:t=>tr(t,".dds"),async load(t,e,r){let i=ee(await (await u.Xd.ADAPTER.fetch(t)).arrayBuffer()).map(i=>tC(new u.VL(i,{mipmap:u.KI.OFF,alphaMode:u.iw.NO_PREMULTIPLIED_ALPHA,resolution:u.P6.getResolutionOfUrl(t),...e.data}),r,t));return 1===i.length?i[0]:i},unload(t){Array.isArray(t)?t.forEach(t=>t.destroy(!0)):t.destroy(!0)}};u.Rw.add(eh);let el={extension:{type:u.nw.LoadParser,priority:th.High},name:"loadKTX",test:t=>tr(t,".ktx"),async load(t,e,r){let i=await (await u.Xd.ADAPTER.fetch(t)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:a}=eo(t,i),o=s??n,h={mipmap:u.KI.OFF,alphaMode:u.iw.NO_PREMULTIPLIED_ALPHA,resolution:u.P6.getResolutionOfUrl(t),...e.data},l=o.map(e=>{o===n&&Object.assign(h,{type:e.type,format:e.format});let i=e.resource??e,s=new u.VL(i,h);return s.ktxKeyValueData=a,tC(s,r,t)});return 1===l.length?l[0]:l},unload(t){Array.isArray(t)?t.forEach(t=>t.destroy(!0)):t.destroy(!0)}};u.Rw.add(el);let eu=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],ed={extension:u.nw.ResolveParser,test:t=>["basis","ktx","dds"].includes(u.P6.path.extname(t).slice(1)),parse:t=>{let e=t.split("."),r=e.pop();if(["ktx","dds"].includes(r)){let r=e.pop();if(eu.includes(r))return{resolution:parseFloat(u.Xd.RETINA_PREFIX.exec(t)?.[1]??"1"),format:r,src:t}}return{resolution:parseFloat(u.Xd.RETINA_PREFIX.exec(t)?.[1]??"1"),format:r,src:t}}};u.Rw.add(ed);let ec=new u.Ae,ef=class t{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,r,i){let s=new Image;return s.src=await this.base64(t,e,r,i),s}async base64(t,e,r,i){let s=this.canvas(t,i);if(void 0!==s.toBlob)return new Promise((t,i)=>{s.toBlob(e=>{if(!e){i(Error("ICanvas.toBlob failed!"));return}let r=new FileReader;r.onload=()=>
907t(r.result),r.onerror=i,r.readAsDataURL(e)},e,r)});if(void 0!==s.toDataURL)return s.toDataURL(e,r);if(void 0!==s.convertToBlob){let t=await s.convertToBlob({type:e,quality:r});return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=r,i.readAsDataURL(t)})}throw Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,r){let{pixels:i,width:s,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,r);a&&t._flipY(i,s,n),o&&t._unpremultiplyAlpha(i);let h=new u.P6.CanvasRenderTarget(s,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return h.context.putImageData(l,0,0),h.canvas}pixels(e,r){let{pixels:i,width:s,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,r);return a&&t._flipY(i,s,n),o&&t._unpremultiplyAlpha(i),i}_rawPixels(t,e){let r=this.renderer;if(!r)throw Error("The Extract has already been destroyed");let i,s=!1,n=!1,a,o=!1;t&&(t instanceof u.TI?a=t:(a=r.generateTexture(t,{region:e,resolution:r.resolution,multisample:r.multisample}),o=!0,e&&(ec.width=e.width,ec.height=e.height,e=ec)));let h=r.gl;if(a){if(i=a.baseTexture.resolution,e=e??a.frame,s=!1,n=a.baseTexture.alphaMode>0&&a.baseTexture.format===u.I2.RGBA,!o){r.renderTexture.bind(a);let t=a.framebuffer.glFramebuffers[r.CONTEXT_UID];t.blitFramebuffer&&r.framebuffer.bind(t.blitFramebuffer)}}else i=r.resolution,e||((e=ec).width=r.width/i,e.height=r.height/i),s=!0,n=this._rendererPremultipliedAlpha,r.renderTexture.bind();let l=Math.max(Math.round(e.width*i),1),d=Math.max(Math.round(e.height*i),1),c=new Uint8Array(4*l*d);return h.readPixels(Math.round(e.x*i),Math.round(e.y*i),l,d,h.RGBA,h.UNSIGNED_BYTE,c),o&&a?.destroy(!0),{pixels:c,width:l,height:d,flipY:s,premultipliedAlpha:n}}destroy(){this.renderer=null}static _flipY(t,e,r){let i=e<<2,s=r>>1,n=new Uint8Array(i);for(let e=0;e<s;e++){let s=e*i,a=(r-e-1)*i;n.set(t.subarray(s,s+i)),t.copyWithin(s,a,a+i),t.set(n,a)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));let e=t.length;for(let r=0;r<e;r+=4){let e=t[r+3];if(0!==e){let i=255.001/e;t[r]=t[r]*i+.5,t[r+1]=t[r+1]*i+.5,t[r+2]=t[r+2]*i+.5}}}};ef.extension={name:"extract",type:u.nw.RendererSystem};let ep=ef;u.Rw.add(ep);let em={build(t){let e,r,i,s,n,a;let o=t.points;if(t.type===u.HS.CIRC){let o=t.shape;e=o.x,r=o.y,n=a=o.radius,i=s=0}else if(t.type===u.HS.ELIP){let o=t.shape;e=o.x,r=o.y,n=o.width,a=o.height,i=s=0}else{let o=t.shape,h=o.width/2,l=o.height/2;e=o.x+h,r=o.y+l,n=a=Math.max(0,Math.min(o.radius,Math.min(h,l))),i=h-n,s=l-a}if(!(n>=0&&a>=0&&i>=0&&s>=0)){o.length=0;return}let h=Math.ceil(2.3*Math.sqrt(n+a)),l=8*h+(i?4:0)+(s?4:0);if(o.length=l,0===l)return;if(0===h){o.length=8,o[0]=o[6]=e+i,o[1]=o[3]=r+s,o[2]=o[4]=e-i,o[5]=o[7]=r-s;return}
907let d=0,c=4*h+(i?2:0)+2,f=c,p=l;{let t=i+n,a=s,h=e+t,l=e-t,u=r+a;if(o[d++]=h,o[d++]=u,o[--c]=u,o[--c]=l,s){let t=r-a;o[f++]=l,o[f++]=t,o[--p]=t,o[--p]=h}}for(let t=1;t<h;t++){let l=Math.PI/2*(t/h),u=i+Math.cos(l)*n,m=s+Math.sin(l)*a,g=e+u,_=e-u,x=r+m,v=r-m;o[d++]=g,o[d++]=x,o[--c]=x,o[--c]=_,o[f++]=_,o[f++]=v,o[--p]=v,o[--p]=g}{let t=i,n=s+a,h=e+t,l=e-t,u=r+n,c=r-n;o[d++]=h,o[d++]=u,o[--p]=c,o[--p]=h,i&&(o[d++]=l,o[d++]=u,o[--p]=c,o[--p]=l)}},triangulate(t,e){let r,i;let s=t.points,n=e.points,a=e.indices;if(0===s.length)return;let o=n.length/2,h=o;if(t.type!==u.HS.RREC){let e=t.shape;r=e.x,i=e.y}else{let e=t.shape;r=e.x+e.width/2,i=e.y+e.height/2}let l=t.matrix;n.push(t.matrix?l.a*r+l.c*i+l.tx:r,t.matrix?l.b*r+l.d*i+l.ty:i),o++,n.push(s[0],s[1]);for(let t=2;t<s.length;t+=2)n.push(s[t],s[t+1]),a.push(o++,h,o);a.push(h+1,h,o)}};function eg(t,e=!1){let r=t.length;if(r<6)return;let i=0;for(let e=0,s=t[r-2],n=t[r-1];e<r;e+=2){let r=t[e],a=t[e+1];i+=(r-s)*(a+n),s=r,n=a}if(!e&&i>0||e&&i<=0){let e=r/2;for(let i=e+e%2;i<r;i+=2){let e=r-i-2,s=r-i-1,n=i,a=i+1;[t[e],t[n]]=[t[n],t[e]],[t[s],t[a]]=[t[a],t[s]]}}}let e_={build(t){t.points=t.shape.points.slice()},triangulate(t,e){let r=t.points,i=t.holes,s=e.points,n=e.indices;if(r.length>=6){eg(r,!1);let t=[];for(let e=0;e<i.length;e++){let s=i[e];eg(s.points,!0),t.push(r.length/2),r=r.concat(s.points)}let e=u.P6.earcut(r,t,2);if(!e)return;let a=s.length/2;for(let t=0;t<e.length;t+=3)n.push(e[t]+a),n.push(e[t+1]+a),n.push(e[t+2]+a);for(let t=0;t<r.length;t++)s.push(r[t])}}},ex={build(t){let e=t.shape,r=e.x,i=e.y,s=e.width,n=e.height,a=t.points;a.length=0,s>=0&&n>=0&&a.push(r,i,r+s,i,r+s,i+n,r,i+n)},triangulate(t,e){let r=t.points,i=e.points;if(0===r.length)return;let s=i.length/2;i.push(r[0],r[1],r[2],r[3],r[6],r[7],r[4],r[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},ev={build(t){em.build(t)},triangulate(t,e){em.triangulate(t,e)}};var ey=((o=ey||{}).MITER="miter",o.BEVEL="bevel",o.ROUND="round",o),eb=((h=eb||{}).BUTT="butt",h.ROUND="round",h.SQUARE="square",h);let eT={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let r=Math.ceil(t/this.maxLength);return r<this.minSegments?r=this.minSegments:r>this.maxSegments&&(r=this.maxSegments),r}},eE=eT;class eA{static curveTo(t,e,r,i,s,n){let a=n[n.length-2],o=n[n.length-1]-e,h=a-t,l=i-e,u=r-t,d=Math.abs(o*u-h*l);if(d<1e-8||0===s)return(n[n.length-2]!==t||n[n.length-1]!==e)&&n.push(t,e),null;let c=o*o+h*h,f=l*l+u*u,p=o*l+h*u,m=s*Math.sqrt(c)/d,g=s*Math.sqrt(f)/d,_=m*p/c,x=g*p/f,v=m*u+g*h,y=m*l+g*o;return{cx:v+t,cy:y+e,radius:s,startAngle:Math.atan2(o*(g+_)-y,h*(g+_)-v),endAngle:Math.atan2(l*(m+x)-y,u*(m+x)-v),anticlockwise:h*l>u*o}}static arc(t,e,r,i,s,n,a,o,h){let l=a-n,d=eT._segmentsCount(Math.abs(l)*s,40*Math.ceil(Math.abs(l)/u._b)),c=l/(2*d),f=2*c,p=Math.cos(c),m=Math.sin(c),g=d-1,_=g%1/g;for(let t=0;t<=g;++t){let e=c+n+f*(t+_*t),a=Math.cos(e),o=-Math.sin(e);h.push((p*a+m*o)*s+r,(-(p*o)+m*a)*s+i)}}}class ew{static curveLength(t,e,r,i,s,n,a,o){let h=0,l=0,u=0,d=0,c=0,f=0,p=0,m=0,g=0,_=0,x=0,v=t,y=e;for(let b=1;b<=10;++b)d=(u=(l=b/10)*l)*l,m=(p=(f=(c=1-l)*c)*c)*t+3*f*l*r+3*c*u*s+d*a,g=p*e+3*f*l*i+3*c*u*n+d*o,_=v-m,x=y-g,v=m,y=g,h+=Math.sqrt(_*_+x*x);return h}static curveTo(t,e,r,i,s,n,a){let o=a[a.length-2],h=a[a.length-1];a.length-=2;let l=eT._segmentsCount(ew.curveLength(o,h,t,e,r,i,s,n)),u=0,d=0,c=0,f=0,p=0;a.push(o,h);for(let m=1,g=0;m<=l;++m)c=(d=(u=1-(g=m/l))*u)*u,p=(f=g*g)*g,a.push(c*o+3*d*g*t+3*u*f*r+p*s,c*h+3*d*g*e+3*u*f*i+p*n)}}function eS(t,e,r,i,s,n,a,o){let h,l;a?(h=i,l=-r):(h=-i,l=r);
907let u=t-r*s+h,d=e-i*s+l,c=t+r*n+h,f=e+i*n+l;return o.push(u,d,c,f),2}function eR(t,e,r,i,s,n,a,o){let h=r-t,l=i-e,u=Math.atan2(h,l),d=Math.atan2(s-t,n-e);o&&u<d?u+=2*Math.PI:!o&&u>d&&(d+=2*Math.PI);let c=u,f=d-u,p=Math.sqrt(h*h+l*l),m=(15*Math.abs(f)*Math.sqrt(p)/Math.PI>>0)+1,g=f/m;if(c+=g,o){a.push(t,e,r,i);for(let r=1,i=c;r<m;r++,i+=g)a.push(t,e,t+Math.sin(i)*p,e+Math.cos(i)*p);a.push(t,e,s,n)}else{a.push(r,i,t,e);for(let r=1,i=c;r<m;r++,i+=g)a.push(t+Math.sin(i)*p,e+Math.cos(i)*p,t,e);a.push(s,n,t,e)}return 2*m}function eI(t,e){t.lineStyle.native?function(t,e){let r=0,i=t.shape,s=t.points||i.points,n=i.type!==u.HS.POLY||i.closeStroke;if(0===s.length)return;let a=e.points,o=e.indices,h=s.length/2,l=a.length/2,d=l;for(a.push(s[0],s[1]),r=1;r<h;r++)a.push(s[2*r],s[2*r+1]),o.push(d,d+1),d++;n&&o.push(d,l)}(t,e):function(t,e){let r=t.shape,i=t.points||r.points.slice(),s=e.closePointEps;if(0===i.length)return;let n=t.lineStyle,a=new u.E9(i[0],i[1]),o=new u.E9(i[i.length-2],i[i.length-1]),h=r.type!==u.HS.POLY||r.closeStroke,l=Math.abs(a.x-o.x)<s&&Math.abs(a.y-o.y)<s;if(h){i=i.slice(),l&&(i.pop(),i.pop(),o.set(i[i.length-2],i[i.length-1]));let t=(a.x+o.x)*.5,e=(o.y+a.y)*.5;i.unshift(t,e),i.push(t,e)}let d=e.points,c=i.length/2,f=i.length,p=d.length/2,m=n.width/2,g=m*m,_=n.miterLimit*n.miterLimit,x=i[0],v=i[1],y=i[2],b=i[3],T=0,E=0,A=-(v-b),w=x-y,S=0,R=0,I=Math.sqrt(A*A+w*w);A/=I,w/=I,A*=m,w*=m;let C=n.alignment,P=(1-C)*2,M=2*C;h||(n.cap===eb.ROUND?f+=eR(x-A*(P-M)*.5,v-w*(P-M)*.5,x-A*P,v-w*P,x+A*M,v+w*M,d,!0)+2:n.cap===eb.SQUARE&&(f+=eS(x,v,A,w,P,M,!0,d))),d.push(x-A*P,v-w*P,x+A*M,v+w*M);for(let t=1;t<c-1;++t){x=i[(t-1)*2],v=i[(t-1)*2+1],y=i[2*t],b=i[2*t+1],T=i[(t+1)*2],E=i[(t+1)*2+1],I=Math.sqrt((A=-(v-b))*A+(w=x-y)*w),A/=I,w/=I,A*=m,w*=m,I=Math.sqrt((S=-(b-E))*S+(R=y-T)*R),S/=I,R/=I,S*=m,R*=m;let e=y-x,r=v-b,s=y-T,a=E-b,o=e*s+r*a,h=r*s-a*e,l=h<0;if(Math.abs(h)<.001*Math.abs(o)){d.push(y-A*P,b-w*P,y+A*M,b+w*M),o>=0&&(n.join===ey.ROUND?f+=eR(y,b,y-A*P,b-w*P,y-S*P,b-R*P,d,!1)+4:f+=2,d.push(y-S*M,b-R*M,y+S*P,b+R*P));continue}let u=(-A+x)*(-w+b)-(-A+y)*(-w+v),c=(-S+T)*(-R+b)-(-S+y)*(-R+E),p=(e*c-s*u)/h,C=(a*u-r*c)/h,D=(p-y)*(p-y)+(C-b)*(C-b),B=y+(p-y)*P,N=b+(C-b)*P,F=y-(p-y)*M,O=b-(C-b)*M,L=l?P:M,U=D<=Math.min(e*e+r*r,s*s+a*a)+L*L*g,k=n.join;if(k===ey.MITER&&D/g>_&&(k=ey.BEVEL),U)switch(k){case ey.MITER:d.push(B,N,F,O);break;case ey.BEVEL:l?d.push(B,N,y+A*M,b+w*M,B,N,y+S*M,b+R*M):d.push(y-A*P,b-w*P,F,O,y-S*P,b-R*P,F,O),f+=2;break;case ey.ROUND:l?(d.push(B,N,y+A*M,b+w*M),f+=eR(y,b,y+A*M,b+w*M,y+S*M,b+R*M,d,!0)+4,d.push(B,N,y+S*M,b+R*M)):(d.push(y-A*P,b-w*P,F,O),f+=eR(y,b,y-A*P,b-w*P,y-S*P,b-R*P,d,!1)+4,d.push(y-S*P,b-R*P,F,O))}else{switch(d.push(y-A*P,b-w*P,y+A*M,b+w*M),k){case ey.MITER:l?d.push(F,O,F,O):d.push(B,N,B,N),f+=2;break;case ey.ROUND:l?f+=eR(y,b,y+A*M,b+w*M,y+S*M,b+R*M,d,!0)+2:f+=eR(y,b,y-A*P,b-w*P,y-S*P,b-R*P,d,!1)+2}d.push(y-S*P,b-R*P,y+S*M,b+R*M),f+=2}}x=i[(c-2)*2],v=i[(c-2)*2+1],y=i[(c-1)*2],I=Math.sqrt((A=-(v-(b=i[(c-1)*2+1])))*A+(w=x-y)*w),A/=I,w/=I,A*=m,w*=m,d.push(y-A*P,b-w*P,y+A*M,b+w*M),h||(n.cap===eb.ROUND?f+=eR(y-A*(P-M)*.5,b-w*(P-M)*.5,y-A*P,b-w*P,y+A*M,b+w*M,d,!1)+2:n.cap===eb.SQUARE&&(f+=eS(y,b,A,w,P,M,!1,d)));let D=e.indices,B=eT.epsilon*eT.epsilon;for(let t=p;t<f+p-2;++t)x=d[2*t],v=d[2*t+1],y=d[(t+1)*2],b=d[(t+1)*2+1],T=d[(t+2)*2],Math.abs(x*(b-(E=d[(t+2)*2+1]))+y*(E-v)+T*(v-b))<B||D.push(t,t+1,t+2)}(t,e)}class eC{static curveLength(t,e,r,i,s,n){let a=t-2*r+s,o=e-2*i+n,h=2*r-2*t,l=2*i-2*e,u=4*(a*a+o*o),d=4*(a*h+o*l),c=h*h+l*l,f=2*Math.sqrt(u+d+c),p=Math.sqrt(u),m=2*u*p,g=2*Math.sqrt(c),_=d/p;return(m*f+p*d*(f-g)+(4*c*u-d*d)*Math.log((2*p+_+f)/(_+g)))/(4*m)}static curveTo(t,e,r,i,s){let n=s[s.length-2],a=s[s.length-1],o=eT._segmentsCount(eC.curveLength(n,a,t,e,r,i)),h=0,l=0;for(let u=1;u<=o;++u){let d=u/o;h=n+(t-n)*d,l=a+(e-a)*d,s.push(h+(t+(r-t)*d-h)*d,l+(e+(i-e)*d-l)*d)}}}let eP={[u.HS.POLY]:e_,[u.HS.CIRC]:em,[u.HS.ELIP]:em,[u.HS.RECT]:ex,[u.HS.RREC]:ev},eM=[],eD=[];class eB{constructor(t,e=null,r=null,i=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=i,this.type=t.type}clone(){return new eB(this.shape,this.fillStyle,this.lineStyle,this.matrix
907)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}class eN{constructor(){this.reset()}begin(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}let eF=new u.E9,eO=class t extends u.JZ{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new d.YZ,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),eD.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){let e=this.batches[t];e.reset(),eM.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,r=null,i=null){let s=new eB(t,e,r,i);return this.graphicsData.push(s),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;let r=new eB(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=i.lineStyle,i.holes.push(r),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){let e=this.graphicsData;for(let r=0;r<e.length;++r){let i=e[r];if(i.fillStyle.visible&&i.shape&&(i.matrix?i.matrix.applyInverse(t,eF):eF.copyFrom(t),i.shape.contains(eF.x,eF.y))){let t=!1;if(i.holes){for(let e=0;e<i.holes.length;e++)if(i.holes[e].shape.contains(eF.x,eF.y)){t=!0;break}}if(!t)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;let t=this.uvs,e=this.graphicsData,r=null,i=null;this.batches.length>0&&(i=(r=this.batches[this.batches.length-1]).style);for(let s=this.shapeIndex;s<e.length;s++){this.shapeIndex++;let n=e[s],a=n.fillStyle,o=n.lineStyle;eP[n.type].build(n),n.matrix&&this.transformPoints(n.points,n.matrix),(a.visible||o.visible)&&this.processHoles(n.holes);for(let e=0;e<2;e++){let s=0===e?a:o;if(!s.visible)continue;let h=s.texture.baseTexture,l=this.indices.length,d=this.points.length/2;h.wrapMode=u.Nt.REPEAT,0===e?this.processFill(n):this.processLine(n);let c=this.points.length/2-d;0!==c&&(r&&!this._compareStyles(i,s)&&(r.end(l,d),r=null),r||((r=eM.pop()||new eN).begin(s,l,d),this.batches.push(r),i=s),this.addUvs(this.points,t,s.texture,d,c,s.matrix))}}let s=this.indices.length,n=this.points.length/2;if(r&&r.end(s,n),0===this.batches.length){this.batchable=!0;return}let a=n>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){let e=this.graphicsData[t],r=e.fillStyle,i=e.lineStyle;if(r&&!r.texture.baseTexture.valid||i&&!i.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);let t=this.batches;for(let e=0,r=t.length;e<r;e++){let r=t[e];for(let t=0;t<r.size;t++){let e=r.start+t;this.indicesUint16[e]=this.indicesUint16[e]-r.attribStart}}}isBatchable(){if(this.points.length>131070)return!1;let e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<2*t.BATCHABLE_SIZE}buildDrawCalls(){let t=++u.VL._globalBatch;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),eD.push(this.drawCalls[t]);this.drawCalls.length=0;let e=this.colors,r=this.textureIds,i=eD.pop();i||((i=new u.a$).texArray=new u.Ie),i.texArray.count=0,i.start=0,i.size=0,i.type=u.lg.TRIANGLES;let s=0,n=null,a=0,o=!1,h=u.lg.TRIANGLES,l=0;this.drawCalls.push(i);for(let d=0;d<this.batches.length;d++){let c=this.batches[d],f=c.style,p=f.texture.baseTexture;!!f.native!==o&&(h=(o=!!f.native)?u.lg.LINES:u.lg.TRIANGLES,n=null,s=8,t++),n!==p&&(n=p,p._batchEnabled!==t&&(8===s&&(t++,s=0,i.size>0&&((i=eD.pop())||((i=new u.a$).texArray=new u.Ie),this.drawCalls.push(i)),i.start=l,i.size=0,i.texArray.count=0,i.type=h),p.touched=1,p._batchEnabled=t,p._batchLocation=s,p.wrapMode=u.Nt.REPEAT,i.texArray.elements[i.texArray.count++
907]=p,s++)),i.size+=c.size,l+=c.size,a=p._batchLocation,this.addColors(e,f.color,f.alpha,c.attribSize,c.attribStart),this.addTextureIds(r,a,c.attribSize,c.attribStart)}u.VL._globalBatch=t,this.packAttributes()}packAttributes(){let t=this.points,e=this.uvs,r=this.colors,i=this.textureIds,s=new ArrayBuffer(12*t.length),n=new Float32Array(s),a=new Uint32Array(s),o=0;for(let s=0;s<t.length/2;s++)n[o++]=t[2*s],n[o++]=t[2*s+1],n[o++]=e[2*s],n[o++]=e[2*s+1],a[o++]=r[s],n[o++]=i[s];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?e_.triangulate(t,this):eP[t.type].triangulate(t,this)}processLine(t){eI(t,this);for(let e=0;e<t.holes.length;e++)eI(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){let r=t[e];eP[r.type].build(r),r.matrix&&this.transformPoints(r.points,r.matrix)}}calculateBounds(){let t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let r=0;r<t.length/2;r++){let i=t[2*r],s=t[2*r+1];t[2*r]=e.a*i+e.c*s+e.tx,t[2*r+1]=e.b*i+e.d*s+e.ty}}addColors(t,e,r,i,s=0){let n=u.Il.shared.setValue(e).toLittleEndianNumber(),a=u.Il.shared.setValue(n).toPremultiplied(r);t.length=Math.max(t.length,s+i);for(let e=0;e<i;e++)t[s+e]=a}addTextureIds(t,e,r,i=0){t.length=Math.max(t.length,i+r);for(let s=0;s<r;s++)t[i+s]=e}addUvs(t,e,r,i,s,n=null){let a=0,o=e.length,h=r.frame;for(;a<s;){let r=t[(i+a)*2],s=t[(i+a)*2+1];if(n){let t=n.a*r+n.c*s+n.tx;s=n.b*r+n.d*s+n.ty,r=t}a++,e.push(r/h.width,s/h.height)}let l=r.baseTexture;(h.width<l.width||h.height<l.height)&&this.adjustUvs(e,r,o,s)}adjustUvs(t,e,r,i){let s=e.baseTexture,n=r+2*i,a=e.frame,o=a.width/s.width,h=a.height/s.height,l=a.x/a.width,u=a.y/a.height,d=Math.floor(t[r]+1e-6),c=Math.floor(t[r+1]+1e-6);for(let e=r+2;e<n;e+=2)d=Math.min(d,Math.floor(t[e]+1e-6)),c=Math.min(c,Math.floor(t[e+1]+1e-6));l-=d,u-=c;for(let e=r;e<n;e+=2)t[e]=(t[e]+l)*o,t[e+1]=(t[e+1]+u)*h}};eO.BATCHABLE_SIZE=100;let eL=eO;class eU{constructor(){this.color=16777215,this.alpha=1,this.texture=u.xE.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){let t=new eU;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=u.xE.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class ek extends eU{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=eb.BUTT,this.join=ey.MITER,this.miterLimit=10}clone(){let t=new ek;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=eb.BUTT,this.join=ey.MITER,this.miterLimit=10}}let eG={},eH=class t extends d.W2{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new eU,this._lineStyle=new ek,this._matrix=null,this._holeMode=!1,this.state=u.ZM.for2d(),this._geometry=t||new eL,this._geometry.refCount++,this._transformID=-1,this._tintColor=new u.Il(16777215),this.blendMode=u.T$.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new t(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,r,i=.5,s=!1){return"number"==typeof t&&(t={width:t,color:e,alpha:r,alignment:i,native:s}),this.lineTextureStyle(t)}lineTextureStyle(t){t=Object.assign({width:0,texture:u.xE.WHITE,color:t?.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:eb.BUTT,join:ey.MITER,miterLimit:10},t),this.normalizeColor(t),this.currentPath&&this.startPoly();let e=t.width>0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){let t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new u.mg,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new u.mg,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);let r=this.currentPath.points,i=r[r.length-2],s=r[r.length-1];return(i!==t||s!==e)&&r.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,r,i){this._initCurve();let s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),eC.curveTo(t,e,r,i,s),this}bezierCurveTo(t,e,r,i,s,n){return this._initCurve(),ew.curveTo(t,e,r,i,s,n,this.currentPath.points),this}arcTo(t,e,r,i,s){this._initCurve(t,e);let n=this.currentPath.points,a=eA.curveTo(t,e,r,i,s,n);
907if(a){let{cx:t,cy:e,radius:r,startAngle:i,endAngle:s,anticlockwise:n}=a;this.arc(t,e,r,i,s,n)}return this}arc(t,e,r,i,s,n=!1){if(i===s||(!n&&s<=i?s+=u._b:n&&i<=s&&(i+=u._b),s-i==0))return this;let a=t+Math.cos(i)*r,o=e+Math.sin(i)*r,h=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){let t=Math.abs(l[l.length-2]-a),e=Math.abs(l[l.length-1]-o);t<h&&e<h||l.push(a,o)}else this.moveTo(a,o),l=this.currentPath.points;return eA.arc(a,o,t,e,r,i,s,n,l),this}beginFill(t=0,e){return this.beginTextureFill({texture:u.xE.WHITE,color:t,alpha:e})}normalizeColor(t){let e=u.Il.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){t=Object.assign({texture:u.xE.WHITE,color:16777215,matrix:null},t),this.normalizeColor(t),this.currentPath&&this.startPoly();let e=t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,r,i){return this.drawShape(new u.Ae(t,e,r,i))}drawRoundedRect(t,e,r,i,s){return this.drawShape(new u.c9(t,e,r,i,s))}drawCircle(t,e,r){return this.drawShape(new u.Cd(t,e,r))}drawEllipse(t,e,r,i){return this.drawShape(new u.Pj(t,e,r,i))}drawPolygon(...t){let e,r=!0,i=t[0];i.points?(r=i.closeStroke,e=i.points):e=Array.isArray(t[0])?t[0]:t;let s=new u.mg(e);return s.closeStroke=r,this.drawShape(s),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){let t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===u.HS.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();let e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){let t=this._geometry,e=this.blendMode,r=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=r,this.vertexData=new Float32Array(t.points);for(let i=0;i<r;i++){let r=t.batches[i],s=r.style.color,n=new Float32Array(this.vertexData.buffer,8*r.attribStart,2*r.attribSize),a=new Float32Array(t.uvsFloat32.buffer,8*r.attribStart,2*r.attribSize),o={vertexData:n,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*r.start,r.size),uvs:a,_batchRGB:u.Il.shared.setValue(s).toRgbArray(),_tintRGB:s,_texture:r.style.texture,alpha:r.style.alpha,worldAlpha:1};this.batches[i]=o}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,r=this.batches.length;e<r;e++){let r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){let e=this._resolveDirectShader(t),r=this._geometry,i=this.worldAlpha,s=e.uniforms,n=r.drawCalls;s.translationMatrix=this.transform.worldTransform,u.Il.shared.setValue(this._tintColor).premultiply(i).toArray(s.tint),t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(let e=0,i=n.length;e<i;e++)this._renderDrawCallDirect(t,r.drawCalls[e])}_renderDrawCallDirect(t,e){let{texArray:r,type:i,size:s,start:n}=e,a=r.count;for(let e=0;e<a;e++)t.texture.bind(r.elements[e],e);t.geometry.draw(i,s,n)}_resolveDirectShader(t){let e=this.shader,r=this.pluginName;if(!e){if(!eG[r]){let{maxTextures:e}=t.plugins[r],i=new Int32Array(e);for(let t=0;t<e;t++)i[t]=t;let s={tint:new Float32Array([1,1,1,1]),translationMatrix:new u.y3,default:u.oo.from({uSamplers:i},!0)},n=t.plugins[r]._shader.program;eG[r]=new u.ex(n,s)}e=eG[r]}return e}_calculateBounds(){this.finishPoly();let t=this._geometry;if(!t.graphicsData.length)return;let{minX:e,minY:r,maxX:i,maxY:s}=t.bounds;this._bounds.addFrame(this.transform,e,r,i,s)}containsPoint(e){return this.worldTransform.applyInverse(e,t._TEMP_POINT),this._geometry.containsPoint(t._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){let e=this.batches[t];e._tintRGB=u.Il.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){let t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;let e=this.transform.worldTransform,r=e.a,i=e.b,s=e.c,n=e.d,a=e.tx,o=e.ty,h=this._geometry.points,l=this.vertexData,u=0;for(let t=0;t<h.length;t+=2){let e=h[t],d=h[t+1];l[u++]=r*e+s*d+a,l[u++]=n*d+i*e+o}}closePath(){let t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,
907super.destroy(t)}};eH.curves=eT,eH._TEMP_POINT=new u.E9;let eX=eH,eV={buildPoly:e_,buildCircle:em,buildRectangle:ex,buildRoundedRectangle:ev,buildLine:eI,ArcUtils:eA,BezierUtils:ew,QuadraticUtils:eC,BatchPart:eN,FILL_COMMANDS:eP,BATCH_POOL:eM,DRAW_CALL_POOL:eD};class eW{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;let e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}let ez=new u.E9,e$=new u.mg,ej=class t extends d.W2{constructor(t,e,r,i=u.lg.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=r||u.ZM.for2d(),this.drawMode=i,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=u.Xd.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(e){let r=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===u.lg.TRIANGLES&&r.length<2*t.BATCHABLE_SIZE?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(t){let e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){let e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;let i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)}calculateVertices(){let t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));let i=this.transform.worldTransform,s=i.a,n=i.b,a=i.c,o=i.d,h=i.tx,l=i.ty,d=this.vertexData;for(let t=0;t<d.length/2;t++){let r=e[2*t],i=e[2*t+1];d[2*t]=s*r+a*i+h,d[2*t+1]=n*r+o*i+l}if(this._roundPixels){let t=u.Xd.RESOLUTION;for(let e=0;e<d.length;++e)d[e]=Math.round(d[e]*t)/t}this.vertexDirty=r}calculateUvs(){let t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new eW(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,ez);let e=this.geometry.getBuffer("aVertexPosition").data,r=e$.points,i=this.geometry.getIndex().data,s=i.length,n=4===this.drawMode?3:1;for(let t=0;t+2<s;t+=n){let s=2*i[t],n=2*i[t+1],a=2*i[t+2];if(r[0]=e[s],r[1]=e[s+1],r[2]=e[n],r[3]=e[n+1],r[4]=e[a],r[5]=e[a+1],e$.contains(ez.x,ez.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};ej.BATCHABLE_SIZE=100;let eY=ej;class eq extends u.wG{constructor(t,e,r){super();let i=new u.lW(t),s=new u.lW(e,!0),n=new u.lW(r,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,u.vK.FLOAT).addAttribute("aTextureCoord",s,2,!1,u.vK.FLOAT).addIndex(n),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var eK=`varying vec2 vTextureCoord; 908uniform vec4 uColor; 909 910uniform sampler2D uSampler; 911 912void main(void) 913{ 914 gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor; 915} 916`,eZ=`attribute vec2 aVertexPosition; 917attribute vec2 aTextureCoord; 918 919uniform mat3 projectionMatrix; 920uniform mat3 translationMatrix; 921uniform mat3 uTextureMatrix; 922 923varying vec2 vTextureCoord; 924 925void main(void) 926{ 927 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
927)).xy, 0.0, 1.0); 928 929 vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy; 930} 931`;class eQ extends u.ex{constructor(t,e){let r={uSampler:t,alpha:1,uTextureMatrix:u.y3.IDENTITY,uColor:new Float32Array([1,1,1,1])};(e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e)).uniforms&&Object.assign(r,e.uniforms),super(e.program||u.$r.from(eZ,eK),r),this._colorDirty=!1,this.uvMatrix=new u.UX(t),this.batchable=void 0===e.program,this.pluginName=e.pluginName,this._tintColor=new u.Il(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;let t=this.texture.baseTexture.alphaMode;u.Il.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class eJ extends eq{constructor(t=100,e=100,r=10,i=10){super(),this.segWidth=r,this.segHeight=i,this.width=t,this.height=e,this.build()}build(){let t=this.segWidth*this.segHeight,e=[],r=[],i=[],s=this.segWidth-1,n=this.segHeight-1,a=this.width/s,o=this.height/n;for(let i=0;i<t;i++){let t=i%this.segWidth,h=i/this.segWidth|0;e.push(t*a,h*o),r.push(t/s,h/n)}let h=s*n;for(let t=0;t<h;t++){let e=t%s,r=t/s|0,n=r*this.segWidth+e,a=r*this.segWidth+e+1,o=(r+1)*this.segWidth+e,h=(r+1)*this.segWidth+e+1;i.push(n,a,o,a,h,o)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(r),this.indexBuffer.data=new Uint16Array(i),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class e0 extends eq{constructor(t=200,e,r=0){super(new Float32Array(4*e.length),new Float32Array(4*e.length),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=r,this.build()}get width(){return this._width}build(){let t=this.points;if(!t)return;let e=this.getBuffer("aVertexPosition"),r=this.getBuffer("aTextureCoord"),i=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),r.data=new Float32Array(4*t.length),i.data=new Uint16Array((t.length-1)*6));let s=r.data,n=i.data;s[0]=0,s[1]=0,s[2]=0,s[3]=1;let a=0,o=t[0],h=this._width*this.textureScale,l=t.length;for(let e=0;e<l;e++){let r=4*e;if(this.textureScale>0){let r=o.x-t[e].x,i=o.y-t[e].y,s=Math.sqrt(r*r+i*i);o=t[e],a+=s/h}else a=e/(l-1);s[r]=a,s[r+1]=0,s[r+2]=a,s[r+3]=1}let u=0;for(let t=0;t<l-1;t++){let e=2*t;n[u++]=e,n[u++]=e+1,n[u++]=e+2,n[u++]=e+2,n[u++]=e+1,n[u++]=e+3}r.update(),i.update(),this.updateVertices()}updateVertices(){let t=this.points;if(t.length<1)return;let e=t[0],r,i=0,s=0,n=this.buffers[0].data,a=t.length,o=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let h=0;h<a;h++){let l=t[h],u=4*h;s=-((r=h<t.length-1?t[h+1]:l).x-e.x),i=r.y-e.y;let d=(1-h/(a-1))*10;d>1&&(d=1);let c=Math.sqrt(i*i+s*s);c<1e-6?(i=0,s=0):(i/=c,s/=c,i*=o,s*=o),n[u]=l.x+i,n[u+1]=l.y+s,n[u+2]=l.x-i,n[u+3]=l.y-s,e=l}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class e1 extends eY{constructor(t,e,r){super(new eJ(t.width,t.height,e,r),new eQ(u.xE.WHITE)),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;let t=this.geometry,{width:e,height:r}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==r)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}class e2 extends e1{constructor(t,e,r,i,s){super(u.xE.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWi
931dth=e??t.defaultBorders?.left??10,this._rightWidth=i??t.defaultBorders?.right??10,this._topHeight=r??t.defaultBorders?.top??10,this._bottomHeight=s??t.defaultBorders?.bottom??10,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){let t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){let t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){let t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,r=this._topHeight+this._bottomHeight;return Math.min(e,this._height>r?1:this._height/r)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){let t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;let r=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class e3 extends eY{constructor(t=u.xE.EMPTY,e,r,i,s){let n=new eq(e,r,i);n.getBuffer("aVertexPosition").static=!1,super(n,new eQ(t),null,s),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class e4 extends eY{constructor(t,e,r=0){let i=new e0(t.height,e,r),s=new eQ(t);r>0&&(t.baseTexture.wrapMode=u.Nt.REPEAT),super(i,s),this.autoUpdate=!0}_render(t){let e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class e5 extends d.W2{constructor(t=1500,e,r=16384,i=!1){super(),r>16384&&(r=16384),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=r,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=u.T$.NORMAL,this.autoResize=i,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new u.Il(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){let e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID}dispose(){if(this._buffers){for(let t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}}destroy(t){super.destroy(t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}class e6{constructor(t,e,r){this.geometry=new u.wG,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(let r=0;r<t.length;++r){let i=t[r];
931i={attributeName:i.attributeName,size:i.size,uploadFunction:i.uploadFunction,type:i.type||u.vK.FLOAT,offset:i.offset},e[r]?this.dynamicProperties.push(i):this.staticProperties.push(i)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){let t=this.geometry,e=0;this.indexBuffer=new u.lW(u.P6.createIndicesForQuads(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let t=0;t<this.dynamicProperties.length;++t){let r=this.dynamicProperties[t];r.offset=e,e+=r.size,this.dynamicStride+=r.size}let r=new ArrayBuffer(this.size*this.dynamicStride*16);this.dynamicData=new Float32Array(r),this.dynamicDataUint32=new Uint32Array(r),this.dynamicBuffer=new u.lW(this.dynamicData,!1,!1);let i=0;this.staticStride=0;for(let t=0;t<this.staticProperties.length;++t){let e=this.staticProperties[t];e.offset=i,i+=e.size,this.staticStride+=e.size}let s=new ArrayBuffer(this.size*this.staticStride*16);this.staticData=new Float32Array(s),this.staticDataUint32=new Uint32Array(s),this.staticBuffer=new u.lW(this.staticData,!0,!1);for(let e=0;e<this.dynamicProperties.length;++e){let r=this.dynamicProperties[e];t.addAttribute(r.attributeName,this.dynamicBuffer,0,r.type===u.vK.UNSIGNED_BYTE,r.type,4*this.dynamicStride,4*r.offset)}for(let e=0;e<this.staticProperties.length;++e){let r=this.staticProperties[e];t.addAttribute(r.attributeName,this.staticBuffer,0,r.type===u.vK.UNSIGNED_BYTE,r.type,4*this.staticStride,4*r.offset)}}uploadDynamic(t,e,r){for(let i=0;i<this.dynamicProperties.length;i++){let s=this.dynamicProperties[i];s.uploadFunction(t,e,r,s.type===u.vK.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,s.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,r){for(let i=0;i<this.staticProperties.length;i++){let s=this.staticProperties[i];s.uploadFunction(t,e,r,s.type===u.vK.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,s.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var e8=`varying vec2 vTextureCoord; 932varying vec4 vColor; 933 934uniform sampler2D uSampler; 935 936void main(void){ 937 vec4 color = texture2D(uSampler, vTextureCoord) * vColor; 938 gl_FragColor = color; 939}`,e7=`attribute vec2 aVertexPosition; 940attribute vec2 aTextureCoord; 941attribute vec4 aColor; 942 943attribute vec2 aPositionCoord; 944attribute float aRotation; 945 946uniform mat3 translationMatrix; 947uniform vec4 uColor; 948 949varying vec2 vTextureCoord; 950varying vec4 vColor; 951 952void main(void){ 953 float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation); 954 float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation); 955 956 vec2 v = vec2(x, y); 957 v = v + aPositionCoord; 958 959 gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); 960 961 vTextureCoord = aTextureCoord; 962 vColor = aColor * uColor; 963} 964`;class e9 extends u.bO{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new u.y3,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:u.vK.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=u.ex.from(e7,e8,{}),this.state=u.ZM.for2d()}render(t){let e=t.children,r=t._maxSize,i=t._batchSize,s=this.renderer,n=e.length;if(0===n)return;n>r&&!t.autoResize&&(n=r);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));let o=e[0]._texture.baseTexture,h=o.alphaMode>0;this.state.blendMode=u.P6.correctBlendMode(t.blendMode,h),s.state.set(this.state);let l=s.gl,d=t.worldTransform.copyTo(this.tempMatrix);d.prepend(s.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=d.toArray(!0),this.shader.uniforms.uColor=u.Il.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=o,this.renderer.shader.bind(this.shader);let c=!1;for(let r=0,o=0;r<n;r+=i,o+=1){let h=n-r;h>i&&(h=i),o>=a.length&&a.push(this._generateOneMoreBuffer(t));let u=a[o];u.uploadDynamic(e,r,h);let d=t._bufferUpdateIDs[o]||0;(c=c||u._updateID<d)&&(u._updateID=t._updateID,u.uploadStatic(e,r,h)),s.geometry.bind(u.geometry),l.drawElements(l.TRIANGLES,6*h,l.UNSIGNED_SHORT,0)}}generateBuffers(t){let e=[],r=t._maxSize,i=t._batchSize,s=t._properties;for(let t=0;t<r;t+=i)e.push(new e6(this.properties,s,i));return e}_generateOneMoreBuffer(t){let e=t._batchSize,r=t._properties;return new e6(this.properties,r,e)}uploadVertices(t,e,r,i,s,n){let a=0,o=0,h=0,l=0;for(let u=0;u<r;++u){let r=t[e+u],d=r._texture,c=r.scale.x,f=r.scale.y,p=d.trim,m=d.orig;p?(a=(o=p.x-r.anchor.x*m.width)+p.width,h=(l=p.y-r.anchor.y*m.height)+p.height):(a=m.width*(1-r.anchor.x),o=-(m.width*r.anchor.x),h=m.he
964ight*(1-r.anchor.y),l=-(m.height*r.anchor.y)),i[n]=o*c,i[n+1]=l*f,i[n+s]=a*c,i[n+s+1]=l*f,i[n+2*s]=a*c,i[n+2*s+1]=h*f,i[n+3*s]=o*c,i[n+3*s+1]=h*f,n+=4*s}}uploadPosition(t,e,r,i,s,n){for(let a=0;a<r;a++){let r=t[e+a].position;i[n]=r.x,i[n+1]=r.y,i[n+s]=r.x,i[n+s+1]=r.y,i[n+2*s]=r.x,i[n+2*s+1]=r.y,i[n+3*s]=r.x,i[n+3*s+1]=r.y,n+=4*s}}uploadRotation(t,e,r,i,s,n){for(let a=0;a<r;a++){let r=t[e+a].rotation;i[n]=r,i[n+s]=r,i[n+2*s]=r,i[n+3*s]=r,n+=4*s}}uploadUvs(t,e,r,i,s,n){for(let a=0;a<r;++a){let r=t[e+a]._texture._uvs;r?(i[n]=r.x0,i[n+1]=r.y0,i[n+s]=r.x1,i[n+s+1]=r.y1,i[n+2*s]=r.x2,i[n+2*s+1]=r.y2,i[n+3*s]=r.x3,i[n+3*s+1]=r.y3):(i[n]=0,i[n+1]=0,i[n+s]=0,i[n+s+1]=0,i[n+2*s]=0,i[n+2*s+1]=0,i[n+3*s]=0,i[n+3*s+1]=0),n+=4*s}}uploadTint(t,e,r,i,s,n){for(let a=0;a<r;++a){let r=t[e+a],o=u.Il.shared.setValue(r._tintRGB).toPremultiplied(r.alpha,r.texture.baseTexture.alphaMode>0);i[n]=o,i[n+s]=o,i[n+2*s]=o,i[n+3*s]=o,n+=4*s}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}e9.extension={name:"particle",type:u.nw.RendererPlugin},u.Rw.add(e9);var rt=((l=rt||{})[l.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",l[l.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",l);let re={willReadFrequently:!0},rr=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0!==e){let r=u.Xd.ADAPTER.getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return e}constructor(t,e,r,i,s,n,a,o,h){this.text=t,this.style=e,this.width=r,this.height=i,this.lines=s,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=o,this.fontProperties=h}static measureText(e,r,i,s=t._canvas){i=i??r.wordWrap;let n=r.toFontString(),a=t.measureFont(n);0===a.fontSize&&(a.fontSize=r.fontSize,a.ascent=r.fontSize);let o=s.getContext("2d",re);o.font=n;let h=(i?t.wordWrap(e,r,s):e).split(/(?:\r\n|\r|\n)/),l=Array(h.length),u=0;for(let e=0;e<h.length;e++){let i=t._measureText(h[e],r.letterSpacing,o);l[e]=i,u=Math.max(u,i)}let d=u+r.strokeThickness;r.dropShadow&&(d+=r.dropShadowDistance);let c=r.lineHeight||a.fontSize+r.strokeThickness,f=Math.max(c,a.fontSize+2*r.strokeThickness)+r.leading+(h.length-1)*(c+r.leading);return r.dropShadow&&(f+=r.dropShadowDistance),new t(e,r,d,f,h,l,c+r.leading,u,a)}static _measureText(e,r,i){let s=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(i.letterSpacing=`${r}px`,i.textLetterSpacing=`${r}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(e).width;return n>0&&(s?n-=r:n+=(t.graphemeSegmenter(e).length-1)*r),n}static wordWrap(e,r,i=t._canvas){let s=i.getContext("2d",re),n=0,a="",o="",h=Object.create(null),{letterSpacing:l,whiteSpace:u}=r,d=t.collapseSpaces(u),c=t.collapseNewlines(u),f=!d,p=r.wordWrapWidth+l,m=t.tokenize(e);for(let e=0;e<m.length;e++){let i=m[e];if(t.isNewline(i)){if(!c){o+=t.addLine(a),f=!d,a="",n=0;continue}i=" "}if(d){let e=t.isBreakingSpace(i),r=t.isBreakingSpace(a[a.length-1]);if(e&&r)continue}let u=t.getFromCache(i,l,h,s);if(u>p){if(""!==a&&(o+=t.addLine(a),a="",n=0),t.canBreakWords(i,r.breakWords)){let e=t.wordWrapSplit(i);for(let u=0;u<e.length;u++){let d=e[u],c=d,m=1;for(;e[u+m];){let s=e[u+m];if(t.canBreakChars(c,s,i,u,r.breakWords))break;d+=s,c=s,m++}u+=m-1;let g=t.getFromCache(d,l,h,s);g+n>p&&(o+=t.addLine(a),f=!1,a="",n=0),a+=d,n+=g}}else{a.length>0&&(o+=t.addLine(a),a="",n=0);let r=e===m.length-1;o+=t.addLine(i,!r),f=!1,a="",n=0}}else u+n>p&&(f=!1,o+=t.addLine(a),a="",n=0),(a.length>0||!t.isBreakingSpace(i)||f)&&(a+=i,n+=u)}return o+t.addLine(a,!1)}static addLine(e,r=!0){return e=t.trimRight(e),e=r?`${e} 965`:e}static getFromCache(e,r,i,s){let n=i[e];return"number"!=typeof n&&(n=t._measureText(e,r,s)+r,i[e]=n),n}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(e){if("string"!=typeof e)return"";for(let r=e.length-1;r>=0;r--){let i=e[r];if(!t.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return"string"==typeof e&&t._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,r){return"string"==typeof e&&t._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){let r=[],i="";if("string"!=typeof e)return r;for(let s=0;s<e.length;s++){let n=e[s],a=e[s+1];if(t.isBreakingSpace(n,a)||t.isNewline(n)){""!==i&&(r.push(i),i=""),r.push(n);continue}i+=n}return""!==i&&r.push(i),r}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,i,s){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];let r={ascent:0,descent:0,fontSize:0},i=t._canvas,s=t._context;s.font=e;let n=t.METRICS_STRING+t.BASELINE_SYMBOL,a=Math.ceil(s.measureText(n).width),o=Math.ceil(s.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*o);if(o=o*t.BASELINE_MULTIPLIER|0,0===a||0===h)return t._fonts[e]=r,r;i.width=a,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,a,h),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,o);let l=s.getImageData(0,0,a,h).data,u=l.length,d=4*a,c=0,f=0,p=!1;for(c=0;c<o;++c){for(let t=0;t<d;t+=4)if(255!==l[f+t]){p=!0;break}if(p)break;f+=d}
965for(r.ascent=o-c,f=u-d,p=!1,c=h;c>o;--c){for(let t=0;t<d;t+=4)if(255!==l[f+t]){p=!0;break}if(p)break;f-=d}return r.descent=c-o,r.fontSize=r.ascent+r.descent,t._fonts[e]=r,r}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{let r=new OffscreenCanvas(0,0);if(r.getContext("2d",re)?.measureText)return t.__canvas=r,r;e=u.Xd.ADAPTER.createCanvas()}catch{e=u.Xd.ADAPTER.createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",re)),t.__context}};rr.METRICS_STRING="|\xc9q\xc5",rr.BASELINE_SYMBOL="M",rr.BASELINE_MULTIPLIER=1.4,rr.HEIGHT_MULTIPLIER=2,rr.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){let t=new Intl.Segmenter;return e=>[...t.segment(e)].map(t=>t.segment)}return t=>[...t]})(),rr.experimentalLetterSpacing=!1,rr._fonts={},rr._newlines=[10,13],rr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let ri=rr,rs=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],rn=class t{constructor(t){this.styleID=0,this.reset(),rh(this,t,t)}clone(){let e={};return rh(e,this,t.defaultStyle),new t(e)}reset(){rh(this,t.defaultStyle,t.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){let e=ro(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){let e=ro(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){let e=ro(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){let t="number"==typeof this.fontSize?`${this.fontSize}px`:this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let t=e.length-1;t>=0;t--){let r=e[t].trim();/([\"\'])[^\'\"]+\1/.test(r)||rs.includes(r)||(r=`"${r}"`),e[t]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};rn.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:rt.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ra=rn;function ro(t){let e=u.Il.shared,r=t=>{let r=e.setValue(t);return 1===r.alpha?r.toHex():r.toRgbaString()};return Array.isArray(t)?t.map(r):r(t)}function rh(t,e,r){for(let i in r)Array.isArray(e[i])?t[i]=e[i].slice():t[i]=e[i]}let rl={texture:!0,children:!1,baseTexture:!0},ru=class t extends p{constructor(e,r,i){let s=!1;i||(i=u.Xd.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;let n=u.xE.from(i);n.orig=new u.Ae,n.trim=new u.Ae,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=t.defaultResolution??u.Xd.RESOLUTION,this._autoResolution=t.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=r,this.localStyleID=-1}static get experimentalLetterSpacing(){return ri.experimentalLetterSpacing}static set experimentalLetterSpacing(t){u.P6.deprecation("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),ri.experimentalLetterSpacing=t}updateText(t){let e,r;let i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();let s=this.context,n=ri.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=n.width,o=n.height,h=n.lines,l=n.lineHeight,d=n.lineWidths,c=n.maxLineWidth,f=n.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+2*i.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+2*i.padding)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=i.strokeThickness,s.textBaseline=i.textBaseline,s.lineJoin=i.lineJoin,s.miterLimit=i.miterLimit;let p=i.dropShadow?2:1;for(let t=0;t<p;
965++t){let a=i.dropShadow&&0===t,p=a?Math.ceil(Math.max(1,o)+2*i.padding):0,m=p*this._resolution;if(a){s.fillStyle="black",s.strokeStyle="black";let t=i.dropShadowColor,e=i.dropShadowBlur*this._resolution,r=i.dropShadowDistance*this._resolution;s.shadowColor=u.Il.shared.setValue(t).setAlpha(i.dropShadowAlpha).toRgbaString(),s.shadowBlur=e,s.shadowOffsetX=Math.cos(i.dropShadowAngle)*r,s.shadowOffsetY=Math.sin(i.dropShadowAngle)*r+m}else s.fillStyle=this._generateFillStyle(i,h,n),s.strokeStyle=i.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let g=(l-f.fontSize)/2;l-f.fontSize<0&&(g=0);for(let t=0;t<h.length;t++)e=i.strokeThickness/2,r=i.strokeThickness/2+t*l+f.ascent+g,"right"===i.align?e+=c-d[t]:"center"===i.align&&(e+=(c-d[t])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(h[t],e+i.padding,r+i.padding-p,!0),i.fill&&this.drawLetterSpacing(h[t],e+i.padding,r+i.padding-p)}this.updateTexture()}drawLetterSpacing(t,e,r,i=!1){let s=this._style.letterSpacing,n=!1;if(ri.experimentalLetterSpacingSupported&&(ri.experimentalLetterSpacing?(this.context.letterSpacing=`${s}px`,this.context.textLetterSpacing=`${s}px`,n=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),0===s||n){i?this.context.strokeText(t,e,r):this.context.fillText(t,e,r);return}let a=e,o=ri.graphemeSegmenter(t),h=this.context.measureText(t).width,l=0;for(let t=0;t<o.length;++t){let e=o[t];i?this.context.strokeText(e,a,r):this.context.fillText(e,a,r);let n="";for(let e=t+1;e<o.length;++e)n+=o[e];a+=h-(l=this.context.measureText(n).width)+s,h=l}}updateTexture(){let t=this.canvas;if(this._style.trim){let e=u.P6.trimCanvas(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}let e=this._texture,r=this._style,i=r.trim?0:r.padding,s=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-i,e.trim.y=-i,e.orig.width=e._frame.width-2*i,e.orig.height=e._frame.height-2*i,this._onTextureUpdate(),s.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),-1===this._textureID&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,r){let i;let s=t.fill;if(!Array.isArray(s))return s;if(1===s.length)return s[0];let n=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,o=this.canvas.width/this._resolution-n-2*a,h=this.canvas.height/this._resolution-n-2*a,l=s.slice(),u=t.fillGradientStops.slice();if(!u.length){let t=l.length+1;for(let e=1;e<t;++e)u.push(e/t)}if(l.unshift(s[0]),u.unshift(0),l.push(s[s.length-1]),u.push(1),t.fillGradientType===rt.LINEAR_VERTICAL){i=this.context.createLinearGradient(o/2,a,o/2,h+a);let s=r.fontProperties.fontSize+t.strokeThickness;for(let t=0;t<e.length;t++){let n=r.lineHeight*(t-1)+s,a=r.lineHeight*t,o=a;t>0&&n>a&&(o=(a+n)/2);let d=a+s,c=r.lineHeight*(t+1),f=d;t+1<e.length&&c<d&&(f=(d+c)/2);let p=(f-o)/h;for(let t=0;t<l.length;t++){let e=Math.min(1,Math.max(0,o/h+("number"==typeof u[t]?u[t]:t/l.length)*p));e=Number(e.toFixed(5)),i.addColorStop(e,l[t])}}}else{i=this.context.createLinearGradient(a,h/2,o+a,h/2);let t=l.length+1,e=1;for(let r=0;r<l.length;r++){let s;s="number"==typeof u[r]?u[r]:e/t,i.addColorStop(s,l[r]),e++}}return i}destroy(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},rl,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);let e=u.P6.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);let e=u.P6.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){(t=t||{})instanceof ra?this._style=t:this._style=new ra(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};ru.defaultAutoResolution=!0;let rd=ru;class rc{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function rf(t,e){let r=!1;if(t?._textures?.length){for(let i=0;i<t._textures.length;i++)if(t._textures[i]instanceof u.xE){let s=t._textures[i].baseTexture;e.includes(s)||(e.push(s),r=!0)}}return r}function rp(t,e){if(t.baseTexture instanceof u.VL){let r=t.baseTexture;return e.includes(r)||e.push(r),!0}return!1}function rm(t,e){if(t._texture&&t._texture instanceof u.xE){let r=t._texture.baseTexture;return e.includes(r)||e.push(r),!0}return!1}function rg(t,e){return e instanceof rd&&(e.updateText(!0),!0)}function r_(t,e){if(e instanceof ra){let t=e.toFontString();return ri.measureFont(t),!0}return!1}function rx(t,e){if(t instanceof rd){e.includes(t.style)||e.push(t.style),e.includes(t)||e.push(t);let r=t._texture.baseTexture;return e.includes(r)||e.push(r),!0}return!1}function rv(t,e){return t instanceof ra&&(e.includes(t)||e.push(t),!0)}let ry=class t{constructor(e){this.limiter=new rc(t.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(rx),this.registerFindHook(rv),this.registerFindHook(rf),this.registerFindHook(rp),this.registerFindHook(rm),this.registerUploadHook(rg),this.registerUploadHook(r_)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,u.vB.system.addOnce(this.tick,this,u.uF.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){let t=this.queue[0],e=!1;if(t&&!t._destroyed){for(let r=0,i=this.uploadHooks.length;r<i;r++)if(this.uploadHooks[r](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)u.vB.system.addOnce(this.tick,this,u.uF.UTILITY);else{this.ticking=!1;let t=this.completes.slice(0);this.completes.length=0;for(let e=0,r=t.length;e<r;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,r=this.addHooks.length;e<r&&!this.addHooks[e](t,this.queue);e++);if(t instanceof d.W2)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&u.vB.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};ry.uploadsPerFrame=4;let rb=ry;function rT(t,e){return e instanceof u.VL&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function rE(t,e){if(!(e instanceof eX))return!1;let{geometry:r}=e;e.finishPoly(),r.updateBatches();let{batches:i}=r;for(let e=0;e<i.length;e++){let{texture:r}=i[e].style;r&&rT(t,r.baseTexture)}return r.batchable||t.geometry.bind(r,e._resolveDirectShader(t)),!0}function rA(t,e){return t instanceof eX&&(e.push(t),!0)}Object.defineProperties(u.Xd,{UPLOADS_PER_FRAME:{get:()=>rb.uploadsPerFrame,set(t){u.P6.deprecation("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),rb.uploadsPerFrame=t}}});class rw extends rb{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(rA),this.registerUploadHook(rT),this.registerUploadHook(rE)}}
965rw.extension={name:"prepare",type:u.nw.RendererSystem},u.Rw.add(rw);class rS{constructor(t){this.maxMilliseconds=t,this.frameStart=0}beginFrame(){this.frameStart=Date.now()}allowedToUpload(){return Date.now()-this.frameStart<this.maxMilliseconds}}class rR extends p{constructor(t,e=!0){super(t[0]instanceof u.xE?t[0]:t[0].texture),this._textures=null,this._durations=null,this._autoUpdate=e,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=t}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(u.vB.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(u.vB.shared.add(this.update,this,u.uF.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=this.animationSpeed*t,r=this.currentFrame;if(null!==this._durations){let r=this._currentTime%1*this._durations[this.currentFrame];for(r+=e/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];let i=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<r||this.animationSpeed<0&&this.currentFrame>r)&&this.onLoop(),this.updateTexture())}updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let r=0;r<t.length;++r)e.push(u.xE.from(t[r]));return new rR(e)}static fromImages(t){let e=[];for(let r=0;r<t.length;++r)e.push(u.xE.from(t[r]));return new rR(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof u.xE)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(u.vB.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(u.vB.shared.add(this.update,this),this._isConnectedToTicker=!0))}}let rI=new u.E9;class rC extends p{constructor(t,e=100,r=100){super(t),this.tileTransform=new u.wx,this._width=e,this._height=r,this.uvMatrix=this.texture.uvMatrix||new u.UX(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(t){let e=this._texture;e&&e.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){let t=-(this._width*this._anchor._x),e=-(this._height*this._anchor._y),r=this._width*(1-this._anchor._x),i=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,r,i)}getLocalBounds(t){return 0===this.children.length?(this._bounds.minX=-(this._width*this._anchor._x),this._bounds.minY=-(this._height*this._anchor._y),this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new u.Ae),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,rI);let e=this._width,r=this._height,i=-e*this.anchor._x;if(rI.x>=i&&rI.x<i+e){let t=-r*this.anchor._y;if(rI.y>=t&&rI.y<t+r)return!0}return!1}destroy(t){super.destroy(t),this.tileTransform=null,this.uvMatrix=null}static from(t,e){return new rC(t instanceof u.xE?t:u.xE.from(t,e),e.width,e.height)}get width(){return this._width}set width(t){this._width=t}get height(){return this._height}set height(t){this._height=t}}var rP=`#version 300 es 966#define SHADER_NAME Tiling-Sprite-100 967 968precision lowp float; 969 970in vec2 vTextureCoord; 971 972out vec4 fragmentColor; 973 974uniform sampler2D uSampler; 975uniform vec4 uColor; 976uniform mat3 uMapCoord; 977uniform vec4 uClampFrame; 978uniform vec2 uClampOffset; 979 980void main(void) 981{ 982 vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord); 983 coord = (uMapCoord * vec3(coord, 1.0)).xy;
984 vec2 unclamped = coord; 985 coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); 986 987 vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0 988 989 fragmentColor = texSample * uColor; 990} 991`,rM=`#version 300 es 992#define SHADER_NAME Tiling-Sprite-300 993 994precision lowp float; 995 996in vec2 aVertexPosition; 997in vec2 aTextureCoord; 998 999uniform mat3 projectionMatrix; 1000uniform mat3 translationMatrix; 1001uniform mat3 uTransform; 1002 1003out vec2 vTextureCoord; 1004 1005void main(void) 1006{ 1007 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); 1008 1009 vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy; 1010} 1011`,rD=`#version 100 1012#ifdef GL_EXT_shader_texture_lod 1013 #extension GL_EXT_shader_texture_lod : enable 1014#endif 1015#define SHADER_NAME Tiling-Sprite-100 1016 1017precision lowp float; 1018 1019varying vec2 vTextureCoord; 1020 1021uniform sampler2D uSampler; 1022uniform vec4 uColor; 1023uniform mat3 uMapCoord; 1024uniform vec4 uClampFrame; 1025uniform vec2 uClampOffset; 1026 1027void main(void) 1028{ 1029 vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord); 1030 coord = (uMapCoord * vec3(coord, 1.0)).xy; 1031 vec2 unclamped = coord; 1032 coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); 1033 1034 #ifdef GL_EXT_shader_texture_lod 1035 vec4 texSample = unclamped == coord 1036 ? texture2D(uSampler, coord) 1037 : texture2DLodEXT(uSampler, coord, 0); 1038 #else 1039 vec4 texSample = texture2D(uSampler, coord); 1040 #endif 1041 1042 gl_FragColor = texSample * uColor; 1043} 1044`,rB=`#version 100 1045#define SHADER_NAME Tiling-Sprite-100 1046 1047precision lowp float; 1048 1049attribute vec2 aVertexPosition; 1050attribute vec2 aTextureCoord; 1051 1052uniform mat3 projectionMatrix; 1053uniform mat3 translationMatrix; 1054uniform mat3 uTransform; 1055 1056varying vec2 vTextureCoord; 1057 1058void main(void) 1059{ 1060 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1060)).xy, 0.0, 1.0); 1061 1062 vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy; 1063} 1064`,rN=`#version 100 1065#define SHADER_NAME Tiling-Sprite-Simple-100 1066 1067precision lowp float; 1068 1069varying vec2 vTextureCoord; 1070 1071uniform sampler2D uSampler; 1072uniform vec4 uColor; 1073 1074void main(void) 1075{ 1076 vec4 texSample = texture2D(uSampler, vTextureCoord); 1077 gl_FragColor = texSample * uColor; 1078} 1079`;let rF=new u.y3;class rO extends u.bO{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new u.ud,this.state=u.ZM.for2d()}contextChange(){let t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=u.ex.from(rB,rN,e),this.shader=t.context.webGLVersion>1?u.ex.from(rM,rP,e):u.ex.from(rB,rD,e)}render(t){let e=this.renderer,r=this.quad,i=r.vertices;i[0]=i[6]=-(t._width*t.anchor.x),i[1]=i[3]=-(t._height*t.anchor.y),i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);let s=t.uvRespectAnchor?t.anchor.x:0,n=t.uvRespectAnchor?t.anchor.y:0;(i=r.uvs)[0]=i[6]=-s,i[1]=i[3]=-n,i[2]=i[4]=1-s,i[5]=i[7]=1-n,r.invalidate();let a=t._texture,o=a.baseTexture,h=o.alphaMode>0,l=t.tileTransform.localTransform,d=t.uvMatrix,c=o.isPowerOfTwo&&a.frame.width===o.width&&a.frame.height===o.height;c&&(o._glTextures[e.CONTEXT_UID]?c=o.wrapMode!==u.Nt.CLAMP:o.wrapMode===u.Nt.CLAMP&&(o.wrapMode=u.Nt.REPEAT));let f=c?this.simpleShader:this.shader,p=a.width,m=a.height,g=t._width,_=t._height;rF.set(l.a*p/g,l.b*p/_,l.c*m/g,l.d*m/_,l.tx/g,l.ty/_),rF.invert(),c?rF.prepend(d.mapCoord):(f.uniforms.uMapCoord=d.mapCoord.toArray(!0),f.uniforms.uClampFrame=d.uClampFrame,f.uniforms.uClampOffset=d.uClampOffset),f.uniforms.uTransform=rF.toArray(!0),f.uniforms.uColor=u.Il.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,e.shader.bind(f),e.geometry.bind(r),this.state.blendMode=u.P6.correctBlendMode(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}rO.extension={name:"tilingSprite",type:u.nw.RendererPlugin},u.Rw.add(rO);let rL=class t{constructor(t,e,r){this.linkedSheets=[],(t instanceof u.VL||t instanceof u.xE)&&(t={texture:t,data:e,resolutionFilename:r});let{texture:i,data:s,resolutionFilename:n=null,cachePrefix:a=""}=t;this.cachePrefix=a,this._texture=i instanceof u.xE?i:null,this.baseTexture=i instanceof u.VL?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=s;let o=this.baseTexture.resource;this.resolution=this._updateResolution(n||(o?o.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){let{scale:e}=this.data.meta,r=u.P6.getResolutionOfUrl(t,null);return null===r&&(r="number"==typeof e?e:parseFloat(e??"1")),1!==r&&this.baseTexture.setResolution(r),r}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let r=e,i=t.BATCH_SIZE;for(;r-e<i&&r<this._frameKeys.length;){let t=this._frameKeys[r],e=this._frames[t],i=e.frame;if(i){let r=null,s=null,n=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,a=new u.Ae(0,0,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution);r=e.rotated?new u.Ae(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.h)/this.resolution,Math.floor(i.w)/this.resolution):new u.Ae(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(s=new u.Ae(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution)),this.textures[t]=new u.xE(this.baseTexture,r,a,s,e.rotated?2:0,e.anchor,e.borders),u.xE.addToCache(this.textures[t],this.cachePrefix+t.toString())}r++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let i=t[e][r];this.animations[e].push(this.textures[i])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};rL.BATCH_SIZE=1e3;let rU=rL,rk=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],rG={extension:u.nw.Asset,cac
1079he:{test:t=>t instanceof rU,getCacheableAssets:(t,e)=>(function t(e,r,i){let s={};if(e.forEach(t=>{s[t]=r}),Object.keys(r.textures).forEach(t=>{s[`${r.cachePrefix}${t}`]=r.textures[t]}),!i){let i=u.P6.path.dirname(e[0]);r.linkedSheets.forEach((e,n)=>{Object.assign(s,t([`${i}/${r.data.meta.related_multi_packs[n]}`],e,!0))})}return s})(t,e,!1)},resolver:{test:t=>{let e=t.split("?")[0].split("."),r=e.pop(),i=e.pop();return"json"===r&&rk.includes(i)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(u.Xd.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:u.nw.LoadParser,priority:th.Normal},testParse:async(t,e)=>".json"===u.P6.path.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,r){let i;let{texture:s,imageFilename:n,cachePrefix:a}=e?.data??{},o=u.P6.path.dirname(e.src);if(o&&o.lastIndexOf("/")!==o.length-1&&(o+="/"),s&&s.baseTexture)i=s;else{let s=t0(o+(n??t.meta.image),e.src);i=(await r.load([s]))[s]}let h=new rU({texture:i.baseTexture,data:t,resolutionFilename:e.src,cachePrefix:a});await h.parse();let l=t?.meta?.related_multi_packs;if(Array.isArray(l)){let t=[];for(let i of l){if("string"!=typeof i)continue;let s=o+i;e.data?.ignoreMultiPack||(s=t0(s,e.src),t.push(r.load({src:s,data:{ignoreMultiPack:!0}})))}let i=await Promise.all(t);h.linkedSheets=i,i.forEach(t=>{t.linkedSheets=[h].concat(h.linkedSheets.filter(e=>e!==t))})}return h},unload(t){t.destroy(!0)}}};u.Rw.add(rG);class rH{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class rX{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){let e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let t in e){let i=e[t].match(/^[a-z]+/gm)[0],s=e[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),n={};for(let t in s){let e=s[t].split("="),r=e[0],i=e[1].replace(/"/gm,""),a=parseFloat(i),o=isNaN(a)?i:a;n[r]=o}r[i].push(n)}let i=new rH;return r.info.forEach(t=>i.info.push({face:t.face,size:parseInt(t.size,10)})),r.common.forEach(t=>i.common.push({lineHeight:parseInt(t.lineHeight,10)})),r.page.forEach(t=>i.page.push({id:parseInt(t.id,10),file:t.file})),r.char.forEach(t=>i.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)})),r.kerning.forEach(t=>i.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)})),r.distanceField.forEach(t=>i.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType})),i}}class rV{static test(t){return"string"!=typeof t&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){let e=new rH,r=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),s=t.getElementsByTagName("page"),n=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let t=0;t<r.length;t++)e.info.push({face:r[t].getAttribute("face"),size:parseInt(r[t].getAttribute("size"),10)});for(let t=0;t<i.length;t++)e.common.push({lineHeight:parseInt(i[t].getAttribute("lineHeight"),10)});for(let t=0;t<s.length;t++)e.page.push({id:parseInt(s[t].getAttribute("id"),10)||0,file:s[t].getAttribute("file")});for(let t=0;t<n.length;t++){let r=n[t];e.char.push({id:parseInt(r.getAttribute("id"),10),page:parseInt(r.getAttribute("page"),10)||0,x:parseInt(r.getAttribute("x"),10),y:parseInt(r.getAttribute("y"),10),width:parseInt(r.getAttribute("width"),10),height:parseInt(r.getAttribute("height"),10),xoffset:parseInt(r.getAttribute("xoffset"),10),yoffset:parseInt(r.getAttribute("yoffset"),10),xadvance:parseInt(r.getAttribute("xadvance"),10)})}for(let t=0;t<a.length;t++)e.kerning.push({first:parseInt(a[t].getAttribute("first"),10),second:parseInt(a[t].getAttribute("second"),10),amount:parseInt(a[t].getAttribute("amount"),10)});for(let t=0;t<o.length;
1079t++)e.distanceField.push({fieldType:o[t].getAttribute("fieldType"),distanceRange:parseInt(o[t].getAttribute("distanceRange"),10)});return e}}class rW{static test(t){return!!("string"==typeof t&&t.includes("<font>"))&&rV.test(u.Xd.ADAPTER.parseXML(t))}static parse(t){return rV.parse(u.Xd.ADAPTER.parseXML(t))}}let rz=[rX,rV,rW];function r$(t){for(let e=0;e<rz.length;e++)if(rz[e].test(t))return rz[e];return null}function rj(t){return Array.from?Array.from(t):t.split("")}function rY(t){return t.codePointAt?t.codePointAt(0):t.charCodeAt(0)}let rq=class t{constructor(t,e,r){let[i]=t.info,[s]=t.common,[n]=t.page,[a]=t.distanceField,o=u.P6.getResolutionOfUrl(n.file),h={};this._ownsTextures=r,this.font=i.face,this.size=i.size,this.lineHeight=s.lineHeight/o,this.chars={},this.pageTextures=h;for(let r=0;r<t.page.length;r++){let{id:i,file:s}=t.page[r];h[i]=e instanceof Array?e[r]:e[s],a?.fieldType&&"none"!==a.fieldType&&(h[i].baseTexture.alphaMode=u.iw.NO_PREMULTIPLIED_ALPHA,h[i].baseTexture.mipmap=u.KI.OFF)}for(let e=0;e<t.char.length;e++){let{id:r,page:i}=t.char[e],{x:s,y:n,width:a,height:l,xoffset:d,yoffset:c,xadvance:f}=t.char[e];s/=o,n/=o,a/=o,l/=o,d/=o,c/=o,f/=o;let p=new u.Ae(s+h[i].frame.x/o,n+h[i].frame.y/o,a,l);this.chars[r]={xOffset:d,yOffset:c,xAdvance:f,kerning:{},texture:new u.xE(h[i].baseTexture,p),page:i}}for(let e=0;e<t.kerning.length;e++){let{first:r,second:i,amount:s}=t.kerning[e];r/=o,i/=o,s/=o,this.chars[i]&&(this.chars[i].kerning[r]=s)}this.distanceFieldRange=a?.distanceRange,this.distanceFieldType=a?.fieldType?.toLowerCase()??"none"}destroy(){for(let t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(let t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(e,r,i){let s;if(e instanceof rH)s=e;else{let t=r$(e);if(!t)throw Error("Unrecognized data format for font.");s=t.parse(e)}r instanceof u.xE&&(r=[r]);let n=new t(s,r,i);return t.available[n.font]=n,n}static uninstall(e){let r=t.available[e];if(!r)throw Error(`No font found named '${e}'`);r.destroy(),delete t.available[e]}static from(e,r,i){if(!e)throw Error("[BitmapFont] Property `name` is required.");let{chars:s,padding:n,resolution:a,textureWidth:o,textureHeight:h,...l}=Object.assign({},t.defaultOptions,i),d=function(t){"string"==typeof t&&(t=[t]);let e=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];if(Array.isArray(i)){if(2!==i.length)throw Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);let t=i[0].charCodeAt(0),r=i[1].charCodeAt(0);if(r<t)throw Error("[BitmapFont]: Invalid character range.");for(let i=t;i<=r;i++)e.push(String.fromCharCode(i))}else e.push(...rj(i))}if(0===e.length)throw Error("[BitmapFont]: Empty set when resolving characters.");return e}(s),c=r instanceof ra?r:new ra(r),f=new rH;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p=0,m=0,g,_,x,v=0,y=[],b=[];for(let t=0;t<d.length;t++){g||((g=u.Xd.ADAPTER.createCanvas()).width=o,g.height=h,_=g.getContext("2d"),x=new u.VL(g,{resolution:a,...l}),y.push(x),b.push(new u.xE(x)),f.page.push({id:b.length-1,file:""}));let e=d[t],r=ri.measureText(e,c,!1,g),i=r.width,s=Math.ceil(r.height),T=Math.ceil(("italic"===c.fontStyle?2:1)*i);if(m>=h-s*a){if(0===m)throw Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,g=null,_=null,x=null,m=0,p=0,v=0;continue}if(v=Math.max(s+r.fontProperties.descent,v),T*a+p>=o){if(0===p)throw Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,m+=v*a,m=Math.ceil(m),p=0,v=0;continue}!function(t,e,r,i,s,n,a){let o=r.text,h=r.fontProperties;e.translate(i,s),e.scale(n,n);let l=a.strokeThickness/2,d=-(a.strokeThickness/2);if(e.font=a.toFontString(),e.lineWidth=a.strokeThickness,e.textBaseline=a.textBaseline,e.lineJoin=a.lineJoin,e.miterLimit=a.miterLimit,e.fillStyle=function(t,e,r,i,s,n){let a;let o=r.fill;if(!Array.isArray(o))return o;if(1===o.length)return o[0];let h=r.dropShadow?r.dropShadowDistance:0,l=r.padding||0,u=t.width/i-h-2*l,d=t.height/i-h-2*l,c=o.slice(),f=r.fillGradientStops.slice();if(!f.length){let t=c.length+1;for(let e=1;e<t;++e)f.push(e/t)}
1079if(c.unshift(o[0]),f.unshift(0),c.push(o[o.length-1]),f.push(1),r.fillGradientType===rt.LINEAR_VERTICAL){a=e.createLinearGradient(u/2,l,u/2,d+l);let t=0,i=(n.fontProperties.fontSize+r.strokeThickness)/d;for(let e=0;e<s.length;e++){let r=n.lineHeight*e;for(let e=0;e<c.length;e++){let s=Math.max(t,r/d+("number"==typeof f[e]?f[e]:e/c.length)*i);s=Math.min(s,1),a.addColorStop(s,c[e]),t=s}}}else{a=e.createLinearGradient(l,d/2,u+l,d/2);let t=c.length+1,r=1;for(let e=0;e<c.length;e++){let i;i="number"==typeof f[e]?f[e]:r/t,a.addColorStop(i,c[e]),r++}}return a}(t,e,a,n,[o],r),e.strokeStyle=a.stroke,a.dropShadow){let t=a.dropShadowColor,r=a.dropShadowBlur*n,i=a.dropShadowDistance*n;e.shadowColor=u.Il.shared.setValue(t).setAlpha(a.dropShadowAlpha).toRgbaString(),e.shadowBlur=r,e.shadowOffsetX=Math.cos(a.dropShadowAngle)*i,e.shadowOffsetY=Math.sin(a.dropShadowAngle)*i}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;a.stroke&&a.strokeThickness&&e.strokeText(o,l,d+r.lineHeight-h.descent),a.fill&&e.fillText(o,l,d+r.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}(g,_,r,p,m,a,c);let E=rY(r.text);f.char.push({id:E,page:b.length-1,x:p/a,y:m/a,width:T,height:s,xoffset:0,yoffset:0,xadvance:i-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),p+=(T+2*n)*a,p=Math.ceil(p)}if(!i?.skipKerning)for(let t=0,e=d.length;t<e;t++){let r=d[t];for(let t=0;t<e;t++){let e=d[t],i=_.measureText(r).width,s=_.measureText(e).width,n=_.measureText(r+e).width-(i+s);n&&f.kerning.push({first:rY(r),second:rY(e),amount:n})}}let T=new t(f,b,!0);return void 0!==t.available[e]&&t.uninstall(e),t.available[e]=T,T}};rq.ALPHA=[["a","z"],["A","Z"]," "],rq.NUMERIC=[["0","9"]],rq.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],rq.ASCII=[[" ","~"]],rq.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:rq.ALPHANUMERIC},rq.available={};let rK=rq;var rZ=`// Pixi texture info\r 1080varying vec2 vTextureCoord;\r 1081uniform sampler2D uSampler;\r 1082\r 1083// Tint\r 1084uniform vec4 uColor;\r 1085\r 1086// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r 1087uniform float uFWidth;\r 1088\r 1089void main(void) {\r 1090\r 1091 // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r 1092 vec4 texColor = texture2D(uSampler, vTextureCoord);\r 1093\r 1094 // MSDF\r 1095 float median = texColor.r + texColor.g + texColor.b -\r 1096 min(texColor.r, min(texColor.g, texColor.b)) -\r 1097 max(texColor.r, max(texColor.g, texColor.b));\r 1098 // SDF\r 1099 median = min(median, texColor.a);\r 1100\r 1101 float screenPxDistance = uFWidth * (median - 0.5);\r 1102 float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r 1103 if (median < 0.01) {\r 1104 alpha = 0.0;\r 1105 } else if (median > 0.99) {\r 1106 alpha = 1.0;\r 1107 }\r 1108\r 1109 // Gamma correction for coverage-like alpha\r 1110 float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r 1111 float gamma = mix(1.0, 1.0 / 2.2, luma);\r 1112 float coverage = pow(uColor.a * alpha, gamma); \r 1113\r 1114 // NPM Textures, NPM outputs\r 1115 gl_FragColor = vec4(uColor.rgb, coverage);\r 1116}\r 1117`,rQ=`// Mesh material default fragment\r 1118attribute vec2 aVertexPosition;\r 1119attribute vec2 aTextureCoord;\r 1120\r 1121uniform mat3 projectionMatrix;\r 1122uniform mat3 translationMatrix;\r 1123uniform mat3 uTextureMatrix;\r 1124\r 1125varying vec2 vTextureCoord;\r 1126\r 1127void main(void)\r 1128{\r 1129 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1129)).xy, 0.0, 1.0);\r 1130\r 1131 vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r 1132}\r 1133`;let rJ=[],r0=[],r1=[],r2=class t extends d.W2{constructor(e,r={}){super();let{align:i,tint:s,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},t.styleDefaults,r);if(!rK.available[o])throw Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new u.Il(s),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=e,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new u.AB(()=>{this.dirty=!0},this,0,0),this._roundPixels=u.Xd.ROUND_PIXELS,this.dirty=!0,this._resolution=u.Xd.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){let t=rK.available[this._fontName],e=this.fontSize,r=e/t.size,i=new u.E9,s=[],n=[],a=[],o=rj(this._text.replace(/(?:\r\n|\r)/g,` 1134`)||" "),h=this._maxWidth*t.size/e,l="none"===t.distanceFieldType?rJ:r0,d=null,c=0,f=0,p=0,m=-1,g=0,_=0,x=0,v=0;for(let e=0;e<o.length;e++){let r=o[e],l=rY(r);if(/(?:\s)/.test(r)&&(m=e,g=c,v++),"\r"===r||r===` 1135`){n.push(c),a.push(-1),f=Math.max(f,c),++p,++_,i.x=0,i.y+=t.lineHeight,d=null,v=0;continue}let y=t.chars[l];if(!y)continue;d&&y.kerning[d]&&(i.x+=y.kerning[d]);let b=r1.pop()||{texture:u.xE.EMPTY,line:0,charCode:0,prevSpaces:0,position:new u.E9};b.texture=y.texture,b.line=p,b.charCode=l,b.position.x=Math.round(i.x+y.xOffset+this._letterSpacing/2),b.position.y=Math.round(i.y+y.yOffset),b.prevSpaces=v,s.push(b),c=b.position.x+Math.max(y.xAdvance-y.xOffset,y.texture.orig.width),i.x+=y.xAdvance+this._letterSpacing,x=Math.max(x,y.yOffset+y.texture.height),d=l,-1!==m&&h>0&&i.x>h&&(++_,u.P6.removeItems(s,1+m-_,1+e-m),e=m,m=-1,n.push(g),a.push(s.length>0?s[s.length-1].prevSpaces:0),f=Math.max(f,g),p++,i.x=0,i.y+=t.lineHeight,d=null,v=0)}let y=o[o.length-1];"\r"!==y&&y!==` 1136`&&(/(?:\s)/.test(y)&&(c=g),n.push(c),f=Math.max(f,c),a.push(-1));let b=[];for(let t=0;t<=p;t++){let e=0;"right"===this._align?e=f-n[t]:"center"===this._align?e=(f-n[t])/2:"justify"===this._align&&(e=a[t]<0?0:(f-n[t])/a[t]),b.push(e)}let T=s.length,E={},A=[],w=this._activePagesMeshData;l.push(...w);for(let e=0;e<T;e++){let r=s[e].texture,i=r.baseTexture.uid;if(!E[i]){let e=l.pop();if(!e){let r,i;let s=new eq;"none"===t.distanceFieldType?(r=new eQ(u.xE.EMPTY),i=u.T$.NORMAL):(r=new eQ(u.xE.EMPTY,{program:u.$r.from(rQ,rZ),uniforms:{uFWidth:0}}),i=u.T$.NORMAL_NPM);let n=new eY(s,r);n.blendMode=i,e={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:n,vertices:null,uvs:null,indices:null}}e.index=0,e.indexCount=0,e.vertexCount=0,e.uvsCount=0,e.total=0;let{_textureCache:s}=this;s[i]=s[i]||new u.xE(r.baseTexture),e.mesh.texture=s[i],e.mesh.tint=this._tintColor.value,A.push(e),E[i]=e}E[i].total++}for(let t=0;t<w.length;t++)A.includes(w[t])||this.removeChild(w[t].mesh);for(let t=0;t<A.length;t++)A[t].mesh.parent!==this&&this.addChild(A[t].mesh);for(let t in this._activePagesMeshData=A,E){let e=E[t],r=e.total;if(!(e.indices?.length>6*r)||e.vertices.length<2*eY.BATCHABLE_SIZE)e.vertices=new Float32Array(8*r),e.uvs=new Float32Array(8*r),e.indices=new Uint16Array(6*r);else{let t=e.total,r=e.vertices;for(let e=8*t;e<r.length;e++)r[e]=0}e.mesh.size=6*r}for(let t=0;t<T;t++){let e=s[t],i=e.position.x+b[e.line]*("justify"===this._align?e.prevSpaces:1);this._roundPixels&&(i=Math.round(i));let n=i*r,a=e.position.y*r,o=e.texture,h=E[o.baseTexture.uid],l=o.frame,u=o._uvs,d=h.index++;h.indices[6*d+0]=0+4*d,h.indices[6*d+1]=1+4*d,h.indices[6*d+2]=2+4*d,h.indices[6*d+3]=0+4*d,h.indices[6*d+4]=2+4*d,h.indices[6*d+5]=3+4*d,h.vertices[8*d+0]=n,h.vertices[8*d+1]=a,h.vertices[8*d+2]=n+l.width*r,h.vertices[8*d+3]=a,h.vertices[8*d+4]=n+l.width*r,h.vertices[8*d+5]=a+l.height*r,h.vertices[8*d+6]=n,h.vertices[8*d+7]=a+l.height*r,h.uvs[8*d+0]=u.x0,h.uvs[8*d+1]=u.y0,h.uvs[8*d+2]=u.x1,h.uvs[8*d+3]=u.y1,h.uvs[8*d+4]=u.x2,h.uvs[8*d+5]=u.y2,h.uvs[8*d+6]=u.x3,h.uvs[8*d+7]=u.y3}for(let e in this._textWidth=f*r,this._textHeight=(i.y+t.lineHeight)*r,E){let t=E[e];if(0!==this.anchor.x||0!==this.anchor.y){let e=0,r=this._textWidth*this.anchor.x,i=this._textHeight*this.anchor.y;for(let s=0;s<t.total;s++)t.vertices[e++]-=r,t.vertices[e++]-=i,t.vertices[e++]-=r,t.vertices[e++]-=i,t.vertices[e++]-=r,t.vertices[e++]-=i,t.vertices[e++]-=r,t.vertices[e++]-=i}this._maxLineHeight=x*r;let i=t.mesh.geometry.getBuffer("aVertexPosition"),s=t.mesh.geometry.getBuffer("aTextureCoord"),n=t.mesh.geometry.getIndex();i.data=t.vertices,s.data=t.uvs,n.data=t.indices,i.update(),s.update(),n.update()}for(let t=0;t<s.length;t++)r1.push(s[t]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);let{distanceFieldRange:e,distanceFieldType:r,size:i}=rK.available[this._fontName];if("none"!==r){let{a:r,b:s,c:n,d:a}=this.worldTransform,o=(Math.abs(Math.sqrt(r*r+s*s))+Math.abs(Math.sqrt(n*n+a*a)))/2,h=this.fontSize/i,l=t._view.resolution;for(let t of this._activePagesMeshData)t.mesh.shader.uniforms.uFWidth=o*e*
1136h*l}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){let t=rK.available[this._fontName];if(!t)throw Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!rK.available[t])throw Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??rK.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){let{_textureCache:e}=this,r="none"===rK.available[this._fontName].distanceFieldType?rJ:r0;for(let t of(r.push(...this._activePagesMeshData),this._activePagesMeshData))this.removeChild(t.mesh);for(let t in this._activePagesMeshData=[],r.filter(t=>e[t.mesh.texture.baseTexture.uid]).forEach(t=>{t.mesh.texture=u.xE.EMPTY}),e)e[t].destroy(),delete e[t];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};r2.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let r3=r2,r4=[".xml",".fnt"],r5={extension:{type:u.nw.LoadParser,priority:th.Normal},name:"loadBitmapFont",test:t=>r4.includes(u.P6.path.extname(t).toLowerCase()),testParse:async t=>rX.test(t)||rW.test(t),async parse(t,e,r){let i=rX.test(t)?rX.parse(t):rW.parse(t),{src:s}=e,{page:n}=i,a=[];for(let t=0;t<n.length;++t){let e=n[t].file,r=u.P6.path.join(u.P6.path.dirname(s),e);r=t0(r,s),a.push(r)}let o=await r.load(a),h=a.map(t=>o[t]);return rK.install(i,h,!0)},load:async(t,e)=>(await u.Xd.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};u.Rw.add(r5);let r6=class t extends ra{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new t(Object.keys(t.defaultOptions).reduce((t,r)=>({...t,[r]:e[r]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(e=>{URL.revokeObjectURL(e.src),e.refs--,0===e.refs&&(e.fontFace&&document.fonts.delete(e.fontFace),delete t.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,r={}){let{availableFonts:i}=t;if(i[e]){let t=i[e];return this._fonts.push(t),t.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return u.Xd.ADAPTER.fetch(e).then(t=>t.blob()).then(async t=>new Promise((e,r)=>{let i=URL.createObjectURL(t),s=new FileReader;s.onload=()=>e([i,s.result]),s.onerror=r,s.readAsDataURL(t)})).then(async([t,s])=>{let n=Object.assign({family:u.P6.path.basename(e,u.P6.path.extname(e)),weight:"normal",style:"normal",display:"auto",src:t,dataSrc:s,refs:1,originalUrl:e,fontFace:null},r);i[e]=n,this._fonts.push(n),this.styleID++;let a=new FontFace(n.family,`url(${n.src})`,{weight:n.weight,style:n.style,display:n.display});n.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){let e=t.filter(t=>!this._overrides.includes(t));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){let e=t.filter(t=>this._overrides.includes(t));e.length>0&&(this._overrides=this._overrides.filter(t=>!e.includes(t)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t} 1137 @font-face { 1138 font-family: "${e.family}"; 1139 src: url('${e.dataSrc}');
1140 font-weight: ${e.weight}; 1141 font-style: ${e.style}; 1142 font-display: ${e.display}; 1143 }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=u.P6.rgb2hex(t)),"number"==typeof t?u.P6.hex2string(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor),e=this.dropShadowAlpha,r=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(255*e|0).toString(16).padStart(2,"0"));let s=`${r}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${s} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${s} ${t}`}reset(){Object.assign(this,t.defaultOptions)}onBeforeDraw(){let{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(t=>setTimeout(t,100)):Promise.resolve()}get isSafari(){let{userAgent:t}=u.Xd.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};r6.availableFonts={},r6.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let r8=r6,r7=class t extends p{constructor(e="",r={}){super(u.xE.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;let i=new Image,s=u.xE.from(i,{scaleMode:u.Xd.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new u.Ae,s.trim=new u.Ae,this.texture=s;let n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",o=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),d=document.createElementNS(a,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",o.appendChild(h),this.maxWidth=t.defaultMaxWidth,this.maxHeight=t.defaultMaxHeight,this._domElement=l,this._styleElement=d,this._svgRoot=o,this._foreignObject=h,this._foreignObject.appendChild(d),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=t.defaultAutoResolution,this._resolution=t.defaultResolution??u.Xd.RESOLUTION,this.text=e,this.style=r}measureText(t){let{text:e,style:r,resolution:i}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:r.toCSS(i)}),this._styleElement.textContent=r.toGlobalCSS(),document.body.appendChild(this._svgRoot);let s=this._domElement.getBoundingClientRect();this._svgRoot.remove();let{width:n,height:a}=s;(n>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");let o=Math.min(this.maxWidth,Math.ceil(n)),h=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",h.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),r!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(i)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:o+2*r.padding,height:h+2*r.padding}}async updateText(t=!0){let{style:e,_image:r,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;let{width:s,height:n}=this.measureText();r.width=i.width=Math.ceil(Math.max(1,s)),r.height=i.height=Math.ceil(Math.max(1,n)),this._updateID++;let a=this._updateID;await new Promise(t=>{i.onload=async()=>
1143{if(a<this._updateID){t();return}await e.onBeforeDraw(),r.src=i.src,i.onload=null,i.src="",this.updateTexture(),t()};let s=new XMLSerializer().serializeToString(this._svgRoot);i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(s)}`})}get source(){return this._image}updateTexture(){let{style:t,texture:e,_image:r,resolution:i}=this,{padding:s}=t,{baseTexture:n}=e;e.trim.width=e._frame.width=r.width/i,e.trim.height=e._frame.height=r.height/i,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-2*s,e.orig.height=e._frame.height-2*s,this._onTextureUpdate(),n.setRealSize(r.width,r.height,i),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},t.defaultDestroyOptions,e),super.destroy(e),this.ownsStyle&&this._style?.cleanFonts(),this._style=null,this._svgRoot?.remove(),this._svgRoot=null,this._domElement?.remove(),this._domElement=null,this._foreignObject?.remove(),this._foreignObject=null,this._styleElement?.remove(),this._styleElement=null,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=null,this._image.src="",this._image=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);let e=u.P6.sign(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);let e=u.P6.sign(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&((t=t||{})instanceof r8?(this.ownsStyle=!1,this._style=t):t instanceof ra?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=r8.from(t)):(this.ownsStyle=!0,this._style=new r8(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(""===t||null==t?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};r7.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},r7.defaultMaxWidth=2024,r7.defaultMaxHeight=2024,r7.defaultAutoResolution=!0;let r9=r7}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.