Files
GdevelopMMOTestv1/Export/pixi-renderers/pixi.js
T

1109 lines
478 KiB
JavaScript
Raw Normal View History

2026-07-28 10:47:32 -04:00
/*!
* pixi.js-legacy - v7.4.2
* Compiled Wed, 20 Mar 2024 19:55:28 UTC
*
* pixi.js-legacy is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var PIXI=function(v){"use strict";var be=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(be||{}),cr=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(cr||{}),dr=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(dr||{}),C=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(C||{}),Ot=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ot||{}),P=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(P||{}),Me=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Me||{}),$=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))($||{}),k=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(k||{}),Bt=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Bt||{}),Zt=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Zt||{}),Ht=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ht||{}),wt=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(wt||{}),Vt=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Vt||{}),fr=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(fr||{}),Rt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Rt||{}),pt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="
`," "],bc=["{","}","|","\\","^","`"].concat(xc),Oi=["'"].concat(bc),so=["%","/","?",";","#"].concat(Oi),ro=["/","?","#"],Tc=255,io=/^[+a-z0-9A-Z_-]{0,63}$/,Ec=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ac={javascript:!0,"javascript:":!0},Bi={javascript:!0,"javascript:":!0},Ke={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Fi=ms;function _s(r,t,e){if(r&&Qt.isObject(r)&&r instanceof Ft)return r;var s=new Ft;return s.parse(r,t,e),s}Ft.prototype.parse=function(r,t,e){if(!Qt.isString(r))throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var s=r.indexOf("?"),i=s!==-1&&s<r.indexOf("#")?"?":"#",n=r.split(i),a=/\\/g;n[0]=n[0].replace(a,"/"),r=n.join(i);var o=r;if(o=o.trim(),!e&&r.split("#").length===1){var h=yc.exec(o);if(h)return this.path=o,this.href=o,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Fi.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=_c.exec(o);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,o=o.substr(l.length)}if(e||l||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var c=o.substr(0,2)==="//";c&&!(l&&Bi[l])&&(o=o.substr(2),this.slashes=!0)}if(!Bi[l]&&(c||l&&!Ke[l])){for(var d=-1,f=0;f<ro.length;f++){var p=o.indexOf(ro[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=o.lastIndexOf("@"):g=o.lastIndexOf("@",d),g!==-1&&(m=o.slice(0,g),o=o.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<so.length;f++){var p=o.indexOf(so[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=o.length),this.host=o.slice(0,d),o=o.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var x=this.hostname.split(/\./),f=0,y=x.length;f<y;f++){var b=x[f];if(b&&!b.match(io)){for(var T="",S=0,A=b.length;S<A;S++)b.charCodeAt(S)>127?T+="x":T+=b[S];if(!T.match(io)){var w=x.slice(0,f),R=x.slice(f+1),M=b.match(Ec);M&&(w.push(M[1]),R.unshift(M[2])),R.length&&(o="/"+R.join(".")+o),this.hostname=w.join(".");break}}}this.hostname.length>Tc?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=fc.toASCII(this.hostname));var H=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+H,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!Ac[u])for(var f=0,y=Oi.length;f<y;f++){var E=Oi[f];if(o.indexOf(E)!==-1){var I=encodeURIComponent(E);I===E&&(I=escape(E)),o=o.split(E).join(I)}}var V=o.indexOf("#");V!==-1&&(this.hash=o.substr(V),o=o.slice(0,V));var q=o.indexOf("?");if(q!==-1?(this.search=o.substr(q),this.query=o.substr(q+1),t&&(this.query=Fi.parse(this.query)),o=o.slice(0,q)):t&&(this.search="",this.query={}),o&&(this.pathname=o),Ke[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var H=this.pathname||"",j=this.search||"";this.path=H+j}return this.href=this.format(),this};function wc(r){return Qt.isString(r)&&(r=_s(r)),r instanceof Ft?r.format():Ft.prototype.format.call(r)}Ft.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",s=this.hash||"",i=!1,n="";this.host?i=r+this.host:this.hostname&&(i=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&Qt.isObject(this.query)&&Object.keys(this.query).length&&(n=Fi.stringify(this.query));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Ke[t])&&i!==!1?(i="//"+(i||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):i||(i=""),s&&s.charAt(0)!=="#"&&(s="#"+s),a&&a.charAt(0)!=="?"&&(a="?"+a),e=e.replace(/[?#]/g,function(o){return encodeURIComponent(o)}),a=a.replace("#","%23"),t+i+e+a+s};function Sc(r,t){return _s(r,!1,!0).resolve(t)}Ft.prototype.resolve=function(r){return this.resolveObject(_s(r,!1,!0)).format()};function Cc(r,t){return r?_s(r,!1,!0).resolveObject(t):t}Ft.prototype.resolveObject=function(r){if(Qt.isString(r)){var t=new Ft;t.parse(r,!1,!0),r=t}for(var e=new Ft,s=Object.keys(this),i=0;i<s.lengt
Deprecated since v${r}`):(s=s.split(`
`).splice(e).join(`
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
Deprecated since v${r}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
Deprecated since v${r}`),console.warn(s))),no[t]=!0}const Rc={get parse(){return pc},get format(){return gc},get resolve(){return mc}};function zt(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function vs(r){return r.split("?")[0].split("#")[0]}function Ic(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pc(r,t,e){return r.replace(new RegExp(Ic(t),"g"),e)}function Mc(r,t){let e="",s=0,i=-1,n=0,a=-1;for(let o=0;o<=r.length;++o){if(o<r.length)a=r.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||n===1))if(i!==o-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",s=0):(e=e.slice(0,h),s=e.length-1-e.lastIndexOf("/")),i=o,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${r.slice(i+1,o)}`:e=r.slice(i+1,o),s=o-i-1;i=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const gt={toPosix(r){return Pc(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){zt(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(zt(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=vs(this.toPosix(t!=null?t:N.ADAPTER.getBaseUrl())),i=vs(this.toPosix(e!=null?e:this.rootname(s)));return r=this.toPosix(r),r.startsWith("/")?gt.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if(zt(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=Mc(r,!1),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return zt(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){var t;if(r.length===0)return".";let e;for(let s=0;s<r.length;++s){const i=r[s];if(zt(i),i.length>0)if(e===void 0)e=i;else{const n=(t=r[s-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(zt(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let s=-1,i=!0;const n=this.getProtocol(r),a=r;r=r.slice(n.length);for(let o=r.length-1;o>=1;--o)if(t=r.charCodeAt(o),t===47){if(!i){s=o;break}}else i=!1;return s===-1?e?"/":this.isUrl(a)?n+r:n:e&&s===1?"//":n+r.slice(0,s)},rootname(r){zt(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){zt(r),t&&zt(t),r=vs(this.toPosix(r));let e=0,s=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let a=t.length-1,o=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!i){e=n+1;break}}else o===-1&&(i=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=o))}return e===s?s=o:s===-1&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!i){e=n+1;break}}else s===-1&&(i=!1,s=n+1);return s===-1?"":r.slice(e,s)},extname(r){zt(r),r=vs(this.toPosix(r));let t=-1,e=0,s=-1,i=!0,n=0;for(let a=r.length-1;a>=0;--a){const o=r.charCodeAt(a);if(o===47){if(!i){e=a+1;break}continue}s===-1&&(i=!1,s=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){zt(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=vs(this.toPosix(r));let e=r.charCodeAt(0);const s=this.isAbsolute(r);let i;const n="";t.root=this.rootname(r),s||this.hasProtocol(r)?i=1:i=0;let a=-1,o=0,h=-1,l=!0,u=r.length
`);function cd(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Lo(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=ud.replace(/%forloop%/gi,cd(r));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const Ki=0,Zi=1,Qi=2,Ji=3,tn=4,en=5;class ee{constructor(){this.data=0,this.blendMode=C.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ki)}set blend(t){!!(this.data&1<<Ki)!==t&&(this.data^=1<<Ki)}get offsets(){return!!(this.data&1<<Zi)}set offsets(t){!!(this.data&1<<Zi)!==t&&(this.data^=1<<Zi)}get culling(){return!!(this.data&1<<Qi)}set culling(t){!!(this.data&1<<Qi)!==t&&(this.data^=1<<Qi)}get depthTest(){return!!(this.data&1<<Ji)}set depthTest(t){!!(this.data&1<<Ji)!==t&&(this.data^=1<<Ji)}get depthMask(){return!!(this.data&1<<en)}set depthMask(t){!!(this.data&1<<en)!==t&&(this.data^=1<<en)}get clockwiseFrontFace(){return!!(this.data&1<<tn)}set clockwiseFrontFace(t){!!(this.data&1<<tn)!==t&&(this.data^=1<<tn)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==C.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new ee;return t.depthTest=!1,t.blend=!0,t}}const wr=[];function sn(r,t){if(!r)return null;let e="";if(typeof r=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);s&&(e=s[1].toLowerCase())}for(let s=wr.length-1;s>=0;--s){const i=wr[s];if(i.test&&i.test(r,e))return new i(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class Pt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,i,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,s,i,n,a,o,h);return u===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){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Pt.prototype,{dispatch:{value:Pt.prototype.emit},run:{value:Pt.prototype.emit}});class Qe{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Pt("setRealSize"),this.onUpdate=new Pt("update"),this.onError=new Pt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class Ts extends Qe{constructor(t,e){var s;const{width:i,height:n}=e||{};if(!i||!n)throw new Error("BufferResource width or height invalid");super(i,n),this.data=t,this.unpackAlignment=(s=e.unpackAlignment)!=null?s:4}upload(t,e,s){const i=t.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===wt.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?i.
uniform sampler2D uSampler;
void main(void){
gl_FragColor *= texture2D(uSampler, vTextureCoord);
}`,Ad=`attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
void main(void){
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
}
`;function jo(r,t,e){const s=r.createShader(t);return r.shaderSource(s,e),r.compileShader(s),s}function hn(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Xo(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return hn(2*t);case"bvec3":return hn(3*t);case"bvec4":return hn(4*t);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}const ke=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
if(uv["${r}"] !== ud["${r}"].value)
{
ud["${r}"].value = uv["${r}"]
gl.uniform1f(ud["${r}"].location, uv["${r}"])
}
`},{test:(r,t)=>(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(t==null||t.castToBaseTexture!==void 0),code:r=>`t = syncData.textureCount++;
renderer.texture.bind(uv["${r}"], t);
if(ud["${r}"].value !== t)
{
ud["${r}"].value = t;
gl.uniform1i(ud["${r}"].location, t);
; // eslint-disable-line max-len
}`},{test:(r,t)=>r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0,code:r=>`
gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true));
`,codeUbo:r=>`
var ${r}_matrix = uv.${r}.toArray(true);
data[offset] = ${r}_matrix[0];
data[offset+1] = ${r}_matrix[1];
data[offset+2] = ${r}_matrix[2];
data[offset + 4] = ${r}_matrix[3];
data[offset + 5] = ${r}_matrix[4];
data[offset + 6] = ${r}_matrix[5];
data[offset + 8] = ${r}_matrix[6];
data[offset + 9] = ${r}_matrix[7];
data[offset + 10] = ${r}_matrix[8];
`},{test:(r,t)=>r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0,code:r=>`
cv = ud["${r}"].value;
v = uv["${r}"];
if(cv[0] !== v.x || cv[1] !== v.y)
{
cv[0] = v.x;
cv[1] = v.y;
gl.uniform2f(ud["${r}"].location, v.x, v.y);
}`,codeUbo:r=>`
v = uv.${r};
data[offset] = v.x;
data[offset+1] = v.y;
`},{test:r=>r.type==="vec2"&&r.size===1&&!r.isArray,code:r=>`
cv = ud["${r}"].value;
v = uv["${r}"];
if(cv[0] !== v[0] || cv[1] !== v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2f(ud["${r}"].location, v[0], v[1]);
}
`},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0,code:r=>`
cv = ud["${r}"].value;
v = uv["${r}"];
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
{
cv[0] = v.x;
cv[1] = v.y;
cv[2] = v.width;
cv[3] = v.height;
gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height)
}`,codeUbo:r=>`
v = uv.${r};
data[offset] = v.x;
data[offset+1] = v.y;
data[offset+2] = v.width;
data[offset+3] = v.height;
`},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>`
cv = ud["${r}"].value;
v = uv["${r}"];
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
{
cv[0] = v.red;
cv[1] = v.green;
cv[2] = v.blue;
cv[3] = v.alpha;
gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha)
}`,codeUbo:r=>`
v = uv.${r};
data[offset] = v.red;
data[offset+1] = v.green;
data[offset+2] = v.blue;
data[offset+3] = v.alpha;
`},{test:(r,t)=>r.type==="vec3"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>`
cv = ud["${r}"].value;
v = uv["${r}"];
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
{
cv[0] = v.red;
cv[1] = v.green;
cv[2] = v.blue;
gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue)
}`,codeUbo:r=>`
v = uv.${r};
data[offset] = v.red;
data[offset+1] = v.green;
data[offset+2] = v.blue;
`},{test:r=>r.type==="vec4"&&r.size===1&&!r.isArray,code:r=>`
cv = ud["${r}"].value;
v = uv["${r}"];
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
}`}],wd={float:`
if (cv !== v)
{
cu.value = v;
gl.uniform1f(location, v);
}`,vec2:`
if (cv[0] !== v[0] || cv[1] !== v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2f(location, v[0], v[1])
}`,vec3:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3f(location, v[0], v[1], v[2])
}`,vec4:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
}`,int:`
if (cv !== v)
{
cu.value = v;
gl.uniform1i(location, v);
}`,ivec2:`
if (cv[0] !== v[0] || cv[1] !== v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2i(location, v[0], v[1]);
}`,ivec3:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3i(location, v[0], v[1], v[2]);
}`,ivec4:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
}`,uint:`
if (cv !== v)
{
cu.value = v;
gl.uniform1ui(location, v);
}`,uvec2:`
if (cv[0] !== v[0] || cv[1] !== v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2ui(location, v[0], v[1]);
}`,uvec3:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3ui(location, v[0], v[1], v[2]);
}`,uvec4:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
}`,bool:`
if (cv !== v)
{
cu.value = v;
gl.uniform1i(location, v);
}`,bvec2:`
if (cv[0] != v[0] || cv[1] != v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2i(location, v[0], v[1]);
}`,bvec3:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3i(location, v[0], v[1], v[2]);
}`,bvec4:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
}`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:`
if (cv !== v)
{
cu.value = v;
gl.uniform1i(location, v);
}`,samplerCube:`
if (cv !== v)
{
cu.value = v;
gl.uniform1i(location, v);
}`,sampler2DArray:`
if (cv !== v)
{
cu.value = v;
gl.uniform1i(location, v);
}`},Sd={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Cd(r,t){var e;const s=[`
var v = null;
var cv = null;
var cu = null;
var t = 0;
var gl = renderer.gl;
`];for(const i in r.uniforms){const n=t[i];if(!n){((e=r.uniforms[i])==null?void 0:e.group)===!0&&(r.uniforms[i].ubo?s.push(`
renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');
`):s.push(`
renderer.shader.syncUniformGroup(uv.${i}, syncData);
`));continue}const a=r.uniforms[i];let o=!1;for(let h=0;h<ke.length;h++)if(ke[h].test(n,a)){s.push(ke[h].code(i,a)),o=!0;break}if(!o){const h=(n.size===1&&!n.isArray?wd:Sd)[n.type].replace("location",`ud["${i}"].location`);s.push(`
cu = ud["${i}"];
cv = cu.value;
v = uv["${i}"];
${h};`)}}return new Function("ud","uv","renderer","syncData",s.join(`
`))}const zo={};let ws=zo;function Wo(){if(ws===zo||ws!=null&&ws.isContextLost()){const r=N.ADAPTER.createCanvas();let t;N.PREFER_ENV>=be.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),ws=t}return ws}let Or;function Rd(){if(!Or){Or=Rt.MEDIUM;const r=Wo();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Or=t.precision?Rt.HIGH:Rt.MEDIUM)}}return Or}function Yo(r,t){const e=r.getShaderSource(t).split(`
`).map((l,u)=>`${u}: ${l}`),s=r.getShaderInfoLog(t),i=s.split(`
`),n={},a=i.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),o=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(`
`);o[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function Id(r,t,e,s){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Yo(r,e),r.getShaderParameter(s,r.COMPILE_STATUS)||Yo(r,s),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const Pd={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function qo(r){return Pd[r]}let Br=null;const Ko={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 Zo(r,t){if(!Br){const e=Object.keys(Ko);Br={};for(let s=0;s<e.length;++s){const i=e[s];Br[r[i]]=Ko[i]}}return Br[t]}function Qo(r,t,e){if(r.substring(0,9)!=="precision"){let s=t;return t===Rt.HIGH&&e!==Rt.HIGH&&(s=Rt.MEDIUM),`precision ${s} float;
${r}`}else if(e!==Rt.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let Ss;function Jo(){if(typeof Ss=="boolean")return Ss;try{Ss=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch(r){Ss=!1}return Ss}let Md=0;const Fr={},ln=class hs{constructor(t,e,s="pixi-shader",i={}){this.extra={},this.id=Md++,this.vertexSrc=t||hs.defaultVertexSrc,this.fragmentSrc=e||hs.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=i,this.vertexSrc.substring(0,8)!=="#version"&&(s=s.replace(/\s+/g,"-"),Fr[s]?(Fr[s]++,s+=`-${Fr[s]}`):Fr[s]=1,this.vertexSrc=`#define SHADER_NAME ${s}
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${s}
${this.fragmentSrc}`,this.vertexSrc=Qo(this.vertexSrc,hs.defaultVertexPrecision,Rt.HIGH),this.fragmentSrc=Qo(this.fragmentSrc,hs.defaultFragmentPrecision,Rd())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Ad}static get defaultFragmentSrc(){return Ed}static from(t,e,s){const i=t+e;let n=Yi[i];return n||(Yi[i]=n=new hs(t,e,s)),n}};ln.defaultVertexPrecision=Rt.HIGH,ln.defaultFragmentPrecision=Xt.apple.device?Rt.HIGH:Rt.MEDIUM;let se=ln,Dd=0;class Lt{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Dd++,this.static=!!e,this.ubo=!!s,t instanceof dt?(this.buffer=t,this.buffer.type=jt.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new dt(new Float32Array(1)),this.buffer.type=jt.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,s){if(!this.ubo)this.uniforms[t]=new Lt(e,s);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,s){return new Lt(t,e,s)}static uboFrom(t,e){return new Lt(t,e!=null?e:!0,!0)}}class Wt{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Lt?this.uniformGroup=e:this.uniformGroup=new Lt(e):this.uniformGroup=new Lt({}),this.disposeRunner=new Pt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const i=e.uniforms[s];if(i.group===!0&&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,s){const i=se.from(t,e);return new Wt(i,s)}}class th{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const s=new Int32Array(t);for(let n=0;n<t;n++)s[n]=n;this.defaultGroupCache[t]=Lt.from({uSamplers:s},!0);let i=this.fragTemplate;i=i.replace(/%count%/gi,`${t}`),i=i.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new se(this.vertexSrc,i)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new tt,default:this.defaultGroupCache[t]};return new Wt(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
`,e+=`
`;for(let s=0;s<t;s++)s>0&&(e+=`
else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
{`,e+=`
color = texture2D(uSamplers[${s}], vTextureCoord);`,e+=`
}`;return e+=`
`,e+=`
`,e}}class Nr{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function Od(){return!Xt.apple.device}function Bd(r){let t=!0;const e=N.ADAPTER.getNavigator();if(Xt.tablet||Xt.phone){if(Xt.apple.device){const s=e.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(t=!1)}if(Xt.android.device){const s=e.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(t=!1)}}return t?r:4}class Cs{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var Fd=`varying vec2 vTextureCoord;
varying vec4 vColor;
varying float vTextureId;
uniform sampler2D uSamplers[%count%];
void main(void){
vec4 color;
%forloop%
gl_FragColor = color * vColor;
}
`,Nd=`precision highp float;
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
attribute vec4 aColor;
attribute float aTextureId;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform vec4 tint;
varying vec2 vTextureCoord;
varying vec4 vColor;
varying float vTextureId;
void main(void){
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
vTextureId = aTextureId;
vColor = aColor * tint;
}
`;const Rs=class Kt extends Cs{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=nn,this.vertexSize=6,this.state=ee.for2d(),this.size=Kt.defaultBatchSize*4,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),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){var t;return this._defaultMaxTextures=(t=this._defaultMaxTextures)!=null?t:Bd(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){var t;return this._canUploadSameBuffer=(t=this._canUploadSameBuffer)!=null?t:Od(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return this.maxTextures}static get defaultVertexSrc(){return Nd}static get defaultFragmentTemplate(){return Fd}setShaderGenerator({vertex:t=Kt.defaultVertexSrc,fragment:e=Kt.defaultFragmentTemplate}={}){this.shaderGenerator=new th(t,e)}contextChange(){const t=this.renderer.gl;N.PREFER_ENV===be.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Kt.defaultMaxTextures),this.maxTextures=Lo(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=Kt,s=this.size/4,i=Math.floor(s/this.maxTextures)+1;for(;t.length<s;)t.push(new Sr);for(;e.length<i;)e.push(new Nr);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=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(){const{_bufferedTextures:t,maxTextures:e}=this,s=Kt._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++X._globalBatch,h=0,l=s[0],u=0;i.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==o&&(l.count>=e&&(i.boundArray(l,n,o,e),this.buildDrawCalls(l,u,c),u=c,l=s[++h],++o),d._batchEnabled=o,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(i.boundArray(l,n,o,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let c=0;c<n.length;c++)n[c]=null;X._globalBatch=o}buildDrawCalls(t,e,s){const{_bufferedElements:i,_attributeBuffer:n,_indexBuffer:a,vertexSize:o}=this,h=Kt._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<s;++f){const p=i[f],m=p._texture.baseTexture,g=Hi[m.alphaMode?1:0][p.blendMode];i[f]=null,e<f&&d.blend!==g&&(d.size=c-d.start,e=f,d=h[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(p,n,a,u,c),u+=p.vertexData.length/2*o,c+=p.indices.length,d.blend=g}e<s&&(d.size=c-d.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let s=0;s<t.count;s++)e.bind(t.elements[s],t.ids[s]),t.elements[s]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:s}=this;Kt.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flus
uniform sampler2D uSampler;
void main(void){
gl_FragColor = texture2D(uSampler, vTextureCoord);
}
`,Ud=`attribute vec2 aVertexPosition;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
uniform vec4 inputSize;
uniform vec4 outputFrame;
vec4 filterVertexPosition( void )
{
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aVertexPosition * (outputFrame.zw * inputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
}
`;const un=class ar extends Wt{constructor(t,e,s){const i=se.from(t||ar.defaultVertexSrc,e||ar.defaultFragmentSrc);super(i,s),this.padding=0,this.resolution=ar.defaultResolution,this.multisample=ar.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new ee}apply(t,e,s,i,n){t.applyFilter(this,e,s,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 Ud}static get defaultFragmentSrc(){return Ld}};un.defaultResolution=1,un.defaultMultisample=ft.NONE;let Et=un;class Is{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Y(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:i}=t,n=s!=null?s:e;n!==void 0&&(this.color=n),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(){}}Is.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Is.extension={type:[D.RendererSystem,D.CanvasRendererSystem],name:"background"},U.add(Is);class cn{constructor(t){this.renderer=t,this.emptyRenderer=new Cs(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){const{boundTextures:s}=this.renderer.texture;for(let i=e-1;i>=0;--i)t[i]=s[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,s,i){const{elements:n,ids:a,count:o}=t;let h=0;for(let l=0;l<o;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<i&&e[c]===u){a[l]=c;continue}for(;h<i;){const d=e[h];if(d&&d._batchEnabled===s&&d._batchLocation===h){h++;continue}a[l]=h,u._batchLocation=h,e[h]=u;break}}}destroy(){this.renderer=null}}cn.extension={type:D.RendererSystem,name:"batch"},U.add(cn);let eh=0;class Ps{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=eh++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,s=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:s,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=eh++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let s;if(N.PREFER_ENV>=be.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getEx
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform sampler2D mask;
uniform float alpha;
uniform float npmAlpha;
uniform vec4 maskClamp;
void main(void)
{
float clip = step(3.5,
step(maskClamp.x, vMaskCoord.x) +
step(maskClamp.y, vMaskCoord.y) +
step(vMaskCoord.x, maskClamp.z) +
step(vMaskCoord.y, maskClamp.w));
vec4 original = texture2D(uSampler, vTextureCoord);
vec4 masky = texture2D(mask, vMaskCoord);
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
original *= (alphaMul * masky.r * alpha * clip);
gl_FragColor = original;
}
`,$d=`attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 otherMatrix;
varying vec2 vMaskCoord;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
}
`;class oh extends Et{constructor(t,e,s){let i=null;typeof t!="string"&&e===void 0&&s===void 0&&(i=t,t=void 0,e=void 0,s=void 0),super(t||$d,e||Gd,s),this.maskSprite=i,this.maskMatrix=new tt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,s,i){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new $r(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=a,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,t.applyFilter(this,e,s,i))}}class hh{constructor(t=null){this.type=pt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Et.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=pt.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 bn{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 s=e;if(!s.isMaskData){const n=this.maskDataPool.pop()||new hh;n.pooled=!0,n.maskObject=e,s=n}const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(s.copyCountersOrReset(i),s._colorMask=i?i._colorMask:15,s.autoDetect&&this.detect(s),s._target=t,s.type!==pt.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case pt.SCISSOR:this.renderer.scissor.push(s);break;case pt.STENCIL:this.renderer.stencil.push(s);break;case pt.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case pt.COLOR:this.pushColorMask(s);break;default:break}s.type===pt.SPRITE&&this.maskStack.push(s)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case pt.SCISSOR:this.renderer.scissor.pop(e);break;case pt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case pt.SPRITE:this.popSpriteMask(e);break;case pt.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const s=this.maskStack[this.maskStack.length-1];s.type===pt.SPRITE&&s._filters&&(s._filters[0].maskSprite=s.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=pt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=pt.SCISSOR:t.type=pt.STENCIL:t.type=pt.COLOR}pushSpriteMask(t){const{maskObject:e}=t,s=t._target;let i=t._filters;i||(i=this.alphaMaskPool[this.alphaMaskIndex],i||(i=this.alphaMaskPool[this.alphaMaskIndex]=[new oh])),i[0].resolution=t.resolution,i[0].multisample=t.multisample,i[0].maskSprite=e;const n=s.filterArea;s.filterArea=e.getBounds(!0),this.renderer.filter.push(s,i),s.filterArea=n,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){const e=t._colorMask,s=t._colorMask=e&t.colorMask;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}popColorMask(t){const e=t._colorMask,s=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}bn.extension={type:D.RendererSystem,name:"mask"},U.add(bn);class
data[offset] = v;
`,vec2:`
data[offset] = v[0];
data[offset+1] = v[1];
`,vec3:`
data[offset] = v[0];
data[offset+1] = v[1];
data[offset+2] = v[2];
`,vec4:`
data[offset] = v[0];
data[offset+1] = v[1];
data[offset+2] = v[2];
data[offset+3] = v[3];
`,mat2:`
data[offset] = v[0];
data[offset+1] = v[1];
data[offset+4] = v[2];
data[offset+5] = v[3];
`,mat3:`
data[offset] = v[0];
data[offset+1] = v[1];
data[offset+2] = v[2];
data[offset + 4] = v[3];
data[offset + 5] = v[4];
data[offset + 6] = v[5];
data[offset + 8] = v[6];
data[offset + 9] = v[7];
data[offset + 10] = v[8];
`,mat4:`
for(var i = 0; i < 16; i++)
{
data[offset + i] = v[i];
}
`},vh={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:16*2,mat3:16*3,mat4:16*4};function yh(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,i=0;for(let n=0;n<t.length;n++){const a=t[n];if(e=vh[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const o=s%e%16;s+=o,i+=o}s+e>16?(i=Math.ceil(i/16)*16,a.offset=i,i+=e,s=e):(a.offset=i,s+=e,i+=e)}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}function xh(r,t){const e=[];for(const s in r)t[s]&&e.push(t[s]);return e.sort((s,i)=>s.index-i.index),e}function bh(r,t){if(!r.autoManage)return{size:0,syncFunc:qd};const e=xh(r.uniforms,t),{uboElements:s,size:i}=yh(e),n=[`
var v = null;
var v2 = null;
var cv = null;
var t = 0;
var gl = renderer.gl
var index = 0;
var data = buffer.data;
`];for(let a=0;a<s.length;a++){const o=s[a],h=r.uniforms[o.data.name],l=o.data.name;let u=!1;for(let c=0;c<ke.length;c++){const d=ke[c];if(d.codeUbo&&d.test(o.data,h)){n.push(`offset = ${o.offset/4};`,ke[c].codeUbo(o.data.name,h)),u=!0;break}}if(!u)if(o.data.size>1){const c=qo(o.data.type),d=Math.max(vh[o.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(`
cv = ud.${l}.value;
v = uv.${l};
offset = ${o.offset/4};
t = 0;
for(var i=0; i < ${o.data.size*d}; i++)
{
for(var j = 0; j < ${f}; j++)
{
data[offset++] = v[t++];
}
offset += ${p};
}
`)}else{const c=Kd[o.data.type];n.push(`
cv = ud.${l}.value;
v = uv.${l};
offset = ${o.offset/4};
${c};
`)}}return n.push(`
renderer.buffer.update(buffer);
`),{size:i,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
`))}}let Zd=0;const Hr={textureCount:0,uboCount:0};class Cn{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=Zd++}systemCheck(){if(!Jo())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,i=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(i.program)),e||(Hr.textureCount=0,Hr.uboCount=0,this.syncUniformGroup(t.uniformGroup,Hr)),i}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Cd(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const i=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),i(s.uniformData,t.uniforms,this.renderer,Hr,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:i}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=bh(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const a in i)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,i=_h(e,s);return s.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}}Cn.extension={type:D.RendererSystem,name:"shader"},U.add(Cn);class Ds{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Ds.defaultOptions={hello:!1},Ds.extension={type:[D.RendererSystem,D.CanvasRendererSystem],name:"startup"},U.add(Ds);function Qd(r,t=[]){return t[C.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.ADD]=[r.ONE,r.ONE],t[C.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.NONE]=[0,0],t[C.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
}`,df=`attribute vec2 aVertexPosition;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
uniform vec4 inputSize;
uniform vec4 outputFrame;
vec4 filterVertexPosition( void )
{
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aVertexPosition * (outputFrame.zw * inputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
}
`;const Ih=cf,On=df;class Bn{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}e>=ft.HIGH?this.multisample=ft.HIGH:e>=ft.MEDIUM?this.multisample=ft.MEDIUM:e>=ft.LOW?this.multisample=ft.LOW:this.multisample=ft.NONE}destroy(){}}Bn.extension={type:D.RendererSystem,name:"_multisample"},U.add(Bn);class ff{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Fn{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:i,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||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{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),s&&(e||i.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;s<e.length;s++)this.dispose(this.managedBuffers[e[s]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:s}=this;return t._glBuffers[e]=new ff(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Fn.extension={type:D.RendererSystem,name:"buffer"},U.add(Fn);class Nn{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let i,n,a,o;if(e&&(i=e.renderTexture,n=e.clear,a=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!i,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=a,!s.context.isLost){if(i||(this.lastObjectRendered=t),!o){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}s.renderTexture.bind(i),s.batch.currentRenderer.start(),(n!=null?n:s.background.clearBeforeRender)&&s.renderTexture.clear(),t.render(s),s.batch.currentRenderer.flush(),i&&(e.blit&&s.framebuffer.blit(),i.baseTexture.update()),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Nn.extension={type:D.RendererSystem,name:"objectRenderer"},U.add(Nn);const Xr=class wa extends Rn{constructor(t){super(),this.type=cr.WEBGL,t=Object.assign({},N.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Lt({projectionMatrix:new tt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:wa.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=wa.__plugins,this.optio
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
in vec2 vTextureCoord;
out vec4 fragmentColor;
uniform sampler2D uSampler;
uniform vec4 uColor;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
void main(void)
{
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
fragmentColor = texSample * uColor;
}
`,Af=`#version 300 es
#define SHADER_NAME Tiling-Sprite-300
precision lowp float;
in vec2 aVertexPosition;
in vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTransform;
out vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
}
`,wf=`#version 100
#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#endif
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 uColor;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
void main(void)
{
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
#ifdef GL_EXT_shader_texture_lod
vec4 texSample = unclamped == coord
? texture2D(uSampler, coord)
: texture2DLodEXT(uSampler, coord, 0);
#else
vec4 texSample = texture2D(uSampler, coord);
#endif
gl_FragColor = texSample * uColor;
}
`,Nh=`#version 100
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTransform;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
}
`,Sf=`#version 100
#define SHADER_NAME Tiling-Sprite-Simple-100
precision lowp float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 uColor;
void main(void)
{
vec4 texSample = texture2D(uSampler, vTextureCoord);
gl_FragColor = texSample * uColor;
}
`;const Kr=new tt;class zn extends Cs{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new mn,this.state=ee.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Wt.from(Nh,Sf,e),this.shader=t.context.webGLVersion>1?Wt.from(Af,Ef,e):Wt.from(Nh,wf,e)}render(t){const e=this.renderer,s=this.quad;let i=s.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);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;i=s.uvs,i[0]=i[6]=-n,i[1]=i[3]=-a,i[2]=i[4]=1-n,i[5]=i[7]=1-a,s.invalidate();const o=t._texture,h=o.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==Zt.CLAMP:h.wrapMode===Zt.CLAMP&&(h.wrapMode=Zt.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,_=t._height;Kr.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),Kr.invert(),d?Kr.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=Kr.toArray(!0),f.uniforms.uColor=Y.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=Vi(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}zn.extension={name:"tilingSprite",type:D.RendererPlugin},U.add(zn);const Zr=new tt,Gs=new tt,ie=[new K,new K,new K,new K];qr.prototype._renderCanvas=function(r){const t=this._texture;if(!t.baseTexture.valid)return;const e=r.canvasContext.activeContext,s=this.worldTransform,i=t.baseTexture,n=i.getDrawableSource(),a=i.resolution;if(this._textureID!==this._texture._updateID||this._cachedTint!==this.tintValue){this._textureID=this._texture._updateID;const d=new bs(t._frame.width,t._frame.height,a);this.tintValue!==16777215?(this._tintedCanvas=_t.getTintedCanvas(this,this.tintValue),d.context.drawImage(this._tintedCanvas,0,0)):d.context.drawImage(n,-t._frame.x*a,-t._frame.y*a),this._cachedTint=this.tintValue,this._canvasPattern=d.context.createPattern(d.canvas,"repeat")}e.globalAlpha=this.worldAlpha,r.canvasContext.setBlendMode(this.blendMode),this.tileTransform.updateLocalTransform();const o=this.tileTransform.localTransform,h=this._width,l=this._height;Zr.identity(),Gs.copyFrom(o),this.uvRespectAnchor||Gs.translate(-this.anchor.x*h,-this.anchor.y*l),Gs.scale(1/a,1/a),Zr.prepend(Gs),Zr.prepend(s),r.canvasContext.setContextTransform(Zr),e.fillStyle=this._canvasPattern;const u=this.anchor.x*-h,c=this.anchor.y*-l;ie[0].set(u,c),ie[1].set(u+h,c),ie[2].set(u+h,c+l),ie[3].set(u,c+l);for(let d=0;d<4;d++)Gs.applyInverse(ie[d],ie[d]);e.beginPath(),e.moveTo(ie[0].x,ie[0].y);for(let d=1;d<4;d++)e.lineTo(ie[d].x,ie[d].y);e.closePath(),e.fill()};class Lh extends Ct{constructor(t=1500,e,s=16384,i=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=C.NORMAL,this.autoResize=i,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new Y(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.c
varying vec4 vColor;
uniform sampler2D uSampler;
void main(void){
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
gl_FragColor = color;
}`,Rf=`attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
attribute vec4 aColor;
attribute vec2 aPositionCoord;
attribute float aRotation;
uniform mat3 translationMatrix;
uniform vec4 uColor;
varying vec2 vTextureCoord;
varying vec4 vColor;
void main(void){
float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
vec2 v = vec2(x, y);
v = v + aPositionCoord;
gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
vColor = aColor * uColor;
}
`;class Wn extends Cs{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new tt,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:$.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Wt.from(Rf,Cf,{}),this.state=ee.for2d()}render(t){const e=t.children,s=t._maxSize,i=t._batchSize,n=this.renderer;let a=e.length;if(a===0)return;a>s&&!t.autoResize&&(a=s);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=Vi(t.blendMode,l),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=Y.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;f<a;f+=i,p+=1){let m=a-f;m>i&&(m=i),p>=o.length&&o.push(this._generateOneMoreBuffer(t));const g=o[p];g.uploadDynamic(e,f,m);const _=t._bufferUpdateIDs[p]||0;d=d||g._updateID<_,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,m*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,i=t._batchSize,n=t._properties;for(let a=0;a<s;a+=i)e.push(new Uh(this.properties,n,i));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new Uh(this.properties,s,e)}uploadVertices(t,e,s,i,n,a){let o=0,h=0,l=0,u=0;for(let c=0;c<s;++c){const d=t[e+c],f=d._texture,p=d.scale.x,m=d.scale.y,g=f.trim,_=f.orig;g?(h=g.x-d.anchor.x*_.width,o=h+g.width,u=g.y-d.anchor.y*_.height,l=u+g.height):(o=_.width*(1-d.anchor.x),h=_.width*-d.anchor.x,l=_.height*(1-d.anchor.y),u=_.height*-d.anchor.y),i[a]=h*p,i[a+1]=u*m,i[a+n]=o*p,i[a+n+1]=u*m,i[a+n*2]=o*p,i[a+n*2+1]=l*m,i[a+n*3]=h*p,i[a+n*3+1]=l*m,a+=n*4}}uploadPosition(t,e,s,i,n,a){for(let o=0;o<s;o++){const h=t[e+o].position;i[a]=h.x,i[a+1]=h.y,i[a+n]=h.x,i[a+n+1]=h.y,i[a+n*2]=h.x,i[a+n*2+1]=h.y,i[a+n*3]=h.x,i[a+n*3+1]=h.y,a+=n*4}}uploadRotation(t,e,s,i,n,a){for(let o=0;o<s;o++){const h=t[e+o].rotation;i[a]=h,i[a+n]=h,i[a+n*2]=h,i[a+n*3]=h,a+=n*4}}uploadUvs(t,e,s,i,n,a){for(let o=0;o<s;++o){const h=t[e+o]._texture._uvs;h?(i[a]=h.x0,i[a+1]=h.y0,i[a+n]=h.x1,i[a+n+1]=h.y1,i[a+n*2]=h.x2,i[a+n*2+1]=h.y2,i[a+n*3]=h.x3,i[a+n*3+1]=h.y3,a+=n*4):(i[a]=0,i[a+1]=0,i[a+n]=0,i[a+n+1]=0,i[a+n*2]=0,i[a+n*2+1]=0,i[a+n*3]=0,i[a+n*3+1]=0,a+=n*4)}}uploadTint(t,e,s,i,n,a){for(let o=0;o<s;++o){const h=t[e+o],l=Y.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);i[a]=l,i[a+n]=l,i[a+n*2]=l,i[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Wn.extension={name:"particle",type:D.RendererPlugin},U.add(Wn),Lh.prototype.renderCanvas=function(r){if(!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable)return;const t=r.canvasContext.activeContext,e=this.worldTransform;let s=!0,i=0,n=0,a=0,o=0;r.canvasContext.setBlendMode(this.blendMode),t.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(let h=0;h<this.children.length;++h){const l=this.children[h];if(!l.visible||!l._texture.valid)continue;const u=l._texture.frame;if(t.globalAlpha=this.worldAlpha*l.alpha,l.rotation%(Math.PI*2)===0)s&&(r.canvasContext.setContextTransform(e,!1,1),s=!1),i=l.anchor.x*(-u.width*l.scale.x)+l.position.x+.5,n=l.anchor.y*(-u.height*l.scale.y)+l.position.y+.5,a=u.width*l.scale.x,o=u.height*l.scale.y;else{s||(s=!0),l.displayObjectUpdateTransform();const f=l.worldTransform;r.canvasContext.setContextTransform(f,this.roundPixels,1),i=l.anchor.x*-u.width+.5,n=l.anchor.y*-u.height+.5,a
`:t,t}static getFromCache(t,e,s,i){let n=s[t];return typeof n!="number"&&(n=G._measureText(t,e,i)+e,s[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!G.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:G._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:G._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let i=0;i<t.length;i++){const n=t[i],a=t[i+1];if(G.isBreakingSpace(n,a)||G.isNewline(n)){s!==""&&(e.push(s),s=""),e.push(n);continue}s+=n}return s!==""&&e.push(s),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,i,n){return!0}static wordWrapSplit(t){return G.graphemeSegmenter(t)}static measureFont(t){if(G._fonts[t])return G._fonts[t];const e={ascent:0,descent:0,fontSize:0},s=G._canvas,i=G._context;i.font=t;const n=G.METRICS_STRING+G.BASELINE_SYMBOL,a=Math.ceil(i.measureText(n).width);let o=Math.ceil(i.measureText(G.BASELINE_SYMBOL).width);const h=Math.ceil(G.HEIGHT_MULTIPLIER*o);if(o=o*G.BASELINE_MULTIPLIER|0,a===0||h===0)return G._fonts[t]=e,e;s.width=a,s.height=h,i.fillStyle="#f00",i.fillRect(0,0,a,h),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(n,0,o);const l=i.getImageData(0,0,a,h).data,u=l.length,c=a*4;let d=0,f=0,p=!1;for(d=0;d<o;++d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=c;else break}for(e.ascent=o-d,f=u-c,p=!1,d=h;d>o;--d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=c;else break}return e.descent=d-o,e.fontSize=e.ascent+e.descent,G._fonts[t]=e,e}static clearMetrics(t=""){t?delete G._fonts[t]:G._fonts={}}static get _canvas(){if(!G.__canvas){let t;try{const e=new OffscreenCanvas(0,0),s=e.getContext("2d",Qr);if(s!=null&&s.measureText)return G.__canvas=e,e;t=N.ADAPTER.createCanvas()}catch(e){t=N.ADAPTER.createCanvas()}t.width=t.height=10,G.__canvas=t}return G.__canvas}static get _context(){return G.__context||(G.__context=G._canvas.getContext("2d",Qr)),G.__context}};ne.METRICS_STRING="|\xC9q\xC5",ne.BASELINE_SYMBOL="M",ne.BASELINE_MULTIPLIER=1.4,ne.HEIGHT_MULTIPLIER=2,ne.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),ne.experimentalLetterSpacing=!1,ne._fonts={},ne._newlines=[10,13],ne._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let ge=ne;const If=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],kh=class hr{constructor(t){this.styleID=0,this.reset(),qn(this,t,t)}clone(){const t={};return qn(t,this,hr.defaultStyle),new hr(t)}reset(){qn(this,hr.defaultStyle,hr.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){const e=Yn(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){const e=Yn(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._f
uniform sampler2D uSampler;
uniform float uAlpha;
void main(void)
{
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
}
`;class Hh extends Et{constructor(t=1){super(Ih,Of,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Bf={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]},Ff=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
`);function Nf(r){const t=Bf[r],e=t.length;let s=Ff,i="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let o=0;o<r;o++){let h=n.replace("%index%",o.toString());a=o,o>=e&&(a=r-o-1),h=h.replace("%value%",t[a].toString()),i+=h,i+=`
`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}const Lf=`
attribute vec2 aVertexPosition;
uniform mat3 projectionMatrix;
uniform float strength;
varying vec2 vBlurTexCoords[%size%];
uniform vec4 inputSize;
uniform vec4 outputFrame;
vec4 filterVertexPosition( void )
{
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aVertexPosition * (outputFrame.zw * inputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vec2 textureCoord = filterTextureCoord();
%blur%
}`;function Uf(r,t){const e=Math.ceil(r/2);let s=Lf,i="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a<r;a++){let o=n.replace("%index%",a.toString());o=o.replace("%sampleIndex%",`${a-(e-1)}.0`),i+=o,i+=`
`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}class ti extends Et{constructor(t,e=8,s=4,i=Et.defaultResolution,n=5){const a=Uf(n,t),o=Nf(n);super(a,o),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=s,this.blur=e}apply(t,e,s,i){if(s?this.horizontal?this.uniforms.strength=1/s.width*(s.width/e.width):this.uniforms.strength=1/s.height*(s.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,this.passes===1)t.applyFilter(this,e,s,i);else{const n=t.getFilterTexture(),a=t.renderer;let o=e,h=n;this.state.blend=!1,t.applyFilter(this,o,h,Vt.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(o,Vt.BLIT),this.uniforms.uSampler=h;const u=h;h=o,o=u,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,h,s,i),t.returnFilterTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class Vh extends Et{constructor(t=8,e=4,s=Et.defaultResolution,i=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new ti(!0,t,e,s,i),this.blurYFilter=new ti(!1,t,e,s,i),this.resolution=s,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,s,i){const n=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(n&&a){const o=t.getFilterTexture();this.blurXFilter.apply(t,e,o,Vt.CLEAR),this.blurYFilter.apply(t,o,s,i),t.returnFilterTexture(o)}else a?this.blurYFilter.apply(t,e,s,i):this.blurXFilter.apply(t,e,s,i)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}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 kf=`varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform float m[20];
uniform float uAlpha;
void main(void)
{
vec4 c = texture2D(uSampler, vTextureCoord);
if (uAlpha == 0.0) {
gl_FragColor = c;
return;
}
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (c.a > 0.0) {
c.rgb /= c.a;
}
vec4 result;
result.r = (m[0] * c.r);
result.r += (m[1] * c.g);
result.r += (m[2] * c.b);
result.r += (m[3] * c.a);
result.r += m[4];
result.g = (m[5] * c.r);
result.g += (m[6] * c.g);
result.g += (m[7] * c.b);
result.g += (m[8] * c.a);
result.g += m[9];
result.b = (m[10] * c.r);
result.b += (m[11] * c.g);
result.b += (m[12] * c.b);
result.b += (m[13] * c.a);
result.b += m[14];
result.a = (m[15] * c.r);
result.a += (m[16] * c.g);
result.a += (m[17] * c.b);
result.a += (m[18] * c.a);
result.a += m[19];
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
// Premultiply alpha again.
rgb *= result.a;
gl_FragColor = vec4(rgb, result.a);
}
`;class ei extends Et{constructor(){const t={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};super(On,kf,t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,i,n]=Y.shared.setValue(t).toArray(),a=[s,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),n=Math.sqrt,a=1/3,o=n(a),h=s+(1-s)*a,l=a*(1-s)-o*i,u=a*(1-s)+o*i,c=a*(1-s)+o*i,d=s+a*(1-s),f=a*(1-s)-o*i,p=a*(1-s)-o*i,m=a*(1-s)+o*i,g=s+a*(1-s),_=[h,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(_,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),n=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,i=(s-1)*-.5,n=[s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[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];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[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];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,i,n){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const a=Y.shared,[o,h,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(i).toArray(),f=[.3,.59,.11,0,0,o,h,l,t,0,u,c,d,e,0,o-u,h-c,l-d,0,0];this._loadMatrix
varying vec2 vTextureCoord;
uniform vec2 scale;
uniform mat2 rotation;
uniform sampler2D uSampler;
uniform sampler2D mapSampler;
uniform highp vec4 inputSize;
uniform vec4 inputClamp;
void main(void)
{
vec4 map = texture2D(mapSampler, vFilterCoord);
map -= 0.5;
map.xy = scale * inputSize.zw * (rotation * map.xy);
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
}
`,$f=`attribute vec2 aVertexPosition;
uniform mat3 projectionMatrix;
uniform mat3 filterMatrix;
varying vec2 vTextureCoord;
varying vec2 vFilterCoord;
uniform vec4 inputSize;
uniform vec4 outputFrame;
vec4 filterVertexPosition( void )
{
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aVertexPosition * (outputFrame.zw * inputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
}
`;class jh extends Et{constructor(t,e){const s=new tt;t.renderable=!1,super($f,Gf,{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=s,e==null&&(e=20),this.scale=new K(e,e)}apply(t,e,s,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&o!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,s,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Hf=`varying vec2 v_rgbNW;
varying vec2 v_rgbNE;
varying vec2 v_rgbSW;
varying vec2 v_rgbSE;
varying vec2 v_rgbM;
varying vec2 vFragCoord;
uniform sampler2D uSampler;
uniform highp vec4 inputSize;
/**
Basic FXAA implementation based on the code on geeks3d.com with the
modification that the texture2DLod stuff was removed since it's
unsupported by WebGL.
--
From:
https://github.com/mitsuhiko/webgl-meincraft
Copyright (c) 2011 by Armin Ronacher.
Some rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FXAA_REDUCE_MIN
#define FXAA_REDUCE_MIN (1.0/ 128.0)
#endif
#ifndef FXAA_REDUCE_MUL
#define FXAA_REDUCE_MUL (1.0 / 8.0)
#endif
#ifndef FXAA_SPAN_MAX
#define FXAA_SPAN_MAX 8.0
#endif
//optimized version for mobile, where dependent
//texture reads can be a bottleneck
vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
vec2 v_rgbNW, vec2 v_rgbNE,
vec2 v_rgbSW, vec2 v_rgbSE,
vec2 v_rgbM) {
vec4 color;
vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
vec4 texColor = texture2D(tex, v_rgbM);
vec3 rgbM = texColor.xyz;
vec3 luma = vec3(0.299, 0.587, 0.114);
float lumaNW = dot(rgbNW, luma);
float lumaNE = dot(rgbNE, luma);
float lumaSW = dot(rgbSW, luma);
float lumaSE = dot(rgbSE, luma);
float lumaM = dot(rgbM, luma);
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
mediump vec2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
dir * rcpDirMin)) * inverseVP;
vec3 rgbA = 0.5 * (
texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
vec3 rgbB = rgbA * 0.5 + 0.25 * (
texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
float lumaB = dot(rgbB, luma);
if ((lumaB < lumaMin) || (lumaB > lumaMax))
color = vec4(rgbA, texColor.a);
else
color = vec4(rgbB, texColor.a);
return color;
}
void main() {
vec4 color;
color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
gl_FragColor = color;
}
`,Vf=`
attribute vec2 aVertexPosition;
uniform mat3 projectionMatrix;
varying vec2 v_rgbNW;
varying vec2 v_rgbNE;
varying vec2 v_rgbSW;
varying vec2 v_rgbSE;
varying vec2 v_rgbM;
varying vec2 vFragCoord;
uniform vec4 inputSize;
uniform vec4 outputFrame;
vec4 filterVertexPosition( void )
{
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
}
void texcoords(vec2 fragCoord, vec2 inverseVP,
out vec2 v_rgbNW, out vec2 v_rgbNE,
out vec2 v_rgbSW, out vec2 v_rgbSE,
out vec2 v_rgbM) {
v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
v_rgbM = vec2(fragCoord * inverseVP);
}
void main(void) {
gl_Position = filterVertexPosition();
vFragCoord = aVertexPosition * outputFrame.zw;
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
}
`;class Xh extends Et{constructor(){super(Vf,Hf)}}var jf=`precision highp float;
varying vec2 vTextureCoord;
varying vec4 vColor;
uniform float uNoise;
uniform float uSeed;
uniform sampler2D uSampler;
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
void main()
{
vec4 color = texture2D(uSampler, vTextureCoord);
float randomValue = rand(gl_FragCoord.xy * uSeed);
float diff = (randomValue - 0.5) * uNoise;
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (color.a > 0.0) {
color.rgb /= color.a;
}
color.r += diff;
color.g += diff;
color.b += diff;
// Premultiply alpha again.
color.rgb *= color.a;
gl_FragColor = color;
}
`;class zh extends Et{constructor(t=.5,e=Math.random()){super(On,jf,{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}}const Kn={AlphaFilter:Hh,BlurFilter:Vh,BlurFilterPass:ti,ColorMatrixFilter:ei,DisplacementFilter:jh,FXAAFilter:Xh,NoiseFilter:zh};Object.entries(Kn).forEach(([r,t])=>{Object.defineProperty(Kn,r,{get(){return ao("7.1.0",`filters.${r} has moved to ${r}`),t}})});let Xf=class{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||(bt.system.add(this.tickerUpdate,this,me.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(bt.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}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||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())}};const we=new Xf;class Je{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Je.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new K,this.page=new K,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,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,s,i,n){throw new 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 Hs extends Je{constructor(){super(...arguments),this.client=new K,this.movement=new K,this.offset=new K,this.global=new K,this.screen=new K}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,s){return t.worldTransform.applyInverse(s||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,s,i,n,a,o,h,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class kt extends Hs{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class He extends Hs{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}He.DOM_DELTA_PIXEL=0,He.DOM_DELTA_LINE=1,He.DOM_DELTA_PAGE=2;const zf=2048,Wf=new K,Zn=new K;cla
${c}`)}});return await Promise.all(h),n?i[a[0].src]:i}async unload(t){const e=Gt(t,s=>({alias:[s],src:s})).map(async s=>{var i,n;const a=gt.toAbsolute(s.src),o=this.promiseCache[a];if(o){const h=await o.promise;delete this.promiseCache[a],(n=(i=o.parser)==null?void 0:i.unload)==null||n.call(i,h,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name],pp(fp({},t),{[e.name]:e})),{})}}var $t=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))($t||{});const gp=".json",_p="application/json",hl={extension:{type:D.LoadParser,priority:$t.Low},name:"loadJson",test(r){return Ve(r,_p)||ve(r,gp)},async load(r){return await(await N.ADAPTER.fetch(r)).json()}};U.add(hl);const vp=".txt",yp="text/plain",ll={name:"loadTxt",extension:{type:D.LoadParser,priority:$t.Low},test(r){return Ve(r,yp)||ve(r,vp)},async load(r){return await(await N.ADAPTER.fetch(r)).text()}};U.add(ll);var xp=Object.defineProperty,bp=Object.defineProperties,Tp=Object.getOwnPropertyDescriptors,ul=Object.getOwnPropertySymbols,Ep=Object.prototype.hasOwnProperty,Ap=Object.prototype.propertyIsEnumerable,cl=(r,t,e)=>t in r?xp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wp=(r,t)=>{for(var e in t||(t={}))Ep.call(t,e)&&cl(r,e,t[e]);if(ul)for(var e of ul(t))Ap.call(t,e)&&cl(r,e,t[e]);return r},Sp=(r,t)=>bp(r,Tp(t));const Cp=["normal","bold","100","200","300","400","500","600","700","800","900"],Rp=[".ttf",".otf",".woff",".woff2"],Ip=["font/ttf","font/otf","font/woff","font/woff2"],Pp=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function dl(r){const t=gt.extname(r),e=gt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(Pp)){s=!1;break}let i=e.join(" ");return s||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}const Mp=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Dp(r){return Mp.test(r)?r:encodeURI(r)}const fl={extension:{type:D.LoadParser,priority:$t.Low},name:"loadWebFont",test(r){return Ve(r,Ip)||ve(r,Rp)},async load(r,t){var e,s,i,n,a,o;const h=N.ADAPTER.getFontFaceSet();if(h){const l=[],u=(s=(e=t.data)==null?void 0:e.family)!=null?s:dl(r),c=(a=(n=(i=t.data)==null?void 0:i.weights)==null?void 0:n.filter(f=>Cp.includes(f)))!=null?a:["normal"],d=(o=t.data)!=null?o:{};for(let f=0;f<c.length;f++){const p=c[f],m=new FontFace(u,`url(${Dp(r)})`,Sp(wp({},d),{weight:p}));await m.load(),h.add(m),l.push(m)}return l.length===1?l[0]:l}return null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>N.ADAPTER.getFontFaceSet().delete(t))}};U.add(fl);const Op=`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})();
`;let ts=null,ea=class{constructor(){ts||(ts=URL.createObjectURL(new Blob([Op],{type:"application/javascript"}))),this.worker=new Worker(ts)}};ea.revokeObjectURL=function(){ts&&(URL.revokeObjectURL(ts),ts=null)};const Bp='(function(){"use strict";async function e(t){const a=await fetch(t);if(!a.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${t}: ${a.status} ${a.statusText}`);const s=await a.blob();return await createImageBitmap(s)}self.onmessage=async t=>{try{const a=await e(t.data.data[0]);self.postMessage({data:a,uuid:t.data.uuid,id:t.data.id},[a])}catch(a){self.postMessage({error:a,uuid:t.data.uuid,id:t.data.id})}}})();\n';let es=null;class pl{constructor(){es||(es=URL.createObjectURL(new Blob([Bp],{type:"application/javascript"}))),this.worker=new Worker(es)}}pl.revokeObjectURL=function(){es&&(URL.revokeObjectURL(es),es=null)};let ml=0,sa,Fp=class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new ea;e.addEventListener("message",s=>{e.terminate(),ea.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){sa===void 0&&(sa=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<sa&&(this._createdWorkers++,t=new pl().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?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();const s=new Promise((i,n)=>{this.queue.push({id:t,arguments:e,resolve:i,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[ml]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:ml++,id:s})}};const gl=new Fp;function ss(r,t,e){r.resource.internal=!0;const s=new L(r),i=()=>{delete t.promiseCache[e],Se.has(e)&&Se.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),i())}),s.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),i())}),s}var Np=Object.defineProperty,_l=Object.getOwnPropertySymbols,Lp=Object.prototype.hasOwnProperty,Up=Object.prototype.propertyIsEnumerable,vl=(r,t,e)=>t in r?Np(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yl=(r,t)=>{for(var e in t||(t={}))Lp.call(t,e)&&vl(r,e,t[e]);if(_l)for(var e of _l(t))Up.call(t,e)&&vl(r,e,t[e]);return r};const kp=[".jpeg",".jpg",".png",".webp",".avif"],Gp=["image/jpeg","image/png","image/webp","image/avif"];async function xl(r){const t=await N.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const js={name:"loadTextures",extension:{type:D.LoadParser,priority:$t.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Ve(r,Gp)||ve(r,kp)},async load(r,t,e){var s,i;const n=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let a;n?this.config.preferWorkers&&await gl.isImageBitmapSupported()?a=await gl.loadImageBitmap(r):a=await xl(r):a=await new Promise((l,u)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=r,c.complete?l(c):(c.onload=()=>l(c),c.onerror=d=>u(d))});const o=yl({},t.data);(s=o.resolution)!=null||(o.resolution=te(r)),n&&((i=o.resourceOptions)==null?void 0:i.ownsImageBitmap)===void
uniform vec4 uColor;
uniform sampler2D uSampler;
void main(void)
{
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
}
`,Vm=`attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTextureMatrix;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
}
`;class Xe extends Wt{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:tt.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(s,e.uniforms),super(e.program||se.from(Vm,Hm),s),this._colorDirty=!1,this.uvMatrix=new $r(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Y(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;const t=this.texture.baseTexture.alphaMode;Y.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class gu extends Zs{constructor(t=100,e=100,s=10,i=10){super(),this.segWidth=s,this.segHeight=i,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],s=[],i=[],n=this.segWidth-1,a=this.segHeight-1,o=this.width/n,h=this.height/a;for(let u=0;u<t;u++){const c=u%this.segWidth,d=u/this.segWidth|0;e.push(c*o,d*h),s.push(c/n,d/a)}const l=n*a;for(let u=0;u<l;u++){const c=u%n,d=u/n|0,f=d*this.segWidth+c,p=d*this.segWidth+c+1,m=(d+1)*this.segWidth+c,g=(d+1)*this.segWidth+c+1;i.push(f,p,m,p,g,m)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint16Array(i),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class _u extends Zs{constructor(t=200,e,s=0){super(new Float32Array(e.length*4),new Float32Array(e.length*4),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=s,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),s=this.getBuffer("aTextureCoord"),i=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),s.data=new Float32Array(t.length*4),i.data=new Uint16Array((t.length-1)*6));const n=s.data,a=i.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let o=0,h=t[0];const l=this._width*this.textureScale,u=t.length;for(let d=0;d<u;d++){const f=d*4;if(this.textureScale>0){const p=h.x-t[d].x,m=h.y-t[d].y,g=Math.sqrt(p*p+m*m);h=t[d],o+=g/l}else o=d/(u-1);n[f]=o,n[f+1]=0,n[f+2]=o,n[f+3]=1}let c=0;for(let d=0;d<u-1;d++){const f=d*2;a[c++]=f,a[c++]=f+1,a[c++]=f+2,a[c++]=f+2,a[c++]=f+1,a[c++]=f+3}s.update(),i.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],s,i=0,n=0;const a=this.buffers[0].data,o=t.length,h=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<o;l++){const u=t[l],c=l*4;l<t.length-1?s=t[l+1]:s=u,n=-(s.x-e.x),i=s.y-e.y;let d=(1-l/(o-1))*10;d>1&&(d=1);const f=Math.sqrt(i*i+n*n);f<1e-6?(i=0,n=0):(i/=f,n/=f,i*=h,n*=h),a[c]=u.x+i,a[c+1]=u.y+n,a[c+2]=u.x-i,a[c+3]=u.y-n,e=u}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class vu extends At{constructor(t,e,s){const i=new gu(t.width,t.height,e,s),n=new Xe(L.WHITE);super(i,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(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(
varying vec2 vTextureCoord;\r
uniform sampler2D uSampler;\r
\r
// Tint\r
uniform vec4 uColor;\r
\r
// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
uniform float uFWidth;\r
\r
void main(void) {\r
\r
// To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
vec4 texColor = texture2D(uSampler, vTextureCoord);\r
\r
// MSDF\r
float median = texColor.r + texColor.g + texColor.b -\r
min(texColor.r, min(texColor.g, texColor.b)) -\r
max(texColor.r, max(texColor.g, texColor.b));\r
// SDF\r
median = min(median, texColor.a);\r
\r
float screenPxDistance = uFWidth * (median - 0.5);\r
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
if (median < 0.01) {\r
alpha = 0.0;\r
} else if (median > 0.99) {\r
alpha = 1.0;\r
}\r
\r
// Gamma correction for coverage-like alpha\r
float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
float gamma = mix(1.0, 1.0 / 2.2, luma);\r
float coverage = pow(uColor.a * alpha, gamma); \r
\r
// NPM Textures, NPM outputs\r
gl_FragColor = vec4(uColor.rgb, coverage);\r
}\r
`,hg=`// Mesh material default fragment\r
attribute vec2 aVertexPosition;\r
attribute vec2 aTextureCoord;\r
\r
uniform mat3 projectionMatrix;\r
uniform mat3 translationMatrix;\r
uniform mat3 uTextureMatrix;\r
\r
varying vec2 vTextureCoord;\r
\r
void main(void)\r
{\r
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
\r
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
}\r
`;const Du=[],Ou=[],Bu=[],Fu=class Xu extends Ct{constructor(t,e={}){super();const{align:s,tint:i,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},Xu.styleDefaults,e);if(!xe.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Y(i),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new pe(()=>{this.dirty=!0},this,0,0),this._roundPixels=N.ROUND_PIXELS,this.dirty=!0,this._resolution=N.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var t;const e=xe.available[this._fontName],s=this.fontSize,i=s/e.size,n=new K,a=[],o=[],h=[],l=this._text.replace(/(?:\r\n|\r)/g,`
`)||" ",u=Ru(l),c=this._maxWidth*e.size/s,d=e.distanceFieldType==="none"?Du:Ou;let f=null,p=0,m=0,g=0,_=-1,x=0,y=0,b=0,T=0;for(let B=0;B<u.length;B++){const E=u[B],I=_i(E);if(/(?:\s)/.test(E)&&(_=B,x=p,T++),E==="\r"||E===`
`){o.push(p),h.push(-1),m=Math.max(m,p),++g,++y,n.x=0,n.y+=e.lineHeight,f=null,T=0;continue}const V=e.chars[I];if(!V)continue;f&&V.kerning[f]&&(n.x+=V.kerning[f]);const q=Bu.pop()||{texture:L.EMPTY,line:0,charCode:0,prevSpaces:0,position:new K};q.texture=V.texture,q.line=g,q.charCode=I,q.position.x=Math.round(n.x+V.xOffset+this._letterSpacing/2),q.position.y=Math.round(n.y+V.yOffset),q.prevSpaces=T,a.push(q),p=q.position.x+Math.max(V.xAdvance-V.xOffset,V.texture.orig.width),n.x+=V.xAdvance+this._letterSpacing,b=Math.max(b,V.yOffset+V.texture.height),f=I,_!==-1&&c>0&&n.x>c&&(++y,Oe(a,1+_-y,1+B-_),B=_,_=-1,o.push(x),h.push(a.length>0?a[a.length-1].prevSpaces:0),m=Math.max(m,x),g++,n.x=0,n.y+=e.lineHeight,f=null,T=0)}const S=u[u.length-1];S!=="\r"&&S!==`
`&&(/(?:\s)/.test(S)&&(p=x),o.push(p),m=Math.max(m,p),h.push(-1));const A=[];for(let B=0;B<=g;B++){let E=0;this._align==="right"?E=m-o[B]:this._align==="center"?E=(m-o[B])/2:this._align==="justify"&&(E=h[B]<0?0:(m-o[B])/h[B]),A.push(E)}const w=a.length,R={},M=[],H=this._activePagesMeshData;d.push(...H);for(let B=0;B<w;B++){const E=a[B].texture,I=E.baseTexture.uid;if(!R[I]){let V=d.pop();if(!V){const j=new Zs;let W,ht;e.distanceFieldType==="none"?(W=new Xe(L.EMPTY),ht=C.NORMAL):(W=new Xe(L.EMPTY,{program:se.from(hg,og),uniforms:{uFWidth:0}}),ht=C.NORMAL_NPM);const F=new At(j,W);F.blendMode=ht,V={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:F,vertices:null,uvs:null,indices:null}}V.index=0,V.indexCount=0,V.vertexCount=0,V.uvsCount=0,V.total=0;const{_textureCache:q}=this;q[I]=q[I]||new L(E.baseTexture),V.mesh.texture=q[I],V.mesh.tint=this._tintColor.value,M.push(V),R[I]=V}R[I].total++}for(let B=0;B<H.length;B++)M.includes(H[B])||this.removeChild(H[B].mesh);for(let B=0;B<M.length;B++)M[B].mesh.parent!==this&&this.addChild(M[B].mesh);this._activePagesMeshData=M;for(const B in R){const E=R[B],I=E.total;if(!(((t=E.indices)==null?void 0:t.length)>6*I)||E.vertices.length<At.BATCHABLE_SIZE*2)E.vertices=new Float32Array(4*2*I),E.uvs=new Float32Array(4*2*I),E.indices=new Uint16Array(6*I);else{const V=E.total,q=E.vertices;for(let j=V*4*2;j<q.length;j++)q[j]=0}E.mesh.size=6*I}for(let B=0;B<w;B++){const E=a[B];let I=E.position.x+A[E.line]*(this._align==="justify"?E.prevSpaces:1);this._roundPixels&&(I=Math.round(I));const V=I*i,q=E.position.y*i,j=E.texture,W=R[j.baseTexture.uid],ht=j.frame,F=j._uvs,O=W.index++;W.indices[O*6+0]=0+O*4,W.indices[O*6+1]=1+O*4,W.indices[O*6+2]=2+O*4,W.indices[O*6+3]=0+O*4,W.indices[O*6+4]=2+O*4,W.indices[O*6+5]=3+O*4,W.vertices[O*8+0]=V,W.vertices[O*8+1]=q,W.vertices[O*8+2]=V+ht.width*i,W.vertices[O*8+3]=q,W.vertices[O*8+4]=V+ht.width*i,W.vertices[O*8+5]=q+ht.height*i,W.vertices[O*8+6]=V,W.vertices[O*8+7]=q+ht.height*i,W.uvs[O*8+0]=F.x0,W.uvs[O*8+1]=F.y0,W.uvs[O*8+2]=F.x1,W.uvs[O*8+3]=F.y1,W.uvs[O*8+4]=F.x2,W.uvs[O*8+5]=F.y2,W.uvs[O*8+6]=F.x3,W.uvs[O*8+7]=F.y3}this._textWidth=m*i,this._textHeight=(n.y+e.lineHeight)*i;for(const B in R){const E=R[B];if(this.anchor.x!==0||this.anchor.y!==0){let j=0;const W=this._textWidth*this.anchor.x,ht=this._textHeight*this.anchor.y;for(let F=0;F<E.total;F++)E.vertices[j++]-=W,E.vertices[j++]-=ht,E.vertices[j++]-=W,E.vertices[j++]-=ht,E.vertices[j++]-=W,E.vertices[j++]-=ht,E.vertices[j++]-=W,E.vertices[j++]-=ht}this._maxLineHeight=b*i;const I=E.mesh.geometry.getBuffer("aVertexPosition"),V=E.mesh.geometry.getBuffer("aTextureCoord"),q=E.mesh.geometry.getIndex();I.data=E.vertices,V.data=E.uvs,q.data=E.indices,I.update(),V.update(),q.update()}for(let B=0;B<a.length;B++)Bu.push(a[B]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:s,size:i}=xe.available[this._fontName];if(s!=="none"){const{a:n,b:a,c:o,d:h}=this.worldTransform,l=Math.sqrt(n*n+a*a),u=Math.sqrt(o*o+h*h),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/i,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=c*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=xe.available[this._fontName];if(!t)throw new 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(!xe.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){var t;return(t=this._fontSize)!=null?t:xe.avail
@font-face {
font-family: "${e.family}";
src: url('${e.dataSrc}');
font-weight: ${e.weight};
font-style: ${e.style};
font-display: ${e.display};
}`,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=Ao(t)),typeof t=="number"?Eo(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,ls.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=N.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}};_a.availableFonts={},_a.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 yi=_a;const sr=class us extends Ut{constructor(t="",e={}){var s;super(L.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,n=L.from(i,{scaleMode:N.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new z,n.trim=new z,this.texture=n;const a="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",h=document.createElementNS(a,"svg"),l=document.createElementNS(a,"foreignObject"),u=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");l.setAttribute("width","10000"),l.setAttribute("height","10000"),l.style.overflow="hidden",h.appendChild(l),this.maxWidth=us.defaultMaxWidth,this.maxHeight=us.defaultMaxHeight,this._domElement=u,this._styleElement=c,this._svgRoot=h,this._foreignObject=l,this._foreignObject.appendChild(c),this._foreignObject.appendChild(u),this._image=i,this._loadImage=new Image,this._autoResolution=us.defaultAutoResolution,this._resolution=(s=us.defaultResolution)!=null?s:N.RESOLUTION,this.text=t,this.style=e}measureText(t){var e,s;const{text:i,style:n,resolution:a}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:i,style:n.toCSS(a)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);const o=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:h,height:l}=o,u=Math.min(this.maxWidth,Math.ceil(h)),c=Math.min(this.maxHeight,Math.ceil(l));return this._svgRoot.setAttribute("width",u.toString()),this._svgRoot.setAttribute("height",c.toString()),i!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:(e=this._style)==null?void 0:e.to
// Disabled to avoid warnings in Chrome (see https://github.com/4ian/GDevelop/pull/3947)
// //# sourceMappingURL=pixi-legacy.min.js.map