vendor: 4,175 bytes, line 1
1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9354],{66579:function(t){var e=Object.prototype.hasOwnProperty,s="~";function i(){}function r(t,e,s){this.fn=t,this.context=e,this.once=s||!1}function n(t,e,i,n,a){if("function"!==typeof i)throw new TypeError("The listener must be a function");var o=new r(i,n||t,a),h=s?s+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0===--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(s=!1)),o.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(s?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=s?s+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,a=new Array(n);r<n;r++)a[r]=i[r].fn;return a},o.prototype.listenerCount=function(t){var e=s?s+t:t,i=this._events[e];return i?i.fn?1:i.length:0},o.prototype.emit=function(t,e,i,r,n,a){var o=s?s+t:t;if(!this._events[o])return!1;var h,l,u=this._events[o],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,r),!0;case 5:return u.fn.call(u.context,e,i,r,n),!0;case 6:return u.fn.call(u.context,e,i,r,n,a),!0}for(l=1,h=new Array(c-1);l<c;l++)h[l-1]=arguments[l];u.fn.apply(u.context,h)}else{var d,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(t,u[l].fn,void 0,!0),c){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,e);break;case 3:u[l].fn.call(u[l].context,e,i);break;case 4:u[l].fn.call(u[l].context,e,i,r);break;default:if(!h)for(d=1,h=new Array(c-1);d<c;d++)h[d-1]=arguments[d];u[l].fn.apply(u[l].context,h)}}return!0},o.prototype.on=function(t,e,s){return n(this,t,e,s,!1)},o.prototype.once=function(t,e,s){return n(this,t,e,s,!0)},o.prototype.removeListener=function(t,e,i,r){var n=s?s+t:t;if(!this._events[n])return this;if(!e)return a(this,n),this;var o=this._events[n];if(o.fn)o.fn!==e||r&&!o.once||i&&o.context!==i||a(this,n);else{for(var h=0,l=[],u=o.length;h<u;h++)(o[h].fn!==e||r&&!o[h].once||i&&o[h].context!==i)&&l.push(o[h]);l.length?this._events[n]=1===l.length?l[0]:l:a(this,n)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=s?s+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=s,o.EventEmitter=o,t.exports=o},77089:function(t){var e=Object.prototype.hasOwnProperty,s="~";function i(){}function r(t,e,s){this.fn=t,this.context=e,this.once=s||!1}function n(t,e,i,n,a){if("function"!==typeof i)throw new TypeError("The listener must be a function");var o=new r(i,n||t,a),h=s?s+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0===--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(s=!1)),o.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(s?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=s?s+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,a=new Array(n);r<n;r++)a[r]=i[r].fn;return a},o.prototype.listenerCount=function(t){var e=s?s+t:t,i=this._events[e];return i?i.fn?1:i.length:0},o.prototype.emit=function(t,e,i,r,n,a){var o=s?s+t:t;if(!this._events[o])return!1;var h,l,u=this._events[o],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;
1case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,r),!0;case 5:return u.fn.call(u.context,e,i,r,n),!0;case 6:return u.fn.call(u.context,e,i,r,n,a),!0}for(l=1,h=new Array(c-1);l<c;l++)h[l-1]=arguments[l];u.fn.apply(u.context,h)}else{var d,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(t,u[l].fn,void 0,!0),c){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,e);break;case 3:u[l].fn.call(u[l].context,e,i);break;case 4:u[l].fn.call(u[l].context,e,i,r);break;default:if(!h)for(d=1,h=new Array(c-1);d<c;d++)h[d-1]=arguments[d];u[l].fn.apply(u[l].context,h)}}return!0},o.prototype.on=function(t,e,s){return n(this,t,e,s,!1)},o.prototype.once=function(t,e,s){return n(this,t,e,s,!0)},o.prototype.removeListener=function(t,e,i,r){var n=s?s+t:t;if(!this._events[n])return this;if(!e)return a(this,n),this;var o=this._events[n];if(o.fn)o.fn!==e||r&&!o.once||i&&o.context!==i||a(this,n);else{for(var h=0,l=[],u=o.length;h<u;h++)(o[h].fn!==e||r&&!o[h].once||i&&o[h].context!==i)&&l.push(o[h]);l.length?this._events[n]=1===l.length?l[0]:l:a(this,n)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=s?s+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=s,o.EventEmitter=o,t.exports=o},99354:function(t,e,s){s.d(e,{MxU:function(){return _r},W20:function(){return Wi},jyi:function(){return Yi},xEZ:function(){return us}});var i=(t=>(t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2",t))(i||{}),r=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS",t))(r||{}),n=(t=>(t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL",t))(n||{}),a=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR",t))(a||{}),o=(t=>(t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t))(o||{}),h=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(h||{}),l=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(l||{}),u=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(u||{}),c=(t=>(t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t))(c||{}),d=(t=>(t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t))(d||{}),f=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(f||{}),p=(t=>(t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL",t))(p||{}),m=(t=>(t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",t))(m||{}),g=(t=>(t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT",t))(g||{}),_=(t=>(t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL",t))(_||{}),x=(t=>(t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp",t))(x||{}),y=(t=>(t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR",t))(y||{}),v=(t=>(t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH",t))(v||{}),b=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(b||{});const T={ADAPTER:{createCanvas:(t,e)=>{const s=document.createElement("canvas");return s.width=t,s.height=e,s},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var E=s(53630);const A=(E.Z.default??E.Z)(globalThis.navigator);T.RETINA_PREFIX=/@([0-9\.]+)x/,T.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var w=s(66579),S=s(9187);s(10861);const R={};function I(t,e,s=3){if(R[e])return;let i=(new Error).stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`):(i=i.split("\n").splice(s).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}\nDeprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`),console.warn(i))),R[e]=!0}function C(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function P(t){return t.split("?")[0].split("#")[0]}const M={toPosix(t){return e="\\",s="/",t.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),s);var e,s},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),isBlobUrl:t=>
1t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){C(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const s=/^[^/:]+:\/{0,2}/.exec(t);return s?s[0]:""},toAbsolute(t,e,s){if(C(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const i=P(this.toPosix(e??T.ADAPTER.getBaseUrl())),r=P(this.toPosix(s??this.rootname(i)));return(t=this.toPosix(t)).startsWith("/")?M.join(r,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(C(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;let e="";const s=(t=this.toPosix(t)).startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const i=t.endsWith("/");return(t=function(t,e){let s="",i=0,r=-1,n=0,a=-1;for(let o=0;o<=t.length;++o){if(o<t.length)a=t.charCodeAt(o);else{if(47===a)break;a=47}if(47===a){if(r!==o-1&&1!==n)if(r!==o-1&&2===n){if(s.length<2||2!==i||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2))if(s.length>2){const t=s.lastIndexOf("/");if(t!==s.length-1){-1===t?(s="",i=0):(s=s.slice(0,t),i=s.length-1-s.lastIndexOf("/")),r=o,n=0;continue}}else if(2===s.length||1===s.length){s="",i=0,r=o,n=0;continue}e&&(s.length>0?s+="/..":s="..",i=2)}else s.length>0?s+=`/${t.slice(r+1,o)}`:s=t.slice(r+1,o),i=o-r-1;r=o,n=0}else 46===a&&-1!==n?++n:n=-1}return s}(t,!1)).length>0&&i&&(t+="/"),s?`/${t}`:e+t},isAbsolute(t){return C(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let s=0;s<t.length;++s){const i=t[s];if(C(i),i.length>0)if(void 0===e)e=i;else{const r=t[s-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(C(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const s=47===e;let i=-1,r=!0;const n=this.getProtocol(t),a=t;for(let o=(t=t.slice(n.length)).length-1;o>=1;--o)if(e=t.charCodeAt(o),47===e){if(!r){i=o;break}}else r=!1;return-1===i?s?"/":this.isUrl(a)?n+t:n:s&&1===i?"//":n+t.slice(0,i)},rootname(t){C(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const s=t.indexOf("/",e.length);e=-1!==s?t.slice(0,s):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){C(t),e&&C(e),t=P(this.toPosix(t));let s,i=0,r=-1,n=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(s=t.length-1;s>=0;--s){const h=t.charCodeAt(s);if(47===h){if(!n){i=s+1;break}}else-1===o&&(n=!1,o=s+1),a>=0&&(h===e.charCodeAt(a)?-1===--a&&(r=s):(a=-1,r=o))}return i===r?r=o:-1===r&&(r=t.length),t.slice(i,r)}for(s=t.length-1;s>=0;--s)if(47===t.charCodeAt(s)){if(!n){i=s+1;break}}else-1===r&&(n=!1,r=s+1);return-1===r?"":t.slice(i,r)},extname(t){C(t);let e=-1,s=0,i=-1,r=!0,n=0;for(let a=(t=P(this.toPosix(t))).length-1;a>=0;--a){const o=t.charCodeAt(a);if(47!==o)-1===i&&(r=!1,i=a+1),46===o?-1===e?e=a:1!==n&&(n=1):-1!==e&&(n=-1);else if(!r){s=a+1;break}}return-1===e||-1===i||0===n||1===n&&e===i-1&&e===s+1?"":t.slice(e,i)},parse(t){C(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let s=(t=P(this.toPosix(t))).charCodeAt(0);const i=this.isAbsolute(t);let r;e.root=this.rootname(t),r=i||this.hasProtocol(t)?1:0;let n=-1,a=0,o=-1,h=!0,l=t.length-1,u=0;for(;l>=r;--l)if(s=t.charCodeAt(l),47!==s)-1===o&&(h=!1,o=l+1),46===s?-1===n?n=l:1!==u&&(u=1):-1!==n&&(u=-1);else if(!h){a=l+1;break}return-1===n||-1===o||0===u||1===u&&n===o-1&&n===a+1?-1!==o&&(e.base=e.name=0===a&&i?t.slice(1,o):t.slice(a,o)):(0===a&&i?(e.name=t.slice(1,n),e.base=t.slice(1,o)):(e.name=t.slice(a,n),e.base=t.slice(a,o)),e.ext=t.slice(n,o)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let D,B;async function N(){return D??(D=(async()=>{const t=document.createElement("canvas").getContext("webgl");if(!t)return m.UNPACK;const e=await new Promise((t=>{const e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()}));if(!e)return m.UNPACK;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);
vendor: 8,674 bytes, line 1
1const r=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,r),t.deleteFramebuffer(i),t.deleteTexture(s),t.getExtension("WEBGL_lose_context")?.loseContext(),r[0]<=r[3]?m.PMA:m.UNPACK})()),D}var O={grad:.9,turn:360,rad:360/(2*Math.PI)},L=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},F=function(t,e,s){return void 0===e&&(e=0),void 0===s&&(s=Math.pow(10,e)),Math.round(s*t)/s+0},U=function(t,e,s){return void 0===e&&(e=0),void 0===s&&(s=1),t>s?s:t>e?t:e},k=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},G=function(t){return{r:U(t.r,0,255),g:U(t.g,0,255),b:U(t.b,0,255),a:U(t.a)}},H=function(t){return{r:F(t.r),g:F(t.g),b:F(t.b),a:F(t.a,3)}},X=/^#([0-9a-f]{3,8})$/i,V=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},z=function(t){var e=t.r,s=t.g,i=t.b,r=t.a,n=Math.max(e,s,i),a=n-Math.min(e,s,i),o=a?n===e?(s-i)/a:n===s?2+(i-e)/a:4+(e-s)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},W=function(t){var e=t.h,s=t.s,i=t.v,r=t.a;e=e/360*6,s/=100,i/=100;var n=Math.floor(e),a=i*(1-s),o=i*(1-(e-n)*s),h=i*(1-(1-e+n)*s),l=n%6;return{r:255*[i,o,a,a,h,i][l],g:255*[h,i,i,o,a,a][l],b:255*[a,a,h,i,i,o][l],a:r}},j=function(t){return{h:k(t.h),s:U(t.s,0,100),l:U(t.l,0,100),a:U(t.a)}},$=function(t){return{h:F(t.h),s:F(t.s),l:F(t.l),a:F(t.a,3)}},Y=function(t){return W((s=(e=t).s,{h:e.h,s:(s*=((i=e.l)<50?i:100-i)/100)>0?2*s/(i+s)*100:0,v:i+s,a:e.a}));var e,s,i},q=function(t){return{h:(e=z(t)).h,s:(r=(200-(s=e.s))*(i=e.v)/100)>0&&r<200?s*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:e.a};var e,s,i,r},K=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Z=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,J=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Q=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tt={string:[[function(t){var e=X.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?F(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?F(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=J.exec(t)||Q.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:G({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=K.exec(t)||Z.exec(t);if(!e)return null;var s,i,r=j({h:(s=e[1],i=e[2],void 0===i&&(i="deg"),Number(s)*(O[i]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return Y(r)},"hsl"]],object:[[function(t){var e=t.r,s=t.g,i=t.b,r=t.a,n=void 0===r?1:r;return L(e)&&L(s)&&L(i)?G({r:Number(e),g:Number(s),b:Number(i),a:Number(n)}):null},"rgb"],[function(t){var e=t.h,s=t.s,i=t.l,r=t.a,n=void 0===r?1:r;if(!L(e)||!L(s)||!L(i))return null;var a=j({h:Number(e),s:Number(s),l:Number(i),a:Number(n)});return Y(a)},"hsl"],[function(t){var e=t.h,s=t.s,i=t.v,r=t.a,n=void 0===r?1:r;if(!L(e)||!L(s)||!L(i))return null;var a=function(t){return{h:k(t.h),s:U(t.s,0,100),v:U(t.v,0,100),a:U(t.a)}}({h:Number(e),s:Number(s),v:Number(i),a:Number(n)});return W(a)},"hsv"]]},et=function(t,e){for(var s=0;s<e.length;s++){var i=e[s][0](t);if(i)return[i,e[s][1]]}return[null,void 0]},st=function(t){return"string"==typeof t?et(t.trim(),tt.string):"object"==typeof t&&null!==t?et(t,tt.object):[null,void 0]},it=function(t,e){var s=q(t);return{h:s.h,s:U(s.s+100*e,0,100),l:s.l,a:s.a}},rt=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},nt=function(t,e){var s=q(t);return{h:s.h,s:s.s,l:U(s.l+100*e,0,100),a:s.a}},at=function(){function t(t){this.parsed=st(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return F(rt(this.rgba),2)},t.prototype.isDark=function(){return rt(this.rgba)<.5},t.prototype.isLight=function(){return rt(this.rgba)>=.5},t.prototype.toHex=function(){return e=(t=H(this.rgba)).r,s=t.g,i=t.b,n=(r=t.a)<1?V(F(255*r)):"","#"+V(e)+V(s)+V(i)+n;var t,e,s,i,r,n},t.prototype.toRgb=function(){return H(this.rgba)},t.prototype.toRgbString=function(){return e=(t=H(this.rgba)).r,s=t.g,i=t.b,(r=t.a)<1?"rgba("+e+", "+s+", "+i+", "+r+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,r},t.prototype.toHsl=function(){return $(q(this.rgba))},t.prototype.toHslString=function(){return e=(t=$(q(this.rgba))).h,s=t.s,i=t.l,(r=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+r+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,r},t.prototype.toHsv=function(){return t=z(this.rgba),{h:F(t.h),s:F(t.s),v:F(t.v),a:F(t.a,3)};var t},t.prototype.invert=function(){return ot({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},t.prototype.saturate=function(t){return void 0===t&&(t=.1),ot(it(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),ot(it(this.rgba,-t))},t.prototype.grayscale=function(){return ot(it(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),ot(nt(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),ot(nt(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){return"number"==typeof t?ot({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):F(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=q(this.rgba);return"number"==typeof t?ot({h:t,s:e.s,l:e.l,a:e.a}):F(e.h)},t.prototype.isEqual=function(t){return this.toHex()===ot(t).toHex()},t}(),ot=function(t){return t instanceof at?t:new at(t)},ht=[];!function(t){t.forEach((function(t){ht.indexOf(t)<0&&(t(at,tt),ht.push(t))}))}([function(t,e){var s={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",s
1andybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in s)i[s[r]]=r;var n={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var r,a,o=i[this.toHex()];if(o)return o;if(null==e?void 0:e.closest){var h=this.toRgb(),l=1/0,u="black";if(!n.length)for(var c in s)n[c]=new t(s[c]).toRgb();for(var d in s){var f=(r=h,a=n[d],Math.pow(r.r-a.r,2)+Math.pow(r.g-a.g,2)+Math.pow(r.b-a.b,2));f<l&&(l=f,u=d)}return u}},e.string.push([function(e){var i=e.toLowerCase(),r="transparent"===i?"#0000":s[i];return r?new t(r).toRgb():null},"name"])}]);const lt=class t{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(e){if(e instanceof t)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw new Error("Cannot set PIXI.Color#value to null");(null===this._value||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if("number"===s||"string"===s||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every(((t,s)=>t===e[s]));if(null!==t&&null!==e){const s=Object.keys(t),i=Object.keys(e);return s.length===i.length&&s.every((s=>t[s]===e[s]))}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return(t=t??[])[0]=Math.round(255*e),t[1]=Math.round(255*s),t[2]=Math.round(255*i),t}toRgbArray(t){t=t??[];const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){const[s,i,r,n]=t.temp.setValue(e)._components;return this._components[0]*=s,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let s=this._int>>16&255,i=this._int>>8&255,r=255&this._int;return e&&(s=s*t+.5|0,i=i*t+.5|0,r=r*t+.5|0),(255*t<<24)+(s<<16)+(i<<8)+r}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,s,i,r]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=r,t}normalize(e){let s,i,r,n;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){s=(e>>16&255)/255,i=(e>>8&255)/255,r=(255&e)/255,n=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[s,i,r,n=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[s,i,r,n=255]=e,s/=255,i/=255,r/=255,n/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){const s=t.HEX_PATTERN.exec(e);s&&(e=`#${s[2]}`)}const a=ot(e);a.isValid()&&(({r:s,g:i,b:r,a:n}=a.rgba),s/=255,i/=255,r/=255)}if(void 0===s)throw new Error(`Unable to convert color ${e}`);this._components[0]=s,this._components[1]=i,this._components[2]=r,this._components[3]=n,this.refreshInt()}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*s|0)}_clamp(t,e=0,s=1){return"number"==typeof t?Math.min(Math.max(t,e),s):(t.forEach(((i,r)=>{t[r]=Math.min(Math.max(i,e),s)})),t)}};lt.shared=new lt,lt.temp=new lt,lt.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let ut=lt;const ct=function(){const t=[],e=[];for(let i=0;i<32;i++)t[i]=i,e[i]=i;t[a.NORMAL_NPM]=a.NORMAL,t[a.ADD_NPM]=a.ADD,t[a.SCREEN_NPM]=a.SCREEN,e[a.NORMAL]=a.NORMAL_NPM,e[a.ADD]=a.ADD_NPM,e[a.SCREEN]=a.SCREEN_NPM;const s=[];return s.push(e),s.push(t),s}();function dt(t,e){return ct[e?1:0][t]}function ft(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}Float32Array,Uint32Array,Int32Array,Uint8Array;function pt(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function mt(t){return!(t&t-1)&&!!t}function gt(t){let e=(t>65535?1:0)<<4,s=((t>>>=e)>255?1:0)<<3;return e|=s,s=((t>>>=s)>15?1:0)<<2,e|=s,s=((t>>>=s)>3?1:0)<<1,e|=s,e|(t>>>=s)>>1}function _t(t,e,s){const i=t.length;let r;if(e>=i||0===s)return;const n=i-(s=e+s>i?i-e:s);for(r=e;r<n;++r)t[r]=t[r+s];t.length=n}function xt(t){return 0===t?0:t<0?-1:1}let yt=0;function vt(){return++yt}const bt=class{constructor(t,e,s,i){this.left=t,this.top=e,this.right=s,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};
1bt.EMPTY=new bt(0,0,0,0);let Tt=bt;const Et={},At=Object.create(null),wt=Object.create(null);class St{constructor(t,e,s){this._canvas=T.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||T.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(null===this._canvas)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function Rt(t,e,s){for(let i=0,r=4*s*e;i<e;++i,r+=4)if(0!==t[r+3])return!1;return!0}function It(t,e,s,i,r){const n=4*e;for(let a=i,o=i*n+4*s;a<=r;++a,o+=n)if(0!==t[o+3])return!1;return!0}function Ct(t){const e=function(t){const{width:e,height:s}=t,i=t.getContext("2d",{willReadFrequently:!0});if(null===i)throw new TypeError("Failed to get canvas 2D context");const r=i.getImageData(0,0,e,s).data;let n=0,a=0,o=e-1,h=s-1;for(;a<s&&Rt(r,e,a);)++a;if(a===s)return Tt.EMPTY;for(;Rt(r,e,h);)--h;for(;It(r,e,n,a,h);)++n;for(;It(r,e,o,a,h);)--o;return++o,++h,new Tt(n,a,o,h)}(t),{width:s,height:i}=e;let r=null;if(!e.isEmpty()){const n=t.getContext("2d");if(null===n)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(e.left,e.top,s,i)}return{width:s,height:i,data:r}}function Pt(t,e=1){const s=T.RETINA_PREFIX.exec(t);return s?parseFloat(s[1]):e}var Mt=(t=>(t.Renderer="renderer",t.Application="application",t.RendererSystem="renderer-webgl-system",t.RendererPlugin="renderer-webgl-plugin",t.CanvasRendererSystem="renderer-canvas-system",t.CanvasRendererPlugin="renderer-canvas-plugin",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t))(Mt||{});const Dt=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t={...t}).type&&(t.type=[t.type]),t},Bt=(t,e)=>Dt(t).priority??e,Nt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Dt).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(Dt).forEach((t=>{t.type.forEach((e=>{const s=this._addHandlers,i=this._queue;s[e]?s[e]?.(t):(i[e]=i[e]||[],i[e]?.push(t))}))})),this},handle(t,e,s){const i=this._addHandlers,r=this._removeHandlers;if(i[t]||r[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,r[t]=s;const n=this._queue;return n[t]&&(n[t]?.forEach((t=>e(t))),delete n[t]),this},handleByMap(t,e){return this.handle(t,(t=>{t.name&&(e[t.name]=t.ref)}),(t=>{t.name&&delete e[t.name]}))},handleByList(t,e,s=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>Bt(e,s)-Bt(t,s))))}),(t=>{const s=e.indexOf(t.ref);-1!==s&&e.splice(s,1)}))}};class Ot{constructor(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const Lt=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Ft(t){let e="";for(let s=0;s<t;++s)s>0&&(e+="\nelse "),s<t-1&&(e+=`if(test == ${s}.0){}`);return e}class Ut{constructor(){this.data=0,this.blendMode=a.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}
1get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==a.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ut;return t.depthTest=!1,t.blend=!0,t}}Ut.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const kt=[];function Gt(t,e){if(!t)return null;let s="";if("string"==typeof t){const e=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);e&&(s=e[1].toLowerCase())}for(let i=kt.length-1;i>=0;--i){const r=kt[i];if(r.test&&r.test(t,s))return new r(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class Ht{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,i,r,n,a,o){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:l}=this;this._aliasCount++;for(let u=0,c=l.length;u<c;u++)l[u][h](t,e,s,i,r,n,a,o);return l===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return 0===this.items.length}get name(){return this._name}}Object.defineProperties(Ht.prototype,{dispatch:{value:Ht.prototype.emit},run:{value:Ht.prototype.emit}});class Xt{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Ht("setRealSize"),this.onUpdate=new Ht("update"),this.onError=new Ht("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 Vt extends Xt{constructor(t,e){const{width:s,height:i}=e||{};if(!s||!i)throw new Error("BufferResource width or height invalid");super(s,i),this.data=t,this.unpackAlignment=e.unpackAlignment??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===m.UNPACK);const r=e.realWidth,n=e.realHeight;return s.width===r&&s.height===n?i.texSubImage2D(e.target,0,0,0,r,n,e.format,s.type,this.data):(s.width=r,s.height=n,i.texImage2D(e.target,0,s.internalFormat,r,n,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return null===t||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const zt={scaleMode:d.NEAREST,alphaMode:m.NPM},Wt=class t extends w{constructor(e=null,s=null){super(),s=Object.assign({},t.defaultOptions,s);const{alphaMode:i,mipmap:r,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=s;e&&!(e instanceof Xt)&&((e=Gt(e,p)).internal=!0),this.resolution=f||T.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=i,this.uid=vt(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),void 0!==e&&e!==this.mipmap&&
1(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=mt(this.realWidth)&&mt(this.realHeight)}setResolution(t){const e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete wt[this.cacheId],delete At[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,s,i=T.STRICT_TEXTURE_CACHE){const r="string"==typeof e;let n=null;if(r)n=e;else{if(!e._pixiId){const t=s?.pixiIdPrefix||"pixiid";e._pixiId=`${t}_${vt()}`}n=e._pixiId}let a=wt[n];if(r&&i&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new t(e,s),a.cacheId=n,t.addToCache(a,n)),a}static fromBuffer(e,s,i,r){e=e||new Float32Array(s*i*4);const n=new Vt(e,{width:s,height:i,...r?.resourceOptions});let a,o;return e instanceof Float32Array?(a=h.RGBA,o=u.FLOAT):e instanceof Int32Array?(a=h.RGBA_INTEGER,o=u.INT):e instanceof Uint32Array?(a=h.RGBA_INTEGER,o=u.UNSIGNED_INT):e instanceof Int16Array?(a=h.RGBA_INTEGER,o=u.SHORT):e instanceof Uint16Array?(a=h.RGBA_INTEGER,o=u.UNSIGNED_SHORT):e instanceof Int8Array?(a=h.RGBA,o=u.BYTE):(a=h.RGBA,o=u.UNSIGNED_BYTE),n.internal=!0,new t(n,Object.assign({},zt,{type:o,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),wt[e]&&wt[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),wt[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=wt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete wt[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete wt[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Wt.defaultOptions={mipmap:p.POW2,anisotropicLevel:0,scaleMode:d.LINEAR,wrapMode:f.CLAMP,alphaMode:m.UNPACK,target:l.TEXTURE_2D,format:h.RGBA,type:u.UNSIGNED_BYTE},Wt._globalBatch=0;let jt=Wt;class $t{constructor(){this.texArray=null,this.blend=0,this.type=o.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Yt=0;class qt{constructor(t,e=!0,s=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=s,this.static=e,this.id=Yt++,this.disposeRunner=new Ht("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?b.ELEMENT_ARRAY_BUFFER:b.ARRAY_BUFFER}get index(){return this.type===b.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new qt(t)}}class Kt{constructor(t,e=0,s=!1,i=u.FLOAT,r,n,a,o=1){this.buffer=t,this.size=e,this.normalized=s,this.type=i,this.stride=r,this.start=n,this.instance=a,this.divisor=o}destroy(){this.buffer=null}static from(t,e,s,i,r){return new Kt(t,e,s,i,r)}}const Zt={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};const Jt={5126:4,5123:2,5121:1};let Qt=0;const te={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array};class ee{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Qt++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Ht("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,i=!1,r,n,a,o=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof qt||(e instanceof Array&&(e=new Float32Array(e)),e=new qt(e));const h=t.split("|");if(h.length>1){for(let t=0;t<h.length;t++)this.addAttribute(h[t],e,s,i,r);return this}let l=this.buffers.indexOf(e);return-1===l&&(this.buffers.push(e),l=this.buffers.length-1),this.attributes[t]=new Kt(l,s,i,r,n,a,o),this.instanced=this.instanced||o,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof qt||(t instanceof Array&&(t=new Uint16Array(t)),t=new qt(t)),t.type=b.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;const t=[],e=[],s=new qt;let i;for(i in this.attributes){const s=this.attributes[i],r=this.buffers[s.buffer];t.push(r.data),e.push(s.size*Jt[s.type]/4),s.buffer=0}for(s.data=function(t,e){let s=0,i=0;const r={};for(let h=0;h<t.length;h++)i+=e[h],s+=t[h].length;const n=new ArrayBuffer(4*s);let a=null,o=0;for(let h=0;h<t.length;h++){const s=e[h],l=t[h],u=ft(l);r[u]||(r[u]=new Zt[u](n)),a=r[u];for(let t=0;t<l.length;t++)a[(t/s|0)*i+o+t%s]=l[t];o+=s}return new Float32Array(n)}(t,e),i=0;i<this.buffers.length;i++)this.buffers[i]!==this.indexBuffer&&this.buffers[i].destroy();return this.buffers=[s],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new ee;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new qt(this.buffers[e].data.slice(0));for(const e in this.attributes){const s=this.attributes[e];t.attributes[e]=new Kt(s.buffer,s.size,s.normalized,s.type,s.stride,s.start,s.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=b.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new ee,s=[],i=[],r=[];let n;for(let a=0;a<t.length;a++){n=t[a];for(let t=0;t<n.buffers.length;t++)i[t]=i[t]||0,i[t]+=n.buffers[t].data.length,r[t]=0}for(let a=0;a<n.buffers.length;a++)s[a]=new(te[ft(n.buffers[a].data)])(i[a]),e.buffers[a]=new qt(s[a]);for(let a=0;a<t.length;a++){n=t[a];for(let t=0;t<n.buffers.length;t++)s[t].set(n.buffers[t].data,r[t]),r[t]+=n.buffers[t].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=b.ELEMENT_ARRAY_BUFFER;let s=0,i=0,r=0,a=0;for(let t=0;t<n.buffers.length;t++)if(n.buffers[t]!==n.indexBuffer){a=t;break}for(const t in n.attributes){const e=n.attributes[t];(0|e.buffer)===a&&(i+=e.size*Jt[e.type]/4)}for(let n=0;n<t.length;n++){const o=t[n].indexBuffer.data;for(let t=0;t<o.length;t++)e.indexBuffer.data[t+r]+=s;s+=t[n].buffers[a].data.length/i,r+=o.length}}return e}}class se extends ee{constructor(t=!1){super(),this._buffer=new qt(null,t,!1),this._indexBuffer=new qt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,u.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,u.FLOAT).addAttribute("aColor",this._buffer,4,!0,u.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,u.FLOAT).addIndex(this._indexBuffer)}}const ie=2*Math.PI,re=180/Math.PI,ne=Math.PI/180;var ae=(t=>
1(t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC",t))(ae||{});class oe{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new oe(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}}oe.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const he=[new oe,new oe,new oe,new oe];class le{constructor(t=0,e=0,s=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i),this.type=ae.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new le(0,0,0,0)}clone(){return new le(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)}intersects(t,e){if(!e){const e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;const s=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>s}const s=this.left,i=this.right,r=this.top,n=this.bottom;if(i<=s||n<=r)return!1;const a=he[0].set(t.left,t.top),o=he[1].set(t.left,t.bottom),h=he[2].set(t.right,t.top),l=he[3].set(t.right,t.bottom);if(h.x<=a.x||o.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u||(e.apply(a,a),e.apply(o,o),e.apply(h,h),e.apply(l,l),Math.max(a.x,o.x,h.x,l.x)<=s||Math.min(a.x,o.x,h.x,l.x)>=i||Math.max(a.y,o.y,h.y,l.y)<=r||Math.min(a.y,o.y,h.y,l.y)>=n))return!1;const c=u*(o.y-a.y),d=u*(a.x-o.x),f=c*s+d*r,p=c*i+d*r,m=c*s+d*n,g=c*i+d*n;if(Math.max(f,p,m,g)<=c*a.x+d*a.y||Math.min(f,p,m,g)>=c*l.x+d*l.y)return!1;const _=u*(a.y-h.y),x=u*(h.x-a.x),y=_*s+x*r,v=_*i+x*r,b=_*s+x*n,T=_*i+x*n;return!(Math.max(y,v,b,T)<=_*a.x+x*a.y||Math.min(y,v,b,T)>=_*l.x+x*l.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),r=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=i,this.height=Math.max(r-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),r=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=r-i,this}}le.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ue{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=ae.CIRC}clone(){return new ue(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,r=this.y-e;return i*=i,r*=r,i+r<=s}getBounds(){return new le(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}}ue.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class ce{constructor(t=0,e=0,s=0,i=0){this.x=t,this.y=e,this.width=s,this.height=i,this.type=ae.ELIP}clone(){return new ce(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,i=(e-this.y)/this.height;return s*=s,i*=i,s+i<=1}getBounds(){return new le(this.x-this.width,this.y-this.height,this.width,this.height)}}ce.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class de{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let s=0,i=e.length;s<i;s++)t.push(e[s].x,e[s].y);e=t}this.points=e,this.type=ae.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new de(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let s=!1;const i=this.points.length/2;for(let r=0,n=i-1;r<i;n=r++){const i=this.points[2*r],a=this.points[2*r+1],o=this.points[2*n],h=this.points[2*n+1];a>e!=h>e&&t<(e-a)/(h-a)*(o-i)+i&&(s=!s)}return s}}de.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce(((t,e)=>`${t}, ${e}`),"")}]`};class fe{constructor(t=0,e=0,s=0,i=0,r=20){this.x=t,this.y=e,this.width=s,this.height=i,this.radius=r,this.type=ae.RREC}clone(){return new fe(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),r=e-(this.y+s);const n=s*s;if(i*i+r*r<=n||(i=t-(this.x+this.width-s),i*i+r*r<=n)||(r=e-(this.y+this.height-s),i*i+r*r<=n)||(i=t-(this.x+s),i*i+r*r<=n))return!0}return!1}}fe.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class pe{constructor(t=1,e=0,s=0,i=1,r=0,n=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,i,r,n){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new oe;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new oe;const s=1/(this.a*this.d+this.c*-this.b),i=t.x,r=t.y;return e.x=this.d*s*i+-this.c*s*r+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*r+-this.b*s*i+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,r=this.c,n=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=r*e-this.d*s,this.d=r*s+this.d*e,this.tx=n*e-this.t
1y*s,this.ty=n*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,r=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*r,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*r,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*r+this.ty,this}setTransform(t,e,s,i,r,n,a,o,h){return this.a=Math.cos(a+h)*r,this.b=Math.sin(a+h)*r,this.c=-Math.sin(a-o)*n,this.d=Math.cos(a-o)*n,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,s=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,r=this.d,n=t.pivot,a=-Math.atan2(-i,r),o=Math.atan2(s,e),h=Math.abs(a+o);return h<1e-5||Math.abs(ie-h)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=o),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+r*r),t.position.x=this.tx+(n.x*e+n.y*i),t.position.y=this.ty+(n.x*s+n.y*r),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,r=this.tx,n=t*i-e*s;return this.a=i/n,this.b=-e/n,this.c=-s/n,this.d=t/n,this.tx=(s*this.ty-i*r)/n,this.ty=-(t*this.ty-e*r)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new pe;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new pe}static get TEMP_MATRIX(){return new pe}}pe.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const me=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ge=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],_e=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],xe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ye=[],ve=[],be=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];ye.push(e);for(let s=0;s<16;s++){const i=be(me[t]*me[s]+_e[t]*ge[s]),r=be(ge[t]*me[s]+xe[t]*ge[s]),n=be(me[t]*_e[s]+_e[t]*xe[s]),a=be(ge[t]*_e[s]+xe[t]*xe[s]);for(let t=0;t<16;t++)if(me[t]===i&&ge[t]===r&&_e[t]===n&&xe[t]===a){e.push(t);break}}}for(let t=0;t<16;t++){const e=new pe;e.set(me[t],ge[t],_e[t],xe[t],0,0),ve.push(e)}}();const Te={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>me[t],uY:t=>ge[t],vX:t=>_e[t],vY:t=>xe[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>ye[t][e],sub:(t,e)=>ye[t][Te.inv(e)],rotate180:t=>4^t,isVertical:t=>2===(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?Te.S:Te.N:2*Math.abs(e)<=Math.abs(t)?t>0?Te.E:Te.W:e>0?t>0?Te.SE:Te.SW:t>0?Te.NE:Te.NW,matrixAppendRotationInv:(t,e,s=0,i=0)=>{const r=ve[Te.inv(e)];r.tx=s,r.ty=i,t.append(r)}};class Ee{constructor(t,e,s=0,i=0){this._x=s,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new Ee(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}Ee.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Ae=class{constructor(){this.worldTransform=new pe,this.localTransform=new pe,this.position=new Ee(this.onChange,this,0,0),this.scale=new Ee(this.onChange,this,1,1),this.pivot=new Ee(this.onChange,this,0,0),this.skew=new Ee(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const s=t.worldTransform,i=this.worldTransform;i.a=e.a*s.a+e.b*s.c,i.b=e.a*s.b+e.b*s.d,i.c=e.c*s.a+e.d*s.c,i.d=e.c*s.b+e.d*s.d,i.tx=e.tx*s.a+e.ty*s.c+s.tx,i.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};Ae.IDENTITY=new Ae;let we=Ae;we.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};const Se=[{test:t=>"float"===t.type&&1===t.size&&!t.isArray,code:t=>`\n if(uv["${t}"] !== ud["${t}"].value)\n {\n ud["${t}"].value = uv["${t}"]\n gl.uniform1f(ud["${t}"].location, uv["${t}"])\n }\n `},{test:(t,e)=>("sampler2D"===t.type||"samplerCube"===t.type||"sampler2DArray"===t.type)&&1===t.size&&!t.isArray&&(null==e||void 0!==e.castToBaseTexture),code:t=>`t = syncData.textureCount++;\n\n renderer.texture.bind(uv["${t}"], t);\n\n if(ud["${t}"].value !== t)\n {\n ud["${t}"].value = t;\n gl.uniform1i(ud["${t}"].location, t);\n; // eslint-disable-line max-len\n }`},{test:(t,e)=>"mat3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.a,code:t=>`\n gl.uniformMatrix3fv(ud["${t}"].location, false, uv["${t}"].toArray(true));\n `,codeUbo:t=>`\n var ${t}_matrix = uv.${t}.toArray(true);\n\n data[offset] = ${t}_matrix[0];\n data[offset+1] = ${t}_matrix[1];\n data[offset+2] = ${t}_matrix[2];\n \n data[offset + 4] = ${t}_matrix[3];\n data[offset + 5] = ${t}_matrix[4];\n data[offset + 6] = ${t}_matrix[5];\n \n data[offset + 8] = ${t}_matrix[6];\n data[offset + 9] = ${t}_matrix[7];\n data[offset + 10] = ${t}_matrix[8];\n `},{test:(t,e)=>"vec2"===t.type&&1===t.size&&!t.isArray&&void 0!==e.x,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["${t}"].location, v.x, v.y);\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `},{test:t=>"vec2"===t.type&&1===t.size&&!t.isArray,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["${t}"].location, v[0], v[1]);\n }\n `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.width,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["${t}"].location, v.x, v.y, v.width, v.height)\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n cv[3] = v.alpha;\n gl.uniform4f(ud["${t}"].location, v.red, v.green, v.blue, v.alpha)\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n data[offset+3] = v.alpha;\n `},{test:(t,e)=>"vec3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n \n gl.uniform3f(ud["${t}"].location, v.red, v.green, v.blue)\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n `},{test:t=>"vec4"===t.type&&1===t.size&&!t.isArray,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["${t}"].location, v[0], v[1], v[2], v[3])\n }`}],Re={float:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }",vec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }",int:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",ivec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",ivec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",ivec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",uint:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }",uvec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }",uvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }",uvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }",bool:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }",bvec2:"\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",bvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",bvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",samplerCube:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",sampler2DArray:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }"},Ie={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)"};const Ce={};let Pe,Me=Ce;function De(){if(!Pe){Pe=x.MEDIUM;const t=function(){if(Me===Ce||Me?.isContextLost()){const t=T.ADAPTER.createCanvas();let e;T.PREFER_ENV>=i.WEBGL2&&(e=t.getContext("webgl2",{})),e||(e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Me=e}return Me}();if(t&&t.getShaderPrecisionFormat){const e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);e&&(Pe=e.precision?x.HIGH:x.MEDIUM)}}return Pe}const Be={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 Ne(t){return Be[t]}let Oe=null;const Le={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 Fe(t,e){if(!Oe){const e=Object.keys(Le);Oe={};for(let s=0;s<e.length;++s){const i=e[s];Oe[t[i]]=Le[i]}}return Oe[e]}function Ue(t,e,s
1){if("precision"!==t.substring(0,9)){let i=e;return e===x.HIGH&&s!==x.HIGH&&(i=x.MEDIUM),`precision ${i} float;\n${t}`}return s!==x.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}let ke=0;const Ge={},He=class t{constructor(e,s,i="pixi-shader",r={}){this.extra={},this.id=ke++,this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=s||t.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=r,"#version"!==this.vertexSrc.substring(0,8)&&(i=i.replace(/\s+/g,"-"),Ge[i]?(Ge[i]++,i+=`-${Ge[i]}`):Ge[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}\n${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}\n${this.fragmentSrc}`,this.vertexSrc=Ue(this.vertexSrc,t.defaultVertexPrecision,x.HIGH),this.fragmentSrc=Ue(this.fragmentSrc,t.defaultFragmentPrecision,De())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"}static from(e,s,i){const r=e+s;let n=Et[r];return n||(Et[r]=n=new t(e,s,i)),n}};He.defaultVertexPrecision=x.HIGH,He.defaultFragmentPrecision=A.apple.device?x.HIGH:x.MEDIUM;let Xe=He,Ve=0;class ze{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Ve++,this.static=!!e,this.ubo=!!s,t instanceof qt?(this.buffer=t,this.buffer.type=b.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new qt(new Float32Array(1)),this.buffer.type=b.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,s){if(this.ubo)throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[t]=new ze(e,s)}static from(t,e,s){return new ze(t,e,s)}static uboFrom(t,e){return new ze(t,e??!0,!0)}}class We{constructor(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof ze?e:new ze(e):new ze({}),this.disposeRunner=new Ht("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const i=e.uniforms[s];if(!0===i.group&&this.checkUniformExists(t,i))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,s){const i=Xe.from(t,e);return new We(i,s)}}class je{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 e=new Int32Array(t);for(let i=0;i<t;i++)e[i]=i;this.defaultGroupCache[t]=ze.from({uSamplers:e},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new Xe(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new pe,default:this.defaultGroupCache[t]};return new We(this.programCache[t],e)}generateSampleSrc(t){let e="";e+="\n",e+="\n";for(let s=0;s<t;s++)s>0&&(e+="\nelse "),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+="\n{",e+=`\n\tcolor = texture2D(uSamplers[${s}], vTextureCoord);`,e+="\n}";return e+="\n",e+="\n",e}}class $e{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}class Ye{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}const qe=class t extends Ye{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=se,this.vertexSize=6,this.state=Ut.for2d(),this.size=4*t.defaultBatchSize,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),e.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??function(t){let e=!0;const s=T.ADAPTER.getNavigator();if(A.tablet||A.phone){if(A.apple.device){const t=s.userAgent.match(/OS (\d+)_(\d+)?/);t&&parseInt(t[1],10)<11&&(e=!1)}if(A.android.device){const t=s.userAgent.match(/Android\s([0-9.]*)/);t&&parseInt(t[1],10)<7&&(e=!1)}}return e?t:4}(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??!A.apple.device,this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return I("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return"precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n"}static get defaultFragmentTemplate(){return"varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n"}setShaderGenerator({vertex:e=t.defaultVertexSrc,fragment:s=t.defaultFragmentTemplate}={}){this.shaderGenerator=new je(e,s)}contextChange(){const e=this.renderer.gl;T.PREFER_ENV===i.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),t.defaultMaxTextures),this.maxTextures=function(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const s=e.createShader(e.FRAGMENT_SHADER);for(;;){const i=Lt.replace(/%forloop%/gi,Ft(t));if(e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))break;t=t/2|0}return t}(this.maxTextures,e)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:e,_textureArrayPool:s}=t,i=this.size/4,r=Math.floor(i/this.maxTextures)+1;for(;e.length<i;)e.push(new $t);for(;s.length<r;)s.push(new $e);for(let t=0;t<this.maxTextures;t++)this._tempBoundTextures[t]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:e,maxTextures:s}=this,i=t._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++jt._globalBatch,h=0,l=i[0],u=0;r.copyBoundTextures(n,s);for(let t=0;t<this._bufferSize;++t){const c=e[t];e[t]=null,c._batchEnabled!==o&&(l.count>=s&&(r.boundArray(l,n,o,s),this.buildDrawCalls(l,u,t),u=t,l=i[++h],++o),c._batchEnabled=o,c.touched=a,l.elements[l.count++]=c)}l.count>0&&(r.boundArray(l,n,o,s),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let t=0;t<n.length;t++)n[t]=null;jt._globalBatch=o}buildDrawCalls(e,s,i){const{_bufferedElements:r,_attributeBuffer:n,_indexBuffer:a,vertexSize:o}=this,h=t._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=e;for(let t=s;t<i;++t){const i=r[t],f=i._texture.baseTexture,p=ct[f.alphaMode?1:0][i.blendMode];r[t]=null,s<t&&d.blend!==p&&(d.size=c-d.start,s=t,d=h[++l],d.texArray=e,d.start=c),this.packInterleavedGeometry(i,n,a,u,c),u+=i.vertexData.length/2*o,c+=i.indices.length,d.blend=p}s<i&&(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:e,_attributeBuffer:s,_indexBuffer:i}=this;t.canUploadSameBuffer?(e[this._flushId]._buffer.update(s.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(s.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const e=this._dcIndex,{gl:s,state:i}=this.renderer,r=t._drawCallPool;let n=null;for(let t=0;t<e;t++){const{texArray:e,type:a,size:o,start:h,blend:l}=r[t];n!==e&&(n=e,this.bindAndClearTexArray(e)),this.state.blendMode=l,i.set(this.state),s.drawElements(a,o,s.UNSIGNED_SHORT,2*h)}}flush(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),t.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=pt(Math.ceil(t/8)),s=gt(e),i=8*e;this._aBuffers.length<=s&&(this._iBuffers.length=s+1);let r=this._aBuffers[i];return r||(this._aBuffers[i]=r=new Ot(i*this.vertexSize*4)),r}getIndexBuffer(t){const e=pt(Math.ceil(t/12)),s=gt(e),i=12*e;this._iBuffers.length<=s&&(this._iBuffers.length=s+1);let r=this._iBuffers[s];return r||(this._iBuffers[s]=r=new Uint16Array(i)),r}packInterleavedGeometry(t,e,s,i,r){const{uint32View:n,float32View:a}=e,o=i/this.vertexSize,h=t.uvs,l=t.indices,u=t.vertexData,c=t._texture.baseTexture._batchLocation,d=Math.min(t.worldAlpha,1),f=ut.shared.setValue(t._tintRGB).toPremultiplied(d,t._texture.baseTexture.alphaMode>0);for(let p=0;p<u.length;p+=2)a[i++]=u[p],a[i++]=u[p+1],a[i++]=h[p],a[i++]=h[p+1],n[i++]=f,a[i++]=c;for(let p=0;p<l.length;p++)s[r++]=o+l[p]}};qe.defaultBatchSize=4096,qe.extension={name:"batch",type:Mt.RendererPlugin},qe._drawCallPool=[],qe._textureArrayPool=[];let Ke=qe;Nt.add(Ke);const Ze=class t extends We{constructor(e,s,i){super(Xe.from(e||t.defaultVertexSrc,s||t.defaultFragmentSrc),i),this.padding=0,this.resolution=t.defaultResolution,this.multisample=t.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ut}apply(t,e,s,i,r){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"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
1\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"}};Ze.defaultResolution=1,Ze.defaultMultisample=v.NONE;let Je=Ze;class Qe{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ut(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:i}=t,r=s??e;void 0!==r&&(this.color=r),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(){}}Qe.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Qe.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"background"},Nt.add(Qe);class ts{constructor(t){this.renderer=t,this.emptyRenderer=new Ye(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:r,ids:n,count:a}=t;let o=0;for(let h=0;h<a;h++){const t=r[h],a=t._batchLocation;if(a>=0&&a<i&&e[a]===t)n[h]=a;else for(;o<i;){const i=e[o];if(!i||i._batchEnabled!==s||i._batchLocation!==o){n[h]=o,t._batchLocation=o,e[o]=t;break}o++}}}destroy(){this.renderer=null}}ts.extension={type:Mt.RendererSystem,name:"batch"},Nt.add(ts);let es=0;class ss{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=es++}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=es++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;void 0!==e.addEventListener&&(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(T.PREFER_ENV>=i.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};1===this.webGLVersion?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout((()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()}),0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,void 0!==t.removeEventListener&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const i=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ss.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ss.extension={type:Mt.RendererSystem,name:"context"},Nt.add(ss);class is{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Ht("disposeFramebuffer"),this.multisample=v.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new jt(null,{scaleMode:d.NEAREST,resolution:1,mipmap:p.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new jt(null,{scaleMode:d.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:p.OFF,format:h.DEPTH_COMPONENT,type:u.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s<this.colorTextures.length;s++){const i=this.colorTextures[s],r=i.resolution;i.setSize(t/r,e/r)}if(this.depthTexture){const s=this.depthTexture.resolution;this.depthTexture.setSize(t/s,e/s)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class rs extends jt{constructor(t={}){if("number"==typeof t){t={width:arguments[0],height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=v.NONE),super(null,t),this.mipmap=p.OFF,this.valid=!0,this._clear=new ut([0,0,0,0]),this.framebuffer=new is(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.he
1ight)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class ns extends Xt{constructor(t){const e=t;super(e.naturalWidth||e.videoWidth||e.displayWidth||e.width,e.naturalHeight||e.videoHeight||e.displayHeight||e.height),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){void 0!==s||e.startsWith("data:")?!1!==s&&(t.crossOrigin="string"==typeof s?s:"anonymous"):t.crossOrigin=function(t,e=globalThis.location){if(t.startsWith("data:"))return"";e=e||globalThis.location;const s=new URL(t,document.baseURI);return s.hostname!==e.hostname||s.port!==e.port||s.protocol!==e.protocol?"anonymous":""}(e)}upload(t,e,s,i){const r=t.gl,n=e.realWidth,a=e.realHeight;if(i=i||this.source,typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement){if(!i.complete||0===i.naturalWidth)return!1}else if(typeof HTMLVideoElement<"u"&&i instanceof HTMLVideoElement&&i.readyState<=1)return!1;return r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===m.UNPACK),this.noSubImage||e.target!==r.TEXTURE_2D||s.width!==n||s.height!==a?(s.width=n,s.height=a,r.texImage2D(e.target,0,s.internalFormat,e.format,s.type,i)):r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,s.type,i),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,s=t.naturalHeight||t.videoHeight||t.height;this.resize(e,s),super.update()}dispose(){this.source=null}}class as extends ns{constructor(t,e){if(e=e||{},"string"==typeof t){const s=new Image;ns.crossOrigin(s,t,e.crossorigin),s.src=t,t=s}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??T.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.bitmap=null,this._load=null,!1!==e.autoLoad&&this.load()}load(t){return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise(((t,e)=>{const s=this.source;this.url=s.src;const i=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?i():(s.onload=i,s.onerror=t=>{e(t),this.onError.emit(t)})}))),this._load}process(){const t=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||"anonymous"===t.crossOrigin;return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then((t=>t.blob())).then((s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===m.UNPACK?"premultiply":"none"}))).then((t=>this.destroyed?Promise.reject():(this.bitmap=t,this.update(),this._process=null,Promise.resolve(this)))),this._process}upload(t,e,s){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let t=!0;const i=e._glTextures;for(const r in i){const n=i[r];if(n!==s&&n.dirtyId!==e.dirtyId){t=!1;break}}t&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&("string"==typeof t||t instanceof HTMLImageElement)}}class os{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const i=e.width,r=e.height;if(s){const e=t.width/2/i,n=t.height/2/r,a=t.x/i+e,o=t.y/r+n;s=Te.add(s,Te.NW),this.x0=a+e*Te.uX(s),this.y0=o+n*Te.uY(s),s=Te.add(s,2),this.x1=a+e*Te.uX(s),this.y1=o+n*Te.uY(s),s=Te.add(s,2),this.x2=a+e*Te.uX(s),this.y2=o+n*Te.uY(s),s=Te.add(s,2),this.x3=a+e*Te.uX(s),this.y3=o+n*Te.uY(s)}else this.x0=t.x/i,this.y0=t.y/r,this.x1=(t.x+t.width)/i,this.y1=t.y/r,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/r,this.x3=t.x/i,this.y3=(t.y+t.height)/r;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}os.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const hs=new os;function ls(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}class us extends w{constructor(t,e,s,i,r,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new le(0,0,1,1)),t instanceof us&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this.destroyed=!1,this._uvs=hs,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(r||0),!0===r)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new oe(n.x,n.y):new oe(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update(
1)}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:t}=this.baseTexture;t?.url&&At[t.url]&&us.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,us.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),s=new us(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=t),s}updateUvs(){this._uvs===hs&&(this._uvs=new os),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=T.STRICT_TEXTURE_CACHE){const i="string"==typeof t;let r=null;if(i)r=t;else if(t instanceof jt){if(!t.cacheId){const s=e?.pixiIdPrefix||"pixiid";t.cacheId=`${s}-${vt()}`,jt.addToCache(t,t.cacheId)}r=t.cacheId}else{if(!t._pixiId){const s=e?.pixiIdPrefix||"pixiid";t._pixiId=`${s}_${vt()}`}r=t._pixiId}let n=At[r];if(i&&s&&!n)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return n||t instanceof jt?!n&&t instanceof jt&&(n=new us(t),us.addToCache(n,r)):(e.resolution||(e.resolution=Pt(t)),n=new us(new jt(t,e)),n.baseTexture.cacheId=r,jt.addToCache(n.baseTexture,r),us.addToCache(n,r)),n}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e?.resourceOptions),i=us.from(t,Object.assign({resourceOptions:s},e),!1),r=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):r.load().then((()=>Promise.resolve(i)))}static fromBuffer(t,e,s,i){return new us(jt.fromBuffer(t,e,s,i))}static fromLoader(t,e,s,i){const r=new jt(t,Object.assign({scaleMode:jt.defaultOptions.scaleMode,resolution:Pt(e)},i)),{resource:n}=r;n instanceof as&&(n.url=e);const a=new us(r);return s||(s=e),jt.addToCache(a.baseTexture,s),us.addToCache(a,s),s!==e&&(jt.addToCache(a.baseTexture,e),us.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise((t=>{a.baseTexture.once("loaded",(()=>t(a)))}))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),At[e]&&At[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),At[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=At[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete At[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)At[t.textureCacheIds[e]]===t&&delete At[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:s,width:i,height:r}=t,n=e+i>this.baseTexture.width,a=s+r>this.baseTexture.height;if(n||a){const t=n&&a?"and":"or",o=`X: ${e} + ${i} = ${e+i} > ${this.baseTexture.width}`,h=`Y: ${s} + ${r} = ${s+r} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${o} ${t} ${h}`)}this.valid=i&&r&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return us._EMPTY||(us._EMPTY=new us(new jt),ls(us._EMPTY),ls(us._EMPTY.baseTexture)),us._EMPTY}static get WHITE(){if(!us._WHITE){const t=T.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),us._WHITE=new us(jt.from(t)),ls(us._WHITE),ls(us._WHITE.baseTexture)}return us._WHITE}}class cs extends us{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const i=this.baseTexture.resolution,r=Math.round(t*i)/i,n=Math.round(e*i)/i;this.valid=r>0&&n>0,this._frame.width=this.orig.width=r,this._frame.height=this.orig.height=n,s&&this.baseTexture.resize(r,n),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new cs(new rs(t))}}class ds{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=v.NONE){const i=new rs(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new cs(i)}getOptimalTexture(t,e,s=1,i=v.NONE){let r;t=Math.max(Math.ceil(t*s-1e-6),1),e=Math.max(Math.ceil(e*s-1e-6),1),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?r=i>1?-i:-1:(r=((65535&(t=pt(t)))<<16|65535&(e=pt(e)))>>>0,i>1&&(r+=4294967296*i)),this.texturePool[r]||(this.texturePool[r]=[]);let n=this.texturePool[r].pop();return n||(n=this.createTexture(t,e,i)),n.filterPoolKey=r,n.setResolution(s),n}getFilterTexture(t,e,s){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||v.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=!1!==t)for(const e in this.texturePool){const t=this.texturePool[e];if(t)for(let e=0;e<t.length;e++)t[e].destroy(!0)}this.texturePool={}}setScreenSize(t){if(t.width!==this._pixelsWidth||t.height!==this._pixelsHeight){this.enableFullScreen=t.width>0&&t.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const e=this.texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}ds.SCREEN_KEY=-1;class fs extends ee{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class ps extends ee{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new qt(this.vertices),this.uvBuffer=new qt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let s=0,i=0;return this.uvs[0]=s,this.uvs[1]=i,this.uvs[2]=s+e.width/t.width,this.uvs[3]=i,this.uvs[4]=s+e.width/t.width,this.uvs[5]=i+e.height/t.height,this.uvs[6]=s,this.uvs[7]=i+e.height/t.height,s=e.x,i=e.y,this.vertices[0]=s,this.vertices[1]=i,this.vertices[2]=s+e.width,this.vertices[3]=i,this.vertices[4]=s+e.width,this.vertices[5]=i+e.height,this.vertices[6]=s,this.vertices[7]=i+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class ms{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=v.NONE,this.sourceFrame=new le,this.destinationFrame=new le,this.bindingSourceFrame=new le,this.bindingDestinationFrame=new le,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const gs=[new oe,new oe,new oe,new oe],_s=new pe;class xs{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new ds,this.statePool=[],this.quad=new fs,this.quadUv=new ps,this.tempRect=new le,this.activeState={},this.globalUniforms=new ze({outputFrame:new le,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}
1init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const s=this.renderer,i=this.defaultFilterStack,r=this.statePool.pop()||new ms,n=s.renderTexture;let a,o;if(n.current){const t=n.current;a=t.resolution,o=t.multisample}else a=s.resolution,o=s.multisample;let h=e[0].resolution||a,l=e[0].multisample??o,u=e[0].padding,c=e[0].autoFit,d=e[0].legacy??!0;for(let m=1;m<e.length;m++){const t=e[m];h=Math.min(h,t.resolution||a),l=Math.min(l,t.multisample??o),u=this.useMaxPadding?Math.max(u,t.padding):u+t.padding,c=c&&t.autoFit,d=d||(t.legacy??!0)}1===i.length&&(this.defaultFilterStack[0].renderTexture=n.current),i.push(r),r.resolution=h,r.multisample=l,r.legacy=d,r.target=t,r.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),r.sourceFrame.pad(u);const f=this.tempRect.copyFrom(n.sourceFrame);s.projection.transform&&this.transformAABB(_s.copyFrom(s.projection.transform).invert(),f),c?(r.sourceFrame.fit(f),(r.sourceFrame.width<=0||r.sourceFrame.height<=0)&&(r.sourceFrame.width=0,r.sourceFrame.height=0)):r.sourceFrame.intersects(f)||(r.sourceFrame.width=0,r.sourceFrame.height=0),this.roundFrame(r.sourceFrame,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),r.renderTexture=this.getOptimalFilterTexture(r.sourceFrame.width,r.sourceFrame.height,h,l),r.filters=e,r.destinationFrame.width=r.renderTexture.width,r.destinationFrame.height=r.renderTexture.height;const p=this.tempRect;p.x=0,p.y=0,p.width=r.sourceFrame.width,p.height=r.sourceFrame.height,r.renderTexture.filterFrame=r.sourceFrame,r.bindingSourceFrame.copyFrom(n.sourceFrame),r.bindingDestinationFrame.copyFrom(n.destinationFrame),r.transform=s.projection.transform,s.projection.transform=null,n.bind(r.renderTexture,r.sourceFrame,p),s.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),s=e.filters;this.activeState=e;const i=this.globalUniforms.uniforms;i.outputFrame=e.sourceFrame,i.resolution=e.resolution;const r=i.inputSize,n=i.inputPixel,a=i.inputClamp;if(r[0]=e.destinationFrame.width,r[1]=e.destinationFrame.height,r[2]=1/r[0],r[3]=1/r[1],n[0]=Math.round(r[0]*e.resolution),n[1]=Math.round(r[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*r[2]-.5*n[2],a[3]=e.sourceFrame.height*r[3]-.5*n[3],e.legacy){const t=i.filterArea;t[0]=e.destinationFrame.width,t[1]=e.destinationFrame.height,t[2]=e.sourceFrame.x,t[3]=e.sourceFrame.y,i.filterClamp=i.inputClamp}this.globalUniforms.update();const o=t[t.length-1];if(this.renderer.framebuffer.blit(),1===s.length)s[0].apply(this,e.renderTexture,o.renderTexture,g.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let t=e.renderTexture,i=this.getOptimalFilterTexture(t.width,t.height,e.resolution);i.filterFrame=t.filterFrame;let r=0;for(r=0;r<s.length-1;++r){1===r&&e.multisample>1&&(i=this.getOptimalFilterTexture(t.width,t.height,e.resolution),i.filterFrame=t.filterFrame),s[r].apply(this,t,i,g.CLEAR,e);const n=t;t=i,i=n}s[r].apply(this,t,o.renderTexture,g.BLEND,e),r>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(t),this.returnFilterTexture(i)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=g.CLEAR){const{renderTexture:s,state:i}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){const e=this.tempRect;e.x=0,e.y=0,e.width=t.filterFrame.width,e.height=t.filterFrame.height,s.bind(t,t.filterFrame,e)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const r=1&i.stateId||this.forceClear;(e===g.CLEAR||e===g.BLIT&&r)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,i){const r=this.renderer;r.state.set(t.state),this.bindAndClear(s,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,r.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),r.geometry.bind(this.quadUv),r.geometry.draw(o.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(o.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:i}=this.activeState,{orig:r}=e._texture,n=t.set(i.width,0,0,i.height,s.x,s.y),a=e.worldTransform.copyTo(pe.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/r.width,1/r.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,i=v.NONE){return this.texturePool.getOptimalTexture(t,e,s,i)}getFilterTexture(t,e,s){if("number"==typeof t){const s=t;t=e,e=s}t=t||this.activeState.renderTexture;const i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||v.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}
vendor: 4,509 bytes, line 1
1resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=gs[0],i=gs[1],r=gs[2],n=gs[3];s.set(e.left,e.top),i.set(e.left,e.bottom),r.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(s,s),t.apply(i,i),t.apply(r,r),t.apply(n,n);const a=Math.min(s.x,i.x,r.x,n.x),o=Math.min(s.y,i.y,r.y,n.y),h=Math.max(s.x,i.x,r.x,n.x),l=Math.max(s.y,i.y,r.y,n.y);e.x=a,e.y=o,e.width=h-a,e.height=l-o}roundFrame(t,e,s,i,r){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(r){const{a:t,b:e,c:s,d:i}=r;if((Math.abs(e)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(i)>1e-4))return}(r=r?_s.copyFrom(r):_s.identity()).translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.transformAABB(r,t),t.ceil(e),this.transformAABB(r.invert(),t)}}}xs.extension={type:Mt.RendererSystem,name:"filter"},Nt.add(xs);class ys{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=v.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const vs=new le;class bs{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new is(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new le,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;T.PREFER_ENV===i.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=t=>e.drawBuffersWEBGL(t):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:i}=this;if(t){const r=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,r.framebuffer)),r.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,r.mipLevel=s),r.dirtyId!==t.dirtyId&&(r.dirtyId=t.dirtyId,r.dirtyFormat!==t.dirtyFormat?(r.dirtyFormat=t.dirtyFormat,r.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):r.dirtySize!==t.dirtySize&&(r.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let e=0;e<t.colorTextures.length;e++){const s=t.colorTextures[e];this.renderer.texture.unbind(s.parentTextureArray||s)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const t=e.width>>s,i=e.height>>s,r=t/e.width;this.setViewport(e.x*r,e.y*r,t,i)}else{const e=t.width>>s,i=t.height>>s;this.setViewport(0,0,e,i)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,i){const r=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),(r.width!==s||r.height!==i||r.x!==t||r.y!==e)&&(r.x=t,r.y=e,r.width=s,r.height=i,this.gl.viewport(t,e,s,i))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,i,r=n.COLOR|n.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,i),a.clear(r)}initFramebuffer(t){const{gl:e}=this,s=new ys(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){let i;e.bindRenderbuffer(e.RENDERBUFFER,s.stencil),i=1===this.renderer.context.webGLVersion?e.DEPTH_STENCIL:t.depth&&t.stencil?e.DEPTH24_STENCIL8:t.depth?e.DEPTH_COMPONENT24:e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,i,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,i,t.width,t.height)}const i=t.colorTextures;let r=i.length;e.drawBuffers||(r=Math.min(r,1));for(let n=0;n<r;n++){const r=i[n],a=r.parentTextureArray||r;this.renderer.texture.bind(a,0),0===n&&s.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,s.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:s}=this,i=t.glFramebuffers[this.CONTEXT_UID],r=t.colorTextures;let n=r.length;s.drawBuffers||(n=Math.min(n,1)),i.multisample>
11&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||s.createRenderbuffer():i.msaaBuffer&&(s.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const a=[];for(let o=0;o<n;o++){const n=r[o],h=n.parentTextureArray||n;this.renderer.texture.bind(h,0),0===o&&i.msaaBuffer?(s.bindRenderbuffer(s.RENDERBUFFER,i.msaaBuffer),s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,i.msaaBuffer)):(s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+o,n.target,h._glTextures[this.CONTEXT_UID].texture,e),a.push(s.COLOR_ATTACHMENT0+o))}if(a.length>1&&s.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const i=t.depthTexture;this.renderer.texture.bind(i,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,i._glTextures[this.CONTEXT_UID].texture,e)}if(!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture)i.stencil&&(s.deleteRenderbuffer(i.stencil),i.stencil=null);else{let e,r;i.stencil=i.stencil||s.createRenderbuffer(),1===this.renderer.context.webGLVersion?(e=s.DEPTH_STENCIL_ATTACHMENT,r=s.DEPTH_STENCIL):t.depth&&t.stencil?(e=s.DEPTH_STENCIL_ATTACHMENT,r=s.DEPTH24_STENCIL8):t.depth?(e=s.DEPTH_ATTACHMENT,r=s.DEPTH_COMPONENT24):(e=s.STENCIL_ATTACHMENT,r=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,i.stencil),i.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,r,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,r,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,e,s.RENDERBUFFER,i.stencil)}}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=v.NONE;if(t<=1||null===e)return s;for(let i=0;i<e.length;i++)if(e[i]<=t){s=e[i];break}return 1===s&&(s=v.NONE),s}blit(t,e,s){const{current:i,renderer:r,gl:n,CONTEXT_UID:a}=this;if(2!==r.context.webGLVersion||!i)return;const o=i.glFramebuffers[a];if(!o)return;if(!t){if(!o.msaaBuffer)return;const e=i.colorTextures[0];if(!e)return;o.blitFramebuffer||(o.blitFramebuffer=new is(i.width,i.height),o.blitFramebuffer.addColorTexture(0,e)),(t=o.blitFramebuffer).colorTextures[0]!==e&&(t.colorTextures[0]=e,t.dirtyId++,t.dirtyFormat++),(t.width!==i.width||t.height!==i.height)&&(t.width=i.width,t.height=i.height,t.dirtyId++,t.dirtySize++)}e||((e=vs).width=i.width,e.height=i.height),s||(s=e);const h=e.width===s.width&&e.height===s.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,o.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,s.left,s.top,s.right,s.bottom,n.COLOR_BUFFER_BIT,h?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const s=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(!s)return;delete t.glFramebuffers[this.CONTEXT_UID];const r=this.managedFramebuffers.indexOf(t);r>=0&&this.managedFramebuffers.splice(r,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&i.deleteRenderbuffer(s.msaaBuffer),s.stencil&&i.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;s<e.length;s++)this.disposeFramebuffer(e[s],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const s=t.width,i=t.height,r=this.gl,n=e.stencil=r.createRenderbuffer();let a,o;r.bindRenderbuffer(r.RENDERBUFFER,n),1===this.renderer.context.webGLVersion?(a=r.DEPTH_STENCIL_ATTACHMENT,o=r.DEPTH_STENCIL):t.depth?(a=r.DEPTH_STENCIL_ATTACHMENT,o=r.DEPTH24_STENCIL8):(a=r.STENCIL_ATTACHMENT,o=r.STENCIL_INDEX8),e.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,e.multisample,o,s,i):r.renderbufferStorage(r.RENDERBUFFER,o,s,i),r.framebufferRenderbuffer(r.FRAMEBUFFER,a,r.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new le}destroy(){this.renderer=null}}bs.extension={type:Mt.RendererSystem,name:"framebuffer"},Nt.add(bs);const Ts={5126:4,5123:2,5121:1};class Es{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==e.webGLVersion){let e=this.renderer.context.extensions.vertexArrayObject;T.PREFER_ENV===i.WEBGL_LEGACY&&(e=null),e?(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=t=>e.bindVertexArrayOES(t),t.deleteVertexArray=t=>e.deleteVertexArrayOES(t)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(2!==e.webGLVersion){const e=t.getExtension("ANGLE_instanced_arrays");e?(t.vertexAttribDivisor=(t,s)=>e.vertexAttribDivisorANGLE(t,s),t.drawElementsInstanced=(t,s,i,r,n)=>e.drawElementsInstancedANGLE(t,s,i,r,n),t.drawArraysInstanced=(t,s,i,r)=>e.drawArraysInstancedANGLE(t,s,i,r)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let i=t.glVertexArrayObjects[this.CONTEXT_UID],r=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},r=!0);const n=i[e.program.id]||this.initGeometryVao(t,e,r);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?s.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s<t.buffers.length;s++){const i=t.buffers[s];e.update(i)}}checkCompatibility(t,e){const s=t.attributes,i=e.attributeData;for(const r in i)if(!s[r])throw new Error(`shader and geometry incompatible, geometry missing the "${r}" attribute`)}getSignature(t,e){const s=t.attributes,i=e.attributeData,r=["g",t.id];for(const n in s)i[n]&&r.push(n,i[n].location);return r.join("-")}initGeometryVao(t,e,s=!0){const i=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[r]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const o=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID];let l=h[o];if(l)return h[a.id]=l,l;const u=t.buffers,c=t.attributes,d={},f={};for(const p in u)d[p]=0,f[p]=0;for(const p in c)!c[p].size&&a.attributeData[p]?c[p].size=a.attributeData[p].size:c[p].size||console.warn(`PIXI Geometry attribute '${p}' size cannot be determined (likely the bound shader does not have the attribute)`),d[c[p].buffer]+=c[p].size*Ts[c[p].type];for(const p in c){const t=c[p],e=t.size;void 0===t.stride&&(d[t.buffer]===e*Ts[t.type]?t.stride=0:t.stride=d[t.buffer]),void 0===t.start&&(t.start=f[t.buffer],f[t.buffer]+=e*Ts[t.type])}l=i.createVertexArray(),i.bindVertexArray(l);for(let p=0;p<u.length;p++){const t=u[p];n.bind(t),s&&t._glBuffers[r].refCount++}return this.activateVao(t,a),h[a.id]=l,h[o]=l,i.bindVertexArray(null),n.unbind(b.ARRAY_BUFFER),l}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const s=t.glVertexArrayObjects[this.CONTEXT_UID],i=this.gl,r=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),s){if(n)for(let t=0;t<r.length;t++){const s=r[t]._glBuffers[this.CONTEXT_UID];s&&(s.refCount--,0===s.refCount&&!e&&n.dispose(r[t],e))}if(!e)for(const t in s)if("g"===t[0]){const e=s[t];this._activeVao===e&&this.unbind(),i.deleteVertexArray(e)}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let s=0;s<e.length;s++)this.disposeGeometry(this.managedGeometries[e[s]],t)}activateVao(t,e){const s=this.gl,i=this.CONTEXT_UID,r=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&r.bind(t.indexBuffer);let o=null;for(const h in a){const t=a[h],l=n[t.buffer],u=l._glBuffers[i];if(e.attributeData[h]){o!==u&&(r.bind(l),o=u);const i=e.attributeData[h].location;if(s.enableVertexAttribArray(i),s.vertexAttribPointer(i,t.size,t.type||s.FLOAT,t.normalized,t.stride,t.start),t.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");
1s.vertexAttribDivisor(i,t.divisor)}}}}draw(t,e,s,i){const{gl:r}=this,n=this._activeGeometry;if(n.indexBuffer){const a=n.indexBuffer.data.BYTES_PER_ELEMENT,o=2===a?r.UNSIGNED_SHORT:r.UNSIGNED_INT;2===a||4===a&&this.canUseUInt32ElementIndex?n.instanced?r.drawElementsInstanced(t,e||n.indexBuffer.data.length,o,(s||0)*a,i||1):r.drawElements(t,e||n.indexBuffer.data.length,o,(s||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?r.drawArraysInstanced(t,s,e||n.getSize(),i||1):r.drawArrays(t,s,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Es.extension={type:Mt.RendererSystem,name:"geometry"},Nt.add(Es);const As=new pe;class ws{constructor(t,e){this._texture=t,this.mapCoord=new pe,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){void 0===e&&(e=t);const s=this.mapCoord;for(let i=0;i<t.length;i+=2){const r=t[i],n=t[i+1];e[i]=r*s.a+n*s.c+s.tx,e[i+1]=r*s.b+n*s.d+s.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const s=e._uvs;this.mapCoord.set(s.x1-s.x0,s.y1-s.y0,s.x3-s.x0,s.y3-s.y0,s.x0,s.y0);const i=e.orig,r=e.trim;r&&(As.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(As));const n=e.baseTexture,a=this.uClampFrame,o=this.clampMargin/n.resolution,h=this.clampOffset;return a[0]=(e._frame.x+o+h)/n.width,a[1]=(e._frame.y+o+h)/n.height,a[2]=(e._frame.x+e._frame.width-o+h)/n.width,a[3]=(e._frame.y+e._frame.height-o+h)/n.height,this.uClampOffset[0]=h/n.realWidth,this.uClampOffset[1]=h/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&0===e.rotate,!0}}class Ss extends Je{constructor(t,e,s){let i=null;"string"!=typeof t&&void 0===e&&void 0===s&&(i=t,t=void 0,e=void 0,s=void 0),super(t||"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n",e||"varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n",s),this.maskSprite=i,this.maskMatrix=new pe}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,s,i){const r=this._maskSprite,n=r._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new ws(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,r).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=r.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,s,i))}}class Rs{constructor(t=null){this.type=y.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Je.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=y.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 Is{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 t=this.maskDataPool.pop()||new Rs;t.pooled=!0,t.maskObject=e,s=t}const i=0!==this.maskStack.length?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!==y.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case y.SCISSOR:this.renderer.scissor.push(s);break;case y.STENCIL:this.renderer.stencil.push(s);break;case y.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case y.COLOR:this.pushColorMask(s)}s.type===y.SPRITE&&this.maskStack.push(s)}pop(t){const e=this.maskStack.pop();if(e&&e._target===t){if(e.enabled)switch(e.type){case y.SCISSOR:this.renderer.scissor.pop(e);break;case y.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case y.SPRITE:this.popSpriteMask(e);break;case y.COLOR:this.popColorMask(e)}if(e.reset(),e.pooled&&this.maskDataPool.push(e),0!==this.maskStack.length){const t=this.maskStack[this.maskStack.length-1];t.type===y.SPRITE&&t._filters&&(t._filters[0].maskSprite=t.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=y.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=y.SCISSOR:t.type=y.STENCIL:t.type=y.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 Ss])),i[0].resolution=t.resolution,i[0].multisample=t.multisample,i[0].maskSprite=e;const r=s.filterArea;s.filterArea=e.getBounds(!0),this.renderer.filter.push(s,i),s.filterArea=r,t._filters||this.alphaMaskIndex++}
1popSpriteMask(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(0!==(1&s),0!==(2&s),0!==(4&s),0!==(8&s))}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(0!==(1&s),0!==(2&s),0!==(4&s),0!==(8&s))}destroy(){this.renderer=null}}Is.extension={type:Mt.RendererSystem,name:"mask"},Nt.add(Is);class Cs{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const i=this.getStackLength();i!==s&&(0===i?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Ps=new pe,Ms=[],Ds=class t extends Cs{constructor(t){super(t),this.glConst=T.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:s}=t,{renderer:i}=this,r=i.renderTexture,n=s.getBounds(!0,Ms.pop()??new le);this.roundFrameToPixels(n,r.current?r.current.resolution:i.resolution,r.sourceFrame,r.destinationFrame,i.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:i,d:r}=t;return(Math.abs(s)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(r)>1e-4)}testScissor(e){const{maskObject:s}=e;if(!s.isFastRect||!s.isFastRect()||t.isMatrixRotated(s.worldTransform)||t.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);const i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,s,i,r,n){t.isMatrixRotated(n)||((n=n?Ps.copyFrom(n):Ps.identity()).translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,e),e.fit(r),e.x=Math.round(e.x*s),e.y=Math.round(e.y*s),e.width=Math.round(e.width*s),e.height=Math.round(e.height*s))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&Ms.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;e=this.renderer.renderTexture.current?t.y:this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};Ds.extension={type:Mt.RendererSystem,name:"scissor"};let Bs=Ds;Nt.add(Bs);class Ns extends Cs{constructor(t){super(t),this.glConst=T.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const r=t._colorMask;0!==r&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,i,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==r&&(t._colorMask=r,s.colorMask(0!==(1&r),0!==(2&r),0!==(4&r),0!==(8&r))),this._useCurrent()}pop(t){const e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{const s=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=s?s._colorMask:15;0!==i&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==i&&(s._colorMask=i,e.colorMask(0!==(1&i),0!==(2&i),0!==(4&i),0!==(8&i))),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;
1t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Ns.extension={type:Mt.RendererSystem,name:"stencil"},Nt.add(Ns);class Os{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get:()=>(I("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract)},prepare:{enumerable:!1,get:()=>(I("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare)},interaction:{enumerable:!1,get:()=>(I("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events)}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}Os.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"_plugin"},Nt.add(Os);class Ls{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new pe,this.transform=null}update(t,e,s,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,i),this.transform&&this.projectionMatrix.append(this.transform);const r=this.renderer;r.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,r.globalUniforms.update(),r.shader.shader&&r.shader.syncUniformGroup(r.shader.shader.uniforms.globals)}calculateProjection(t,e,s,i){const r=this.projectionMatrix,n=i?-1:1;r.identity(),r.a=1/e.width*2,r.d=n*(1/e.height*2),r.tx=-1-e.x*r.a,r.ty=-n-e.y*r.d}setTransform(t){}destroy(){this.renderer=null}}Ls.extension={type:Mt.RendererSystem,name:"projection"},Nt.add(Ls);const Fs=new we,Us=new le;class ks{constructor(t){this.renderer=t,this._tempMatrix=new pe}generateTexture(t,e){const{region:s,...i}=e||{},r=s?.copyTo(Us)||t.getLocalBounds(Us,!0),n=i.resolution||this.renderer.resolution;r.width=Math.max(r.width,1/n),r.height=Math.max(r.height,1/n),i.width=r.width,i.height=r.height,i.resolution=n,i.multisample??(i.multisample=this.renderer.multisample);const a=cs.create(i);this._tempMatrix.tx=-r.x,this._tempMatrix.ty=-r.y;const o=t.transform;return t.transform=Fs,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,a}destroy(){}}ks.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"textureGenerator"},Nt.add(ks);const Gs=new le,Hs=new le;class Xs{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new le,this.destinationFrame=new le,this.viewportFrame=new le}contextChange(){const t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,s){const i=this.renderer;let r,n,a;this.current=t,t?(r=t.baseTexture,a=r.resolution,e||(Gs.width=t.frame.width,Gs.height=t.frame.height,e=Gs),s||(Hs.x=t.frame.x,Hs.y=t.frame.y,Hs.width=e.width,Hs.height=e.height,s=Hs),n=r.framebuffer):(a=i.resolution,e||(Gs.width=i._view.screen.width,Gs.height=i._view.screen.height,e=Gs),s||((s=Gs).width=e.width,s.height=e.height));const o=this.viewportFrame;o.x=s.x*a,o.y=s.y*a,o.width=s.width*a,o.height=s.height*a,t||(o.y=i.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(n,o),this.renderer.projection.update(s,e,a,!n),t?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,i=ut.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);const r=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=r.width!==n.width||r.height!==n.height;if(a){let{x:t,y:e,width:s,height:i}=this.viewportFrame;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(t,e,s,i)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Xs.extension={type:Mt.RendererSystem,name:"renderTexture"},Nt.add(Xs);class Vs{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function zs(t,e,s){const i=t.createShader(e);return t.shaderSource(i,s),t.compileShader(i),i}function Ws(t){const e=new Array(t);for(let s=0;s<e.length;s++)e[s]=!1;return e}function js(t,e){switch(t){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return Ws(2*e);case"bvec3":return Ws(3*e);case"bvec4":return Ws(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}function $s(t,e){const s=t.getShaderSource(e).split("\n").map(((t,e)=>`${e}: ${t}`)),i=t.getShaderInfoLog(e),r=i.split("\n"),n={},a=r.map((t=>
1parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1")))).filter((t=>!(!t||n[t])&&(n[t]=!0,!0))),o=[""];a.forEach((t=>{s[t-1]=`%c${s[t-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));const h=s.join("\n");o[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function Ys(t,e){const s=zs(t,t.VERTEX_SHADER,e.vertexSrc),i=zs(t,t.FRAGMENT_SHADER,e.fragmentSrc),r=t.createProgram();t.attachShader(r,s),t.attachShader(r,i);const n=e.extra?.transformFeedbackVaryings;if(n&&("function"!=typeof t.transformFeedbackVaryings?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(r,n.names,"separate"===n.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(r),t.getProgramParameter(r,t.LINK_STATUS)||function(t,e,s,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(s,t.COMPILE_STATUS)||$s(t,s),t.getShaderParameter(i,t.COMPILE_STATUS)||$s(t,i),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,r,s,i),e.attributeData=function(t,e){const s={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r);if(i.name.startsWith("gl_"))continue;const n=Fe(e,i.type),a={type:n,name:i.name,size:Ne(n),location:e.getAttribLocation(t,i.name)};s[i.name]=a}return s}(r,t),e.uniformData=function(t,e){const s={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;r++){const i=e.getActiveUniform(t,r),n=i.name.replace(/\[.*?\]$/,""),a=!!i.name.match(/\[.*?\]$/),o=Fe(e,i.type);s[n]={name:n,index:r,type:o,size:i.size,isArray:a,value:js(o,i.size)}}return s}(r,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){const s=Object.keys(e.attributeData);s.sort(((t,e)=>t>e?1:-1));for(let i=0;i<s.length;i++)e.attributeData[s[i]].location=i,t.bindAttribLocation(r,i,s[i]);t.linkProgram(r)}t.deleteShader(s),t.deleteShader(i);const a={};for(const o in e.uniformData){const s=e.uniformData[o];a[o]={location:t.getUniformLocation(r,o),value:js(s.type,s.size)}}return new Vs(r,a)}function qs(t,e,s,i,r){s.buffer.update(r)}const Ks={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},Zs={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function Js(t,e){if(!t.autoManage)return{size:0,syncFunc:qs};const s=function(t,e){const s=[];for(const i in t)e[i]&&s.push(e[i]);return s.sort(((t,e)=>t.index-e.index)),s}(t.uniforms,e),{uboElements:i,size:r}=function(t){const e=t.map((t=>({data:t,offset:0,dataLen:0,dirty:0})));let s=0,i=0,r=0;for(let n=0;n<e.length;n++){const t=e[n];if(s=Zs[t.data.type],t.data.size>1&&(s=Math.max(s,16)*t.data.size),t.dataLen=s,i%s!==0&&i<16){const t=i%s%16;i+=t,r+=t}i+s>16?(r=16*Math.ceil(r/16),t.offset=r,r+=s,i=s):(t.offset=r,i+=s,r+=s)}return r=16*Math.ceil(r/16),{uboElements:e,size:r}}(s),n=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "];for(let a=0;a<i.length;a++){const e=i[a],s=t.uniforms[e.data.name],r=e.data.name;let o=!1;for(let t=0;t<Se.length;t++){const i=Se[t];if(i.codeUbo&&i.test(e.data,s)){n.push(`offset = ${e.offset/4};`,Se[t].codeUbo(e.data.name,s)),o=!0;break}}if(!o)if(e.data.size>1){const t=Ne(e.data.type),s=Math.max(Zs[e.data.type]/16,1),i=t/s,a=(4-i%4)%4;n.push(`\n cv = ud.${r}.value;\n v = uv.${r};\n offset = ${e.offset/4};\n\n t = 0;\n\n for(var i=0; i < ${e.data.size*s}; i++)\n {\n for(var j = 0; j < ${i}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${a};\n }\n\n `)}else{const t=Ks[e.data.type];n.push(`\n cv = ud.${r}.value;\n v = uv.${r};\n offset = ${e.offset/4};\n ${t};\n `)}}return n.push("\n renderer.buffer.update(buffer);\n "),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join("\n"))}}let Qs;let ti=0;const ei={textureCount:0,uboCount:0};class si{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=ti++}systemCheck(){if(!function(){if("boolean"==typeof Qs)return Qs;try{Qs=!0===new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")}catch{Qs=!1}return Qs}())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||(ei.textureCount=0,ei.uboCount=0,this.syncUniformGroup(t.uniformGroup,ei)),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]=function(t,e){const s=["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "];for(const i in t.uniforms){const r=e[i];if(!r){!0===t.uniforms[i]?.group&&(t.uniforms[i].ubo?s.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `):s.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `));continue}const n=t.uniforms[i];let a=!1;for(let t=0;t<Se.length;t++)if(Se[t].test(r,n)){s.push(Se[t].code(i,n)),a=!0;break}if(!a){const t=(1!==r.size||r.isArray?Ie:Re)[r.type].replace("location",`ud["${i}"].location`);s.push(`\n cu = ud["${i}"];\n cv = cu.value;\n v = uv["${i}"];\n ${t};`)}}return new Function("ud","uv","renderer","syncData",s.join("\n"))}(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||0!==t.dirtyId||!s.uniformGroups[t.id]){t.dirtyId=0;const i=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);
1t.buffer.update(),i(s.uniformData,t.uniforms,this.renderer,ei,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 r=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,r,this.shader.uniformBindCount),this.shader.uniformBindCount++;const n=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[n];if(a||(a=this._uboCache[n]=Js(t,this.shader.program.uniformData)),t.autoManage){const e=new Float32Array(a.size/4);t.buffer.update(e)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const i=t.uniforms,r=[`${s}-`];for(const n in i)r.push(n),e[n]&&r.push(e[n].type);return r.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,i=Ys(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}}si.extension={type:Mt.RendererSystem,name:"shader"},Nt.add(si);class ii{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(){}}ii.defaultOptions={hello:!1},ii.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"startup"},Nt.add(ii);const ri=class t{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=a.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new Ut,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=function(t,e=[]){return e[a.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.ADD]=[t.ONE,t.ONE],e[a.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.NONE]=[0,0],e[a.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[a.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[a.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[a.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[a.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[a.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[a.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[a.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[a.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[a.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[a.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)1&e&&this.map[s].call(this,!!(t.data&1<<s)),e>>=1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],s=this.gl;2===e.length?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const s=this.checks.indexOf(t);e&&-1===s?this.checks.push(t):!e&&-1!==s&&this.checks.splice(s,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};ri.extension={type:Mt.RendererSystem,name:"state"};let ni=ri;Nt.add(ni);class ai extends w{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter((e=>t.systems[e])),s=[...e,...Object.keys(t.systems).filter((t=>!e.includes(t)))];for(const i of s)this.addSystem(t.systems[i],i)}addRunners(...t){t.forEach((t=>{this.runners[t]=new Ht(t)}))}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const i in this.runners)this.runners[i].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);
1t.items.forEach((i=>{const r=s.find((t=>this._systemsHash[t]===i));i[t.name](e[r])}))}destroy(){Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash={}}}const oi=class t{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=t.defaultMaxIdle,this.checkCountMax=t.defaultCheckCountMax,this.mode=t.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==_.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let i=0;i<e.length;i++){const r=e[i];r.resource&&this.count-r.touched>this.maxIdle&&(t.destroyTexture(r,!0),e[i]=null,s=!0)}if(s){let t=0;for(let s=0;s<e.length;s++)null!==e[s]&&(e[t++]=e[s]);e.length=t}}unload(t){const e=this.renderer.texture,s=t._texture;s&&!s.framebuffer&&e.destroyTexture(s);for(let i=t.children.length-1;i>=0;i--)this.unload(t.children[i])}destroy(){this.renderer=null}};oi.defaultMode=_.AUTO,oi.defaultMaxIdle=3600,oi.defaultCheckCountMax=600,oi.extension={type:Mt.RendererSystem,name:"textureGC"};let hi=oi;Nt.add(hi);class li{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=u.UNSIGNED_BYTE,this.internalFormat=h.RGBA,this.samplerType=0}}class ui{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new jt,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(t){let e;return e="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?{[u.UNSIGNED_BYTE]:{[h.RGBA]:t.RGBA8,[h.RGB]:t.RGB8,[h.RG]:t.RG8,[h.RED]:t.R8,[h.RGBA_INTEGER]:t.RGBA8UI,[h.RGB_INTEGER]:t.RGB8UI,[h.RG_INTEGER]:t.RG8UI,[h.RED_INTEGER]:t.R8UI,[h.ALPHA]:t.ALPHA,[h.LUMINANCE]:t.LUMINANCE,[h.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[u.BYTE]:{[h.RGBA]:t.RGBA8_SNORM,[h.RGB]:t.RGB8_SNORM,[h.RG]:t.RG8_SNORM,[h.RED]:t.R8_SNORM,[h.RGBA_INTEGER]:t.RGBA8I,[h.RGB_INTEGER]:t.RGB8I,[h.RG_INTEGER]:t.RG8I,[h.RED_INTEGER]:t.R8I},[u.UNSIGNED_SHORT]:{[h.RGBA_INTEGER]:t.RGBA16UI,[h.RGB_INTEGER]:t.RGB16UI,[h.RG_INTEGER]:t.RG16UI,[h.RED_INTEGER]:t.R16UI,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT16},[u.SHORT]:{[h.RGBA_INTEGER]:t.RGBA16I,[h.RGB_INTEGER]:t.RGB16I,[h.RG_INTEGER]:t.RG16I,[h.RED_INTEGER]:t.R16I},[u.UNSIGNED_INT]:{[h.RGBA_INTEGER]:t.RGBA32UI,[h.RGB_INTEGER]:t.RGB32UI,[h.RG_INTEGER]:t.RG32UI,[h.RED_INTEGER]:t.R32UI,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT24},[u.INT]:{[h.RGBA_INTEGER]:t.RGBA32I,[h.RGB_INTEGER]:t.RGB32I,[h.RG_INTEGER]:t.RG32I,[h.RED_INTEGER]:t.R32I},[u.FLOAT]:{[h.RGBA]:t.RGBA32F,[h.RGB]:t.RGB32F,[h.RG]:t.RG32F,[h.RED]:t.R32F,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT32F},[u.HALF_FLOAT]:{[h.RGBA]:t.RGBA16F,[h.RGB]:t.RGB16F,[h.RG]:t.RG16F,[h.RED]:t.R16F},[u.UNSIGNED_SHORT_5_6_5]:{[h.RGB]:t.RGB565},[u.UNSIGNED_SHORT_4_4_4_4]:{[h.RGBA]:t.RGBA4},[u.UNSIGNED_SHORT_5_5_5_1]:{[h.RGBA]:t.RGB5_A1},[u.UNSIGNED_INT_2_10_10_10_REV]:{[h.RGBA]:t.RGB10_A2,[h.RGBA_INTEGER]:t.RGB10_A2UI},[u.UNSIGNED_INT_10F_11F_11F_REV]:{[h.RGB]:t.R11F_G11F_B10F},[u.UNSIGNED_INT_5_9_9_9_REV]:{[h.RGB]:t.RGB9_E5},[u.UNSIGNED_INT_24_8]:{[h.DEPTH_STENCIL]:t.DEPTH24_STENCIL8},[u.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[h.DEPTH_STENCIL]:t.DEPTH32F_STENCIL8}}:{[u.UNSIGNED_BYTE]:{[h.RGBA]:t.RGBA,[h.RGB]:t.RGB,[h.ALPHA]:t.ALPHA,[h.LUMINANCE]:t.LUMINANCE,[h.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[u.UNSIGNED_SHORT_5_6_5]:{[h.RGB]:t.RGB},[u.UNSIGNED_SHORT_4_4_4_4]:{[h.RGBA]:t.RGBA},[u.UNSIGNED_SHORT_5_5_5_1]:{[h.RGBA]:t.RGBA}},e}(t),this.samplerTypes=function(t){let e;return e="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?{[t.RGB]:c.FLOAT,[t.RGBA]:c.FLOAT,[t.ALPHA]:c.FLOAT,[t.LUMINANCE]:c.FLOAT,[t.LUMINANCE_ALPHA]:c.FLOAT,[t.R8]:c.FLOAT,[t.R8_SNORM]:c.FLOAT,[t.RG8]:c.FLOAT,[t.RG8_SNORM]:c.FLOAT,[t.RGB8]:c.FLOAT,[t.RGB8_SNORM]:c.FLOAT,[t.RGB565]:c.FLOAT,[t.RGBA4]:c.FLOAT,[t.RGB5_A1]:c.FLOAT,[t.RGBA8]:c.FLOAT,[t.RGBA8_SNORM]:c.FLOAT,[t.RGB10_A2]:c.FLOAT,[t.RGB10_A2UI]:c.FLOAT,[t.SRGB8]:c.FLOAT,[t.SRGB8_ALPHA8]:c.FLOAT,[t.R16F]:c.FLOAT,[t.RG16F]:c.FLOAT,[t.RGB16F]:c.FLOAT,[t.RGBA16F]:c.FLOAT,[t.R32F]:c.FLOAT,[t.RG32F]:c.FLOAT,[t.RGB32F]:c.FLOAT,[t.RGBA32F]:c.FLOAT,[t.R11F_G11F_B10F]:c.FLOAT,[t.RGB9_E5]:c.FLOAT,[t.R8I]:c.INT,[t.R8UI]:c.UINT,[t.R16I]:c.INT,[t.R16UI]:c.UINT,[t.R32I]:c.INT,[t.R32UI]:c.UINT,[t.RG8I]:c.INT,[t.RG8UI]:c.UINT,[t.RG16I]:c.INT,[t.RG16UI]:c.UINT,[t.RG32I]:c.INT,[t.RG32UI]:c.UINT,[t.RGB8I]:c.INT,[t.RGB8UI]:c.UINT,[t.RGB16I]:c.INT,[t.RGB16UI]:c.UINT,[t.RGB32I]:c.INT,[t.RGB32UI]:c.UINT,[t.RGBA8I]:c.INT,[t.RGBA8UI]:c.UINT,[t.RGBA16I]:c.INT,[t.RGBA16UI]:c.UINT,[t.RGBA32I]:c.INT,[t.RGBA32UI]:c.UINT,[t.DEPTH_COMPONENT16]:c.FLOAT,[t.DEPTH_COMPONENT24]:c.FLOAT,[t.DEPTH_COMPONENT32F]:c.FLOAT,[t.DEPTH_STENCIL]:c.FLOAT,[t.DEPTH24_STENCIL8]:c.FLOAT,[t.DEPTH32F_STENCIL8]:c.FLOAT}:{[t.RGB]:c.FLOAT,[t.RGBA]:c.FLOAT,[t.ALPHA]:c.FLOAT,[t.LUMINANCE]:c.FLOAT,[t.LUMINANCE_ALPHA]:c.FLOAT,[t.DEPTH_STENCIL]:c.FLOAT},e}(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let i=0;i<e;i++)this.boundTextures[i]=null;this.emptyTextures={};const s=new li(t.createTexture());t.bindTexture(t.TEXTURE_2D,s.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=s,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new li(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let i=0;i<this.boundTextures.length;i++)this.bind(null,i)}bind(t,e=0){const{gl:s}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const i=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(t.target,i.texture)),i.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),this.updateTexture(t)):i.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(s.TEXTURE_2D,this.emptyTextures[s.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:s}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let t=0;t<s.length;t++)s[t]===this.unknownTexture&&this.bind(null,t)}for(let i=0;i<s.length;i++)s[i]===t&&(this.currentLocation!==i&&(e.activeTexture(e.TEXTURE0+i),this.currentLocation=i),e.bindTexture(t.target,this.emptyTextures[t.target].texture),s[i]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:s,CONTEXT_UID:i}=this;if(s)for(let r=t-1;r>=0;--r){const t=e[r];t&&t._glTextures[i].samplerType!==c.FLOAT&&this.renderer.texture.unbind(t)}}initTexture(t){const e=new li(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??c.FLOAT,2===this.webGLVersion&&t.type===u.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const s=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(s,t,e))e.samplerType!==c.FLOAT&&(this.hasIntegerTextures=!0);else{const i=t.realWidth,r=t.realHeight,n=s.gl;(e.width!==i||e.height!==r||e.dirtyId<0)&&(e.width=i,e.height=r,n.texImage2D(t.target,0,e.internalFormat,i,r,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const e=this.managedTextures.indexOf(t);-1!==e&&_t(this.managedTextures,e,1)}}updateTextureStyle(t){const e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==p.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=f.CLAMP,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==p.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===d.L
1INEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const e=this.renderer.context.extensions.anisotropicFiltering;if(e&&t.anisotropicLevel>0&&t.scaleMode===d.LINEAR){const i=Math.min(t.anisotropicLevel,s.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY_EXT,i)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===d.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===d.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}ui.extension={type:Mt.RendererSystem,name:"texture"},Nt.add(ui);class ci{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:i}=this;e&&i.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:i}=this,r=e.createTransformFeedback();t._glTransformFeedbacks[i]=r,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r);for(let n=0;n<t.buffers.length;n++){const r=t.buffers[n];r&&(s.buffer.update(r),r._glBuffers[i].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,r._glBuffers[i].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),r}disposeTransformFeedback(t,e){const s=t._glTransformFeedbacks[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this);const r=this.renderer.buffer;if(r)for(let n=0;n<t.buffers.length;n++){const s=t.buffers[n];if(!s)continue;const i=s._glBuffers[this.CONTEXT_UID];i&&(i.refCount--,0===i.refCount&&!e&&r.dispose(s,e))}s&&(e||i.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}ci.extension={type:Mt.RendererSystem,name:"transformFeedback"},Nt.add(ci);class di{constructor(t){this.renderer=t}init(t){this.screen=new le(0,0,t.width,t.height),this.element=t.view||T.ADAPTER.createCanvas(),this.resolution=t.resolution||T.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const s=this.element.width/this.resolution,i=this.element.height/this.resolution;this.screen.width=s,this.screen.height=i,this.autoDensity&&(this.element.style.width=`${s}px`,this.element.style.height=`${i}px`),this.renderer.emit("resize",s,i),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}}di.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},di.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"_view"},Nt.add(di),T.PREFER_ENV=i.WEBGL2,T.STRICT_TEXTURE_CACHE=!1,T.RENDER_OPTIONS={...ss.defaultOptions,...Qe.defaultOptions,...di.defaultOptions,...ii.defaultOptions},Object.defineProperties(T,{WRAP_MODE:{get:()=>jt.defaultOptions.wrapMode,set(t){I("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),jt.defaultOptions.wrapMode=t}},SCALE_MODE:{get:()=>jt.defaultOptions.scaleMode,set(t){I("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),jt.defaultOptions.scaleMode=t}},MIPMAP_TEXTURES:{get:()=>jt.defaultOptions.mipmap,set(t){I("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),jt.defaultOptions.mipmap=t}},ANISOTROPIC_LEVEL:{get:()=>jt.defaultOptions.anisotropicLevel,set(t){I("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),jt.defaultOptions.anisotropicLevel=t}},FILTER_RESOLUTION:{get:()=>(I("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Je.defaultResolution),set(t){Je.defaultResolution=t}},FILTER_MULTISAMPLE:{get:()=>(I("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Je.defaultMultisample),set(t){Je.defaultMultisample=t}},SPRITE_MAX_TEXTURES:{get:()=>Ke.defaultMaxTextures,set(t){I("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Ke.defaultMaxTextures=t}},SPRITE_BATCH_SIZE:{get:()=>Ke.defaultBatchSize,set(t){I("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Ke.defaultBatchSize=t}},CAN_UPLOAD_SAME_BUFFER:{get:()=>Ke.canUploadSameBuffer,set(t){I("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Ke.canUploadSameBuffer=t}},GC_MODE:{get:()=>hi.defaultMode,set(t){I("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),hi.defaultMode=t}},GC_MAX_IDLE:{get:()=>hi.defaultMaxIdle,set(t){I("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),hi.defaultMaxIdle=t}},GC_MAX_CHECK_COUNT:{get:()=>hi.defaultCheckCountMax,set(t){I("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),hi.defaultCheckCountMax=t}},PRECISION_VERTEX:{get:()=>Xe.defaultVertexPrecision,set(t){I("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Xe.defaultVertexPrecision=t}},PRECISION_FRAGMENT:{get:()=>Xe.defaultFragmentPrecision,set(t){I("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Xe.defaultFragmentPrecision=t}}});const fi={ADAPTER:{createCanvas:(t,e)=>{const s=document.createElement("canvas");return s.width=t,s.height=e,s},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};(E.Z.default??E.Z)(globalThis.navigator);fi.RETINA_PREFIX=/@([0-9\.]+)x/,fi.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;s(77089);const pi={};function mi(t,e,s=3){if(pi[e])return;let i=(new Error).stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`):(i=i.split("\n").splice(s).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}\nDeprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`),console.warn(i))),pi[e]=!0}var gi=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERA
1SE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR",t))(gi||{});!function(){const t=[],e=[];for(let i=0;i<32;i++)t[i]=i,e[i]=i;t[gi.NORMAL_NPM]=gi.NORMAL,t[gi.ADD_NPM]=gi.ADD,t[gi.SCREEN_NPM]=gi.SCREEN,e[gi.NORMAL]=gi.NORMAL_NPM,e[gi.ADD]=gi.ADD_NPM,e[gi.SCREEN]=gi.SCREEN_NPM;const s=[];s.push(e),s.push(t)}();Float32Array,Uint32Array,Int32Array,Uint8Array;const _i=class{constructor(t,e,s,i){this.left=t,this.top=e,this.right=s,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};_i.EMPTY=new _i(0,0,0,0);var xi=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(xi||{});class yi{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=i}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const vi=class t{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new yi(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=xi.NORMAL){return this._addListener(new yi(t,e,s))}addOnce(t,e,s=xi.NORMAL){return this._addListener(new yi(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}else t.connect(s);return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s=s.match(t,e)?s.destroy():s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let s;if(e>this.lastTime){if(s=this.elapsedMS=e-this.lastTime,s>this._maxElapsedMS&&(s=this._maxElapsedMS),s*=this.speed,this._minElapsedMS){const t=e-this._lastFrame|0;if(t<this._minElapsedMS)return;this._lastFrame=e-t%this._minElapsedMS}this.deltaMS=s,this.deltaTime=this.deltaMS*t.targetFPMS;const i=this._head;let r=i.next;for(;r;)r=r.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const s=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,s)/1e3,t.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(0===t)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!t._shared){const e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){const e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};
vendor: 4,369 bytes, line 1
1vi.targetFPMS=.06;let bi=vi;Object.defineProperties(fi,{TARGET_FPMS:{get:()=>bi.targetFPMS,set(t){mi("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),bi.targetFPMS=t}}});class Ti{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,xi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?bi.shared:new bi,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Ti.extension=Mt.Application,Nt.add(Ti);const Ei=[];Nt.handleByList(Mt.Renderer,Ei);const Ai="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n";class wi{constructor(t){this.renderer=t}contextChange(t){let e;if(1===this.renderer.context.webGLVersion){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>=v.HIGH?this.multisample=v.HIGH:e>=v.MEDIUM?this.multisample=v.MEDIUM:e>=v.LOW?this.multisample=v.LOW:this.multisample=v.NONE}destroy(){}}wi.extension={type:Mt.RendererSystem,name:"_multisample"},Nt.add(wi);class Si{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Ri{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 r=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,r.buffer)}}bindBufferRange(t,e,s){const{gl:i,CONTEXT_UID:r}=this;s=s||0;const n=t._glBuffers[r]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,n.buffer,256*s,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 s=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,s)}}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 Si(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Ri.extension={type:Mt.RendererSystem,name:"buffer"},Nt.add(Ri);class Ii{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let i,r,n,a;if(e&&(i=e.renderTexture,r=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!i,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=n,!s.context.isLost){if(i||(this.lastObjectRendered=t),!a){const e=t.enableTempParent();t.updateTransform(),t.disableTempParent(e)}s.renderTexture.bind(i),s.batch.currentRenderer.start(),(r??s.background.clearBeforeRender)&&s.renderTexture.clear(),t.render(s),s.batch.currentRenderer.flush(),i&&(e.blit&&s.framebuffer.blit(),i.baseTexture.update(
1)),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Ii.extension={type:Mt.RendererSystem,name:"objectRenderer"},Nt.add(Ii);const Ci=class t extends ai{constructor(e){super(),this.type=r.WEBGL,e=Object.assign({},T.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ze({projectionMatrix:new pe},!0);const s={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:t.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(s),"useContextAlpha"in e&&(I("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&"notMultiplied"!==e.useContextAlpha,e.backgroundAlpha=!1===e.useContextAlpha?1:e.backgroundAlpha),this._plugin.rendererPlugins=t.__plugins,this.options=e,this.startup.run(this.options)}static test(t){return!t?.forceCanvas&&(typeof B>"u"&&(B=function(){const t={stencil:!0,failIfMajorPerformanceCaveat:T.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!T.ADAPTER.getWebGLRenderingContext())return!1;const e=T.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const i=!!s?.getContextAttributes()?.stencil;if(s){const t=s.getExtension("WEBGL_lose_context");t&&t.loseContext()}return s=null,i}catch{return!1}}()),B)}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return I("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return I("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return I("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return I("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){I("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return I("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){I("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return I("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Ci.extension={type:Mt.Renderer,priority:1},Ci.__plugins={},Ci.__systems={};let Pi=Ci;Nt.handleByMap(Mt.RendererPlugin,Pi.__plugins),Nt.handleByMap(Mt.RendererSystem,Pi.__systems),Nt.add(Pi);class Mi extends Xt{constructor(t,e){const{width:s,height:i}=e||{};super(s,i),this.items=[],this.itemDirtyIds=[];for(let r=0;r<t;r++){const t=new jt;this.items.push(t),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let s=0;s<this.length;s++)t[s]&&(t[s].castToBaseTexture?this.addBaseTextureAt(t[s].castToBaseTexture(),s):t[s]instanceof Xt?this.addResourceAt(t[s],s):this.addResourceAt(Gt(t[s],e),s))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map((t=>t.resource)).filter((t=>t)).map((t=>t.load()));return this._load=Promise.all(t).then((()=>{const{realWidth:t,realHeight:e}=this.items[0];return this.resize(t,e),this.update(),Promise.resolve(this)})),this._load}}const Di=class t extends Mi{constructor(e,s){const{width:i,height:r,autoLoad:n,linkBaseTexture:a}=s||{};if(e&&e.length!==t.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:r});for(let o=0;o<t.SIDES;o++)this.items[o].target=l.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=!1!==a,e&&this.initFromArray(e,s),!1!==n&&this.load()}bind(t){super.bind(t),t.target=l.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,s){if(void 0===s&&(s=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=l.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(e,s,i){const r=this.itemDirtyIds;for(let n=0;n<t.SIDES;n++){const t=this.items[n];(r[n]<t.dirtyId||i.dirtyId<s.dirtyId)&&(t.valid&&t.resource?(t.resource.upload(e,t,i),r[n]=t.dirtyId):r[n]<-1&&(e.gl.texImage2D(t.target,0,i.internalFormat,s.realWidth,s.realHeight,0,s.format,i.type,null),r[n]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===t.SIDES}};Di.SIDES=6;let Bi=Di;class Ni extends ns{constructor(t,e){let s,i,r;e=e||{},"string"==typeof t?(s=Ni.EMPTY,i=t,r=!0):(s=t,i=null,r=!1),super(s),this.url=i,this.crossOrigin=e.crossOrigin??!0,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??r,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise((async(t,e)=>{if(null!==this.url)try{const e=await T.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await e.blob();if(this.destroyed)return;const i=await createImageBitmap(s,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===m.UNPACK?"premultiply":"none"});if(this.destroyed)return void i.close();this.source=i,this.update(),t(this)}catch(U){if(this.destroyed)return;e(U),this.onError.emit(U)}else t(this)}))),this._load}upload(t,e,s){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&("string"==typeof t||t instanceof ImageBitmap)}static get EMPTY(){return Ni._EMPTY=Ni._EMPTY??T.ADAPTER.createCanvas(0,0),Ni._EMPTY}}const Oi=class t extends ns{constructor(t,e){e=e||{},super(T.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise((e=>{if(this._resolve=()=>{this.update(),e(this)},t.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}))),this._load}_loadSvg(){const t=new Image;ns.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>
1{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=e*this.scale,r=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*e,r=this._overrideHeight||this._overrideWidth/e*s),i=Math.round(i),r=Math.round(r);const n=this.source;n.width=i,n.height=r,n._pixiId=`canvas_${vt()}`,n.getContext("2d").drawImage(t,0,0,e,s,0,0,i,r),this._resolve(),this._resolve=null}}static getSize(e){const s=t.SVG_SIZE.exec(e),i={};return s&&(i[s[1]]=Math.round(parseFloat(s[3])),i[s[5]]=Math.round(parseFloat(s[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,s){return"svg"===s||"string"==typeof e&&e.startsWith("data:image/svg+xml")||"string"==typeof e&&t.SVG_XML.test(e)}};Oi.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Oi.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Li=Oi;const Fi=class t extends ns{constructor(e,s){if(s=s||{},!(e instanceof HTMLVideoElement)){const i=document.createElement("video");!1!==s.autoLoad&&i.setAttribute("preload","auto"),!1!==s.playsinline&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),!0===s.muted&&(i.setAttribute("muted",""),i.muted=!0),!0===s.loop&&i.setAttribute("loop",""),!1!==s.autoPlay&&i.setAttribute("autoplay",""),"string"==typeof e&&(e=[e]);const r=e[0].src||e[0];ns.crossOrigin(i,r,s.crossorigin);for(let s=0;s<e.length;++s){const r=document.createElement("source");let{src:n,mime:a}=e[s];if(n=n||e[s],n.startsWith("data:"))a=n.slice(5,n.indexOf(";"));else if(!n.startsWith("blob:")){const e=n.split("?").shift().toLowerCase(),s=e.slice(e.lastIndexOf(".")+1);a=a||t.MIME_TYPES[s]||`video/${s}`}r.src=n,a&&(r.type=a),i.appendChild(r)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=s.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==s.autoPlay,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==s.autoLoad&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const t=bi.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise(((e,s)=>{this.valid?e(this):(this._resolve=e,this._reject=s,t.load())})),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(bi.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(bi.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(bi.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,s){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.includes(s)}};Fi.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Fi.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Ui=Fi;kt.push(Ni,as,class extends ns{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return!!(e&&t instanceof e)||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}
vendor: 5,469 bytes, line 1
1,Ui,class extends ns{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}},Li,Vt,Bi,class extends Mi{constructor(t,e){const{width:s,height:i}=e||{};let r,n;Array.isArray(t)?(r=t,n=t.length):n=t,super(n,{width:s,height:i}),r&&this.initFromArray(r,e)}addBaseTextureAt(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this}bind(t){super.bind(t),t.target=l.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:i,itemDirtyIds:r,items:n}=this,{gl:a}=t;s.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,i,0,e.format,s.type,null);for(let o=0;o<i;o++){const t=n[o];r[o]<t.dirtyId&&(r[o]=t.dirtyId,t.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,o,t.resource.width,t.resource.height,1,e.format,s.type,t.resource.source))}return!0}});class ki{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?le.EMPTY:((t=t||new le(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:s,b:i,c:r,d:n,tx:a,ty:o}=t,h=s*e.x+r*e.y+a,l=i*e.x+n*e.y+o;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)}addQuad(t){let e=this.minX,s=this.minY,i=this.maxX,r=this.maxY,n=t[0],a=t[1];e=n<e?n:e,s=a<s?a:s,i=n>i?n:i,r=a>r?a:r,n=t[2],a=t[3],e=n<e?n:e,s=a<s?a:s,i=n>i?n:i,r=a>r?a:r,n=t[4],a=t[5],e=n<e?n:e,s=a<s?a:s,i=n>i?n:i,r=a>r?a:r,n=t[6],a=t[7],e=n<e?n:e,s=a<s?a:s,i=n>i?n:i,r=a>r?a:r,this.minX=e,this.minY=s,this.maxX=i,this.maxY=r}addFrame(t,e,s,i,r){this.addFrameMatrix(t.worldTransform,e,s,i,r)}addFrameMatrix(t,e,s,i,r){const n=t.a,a=t.b,o=t.c,h=t.d,l=t.tx,u=t.ty;let c=this.minX,d=this.minY,f=this.maxX,p=this.maxY,m=n*e+o*s+l,g=a*e+h*s+u;c=m<c?m:c,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,m=n*i+o*s+l,g=a*i+h*s+u,c=m<c?m:c,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,m=n*e+o*r+l,g=a*e+h*r+u,c=m<c?m:c,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,m=n*i+o*r+l,g=a*i+h*r+u,c=m<c?m:c,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,this.minX=c,this.minY=d,this.maxX=f,this.maxY=p}addVertexData(t,e,s){let i=this.minX,r=this.minY,n=this.maxX,a=this.maxY;for(let o=e;o<s;o+=2){const e=t[o],s=t[o+1];i=e<i?e:i,r=s<r?s:r,n=e>n?e:n,a=s>a?s:a}this.minX=i,this.minY=r,this.maxX=n,this.maxY=a}addVertices(t,e,s,i){this.addVerticesMatrix(t.worldTransform,e,s,i)}addVerticesMatrix(t,e,s,i,r=0,n=r){const a=t.a,o=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY;for(let g=s;g<i;g+=2){const t=e[g],s=e[g+1],i=a*t+h*s+u,_=l*s+o*t+c;d=Math.min(d,i-r),p=Math.max(p,i+r),f=Math.min(f,_-n),m=Math.max(m,_+n)}this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addBounds(t){const e=this.minX,s=this.minY,i=this.maxX,r=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<s?t.minY:s,this.maxX=t.maxX>i?t.maxX:i,this.maxY=t.maxY>r?t.maxY:r}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,r=t.maxX<e.maxX?t.maxX:e.maxX,n=t.maxY<e.maxY?t.maxY:e.maxY;if(s<=r&&i<=n){const t=this.minX,e=this.minY,a=this.maxX,o=this.maxY;this.minX=s<t?s:t,this.minY=i<e?i:e,this.maxX=r>a?r:a,this.maxY=n>o?n:o}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const s=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,r=t.maxX<e.x+e.width?t.maxX:e.x+e.width,n=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(s<=r&&i<=n){const t=this.minX,e=this.minY,a=this.maxX,o=this.maxY;this.minX=s<t?s:t,this.minY=i<e?i:e,this.maxX=r>a?r:a,this.maxY=n>o?n:o}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,i,r,n){t-=r,e-=n,s+=r,i+=n,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>s?this.maxX:s,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>i?this.maxY:i}}class Gi extends w{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new we,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new ki,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s<e.length;++s){const i=e[s];Object.defineProperty(Gi.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&
1(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new le),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new le),t=this._localBoundsRect),this._localBounds||(this._localBounds=new ki);const e=this.transform,s=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=s?.worldAlpha??1,this.transform=this._tempDisplayObjectParent.transform;const i=this._bounds,r=this._boundsID;this._bounds=this._localBounds;const n=this.getBounds(!1,t);return this.parent=s,this.transform=e,this._bounds=i,this._bounds.updateID+=this._boundsID-r,n}toGlobal(t,e,s=!1){return s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,s,i){return e&&(t=e.toGlobal(t,s,i)),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,s)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){this.parent?.removeChild(this)}setTransform(t=0,e=0,s=1,i=1,r=0,n=0,a=0,o=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=s||1,this.scale.y=i||1,this.rotation=r,this.skew.x=n,this.skew.y=a,this.pivot.x=o,this.pivot.y=h,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new Hi),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*re}set angle(t){this.transform.rotation=t*ne}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount--,0===t._maskRefCount&&(t.renderable=!0,t.isMask=!1))}if(this._mask=t,this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(0===t._maskRefCount&&(t.renderable=!1,t.isMask=!0),t._maskRefCount++)}}}}class Hi extends Gi{constructor(){super(...arguments),this.sortDirty=null}}Gi.prototype.displayObjectUpdateTransform=Gi.prototype.updateTransform;const Xi=new pe;function Vi(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}const zi=class t extends Gi{constructor(){super(),this.children=[],this.sortableChildren=t.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit
1("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),i=this.getChildIndex(e);this.children[s]=e,this.children[i]=t,this.onChildrenChange(s<i?s:i)}getChildIndex(t){const e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);_t(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],s=this.children.indexOf(e);if(-1===s)return null;e.parent=null,e.transform._parentID=-1,_t(this.children,s,1),this._boundsID++,this.onChildrenChange(s),e.emit("removed",this),this.emit("childRemoved",e,this,s)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,_t(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const s=t,i=e-s;let r;if(i>0&&i<=e){r=this.children.splice(s,i);for(let t=0;t<r.length;++t)r[t].parent=null,r[t].transform&&(r[t].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let t=0;t<r.length;++t)r[t].emit("removed",this),this.emit("childRemoved",r[t],this,t);return r}if(0===i&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,s=this.children.length;e<s;++e){const s=this.children[e];s._lastSortedIndex=e,!t&&0!==s.zIndex&&(t=!0)}t&&this.children.length>1&&this.children.sort(Vi),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const e=this.children[t];e.visible&&e.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(e.visible&&e.renderable)if(e.calculateBounds(),e._mask){const t=e._mask.isMaskData?e._mask.maskObject:e._mask;t?(t.calculateBounds(),this._bounds.addBoundsMask(e._bounds,t._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const s=super.getLocalBounds(t);if(!e)for(let i=0,r=this.children.length;i<r;++i){const t=this.children[i];t.visible&&t.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(e){const s=e.renderTexture.sourceFrame;if(!(s.width>0&&s.height>0))return;let i,r;this.cullArea?(i=this.cullArea,r=this.worldTransform):this._render!==t.prototype._render&&(i=this.getBounds(!0));const n=e.projection.transform;if(n&&(r?(r=Xi.copyFrom(r),r.prepend(n)):r=n),i&&s.intersects(i,r))this._render(e);else if(this.cullArea)return;for(let t=0,a=this.children.length;t<a;++t){const s=this.children[t],i=s.cullable;s.cullable=i||!this.cullArea,s.render(e),s.cullable=i}}render(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters?.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,s=this.children.length;e<s;++e)this.children[e].render(t)}}renderAdvanced(t){const e=this.filters,s=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let t=0;t<e.length;t++)e[t].enabled&&this._enabledFilters.push(e[t])}const i=e&&this._enabledFilters?.length||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==y.NONE));if(i&&t.batch.flush(),e&&this._enabledFilters?.length&&t.filter.push(this,this._enabledFilters),s&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,s=this.children.length;e<s;++e)this.children[e].render(t)}i&&t.batch.flush(),s&&t.mask.pop(this),e&&this._enabledFilters?.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e="boolean"==typeof t?t:t?.children,s=this.removeChildren(0,this.children.length);if(e)for(let i=0;i<s.length;++i)s[i].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;this.scale.x=0!==e?t/e:1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;this.scale.y=0!==e?t/e:1,this._height=t}};zi.defaultSortableChildren=!1;let Wi=zi;Wi.prototype.containerUpdateTransform=Wi.prototype.updateTransform,Object.defineProperties(T,{SORTABLE_CHILDREN:{get:()=>Wi.defaultSortableChildren,set(t){I("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Wi.defaultSortableChildren=t}}});const ji=new oe,$i=new Uint16Array([0,1,2,0,2,3]);class Yi extends Wi{constructor(t){super(),this._anchor=new Ee(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new ut(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=a.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||us.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=$i,this.pluginName="batch",this.isSprite=!0,this._roundPixels=T.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=xt(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=xt(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,s=e.a,i=e.b,r=e.c,n=e.d,a=e.tx,o=e.ty,h=this.vertexData,l=t.trim,u=t.orig,c=this._anchor;let d=0,f=0,p=0,m=0;if(l?(f=l.x-c._x*u.width,d=f+l.width,m=l.y-c._y*u.height,p=m+l.height):(f=-c._x*u.width,d=f+u.width,m=-c._y*u.height,p=m+u.height),h[0]=s*f+r*m+a,h[1]=n*m+i*f+o,h[2]=s*d+r*m+a,h[3]=n*m+i*d+o,h[4]=s*d+r*p+a,h[5]=n*p+i*d+o,h[6]=s*f+r*p+a,h[7]=n*p+i*f+o,this._roundPixels){const t=T.RESOLUTION;for(let e=0;e<h.length;++e)h[e]=Math.round(h[e]*t)/t}}
vendor: 8,461 bytes, line 1
1calculateTrimmedVertices(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,s=t.orig,i=this._anchor,r=this.transform.worldTransform,n=r.a,a=r.b,o=r.c,h=r.d,l=r.tx,u=r.ty,c=-i._x*s.width,d=c+s.width,f=-i._y*s.height,p=f+s.height;if(e[0]=n*c+o*f+l,e[1]=h*f+a*c+u,e[2]=n*d+o*f+l,e[3]=h*f+a*d+u,e[4]=n*d+o*p+l,e[5]=h*p+a*d+u,e[6]=n*c+o*p+l,e[7]=h*p+a*c+u,this._roundPixels){const t=T.RESOLUTION;for(let s=0;s<e.length;++s)e[s]=Math.round(e[s]*t)/t}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return 0===this.children.length?(this._localBounds||(this._localBounds=new ki),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new le),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ji);const e=this._texture.orig.width,s=this._texture.orig.height,i=-e*this.anchor.x;let r=0;return ji.x>=i&&ji.x<i+e&&(r=-s*this.anchor.y,ji.y>=r&&ji.y<r+s)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const s=t instanceof us?t:us.from(t,e);return new Yi(s)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=xt(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=xt(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||us.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const qi=new pe;Gi.prototype._cacheAsBitmap=!1,Gi.prototype._cacheData=null,Gi.prototype._cacheAsBitmapResolution=null,Gi.prototype._cacheAsBitmapMultisample=null;class Ki{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Gi.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(t){if(this._cacheAsBitmap===t)return;let e;this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new Ki),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}),Gi.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},Gi.prototype._initCachedDisplayObject=function(t){if(this._cacheData?.sprite)return;const e=this.alpha;this.alpha=1,t.batch.flush();const s=this.getLocalBounds(new le,!0);if(this.filters?.length){const t=this.filters[0].padding;s.pad(t)}const i=this.cacheAsBitmapResolution||t.resolution;s.ceil(i),s.width=Math.max(s.width,1/i),s.height=Math.max(s.height,1/i);const r=t.renderTexture.current,n=t.renderTexture.sourceFrame.clone(),a=t.renderTexture.destinationFrame.clone(),o=t.projection.transform,h=cs.create({width:s.width,height:s.height,resolution:i,multisample:this.cacheAsBitmapMultisample??t.multisample}),l=`cacheAsBitmap_${vt()}`;this._cacheData.textureCacheId=l,jt.addToCache(h.baseTexture,l),us.addToCache(h,l);const u=this.transform.localTransform.copyTo(qi).invert().translate(-s.x,-s.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:h,clear:!0,transform:u,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=o,t.renderTexture.bind(r,n,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const c=new Yi(h);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-s.x/s.width,c.anchor.y=-s.y/s.height,c.alpha=e,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Gi.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},Gi.prototype._initCachedDisplayObjectCanvas=function(t){if(this._cacheData?.sprite)return;const e=this.getLocalBounds(new le,!0),s=this.alpha;this.alpha=1;const i=t.canvasContext.activeContext,r=t._projTransform,n=this.cacheAsBitmapResolution||t.resolution;e.ceil(n),e.width=Math.max(e.width,1/n),e.height=Math.max(e.height,1/n);const a=cs.create({width:e.width,height:e.height,resolution:n}),o=`cacheAsBitmap_${vt()}`;this._cacheData.textureCacheId=o,jt.addToCache(a.baseTexture,o),us.addToCache(a,o);const h=qi;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),t.canvasContext.activeContext=i,t._projTransform=r,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=s;const l=new Yi(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-e.x/e.width,l.anchor.y=-e.y
1/e.height,l.alpha=s,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Gi.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Gi.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Gi.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,jt.removeFromCache(this._cacheData.textureCacheId),us.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Gi.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},Gi.prototype.name=null,Wi.prototype.getChildByName=function(t,e){for(let s=0,i=this.children.length;s<i;s++)if(this.children[s].name===t)return this.children[s];if(e)for(let s=0,i=this.children.length;s<i;s++){const e=this.children[s];if(!e.getChildByName)continue;const i=e.getChildByName(t,!0);if(i)return i}return null},Gi.prototype.getGlobalPosition=function(t=new oe,e=!1){return this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};const Zi={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]},Ji=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join("\n");class Qi extends Je{constructor(t,e=8,s=4,i=Je.defaultResolution,r=5){super(function(t,e){const s=Math.ceil(t/2);let i,r="\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }",n="";i=e?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a<t;a++){let t=i.replace("%index%",a.toString());t=t.replace("%sampleIndex%",a-(s-1)+".0"),n+=t,n+="\n"}return r=r.replace("%blur%",n),r=r.replace("%size%",t.toString()),r}(r,t),function(t){const e=Zi[t],s=e.length;let i,r=Ji,n="";for(let a=0;a<t;a++){let r="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",a.toString());i=a,a>=s&&(i=t-a-1),r=r.replace("%value%",e[i].toString()),n+=r,n+="\n"}return r=r.replace("%blur%",n),r=r.replace("%size%",t.toString()),r}(r)),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,1===this.passes)t.applyFilter(this,e,s,i);else{const r=t.getFilterTexture(),n=t.renderer;let a=e,o=r;this.state.blend=!1,t.applyFilter(this,a,o,g.CLEAR);for(let e=1;e<this.passes-1;e++){t.bindAndClear(a,g.BLIT),this.uniforms.uSampler=o;const e=o;o=a,a=e,n.shader.bind(this),n.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,o,s,i),t.returnFilterTexture(r)}}get blur(){return this.strength}set blur(t){this.padding=1+2*Math.abs(t),this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class tr extends Je{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(Ai,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",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,r]=ut.shared.setValue(t).toArray(),n=[s,0,0,0,0,0,i,0,0,0,0,0,r,0,0,0,0,0,1,0];this._loadMatrix(n,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){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),r=1/3,n=(0,Math.sqrt)(r),a=[s+(1-s)*r,r*(1-s)-n*i,r*(1-s)+n*i,0,0,r*(1-s)+n*i,s+r*(1-s),r*(1-s)-n*i,0,0,r*(1-s)-n*i,r*(1-s)+n*i,s+r*(1-s),0,0,0,0,0,1,0];this._loadMatrix(a,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),r=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(r,e)}saturate(t=0,e){const s=2*t/3+1,i=-.5*(s-1),r=[s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0];this._loadMatrix(r,e)}desaturate(){this.saturate(-1)}negative(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.091555084827
155585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,s,i,r){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const n=ut.shared,[a,o,h]=n.setValue(s).toArray(),[l,u,c]=n.setValue(i).toArray(),d=[.3,.59,.11,0,0,a,o,h,t,0,l,u,c,e,0,a-l,o-u,h-c,0,0];this._loadMatrix(d,r)}night(t,e){const s=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}predator(t,e){const s=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(s,e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}tr.prototype.grayscale=tr.prototype.greyscale;const er={AlphaFilter:class extends Je{constructor(t=1){super("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}},BlurFilter:class extends Je{constructor(t=8,e=4,s=Je.defaultResolution,i=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Qi(!0,t,e,s,i),this.blurYFilter=new Qi(!1,t,e,s,i),this.resolution=s,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,s,i){const r=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(r&&n){const r=t.getFilterTexture();this.blurXFilter.apply(t,e,r,g.CLEAR),this.blurYFilter.apply(t,r,s,i),t.returnFilterTexture(r)}else n?this.blurYFilter.apply(t,e,s,i):this.blurXFilter.apply(t,e,s,i)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}},BlurFilterPass:Qi,ColorMatrixFilter:tr,DisplacementFilter:class extends Je{constructor(t,e){const s=new pe;t.renderable=!1,super("attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=s,null==e&&(e=20),this.scale=new oe(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 r=this.maskSprite.worldTransform,n=Math.sqrt(r.a*r.a+r.b*r.b),a=Math.sqrt(r.c*r.c+r.d*r.d);0!==n&&0!==a&&(this.uniforms.rotation[0]=r.a/n,this.uniforms.rotation[1]=r.b/n,this.uniforms.rotation[2]=r.c/a,this.uniforms.rotation[3]=r.d/a),t.applyFilter(this,e,s,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}},FXAAFilter:class extends Je{constructor(){super("\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
1\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
1\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')}},NoiseFilter:class extends Je{constructor(t=.5,e=Math.random()){super(Ai,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{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}}};Object.entries(er).forEach((([t,e])=>{Object.defineProperty(er,t,{get:()=>(I("7.1.0",`filters.${t} has moved to ${t}`),e)})}));const sr=new 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||(bi.system.add(this.tickerUpdate,this,xi.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(bi.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove)return void(this._didMove=!1);const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&"touch"===t.pointerType||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}};class ir{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ir.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new oe,this.page=new oe,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,r){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 rr extends ir{constructor(){super(...arguments),this.client=new oe,this.movement=new oe,this.offset=new oe,this.global=new oe,this.screen=new oe}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,r,n,a,o,h,l,u,c,d,f,p){throw new Error("Method not implemented.")}}class nr extends rr{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class ar extends rr{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}
1ar.DOM_DELTA_PIXEL=0,ar.DOM_DELTA_LINE=1,ar.DOM_DELTA_PAGE=2;const or=new oe,hr=new oe;class lr{constructor(t){this.dispatch=new w,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,i=e.length;s<i;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}
1hitTest(t,e){sr.pauseUpdate=!0;const s=this[this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive"](this.rootTarget,this.rootTarget.eventMode,or.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,r=s.length-1;i<r;i++)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let i=s.length-2;i>=0;i--)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(0===s.length)return;t.eventPhase=t.BUBBLING_PHASE;const i=Array.isArray(e)?e:[e];for(let r=s.length-1;r>=0;r--)i.forEach((e=>{t.currentTarget=s[r],this.notifyTarget(t,e)}))}propagationPath(t){const e=[t];for(let s=0;s<2048&&t!==this.rootTarget;s++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,s,i,r,n=!1){let a=!1;if(this._interactivePrune(t))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(sr.pauseUpdate=!1),t.interactiveChildren&&t.children){const o=t.children;for(let h=o.length-1;h>=0;h--){const l=o[h],u=this.hitTestMoveRecursive(l,this._isInteractive(e)?e:l.eventMode,s,i,r,n||r(t,s));if(u){if(u.length>0&&!u[u.length-1].parent)continue;const e=t.isInteractive();(u.length>0||e)&&(e&&this._allInteractiveElements.push(t),u.push(t)),0===this._hitElements.length&&(this._hitElements=u),a=!0}}}const o=this._isInteractive(e),h=t.isInteractive();return o&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:o&&!r(t,s)&&i(t,s)?h?[t]:[]:null}hitTestRecursive(t,e,s,i,r){if(this._interactivePrune(t)||r(t,s))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(sr.pauseUpdate=!1),t.interactiveChildren&&t.children){const n=t.children;for(let a=n.length-1;a>=0;a--){const o=n[a],h=this.hitTestRecursive(o,this._isInteractive(e)?e:o.eventMode,s,i,r);if(h){if(h.length>0&&!h[h.length-1].parent)continue;const e=t.isInteractive();
1return(h.length>0||e)&&h.push(t),h}}}const n=this._isInteractive(e),a=t.isInteractive();return n&&i(t,s)?a?[t]:[]:null}_isInteractive(t){return"static"===t||"dynamic"===t}_interactivePrune(t){return!(t&&!t.isMask&&t.visible&&t.renderable&&"none"!==t.eventMode&&("passive"!==t.eventMode||t.interactiveChildren)&&!t.isMask)}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,hr),!t.hitArea.contains(hr.x,hr.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!s.containsPoint?.(e))return!0}return!1}hitTestFn(t,e){return"passive"!==t.eventMode&&(!!t.hitArea||!!t.containsPoint&&t.containsPoint(e))}notifyTarget(t,e){const s=`on${e=e??t.type}`;t.currentTarget[s]?.(t);const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof nr))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){const t=2===e.button;this.dispatchEvent(e,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof nr))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const s="mouse"===e.pointerType||"pen"===e.pointerType,i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.overTargets);if(i.overTargets?.length>0&&r!==e.target){const i="mousemove"===t.type?"mouseout":"pointerout",n=this.createPointerEvent(t,i,r);if(this.dispatchEvent(n,"pointerout"),s&&this.dispatchEvent(n,"mouseout"),!e.composedPath().includes(r)){const i=this.createPointerEvent(t,"pointerleave",r);for(i.eventPhase=i.AT_TARGET;i.target&&!e.composedPath().includes(i.target);)i.currentTarget=i.target,this.notifyTarget(i),s&&this.notifyTarget(i,"mouseleave"),i.target=i.target.parent;this.freeEvent(i)}this.freeEvent(n)}if(r!==e.target){const i="mousemove"===t.type?"mouseover":"pointerover",n=this.clonePointerEvent(e,i);this.dispatchEvent(n,"pointerover"),s&&this.dispatchEvent(n,"mouseover");let a=r?.parent;for(;a&&a!==this.rootTarget.parent&&a!==e.target;)a=a.parent;if(!a||a===this.rootTarget.parent){const t=this.clonePointerEvent(e,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==r&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),s&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(n)}const n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),"touch"===e.pointerType&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),s&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof nr))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),i="mouse"===s.pointerType||"pen"===s.pointerType;this.dispatchEvent(s,"pointerover"),i&&this.dispatchEvent(s,"mouseover"),"mouse"===s.pointerType&&(this.cursor=s.target?.cursor);const r=this.clonePointerEvent(s,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(r)}mapPointerOut(t){if(!(t instanceof nr))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId);if(e.overTargets){const s="mouse"===t.pointerType||"pen"===t.pointerType,i=this.findMountedTarget(e.overTargets),r=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(r),s&&this.dispatchEvent(r,"mouseout");const n=this.createPointerEvent(t,"pointerleave",i);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(r),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof nr))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if("mouse"===s.pointerType||"pen"===s.pointerType){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]);let n=r;if(r&&!s.composedPath().includes(r)){let e=r;
1for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if("mouse"===s.pointerType||"pen"===s.pointerType){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete i.pressTargetsByButton[t.button],n=e}if(n){const r=this.clonePointerEvent(s,"click");r.target=n,r.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:r.target,timeStamp:e});const a=i.clicksByButton[t.button];if(a.target===r.target&&e-a.timeStamp<200?++a.clickCount:a.clickCount=1,a.target=r.target,a.timeStamp=e,r.detail=a.clickCount,"mouse"===r.pointerType){const t=2===r.button;this.dispatchEvent(r,t?"rightclick":"click")}else"touch"===r.pointerType&&this.dispatchEvent(r,"tap");this.dispatchEvent(r,"pointertap"),this.freeEvent(r)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof nr))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(s){let r=s;for(;r;)i.currentTarget=r,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType?this.notifyTarget(i,"touchendoutside"):("mouse"===i.pointerType||"pen"===i.pointerType)&&this.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),r=r.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof ar))return void console.warn("EventBoundary cannot map a non-wheel event as a wheel event");const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;s<t.length&&t[s].parent===e;s++)e=t[s];return e}createPointerEvent(t,e,s){const i=this.allocateEvent(nr);return this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=s??this.hitTest(i.global.x,i.global.y)??this._hitElements[0],"string"==typeof e&&(i.type=e),i}createWheelEvent(t){const e=this.allocateEvent(ar);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const s=this.allocateEvent(nr);return s.nativeEvent=t.nativeEvent,s.originalEvent=t.originalEvent,this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.target=t.target,s.path=t.composedPath().slice(),s.type=e??s.type,s}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof nr&&e instanceof nr&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof rr&&e instanceof rr&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const s=t.currentTarget._events[e];if(s&&t.currentTarget.isInteractive())if("fn"in s)s.once&&t.currentTarget.removeListener(e,s.fn,void 0,!0),s.fn.call(s.context,t);else for(let i=0,r=s.length;i<r&&!t.propagationImmediatelyStopped;i++)s[i].once&&t.currentTarget.removeListener(e,s[i].fn,void 0,!0),s[i].fn.call(s[i].context,t)}}const ur={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},cr=class t{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new lr(null),sr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=ne
vendor: 6,128 bytes, line 1
1w nr(null),this.rootWheelEvent=new ar(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...t.defaultEventFeatures},{set:(t,e,s)=>("globalMove"===e&&(this.rootBoundary.enableGlobalMoveEvents=s),t[e]=s,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{view:s,resolution:i}=this.renderer;this.setTargetElement(s),this.resolution=i,t._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let s=0,i=e.length;s<i;s++){const t=e[s],i=this.bootstrapEvent(this.rootPointerEvent,t);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,sr.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,i=e.length;s<i;s++){const t=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(t)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let r=0,n=i.length;r<n;r++){const t=this.bootstrapEvent(this.rootPointerEvent,i[r]);t.type+=s,this.rootBoundary.mapEvent(t)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let s=0,i=e.length;s<i;s++){const t=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(t)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,sr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;sr.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;sr.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,s){const i=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},r=1/this.resolution;t.x=(e-i.left)*(this.domElement.width/i.width)*r,t.y=(s-i.top)*(this.domElement.height/i.height)*r}normalizeToPointerData(t){const e=[];
1if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,i=t.changedTouches.length;s<i;s++){const i=t.changedTouches[s];typeof i.button>"u"&&(i.button=0),typeof i.buttons>"u"&&(i.buttons=1),typeof i.isPrimary>"u"&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),typeof i.width>"u"&&(i.width=i.radiusX||1),typeof i.height>"u"&&(i.height=i.radiusY||1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="touch"),typeof i.pointerId>"u"&&(i.pointerId=i.identifier||0),typeof i.pressure>"u"&&(i.pressure=i.force||.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),typeof i.layerX>"u"&&(i.layerX=i.offsetX=i.clientX),typeof i.layerY>"u"&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{const s=t;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=1),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=ur[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};cr.extension={name:"events",type:[Mt.RendererSystem,Mt.CanvasRendererSystem]},cr.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let dr=cr;function fr(t){return"dynamic"===t||"static"===t}Nt.add(dr);const pr={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??fr(dr.defaultEventMode)},set interactive(t){I("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=t,this.eventMode=t?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??dr.defaultEventMode},set eventMode(t){this._internalInteractive=fr(t),this._internalEventMode=t},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(t,e,s){const i="boolean"==typeof s&&s||"object"==typeof s&&s.capture,r="object"==typeof s?s.signal:void 0,n="object"==typeof s&&!0===s.once,a="function"==typeof e?void 0:e;t=i?`${t}capture`:t;const o="function"==typeof e?e:e.handleEvent,h=this;r&&r.addEventListener("abort",(()=>{h.off(t,o,a)})),n?h.once(t,o,a):h.on(t,o,a)},removeEventListener(t,e,s){const i="function"==typeof e?void 0:e;t="boolean"==typeof s&&s||"object"==typeof s&&s.capture?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,i)},dispatchEvent(t){if(!(t instanceof ir))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};Gi.mixin(pr);Gi.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});class mr{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(A.tablet||A.phone)&&this.createTouchHook();const e=document.createElement("div");
1e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex=2..toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",(()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()})),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode?.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let s=0;s<e.length;s++)this.updateAccessibleObjects(e[s])}update(){const t=performance.now();if(A.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:s,width:i,height:r}=this.renderer.view.getBoundingClientRect(),{width:n,height:a,resolution:o}=this.renderer,h=i/n*o,l=r/a*o;let u=this.div;u.style.left=`${e}px`,u.style.top=`${s}px`,u.style.width=`${n}px`,u.style.height=`${a}px`;for(let c=0;c<this.children.length;c++){const t=this.children[c];if(t.renderId!==this.renderId)t._accessibleActive=!1,_t(this.children,c,1),this.div.removeChild(t._accessibleDiv),this.pool.push(t._accessibleDiv),t._accessibleDiv=null,c--;else{u=t._accessibleDiv;let e=t.hitArea;const s=t.worldTransform;t.hitArea?(u.style.left=(s.tx+e.x*s.a)*h+"px",u.style.top=(s.ty+e.y*s.d)*l+"px",u.style.width=e.width*s.a*h+"px",u.style.height=e.height*s.d*l+"px"):(e=t.getBounds(),this.capHitArea(e),u.style.left=e.x*h+"px",u.style.top=e.y*l+"px",u.style.width=e.width*h+"px",u.style.height=e.height*l+"px",u.title!==t.accessibleTitle&&null!==t.accessibleTitle&&(u.title=t.accessibleTitle),u.getAttribute("aria-label")!==t.accessibleHint&&null!==t.accessibleHint&&u.setAttribute("aria-label",t.accessibleHint)),(t.accessibleTitle!==u.title||t.tabIndex!==u.tabIndex)&&(u.title=t.accessibleTitle,u.tabIndex=t.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:(!t.accessibleHint||null===t.accessibleHint)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,i=this.renderer.events.rootBoundary,r=Object.assign(new ir(i),{target:s});i.rootTarget=this.renderer.lastObjectRendered,e.forEach((t=>i.dispatchEvent(r,t)))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this.activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}mr.extension={name:"accessibility",type:[Mt.RendererPlugin,Mt.CanvasRendererPlugin]},Nt.add(mr);const gr=class t{constructor(e){this.stage=new Wi,e=Object.assign({forceCanvas:!1},e),this.renderer=function(t){for(const e of Ei)if(e.test(t))return new e(t);throw new Error("Unable to auto-detect a suitable renderer.")}(e),t._plugins.forEach((t=>{t.init.call(this,e)}))}render(){this.renderer.render(this.stage)}get view(){return this.renderer?.view}get screen(){return this.renderer?.screen}destroy(e,s){const i=t._plugins.slice(0);
1i.reverse(),i.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(s),this.stage=null,this.renderer.destroy(e),this.renderer=null}};gr._plugins=[];let _r=gr;Nt.handleByList(Mt.Application,_r._plugins);class xr{static init(t){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame((()=>this.resize())))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let t,e;if(this.cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:i}=this._resizeTo;t=s,e=i}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}xr.extension=Mt.Application,Nt.add(xr);const yr={loader:Mt.LoadParser,resolver:Mt.ResolveParser,cache:Mt.CacheParser,detection:Mt.DetectionParser};Nt.handle(Mt.Asset,(t=>{const e=t.ref;Object.entries(yr).filter((([t])=>!!e[t])).forEach((([t,s])=>Nt.add(Object.assign(e[t],{extension:e[t].extension??s}))))}),(t=>{const e=t.ref;Object.keys(yr).filter((t=>!!e[t])).forEach((t=>Nt.remove(e[t])))}));class vr{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach((t=>{this._assetList.push(t)})),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s<e;s++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function br(t,e){const s=t.split("?")[0],i=M.extname(s).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}const Tr=(t,e,s=!1)=>(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t||s?e(t):t)):t);const Er=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=Tr(t);let i;for(let a=0;a<this.parsers.length;a++){const t=this.parsers[a];if(t.test(e)){i=t.getCacheableAssets(s,e);break}}i||(i={},s.forEach((t=>{i[t]=e})));const r=Object.keys(i),n={cacheKeys:r,keys:s};if(s.forEach((t=>{this._cacheMap.set(t,n)})),r.forEach((t=>{this._cache.has(t)&&this._cache.get(t)!==e&&console.warn("[Cache] already has key:",t),this._cache.set(t,i[t])})),e instanceof us){const t=e;s.forEach((e=>{t.baseTexture!==us.EMPTY.baseTexture&&jt.addToCache(t.baseTexture,e),us.addToCache(t,e)}))}}remove(t){if(!this._cacheMap.has(t))return void console.warn(`[Assets] Asset id ${t} was not found in the Cache`);const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}},Ar=t=>!Array.isArray(t);class wr{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{let i=null,r=null;if(e.loadParser&&(r=this._parserHash[e.loadParser],r||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!r){for(let s=0;s<this.parsers.length;s++){const i=this.parsers[s];if(i.load&&i.test?.(t,e,this)){r=i;break}}if(!r)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}i=await r.load(t,e,this),s.parser=r;for(let t=0;t<this.parsers.length;t++){const r=this.parsers[t];r.parse&&r.parse&&await(r.testParse?.(i,e,this))&&(i=await r.parse(i,e,this)||i,s.parser=r)}return i})(),s}
1async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const i={},r=Ar(t),n=Tr(t,(t=>({alias:[t],src:t}))),a=n.length,o=n.map((async t=>{const r=M.toAbsolute(t.src);if(!i[t.src])try{this.promiseCache[r]||(this.promiseCache[r]=this._getLoadPromiseAndParser(r,t)),i[t.src]=await this.promiseCache[r].promise,e&&e(++s/a)}catch(U){throw delete this.promiseCache[r],delete i[t.src],new Error(`[Loader.load] Failed to load ${r}.\n${U}`)}}));return await Promise.all(o),r?i[n[0].src]:i}async unload(t){const e=Tr(t,(t=>({alias:[t],src:t}))).map((async t=>{const e=M.toAbsolute(t.src),s=this.promiseCache[e];if(s){const i=await s.promise;delete this.promiseCache[e],s.parser?.unload?.(i,t,this)}}));await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter((t=>t.name)).reduce(((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e})),{})}}var Sr=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Sr||{});function Rr(t,e){if(Array.isArray(e)){for(const s of e)if(t.startsWith(`data:${s}`))return!0;return!1}return t.startsWith(`data:${e}`)}const Ir={extension:{type:Mt.LoadParser,priority:Sr.Low},name:"loadJson",test:t=>Rr(t,"application/json")||br(t,".json"),load:async t=>await(await T.ADAPTER.fetch(t)).json()};Nt.add(Ir);const Cr={name:"loadTxt",extension:{type:Mt.LoadParser,priority:Sr.Low},test:t=>Rr(t,"text/plain")||br(t,".txt"),load:async t=>await(await T.ADAPTER.fetch(t)).text()};Nt.add(Cr);const Pr=["normal","bold","100","200","300","400","500","600","700","800","900"],Mr=[".ttf",".otf",".woff",".woff2"],Dr=["font/ttf","font/otf","font/woff","font/woff2"],Br=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;const Nr=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;const Or={extension:{type:Mt.LoadParser,priority:Sr.Low},name:"loadWebFont",test:t=>Rr(t,Dr)||br(t,Mr),async load(t,e){const s=T.ADAPTER.getFontFaceSet();if(s){const r=[],n=e.data?.family??function(t){const e=M.extname(t),s=M.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map((t=>t.charAt(0).toUpperCase()+t.slice(1)));let i=s.length>0;for(const n of s)if(!n.match(Br)){i=!1;break}let r=s.join(" ");return i||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}(t),a=e.data?.weights?.filter((t=>Pr.includes(t)))??["normal"],o=e.data??{};for(let e=0;e<a.length;e++){const h=a[e],l=new FontFace(n,`url(${i=t,Nr.test(i)?i:encodeURI(i)})`,{...o,weight:h});await l.load(),s.add(l),r.push(l)}return 1===r.length?r[0]:r}var i;return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(t){(Array.isArray(t)?t:[t]).forEach((t=>T.ADAPTER.getFontFaceSet().delete(t)))}};Nt.add(Or);let Lr=null;class Fr{constructor(){Lr||(Lr=URL.createObjectURL(new Blob(['(function() {\n "use strict";\n const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";\n async function checkImageBitmap() {\n try {\n if (typeof createImageBitmap != "function")\n return !1;\n const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);\n return imageBitmap.width === 1 && imageBitmap.height === 1;\n } catch {\n return !1;\n }\n }\n checkImageBitmap().then((result) => {\n self.postMessage(result);\n });\n})();\n'],{type:"application/javascript"}))),this.worker=new Worker(Lr)}}Fr.revokeObjectURL=function(){Lr&&(URL.revokeObjectURL(Lr),Lr=null)};let Ur=null;class kr{constructor(){Ur||(Ur=URL.createObjectURL(new Blob(['(function() {\n "use strict";\n async function loadImageBitmap(url) {\n const response = await fetch(url);\n if (!response.ok)\n throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${url}: ${response.status} ${response.statusText}`);\n const imageBlob = await response.blob();\n return await createImageBitmap(imageBlob);\n }\n self.onmessage = async (event) => {\n try {\n const imageBitmap = await loadImageBitmap(event.data.data[0]);\n self.postMessage({\n data: imageBitmap,\n uuid: event.data.uuid,\n id: event.data.id\n }, [imageBitmap]);\n } catch (e) {\n self.postMessage({\n error: e,\n uuid: event.data.uuid,\n id: event.data.id\n });\n }\n };\n})();\n'],{type:"application/javascript"}))),this.worker=new Worker(Ur)}}kr.revokeObjectURL=function(){Ur&&(URL.revokeObjectURL(Ur),Ur=null)};let Gr,Hr=0;const Xr=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise((t=>{const{worker:e}=new Fr;e.addEventListener("message",(s=>{e.terminate(),Fr.revokeObjectURL(),t(s.data)}))}))),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===Gr&&(Gr=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Gr&&(this._createdWorkers++,t=(new kr).worker,t.addEventListener("message",(t=>{this.complete(t.data),this.returnWorker(t.target),this.next()}))),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise(((s,i)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:i})}
1));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[Hr]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Hr++,id:s})}};function Vr(t,e,s){t.resource.internal=!0;const i=new us(t),r=()=>{delete e.promiseCache[s],Er.has(s)&&Er.remove(s)};return i.baseTexture.once("destroyed",(()=>{s in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),r())})),i.once("destroyed",(()=>{t.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())})),i}const zr=[".jpeg",".jpg",".png",".webp",".avif"],Wr=["image/jpeg","image/png","image/webp","image/avif"];const jr={name:"loadTextures",extension:{type:Mt.LoadParser,priority:Sr.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:t=>Rr(t,Wr)||br(t,zr),async load(t,e,s){const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let r;r=i?this.config.preferWorkers&&await Xr.isImageBitmapSupported()?await Xr.loadImageBitmap(t):await async function(t){const e=await T.ADAPTER.fetch(t);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${t}: ${e.status} ${e.statusText}`);const s=await e.blob();return await createImageBitmap(s)}(t):await new Promise(((e,s)=>{const i=new Image;i.crossOrigin=this.config.crossOrigin,i.src=t,i.complete?e(i):(i.onload=()=>e(i),i.onerror=t=>s(t))}));const n={...e.data};n.resolution??(n.resolution=Pt(t)),i&&void 0===n.resourceOptions?.ownsImageBitmap&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const a=new jt(r,n);return a.resource.src=t,Vr(a,s,t)},unload(t){t.destroy(!0)}};Nt.add(jr);const $r={extension:{type:Mt.LoadParser,priority:Sr.High},name:"loadSVG",test:t=>Rr(t,"image/svg+xml")||br(t,".svg"),testParse:async t=>Li.test(t),async parse(t,e,s){const i=new Li(t,e?.data?.resourceOptions);await i.load();const r=new jt(i,{resolution:Pt(t),...e?.data});return r.resource.src=e.src,Vr(r,s,e.src)},load:async(t,e)=>(await T.ADAPTER.fetch(t)).text(),unload:jr.unload};Nt.add($r);const Yr=[".mp4",".m4v",".webm",".ogv"],qr=["video/mp4","video/webm","video/ogg"],Kr={name:"loadVideo",extension:{type:Mt.LoadParser,priority:Sr.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test:t=>Rr(t,qr)||br(t,Yr),async load(t,e,s){let i;const r=await(await T.ADAPTER.fetch(t)).blob(),n=URL.createObjectURL(r);try{const r={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...e?.data?.resourceOptions,autoLoad:!0},a=new Ui(n,r);await a.load();const o=new jt(a,{alphaMode:await N(),resolution:Pt(t),...e?.data});o.resource.src=t,i=Vr(o,s,t),i.baseTexture.once("destroyed",(()=>{URL.revokeObjectURL(n)}))}catch(U){throw URL.revokeObjectURL(n),U}return i},unload(t){t.destroy(!0)}};function Zr(t,e,s,i,r){const n=e[s];for(let a=0;a<n.length;a++){const o=n[a];s<e.length-1?Zr(t.replace(i[s],o),e,s+1,i,r):r.push(t.replace(i[s],o))}}function Jr(t){const e=t.match(/\{(.*?)\}/g),s=[];if(e){const i=[];e.forEach((t=>{const e=t.substring(1,t.length-1).split(",");i.push(e)})),Zr(t,i,0,e,s)}else s.push(t);return s}Nt.add(Kr);class Qr{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}
1)),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}}getAlias(t){const{alias:e,name:s,src:i,srcs:r}=t;return Tr(e||s||i||r,(t=>"string"==typeof t?t:Array.isArray(t)?t.map((t=>t?.src??t?.srcs??t)):t?.src||t?.srcs?t.src??t.srcs:t),!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach((e=>{const i=e.src??e.srcs,r=e.alias??e.name;let n;if("string"==typeof r){const e=this._createBundleAssetId(t,r);s.push(e),n=[r,e]}else{const e=r.map((e=>this._createBundleAssetId(t,e)));s.push(...e),n=[...r,...e]}this.add({...e,alias:n,src:i})})):Object.keys(e).forEach((i=>{const r=[i,this._createBundleAssetId(t,i)];if("string"==typeof e[i])this.add({alias:r,src:e[i]});else if(Array.isArray(e[i]))this.add({alias:r,src:e[i]});else{const t=e[i],s=t.src??t.srcs;this.add({...t,alias:r,src:Array.isArray(s)?s:[s]})}s.push(...r)})),this._bundles[t]=s}add(t,e,s,i,r){const n=[];let a;"string"==typeof t||Array.isArray(t)&&"string"==typeof t[0]?(I("7.2.0","Assets.add now uses an object instead of individual parameters.\nPlease use Assets.add({ alias, src, data, format, loadParser }) instead."),n.push({alias:t,src:e,data:s,format:i,loadParser:r})):Array.isArray(t)?n.push(...t):n.push(t),a=t=>{this.hasKey(t)&&console.warn(`[Resolver] already has key: ${t} overwriting`)},Tr(n).forEach((t=>{const{src:e,srcs:s}=t;let{data:i,format:r,loadParser:n}=t;const o=Tr(e||s).map((t=>"string"==typeof t?Jr(t):Array.isArray(t)?t:[t])),h=this.getAlias(t);Array.isArray(h)?h.forEach(a):a(h);const l=[];o.forEach((t=>{t.forEach((t=>{let e={};if("object"!=typeof t){e.src=t;for(let s=0;s<this._parsers.length;s++){const i=this._parsers[s];if(i.test(t)){e=i.parse(t);break}}}else i=t.data??i,r=t.format??r,n=t.loadParser??n,e={...e,...t};if(!h)throw new Error(`[Resolver] alias is undefined for this asset: ${e.src}`);e=this.buildResolvedAsset(e,{aliases:h,data:i,format:r,loadParser:n}),l.push(e)}))})),h.forEach((t=>{this._assetMap[t]=l}))}))}resolveBundle(t){const e=Ar(t);t=Tr(t);const s={};return t.forEach((t=>{const e=this._bundles[t];if(e){const i=this.resolve(e),r={};for(const e in i){const s=i[e];r[this._extractAssetIdFromBundle(t,e)]=s}s[t]=r}})),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const s in e)t[s]=e[s].src;return t}return e.src}resolve(t){const e=Ar(t);t=Tr(t);const s={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const s=e[0],i=this._getPreferredOrder(e);i?.priority.forEach((t=>{i.params[t].forEach((s=>{const i=e.filter((e=>!!e[t]&&e[t]===s));i.length&&(e=i)}))})),this._resolverHash[t]=e[0]??s}else this._resolverHash[t]=this.buildResolvedAsset({alias:[t],src:t},{});s[t]=this._resolverHash[t]})),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const e=t[0],s=this._preferredOrder.find((t=>t.params.format.includes(e.format)));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:s,data:i,loadParser:r,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=M.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=r??t.loadParser,t.format=n??t.format??M.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}const tn=new class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Qr,this.loader=new wr,this.cache=Er,this._backgroundLoader=new vr(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized)return void console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let e=t.manifest;"string"==typeof e&&(e=await this.load(e)),this.resolver.addManifest(e)}const e=t.texturePreference?.resolution??1,s="number"==typeof e?[e]:e,i=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:i,resolution:s}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,i,r){this.resolver.add(t,e,s,i,r)}async load(t,e){this._initialized||await this.init();const s=Ar(t),i=Tr(t).map((t=>{if("string"!=typeof t){const e=this.resolver.getAlias(t);return e.some((t=>!this.resolver.hasKey(t)))&&this.add(t),Array.isArray(e)?e[0]:e}return this.resolver.hasKey(t)||this.add({alias:t,src:t}),t})),r=this.resolver.resolve(i),n=await this._mapLoadToResolve(r,e);return s?n[i[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;"string"==typeof t&&(s=!0,t=[t]);const i=this.resolver.resolveBundle(t),r={},n=Object.keys(i);let a=0,o=0;const h=()=>{e?.(++a/o)},l=n.map((t=>{const e=i[t];return o+=Object.keys(e).length,this._mapLoadToResolve(e,h).then((e=>{r[t]=e}))}));return await Promise.all(l),s?r[t[0]]:r}async backgroundLoad(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach((t=>{this._backgroundLoader.add(Object.values(t))}))}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return Er.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Er.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),i=Object.keys(t);this._backgroundLoader.active=!1;const r=await this.loader.load(s,e);this._backgroundLoader.active=!0;const n={};
1return s.forEach(((t,e)=>{const s=r[t.src],a=[t.src];t.alias&&a.push(...t.alias),n[i[e]]=s,Er.set(a,s)})),n}async unload(t){this._initialized||await this.init();const e=Tr(t).map((t=>"string"!=typeof t?t.src:t)),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Tr(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map((t=>this._unloadFromResolved(e[t])));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach((t=>{Er.remove(t.src)})),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter(((t,s)=>e.indexOf(t)===s)),e}get detections(){return this._detections}get preferWorkers(){return jr.config.preferWorkers}set preferWorkers(t){I("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach((e=>{e.config&&Object.keys(e.config).filter((e=>e in t)).forEach((s=>{e.config[s]=t[s]}))}))}};Nt.handleByList(Mt.LoadParser,tn.loader.parsers).handleByList(Mt.ResolveParser,tn.resolver.parsers).handleByList(Mt.CacheParser,tn.cache.parsers).handleByList(Mt.DetectionParser,tn.detections);const en={extension:Mt.CacheParser,test:t=>Array.isArray(t)&&t.every((t=>t instanceof us)),getCacheableAssets:(t,e)=>{const s={};return t.forEach((t=>{e.forEach(((e,i)=>{s[t+(0===i?"":i+1)]=e}))})),s}};async function sn(t){if("Image"in globalThis)return new Promise((e=>{const s=new Image;s.onload=()=>{e(!0)},s.onerror=()=>{e(!1)},s.src=t}));if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(t)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}Nt.add(en);const rn={extension:{type:Mt.DetectionParser,priority:1},test:async()=>sn("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async t=>[...t,"avif"],remove:async t=>t.filter((t=>"avif"!==t))};Nt.add(rn);const nn={extension:{type:Mt.DetectionParser,priority:0},test:async()=>sn("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async t=>[...t,"webp"],remove:async t=>t.filter((t=>"webp"!==t))};Nt.add(nn);const an=["png","jpg","jpeg"],on={extension:{type:Mt.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...an],remove:async t=>t.filter((t=>!an.includes(t)))};Nt.add(on);const hn="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function ln(t){return!hn&&""!==document.createElement("video").canPlayType(t)}const un={extension:{type:Mt.DetectionParser,priority:0},test:async()=>ln("video/webm"),add:async t=>[...t,"webm"],remove:async t=>t.filter((t=>"webm"!==t))};Nt.add(un);const cn={extension:{type:Mt.DetectionParser,priority:0},test:async()=>ln("video/mp4"),add:async t=>[...t,"mp4","m4v"],remove:async t=>t.filter((t=>"mp4"!==t&&"m4v"!==t))};Nt.add(cn);const dn={extension:{type:Mt.DetectionParser,priority:0},test:async()=>ln("video/ogg"),add:async t=>[...t,"ogv"],remove:async t=>t.filter((t=>"ogv"!==t))};Nt.add(dn);const fn={extension:Mt.ResolveParser,test:jr.test,parse:t=>({resolution:parseFloat(T.RETINA_PREFIX.exec(t)?.[1]??"1"),format:M.extname(t).slice(1),src:t})};Nt.add(fn);const pn=(t,e)=>{const s=e.split("?")[1];return s&&(t+=`?${s}`),t};var mn=(t=>(t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_R11_
1EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t))(mn||{});const gn={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let _n,xn;function yn(){xn={bptc:_n.getExtension("EXT_texture_compression_bptc"),astc:_n.getExtension("WEBGL_compressed_texture_astc"),etc:_n.getExtension("WEBGL_compressed_texture_etc"),s3tc:_n.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:_n.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:_n.getExtension("WEBGL_compressed_texture_pvrtc")||_n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:_n.getExtension("WEBGL_compressed_texture_etc1"),atc:_n.getExtension("WEBGL_compressed_texture_atc")}}const vn={extension:{type:Mt.DetectionParser,priority:2},test:async()=>{const t=T.ADAPTER.createCanvas().getContext("webgl");return t?(_n=t,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async t=>{xn||yn();const e=[];for(const s in xn)xn[s]&&e.push(s);return[...e,...t]},remove:async t=>(xn||yn(),t.filter((t=>!(t in xn))))};Nt.add(vn);class bn extends Vt{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,i;"string"==typeof t?(s=t,i=new Uint8Array):(s=null,i=t),super(i,e),this.origin=s,this.buffer=i?new Ot(i):null,this._load=null,this.loaded=!1,null!==this.origin&&!1!==e.autoLoad&&this.load(),null===this.origin&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load||(this._load=fetch(this.origin).then((t=>t.blob())).then((t=>t.arrayBuffer())).then((t=>(this.data=new Uint32Array(t),this.buffer=new Ot(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)))),this._load}}class Tn extends bn{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Tn._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Tn._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const i=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;i.pixelStorei(i.UNPACK_ALIGNMENT,4);for(let r=0,n=this.levels;r<n;r++){const{levelID:t,levelWidth:e,levelHeight:s,levelBuffer:n}=this._levelBuffers[r];i.compressedTexImage2D(i.TEXTURE_2D,t,this.format,e,s,0,n)}return!0}onBlobLoaded(){this._levelBuffers=Tn._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(36196===t)return"etc1";
1if(35986===t||35987===t||34798===t)return"atc";if(t>=36492&&t<=36495)return"bptc";if(37808===t)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,s,i,r,n,a){const o=new Array(s);let h=t.byteOffset,l=n,u=a,c=l+i-1&~(i-1),d=u+r-1&~(r-1),f=c*d*gn[e];for(let p=0;p<s;p++)o[p]={levelID:p,levelWidth:s>1?l:c,levelHeight:s>1?u:d,levelBuffer:new Uint8Array(t.buffer,h,f)},h+=f,l=l>>1||1,u=u>>1||1,c=l+i-1&~(i-1),d=u+r-1&~(r-1),f=c*d*gn[e];return o}}const En=124,An=3,wn=4,Sn=7,Rn=19,In=2,Cn=0,Pn=1,Mn=2,Dn=3,Bn={827611204:mn.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:mn.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:mn.COMPRESSED_RGBA_S3TC_DXT5_EXT},Nn={70:mn.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:mn.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:mn.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:mn.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:mn.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:mn.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:mn.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:mn.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:mn.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:mn.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};const On=[171,75,84,88,32,49,49,187,13,10,26,10],Ln=12,Fn=16,Un=24,kn=28,Gn=36,Hn=40,Xn=44,Vn=48,zn=52,Wn=56,jn=60,$n={[u.UNSIGNED_BYTE]:1,[u.UNSIGNED_SHORT]:2,[u.INT]:4,[u.UNSIGNED_INT]:4,[u.FLOAT]:4,[u.HALF_FLOAT]:8},Yn={[h.RGBA]:4,[h.RGB]:3,[h.RG]:2,[h.RED]:1,[h.LUMINANCE]:1,[h.LUMINANCE_ALPHA]:2,[h.ALPHA]:1},qn={[u.UNSIGNED_SHORT_4_4_4_4]:2,[u.UNSIGNED_SHORT_5_5_5_1]:2,[u.UNSIGNED_SHORT_5_6_5]:2};function Kn(t,e,s=!1){const i=new DataView(e);if(!function(t,e){for(let s=0;s<On.length;s++)if(e.getUint8(s)!==On[s])return console.error(`${t} is not a valid *.ktx file!`),!1;return!0}(t,i))return null;const r=67305985===i.getUint32(Ln,!0),n=i.getUint32(Fn,r),a=i.getUint32(Un,r),o=i.getUint32(kn,r),h=i.getUint32(Gn,r),l=i.getUint32(Hn,r)||1,c=i.getUint32(Xn,r)||1,d=i.getUint32(Vn,r)||1,f=i.getUint32(zn,r),p=i.getUint32(Wn,r),m=i.getUint32(jn,r);if(0===l||1!==c)throw new Error("Only 2D textures are supported");if(1!==f)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==d)throw new Error("WebGL does not support array textures");const g=h+3&-4,_=l+3&-4,x=new Array(d);let y,v=h*l;if(0===n&&(v=g*_),y=0!==n?$n[n]?$n[n]*Yn[a]:qn[n]:gn[o],void 0===y)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const b=s?function(t,e,s){const i=new Map;let r=0;for(;r<e;){const n=t.getUint32(64+r,s),a=64+r+4,o=3-(n+3)%4;if(0===n||n>e-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&0!==t.getUint8(a+h);h++);if(-1===h){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=(new TextDecoder).decode(new Uint8Array(t.buffer,a,h)),u=new DataView(t.buffer,a+h+1,n-h-1);i.set(l,u),r+=4+n+o}return i}(i,m,r):null;let T=v*y,E=h,A=l,w=g,S=_,R=64+m;for(let u=0;u<p;u++){const t=i.getUint32(R,r);let s=R+4;for(let i=0;i<d;i++){let t=x[i];t||(t=x[i]=new Array(p)),t[u]={levelID:u,levelWidth:p>1||0!==n?E:w,levelHeight:p>1||0!==n?A:S,levelBuffer:new Uint8Array(e,s,T)},s+=T}R+=t+4,R=R%4!==0?R+4-R%4:R,E=E>>1||1,A=A>>1||1,w=E+4-1&-4,S=A+4-1&-4,T=w*S*y}return 0!==n?{uncompressed:x.map((t=>{let e=t[0].levelBuffer,s=!1;return n===u.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):n===u.UNSIGNED_INT?(s=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):n===u.INT&&(s=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new Vt(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:n,format:s?Zn(a):a}})),kvData:b}:{compressed:x.map((t=>new Tn(null,{format:o,width:h,height:l,levels:p,levelBuffers:t}))),kvData:b}}function Zn(t){switch(t){case h.RGBA:return h.RGBA_INTEGER;case h.RGB:return h.RGB_INTEGER;case h.RG:return h.RG_INTEGER;case h.RED:return h.RED_INTEGER;default:return t}}const Jn={extension:{type:Mt.LoadParser,priority:Sr.High},name:"loadDDS",test:t=>br(t,".dds"),async load(t,e,s){const i=function(t){const e=new Uint32Array(t);if(542327876!==e[0])throw new Error("Invalid DDS file magic word");const s=new Uint32Array(t,0,En/Uint32Array.BYTES_PER_ELEMENT),i=s[An],r=s[wn],n=s[Sn],a=new Uint32Array(t,Rn*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),o=a[1];if(4&o){const s=a[In];if(808540228!==s){const e=Bn[s],a=new Uint8Array(t,128);return[new Tn(a,{format:e,width:r,height:i,levels:n})]}const o=128,h=new Uint32Array(e.buffer,o,20/Uint32Array.BYTES_PER_ELEMENT),l=h[Cn],u=h[Pn],c=h[Mn],d=h[Dn],f=Nn[l];if(void 0===f)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(4===c)throw new Error("DDSParser does not support cubemap textures");if(6===u)throw new Error("DDSParser does not supported 3D texture data");const p=new Array,m=148;if(1===d)p.push(new Uint8Array(t,m));else{const e=gn[f];let s=0,a=r,o=i;for(let t=0;t<n;t++)s+=Math.max(1,a+3&-4)*Math.max(1,o+3&-4)*e,a>>>=1,o>>>=1;let h=m;for(let i=0;i<d;i++)p.push(new Uint8Array(t,h,s)),h+=s}return p.map((t=>new Tn(t,{format:f,width:r,height:i,levels:n})))}throw 64&o?new Error("DDSParser does not support uncompressed texture data."):512&o?new Error("DDSParser does not supported YUV uncompressed texture data."):131072&o?new Error("DDSParser does not support single-channel (lumninance) texture data!"):2&o?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}(await(await T.ADAPTER.fetch(t)).arrayBuffer()).map((i=>Vr(new jt(i,{mipmap:p.OFF,alphaMode:m.NO_PREMULTIPLIED_ALPHA,resolution:Pt(t),...e.data}),s,t)));return 1===i.length?i[0]:i},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};Nt.add(Jn);const Qn={extension:{type:Mt.LoadParser,priority:Sr.High},name:"loadKTX",test:t=>br(t,".ktx"),async load(t,e,s){const i=await(await T.ADAPTER.fetch(t)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=Kn(t,i),o=r??n,h={mipmap:p.OFF,alphaMode:m.NO_PREMULTIPLIED_ALPHA,resolution:Pt(t),...e.data},l=o.map((e=>{o===n&&Object.assign(h,{type:e.type,format:e.format});const i=e.resource??e,r=new jt(i,h);
1return r.ktxKeyValueData=a,Vr(r,s,t)}));return 1===l.length?l[0]:l},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};Nt.add(Qn);const ta=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],ea={extension:Mt.ResolveParser,test:t=>{const e=M.extname(t).slice(1);return["basis","ktx","dds"].includes(e)},parse:t=>{const e=t.split("."),s=e.pop();if(["ktx","dds"].includes(s)){const s=e.pop();if(ta.includes(s))return{resolution:parseFloat(T.RETINA_PREFIX.exec(t)?.[1]??"1"),format:s,src:t}}return{resolution:parseFloat(T.RETINA_PREFIX.exec(t)?.[1]??"1"),format:s,src:t}}};Nt.add(ea);const sa=new le,ia=class t{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){const t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,s,i){const r=new Image;return r.src=await this.base64(t,e,s,i),r}async base64(t,e,s,i){const r=this.canvas(t,i);if(void 0!==r.toBlob)return new Promise(((t,i)=>{r.toBlob((e=>{if(!e)return void i(new Error("ICanvas.toBlob failed!"));const s=new FileReader;s.onload=()=>t(s.result),s.onerror=i,s.readAsDataURL(e)}),e,s)}));if(void 0!==r.toDataURL)return r.toDataURL(e,s);if(void 0!==r.convertToBlob){const t=await r.convertToBlob({type:e,quality:s});return new Promise(((e,s)=>{const i=new FileReader;i.onload=()=>e(i.result),i.onerror=s,i.readAsDataURL(t)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,s){const{pixels:i,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,s);a&&t._flipY(i,r,n),o&&t._unpremultiplyAlpha(i);const h=new St(r,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),r,n);return h.context.putImageData(l,0,0),h.canvas}pixels(e,s){const{pixels:i,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,s);return a&&t._flipY(i,r,n),o&&t._unpremultiplyAlpha(i),i}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let i,r,n=!1,a=!1,o=!1;t&&(t instanceof cs?r=t:(r=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),o=!0,e&&(sa.width=e.width,sa.height=e.height,e=sa)));const l=s.gl;if(r){if(i=r.baseTexture.resolution,e=e??r.frame,n=!1,a=r.baseTexture.alphaMode>0&&r.baseTexture.format===h.RGBA,!o){s.renderTexture.bind(r);const t=r.framebuffer.glFramebuffers[s.CONTEXT_UID];t.blitFramebuffer&&s.framebuffer.bind(t.blitFramebuffer)}}else i=s.resolution,e||((e=sa).width=s.width/i,e.height=s.height/i),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*i),1),c=Math.max(Math.round(e.height*i),1),d=new Uint8Array(4*u*c);return l.readPixels(Math.round(e.x*i),Math.round(e.y*i),u,c,l.RGBA,l.UNSIGNED_BYTE,d),o&&r?.destroy(!0),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const i=e<<2,r=s>>1,n=new Uint8Array(i);for(let a=0;a<r;a++){const e=a*i,r=(s-a-1)*i;n.set(t.subarray(e,e+i)),t.copyWithin(e,r,r+i),t.set(n,r)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let s=0;s<e;s+=4){const e=t[s+3];if(0!==e){const i=255.001/e;t[s]=t[s]*i+.5,t[s+1]=t[s+1]*i+.5,t[s+2]=t[s+2]*i+.5}}}};ia.extension={name:"extract",type:Mt.RendererSystem};let ra=ia;Nt.add(ra);const na={build(t){const e=t.points;let s,i,r,n,a,o;if(t.type===ae.CIRC){const e=t.shape;s=e.x,i=e.y,a=o=e.radius,r=n=0}else if(t.type===ae.ELIP){const e=t.shape;s=e.x,i=e.y,a=e.width,o=e.height,r=n=0}else{const e=t.shape,h=e.width/2,l=e.height/2;s=e.x+h,i=e.y+l,a=o=Math.max(0,Math.min(e.radius,Math.min(h,l))),r=h-a,n=l-o}if(!(a>=0&&o>=0&&r>=0&&n>=0))return void(e.length=0);const h=Math.ceil(2.3*Math.sqrt(a+o)),l=8*h+(r?4:0)+(n?4:0);if(e.length=l,0===l)return;if(0===h)return e.length=8,e[0]=e[6]=s+r,e[1]=e[3]=i+n,e[2]=e[4]=s-r,void(e[5]=e[7]=i-n);let u=0,c=4*h+(r?2:0)+2,d=c,f=l;{const t=r+a,o=n,h=s+t,l=s-t,p=i+o;if(e[u++]=h,e[u++]=p,e[--c]=p,e[--c]=l,n){const t=i-o;e[d++]=l,e[d++]=t,e[--f]=t,e[--f]=h}}for(let p=1;p<h;p++){const t=Math.PI/2*(p/h),l=r+Math.cos(t)*a,m=n+Math.sin(t)*o,g=s+l,_=s-l,x=i+m,y=i-m;e[u++]=g,e[u++]=x,e[--c]=x,e[--c]=_,e[d++]=_,e[d++]=y,e[--f]=y,e[--f]=g}{const t=n+o,a=s+r,h=s-r,l=i+t,c=i-t;e[u++]=a,e[u++]=l,e[--f]=c,e[--f]=a,r&&(e[u++]=h,e[u++]=l,e[--f]=c,e[--f]=h)}},triangulate(t,e){const s=t.points,i=e.points,r=e.indices;if(0===s.length)return;let n=i.length/2;const a=n;let o,h;
1if(t.type!==ae.RREC){const e=t.shape;o=e.x,h=e.y}else{const e=t.shape;o=e.x+e.width/2,h=e.y+e.height/2}const l=t.matrix;i.push(t.matrix?l.a*o+l.c*h+l.tx:o,t.matrix?l.b*o+l.d*h+l.ty:h),n++,i.push(s[0],s[1]);for(let u=2;u<s.length;u+=2)i.push(s[u],s[u+1]),r.push(n++,a,n);r.push(a+1,a,n)}};function aa(t,e=!1){const s=t.length;if(s<6)return;let i=0;for(let r=0,n=t[s-2],a=t[s-1];r<s;r+=2){const e=t[r],s=t[r+1];i+=(e-n)*(s+a),n=e,a=s}if(!e&&i>0||e&&i<=0){const e=s/2;for(let i=e+e%2;i<s;i+=2){const e=s-i-2,r=s-i-1,n=i,a=i+1;[t[e],t[n]]=[t[n],t[e]],[t[r],t[a]]=[t[a],t[r]]}}}const oa={build(t){t.points=t.shape.points.slice()},triangulate(t,e){let s=t.points;const i=t.holes,r=e.points,n=e.indices;if(s.length>=6){aa(s,!1);const t=[];for(let r=0;r<i.length;r++){const e=i[r];aa(e.points,!0),t.push(s.length/2),s=s.concat(e.points)}const e=S(s,t,2);if(!e)return;const a=r.length/2;for(let s=0;s<e.length;s+=3)n.push(e[s]+a),n.push(e[s+1]+a),n.push(e[s+2]+a);for(let i=0;i<s.length;i++)r.push(s[i])}}},ha={build(t){const e=t.shape,s=e.x,i=e.y,r=e.width,n=e.height,a=t.points;a.length=0,r>=0&&n>=0&&a.push(s,i,s+r,i,s+r,i+n,s,i+n)},triangulate(t,e){const s=t.points,i=e.points;if(0===s.length)return;const r=i.length/2;i.push(s[0],s[1],s[2],s[3],s[6],s[7],s[4],s[5]),e.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},la={build(t){na.build(t)},triangulate(t,e){na.triangulate(t,e)}};var ua=(t=>(t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t))(ua||{}),ca=(t=>(t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t))(ca||{});const da={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let s=Math.ceil(t/this.maxLength);return s<this.minSegments?s=this.minSegments:s>this.maxSegments&&(s=this.maxSegments),s}};class fa{static curveTo(t,e,s,i,r,n){const a=n[n.length-2],o=n[n.length-1]-e,h=a-t,l=i-e,u=s-t,c=Math.abs(o*u-h*l);if(c<1e-8||0===r)return(n[n.length-2]!==t||n[n.length-1]!==e)&&n.push(t,e),null;const d=o*o+h*h,f=l*l+u*u,p=o*l+h*u,m=r*Math.sqrt(d)/c,g=r*Math.sqrt(f)/c,_=m*p/d,x=g*p/f,y=m*u+g*h,v=m*l+g*o,b=h*(g+_),T=o*(g+_),E=u*(m+x),A=l*(m+x);return{cx:y+t,cy:v+e,radius:r,startAngle:Math.atan2(T-v,b-y),endAngle:Math.atan2(A-v,E-y),anticlockwise:h*l>u*o}}static arc(t,e,s,i,r,n,a,o,h){const l=a-n,u=da._segmentsCount(Math.abs(l)*r,40*Math.ceil(Math.abs(l)/ie)),c=l/(2*u),d=2*c,f=Math.cos(c),p=Math.sin(c),m=u-1,g=m%1/m;for(let _=0;_<=m;++_){const t=c+n+d*(_+g*_),e=Math.cos(t),a=-Math.sin(t);h.push((f*e+p*a)*r+s,(f*-a+p*e)*r+i)}}}class pa{static curveLength(t,e,s,i,r,n,a,o){let h=0,l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,y=t,v=e;for(let b=1;b<=10;++b)l=b/10,u=l*l,c=u*l,d=1-l,f=d*d,p=f*d,m=p*t+3*f*l*s+3*d*u*r+c*a,g=p*e+3*f*l*i+3*d*u*n+c*o,_=y-m,x=v-g,y=m,v=g,h+=Math.sqrt(_*_+x*x);return h}static curveTo(t,e,s,i,r,n,a){const o=a[a.length-2],h=a[a.length-1];a.length-=2;const l=da._segmentsCount(pa.curveLength(o,h,t,e,s,i,r,n));let u=0,c=0,d=0,f=0,p=0;a.push(o,h);for(let m=1,g=0;m<=l;++m)g=m/l,u=1-g,c=u*u,d=c*u,f=g*g,p=f*g,a.push(d*o+3*c*g*t+3*u*f*s+p*r,d*h+3*c*g*e+3*u*f*i+p*n)}}function ma(t,e,s,i,r,n,a,o){let h,l;a?(h=i,l=-s):(h=-i,l=s);const u=t-s*r+h,c=e-i*r+l,d=t+s*n+h,f=e+i*n+l;return o.push(u,c,d,f),2}function ga(t,e,s,i,r,n,a,o){const h=s-t,l=i-e;let u=Math.atan2(h,l),c=Math.atan2(r-t,n-e);o&&u<c?u+=2*Math.PI:!o&&u>c&&(c+=2*Math.PI);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=1+(15*p*Math.sqrt(m)/Math.PI>>0),_=f/g;if(d+=_,o){a.push(t,e,s,i);for(let s=1,i=d;s<g;s++,i+=_)a.push(t,e,t+Math.sin(i)*m,e+Math.cos(i)*m);a.push(t,e,r,n)}else{a.push(s,i,t,e);for(let s=1,i=d;s<g;s++,i+=_)a.push(t+Math.sin(i)*m,e+Math.cos(i)*m,t,e);a.push(r,n,t,e)}return 2*g}function _a(t,e){t.lineStyle.native?function(t,e){let s=0;const i=t.shape,r=t.points||i.points,n=i.type!==ae.POLY||i.closeStroke;if(0===r.length)return;const a=e.points,o=e.indices,h=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),s=1;s<h;s++)a.push(r[2*s],r[2*s+1]),o.push(u,u+1),u++;n&&o.push(u,l)}(t,e):function(t,e){const s=t.shape;let i=t.points||s.points.slice();const r=e.closePointEps;if(0===i.length)return;const n=t.lineStyle,a=new oe(i[0],i[1]),o=new oe(i[i.length-2],i[i.length-1]),h=s.type!==ae.POLY||s.closeStroke,l=Math.abs(a.x-o.x)<r&&Math.abs(a.y-o.y)<r;if(h){i=i.slice(),l&&(i.pop(),i.pop(),o.set(i[i.length-2],i[i.length-1]));const t=.5*(a.x+o.x),e=.5*(o.y+a.y);i.unshift(t,e),i.push(t,e)}const u=e.points,c=i.length/2;let d=i.length;const f=u.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let _=i[0],x=i[1],y=i[2],v=i[3],b=0,T=0,E=-(x-v),A=_-y,w=0,S=0,R=Math.sqrt(E*E+A*A);E/=R,A/=R,E*=p,A*=p;const I=n.alignment,C=2*(1-I),P=2*I;h||(n.cap===ca.ROUND?d+=ga(_-E*(C-P)*.5,x-A*(C-P)*.5,_-E*C,x-A*C,_+E*P,x+A*P,u,!0)+2:n.cap===ca.SQUARE&&(d+=ma(_,x,E,A,C,P,!0,u))),u.push(_-E*C,x-A*C,_+E*P,x+A*P);for(let B=1;B<c-1;++B){_=i[2*(B-1)],x=i[2*(B-1)+1],y=i[2*B],v=i[2*B+1],b=i[2*(B+1)],T=i[2*(B+1)+1],E=-(x-v),A=_-y,R=Math.sqrt(E*E+A*A),E/=R,A/=R,E*=p,A*=p,w=-(v-T),S=y-b,R=Math.sqrt(w*w+S*S),w/=R,S/=R,w*=p,S*=p;const t=y-_,e=x-v,s=y-b,r=T-v,a=t*s+e*r,o=e*s-r*t,h=o<0;
1if(Math.abs(o)<.001*Math.abs(a)){u.push(y-E*C,v-A*C,y+E*P,v+A*P),a>=0&&(n.join===ua.ROUND?d+=ga(y,v,y-E*C,v-A*C,y-w*C,v-S*C,u,!1)+4:d+=2,u.push(y-w*P,v-S*P,y+w*C,v+S*C));continue}const l=(-E+_)*(-A+v)-(-E+y)*(-A+x),c=(-w+b)*(-S+v)-(-w+y)*(-S+T),f=(t*c-s*l)/o,I=(r*l-e*c)/o,M=(f-y)*(f-y)+(I-v)*(I-v),D=y+(f-y)*C,N=v+(I-v)*C,O=y-(f-y)*P,L=v-(I-v)*P,F=h?C:P,U=M<=Math.min(t*t+e*e,s*s+r*r)+F*F*m;let k=n.join;if(k===ua.MITER&&M/m>g&&(k=ua.BEVEL),U)switch(k){case ua.MITER:u.push(D,N,O,L);break;case ua.BEVEL:h?u.push(D,N,y+E*P,v+A*P,D,N,y+w*P,v+S*P):u.push(y-E*C,v-A*C,O,L,y-w*C,v-S*C,O,L),d+=2;break;case ua.ROUND:h?(u.push(D,N,y+E*P,v+A*P),d+=ga(y,v,y+E*P,v+A*P,y+w*P,v+S*P,u,!0)+4,u.push(D,N,y+w*P,v+S*P)):(u.push(y-E*C,v-A*C,O,L),d+=ga(y,v,y-E*C,v-A*C,y-w*C,v-S*C,u,!1)+4,u.push(y-w*C,v-S*C,O,L))}else{switch(u.push(y-E*C,v-A*C,y+E*P,v+A*P),k){case ua.MITER:h?u.push(O,L,O,L):u.push(D,N,D,N),d+=2;break;case ua.ROUND:d+=h?ga(y,v,y+E*P,v+A*P,y+w*P,v+S*P,u,!0)+2:ga(y,v,y-E*C,v-A*C,y-w*C,v-S*C,u,!1)+2}u.push(y-w*C,v-S*C,y+w*P,v+S*P),d+=2}}_=i[2*(c-2)],x=i[2*(c-2)+1],y=i[2*(c-1)],v=i[2*(c-1)+1],E=-(x-v),A=_-y,R=Math.sqrt(E*E+A*A),E/=R,A/=R,E*=p,A*=p,u.push(y-E*C,v-A*C,y+E*P,v+A*P),h||(n.cap===ca.ROUND?d+=ga(y-E*(C-P)*.5,v-A*(C-P)*.5,y-E*C,v-A*C,y+E*P,v+A*P,u,!1)+2:n.cap===ca.SQUARE&&(d+=ma(y,v,E,A,C,P,!1,u)));const M=e.indices,D=da.epsilon*da.epsilon;for(let B=f;B<d+f-2;++B)_=u[2*B],x=u[2*B+1],y=u[2*(B+1)],v=u[2*(B+1)+1],b=u[2*(B+2)],T=u[2*(B+2)+1],!(Math.abs(_*(v-T)+y*(T-x)+b*(x-v))<D)&&M.push(B,B+1,B+2)}(t,e)}class xa{static curveLength(t,e,s,i,r,n){const a=t-2*s+r,o=e-2*i+n,h=2*s-2*t,l=2*i-2*e,u=4*(a*a+o*o),c=4*(a*h+o*l),d=h*h+l*l,f=2*Math.sqrt(u+c+d),p=Math.sqrt(u),m=2*u*p,g=2*Math.sqrt(d),_=c/p;return(m*f+p*c*(f-g)+(4*d*u-c*c)*Math.log((2*p+_+f)/(_+g)))/(4*m)}static curveTo(t,e,s,i,r){const n=r[r.length-2],a=r[r.length-1],o=da._segmentsCount(xa.curveLength(n,a,t,e,s,i));let h=0,l=0;for(let u=1;u<=o;++u){const c=u/o;h=n+(t-n)*c,l=a+(e-a)*c,r.push(h+(t+(s-t)*c-h)*c,l+(e+(i-e)*c-l)*c)}}}const ya={[ae.POLY]:oa,[ae.CIRC]:na,[ae.ELIP]:na,[ae.RECT]:ha,[ae.RREC]:la},va=[],ba=[];class Ta{constructor(t,e=null,s=null,i=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=i,this.type=t.type}clone(){return new Ta(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}class Ea{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}const Aa=new oe,wa=class t extends se{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new ki,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),ba.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),va.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,i=null){const r=new Ta(t,e,s,i);return this.graphicsData.push(r),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Ta(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=i.lineStyle,i.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let s=0;s<e.length;++s){const i=e[s];if(i.fillStyle.visible&&i.shape&&(i.matrix?i.matrix.applyInverse(t,Aa):Aa.copyFrom(t),i.shape.contains(Aa.x,Aa.y))){let t=!1;if(i.holes)for(let e=0;e<i.holes.length;e++)if(i.holes[e].shape.contains(Aa.x,Aa.y)){t=!0;break}if(!t)return!0}}return!1}updateBatches(){if(!this.graphicsData.length)return void(this.batchable=!0);if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let s=null,i=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],i=s.style);for(let o=this.shapeIndex;o<e.length;o++){this.shapeIndex++;const r=e[o],n=r.fillStyle,a=r.lineStyle;ya[r.type].build(r),r.matrix&&this.transformPoints(r.points,r.matrix),(n.visible||a.visible)&&this.processHoles(r.holes);for(let e=0;e<2;e++){const o=0===e?n:a;if(!o.visible)continue;const h=o.texture.baseTexture,l=this.indices.length,u=this.points.length/2;h.wrapMode=f.REPEAT,0===e?this.processFill(r):this.processLine(r);const c=this.points.length/2-u;0!==c&&(s&&!this._compareStyles(i,o)&&(s.end(l,u),s=null),s||(s=va.pop()||new Ea,s.begin(o,l,u),this.batches.push(s),i=o),this.addUvs(this.points,t,o.texture,u,c,o.matrix
1))}}const r=this.indices.length,n=this.points.length/2;if(s&&s.end(r,n),0===this.batches.length)return void(this.batchable=!0);const a=n>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const e=this.graphicsData[t],s=e.fillStyle,i=e.lineStyle;if(s&&!s.texture.baseTexture.valid||i&&!i.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,s=t.length;e<s;e++){const s=t[e];for(let t=0;t<s.size;t++){const e=s.start+t;this.indicesUint16[e]=this.indicesUint16[e]-s.attribStart}}}isBatchable(){if(this.points.length>131070)return!1;const e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<2*t.BATCHABLE_SIZE}buildDrawCalls(){let t=++jt._globalBatch;for(let o=0;o<this.drawCalls.length;o++)this.drawCalls[o].texArray.clear(),ba.push(this.drawCalls[o]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let i=ba.pop();i||(i=new $t,i.texArray=new $e),i.texArray.count=0,i.start=0,i.size=0,i.type=o.TRIANGLES;let r=0,n=null,a=0,h=!1,l=o.TRIANGLES,u=0;this.drawCalls.push(i);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],p=8,m=d.style,g=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?o.LINES:o.TRIANGLES,n=null,r=p,t++),n!==g&&(n=g,g._batchEnabled!==t&&(r===p&&(t++,r=0,i.size>0&&(i=ba.pop(),i||(i=new $t,i.texArray=new $e),this.drawCalls.push(i)),i.start=u,i.size=0,i.texArray.count=0,i.type=l),g.touched=1,g._batchEnabled=t,g._batchLocation=r,g.wrapMode=f.REPEAT,i.texArray.elements[i.texArray.count++]=g,r++)),i.size+=d.size,u+=d.size,a=g._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,a,d.attribSize,d.attribStart)}jt._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,i=this.textureIds,r=new ArrayBuffer(3*t.length*4),n=new Float32Array(r),a=new Uint32Array(r);let o=0;for(let h=0;h<t.length/2;h++)n[o++]=t[2*h],n[o++]=t[2*h+1],n[o++]=e[2*h],n[o++]=e[2*h+1],a[o++]=s[h],n[o++]=i[h];this._buffer.update(r),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?oa.triangulate(t,this):ya[t.type].triangulate(t,this)}processLine(t){_a(t,this);for(let e=0;e<t.holes.length;e++)_a(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];ya[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let s=0;s<t.length/2;s++){const i=t[2*s],r=t[2*s+1];t[2*s]=e.a*i+e.c*r+e.tx,t[2*s+1]=e.b*i+e.d*r+e.ty}}addColors(t,e,s,i,r=0){const n=ut.shared.setValue(e).toLittleEndianNumber(),a=ut.shared.setValue(n).toPremultiplied(s);t.length=Math.max(t.length,r+i);for(let o=0;o<i;o++)t[r+o]=a}addTextureIds(t,e,s,i=0){t.length=Math.max(t.length,i+s);for(let r=0;r<s;r++)t[i+r]=e}addUvs(t,e,s,i,r,n=null){let a=0;const o=e.length,h=s.frame;for(;a<r;){let s=t[2*(i+a)],r=t[2*(i+a)+1];if(n){const t=n.a*s+n.c*r+n.tx;r=n.b*s+n.d*r+n.ty,s=t}a++,e.push(s/h.width,r/h.height)}const l=s.baseTexture;(h.width<l.width||h.height<l.height)&&this.adjustUvs(e,s,o,r)}adjustUvs(t,e,s,i){const r=e.baseTexture,n=1e-6,a=s+2*i,o=e.frame,h=o.width/r.width,l=o.height/r.height;let u=o.x/o.width,c=o.y/o.height,d=Math.floor(t[s]+n),f=Math.floor(t[s+1]+n);for(let p=s+2;p<a;p+=2)d=Math.min(d,Math.floor(t[p]+n)),f=Math.min(f,Math.floor(t[p+1]+n));u-=d,c-=f;for(let p=s;p<a;p+=2)t[p]=(t[p]+u)*h,t[p+1]=(t[p+1]+c)*l}};wa.BATCHABLE_SIZE=100;let Sa=wa;class Ra{constructor(){this.color=16777215,this.alpha=1,this.texture=us.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ra;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=us.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Ia extends Ra{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=ca.BUTT,this.join=ua.MITER,this.miterLimit=10}clone(){const t=new Ia;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=ca.BUTT,this.join=ua.MITER,this.miterLimit=10}}const Ca={},Pa=class t extends Wi{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Ra,this._lineStyle=new Ia,this._matrix=null,this._holeMode=!1,this.state=Ut.for2d(),this._geometry=t||new Sa,this._geometry.refCount++,this._transformID=-1,this._tintColor=new ut(16777215),this.blendMode=a.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new t(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,s,i=.5,r=!1){return"number"==typeof t&&(t={width:t,color:e,alpha:s,alignment:i,native:r}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:us.WHITE,color:t?.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:ca.BUTT,join:ua.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.width>0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new de,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new de,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,i=s[s.length-2],r=s[s.length-1];return(i!==t||r!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,i){this._initCurve();const r=this.currentPath.points;return 0===r.length&&this.moveTo(0,0),xa.curveTo(t,e,s,i,r),this}bezierCurveTo(t,e,s,i,r,n){return this._initCurve(),pa.curveTo(t,e,s,i,r,n,this.currentPath.points),this}arcTo(t,e,s,i,r){this._initCurve(t,e);const n=this.currentPath.points,a=fa.curveTo(t,e,s,i,r,n);
1if(a){const{cx:t,cy:e,radius:s,startAngle:i,endAngle:r,anticlockwise:n}=a;this.arc(t,e,s,i,r,n)}return this}arc(t,e,s,i,r,n=!1){if(i===r)return this;if(!n&&r<=i?r+=ie:n&&i<=r&&(i+=ie),r-i===0)return this;const a=t+Math.cos(i)*s,o=e+Math.sin(i)*s,h=this._geometry.closePointEps;let l=this.currentPath?this.currentPath.points:null;if(l){const t=Math.abs(l[l.length-2]-a),e=Math.abs(l[l.length-1]-o);t<h&&e<h||l.push(a,o)}else this.moveTo(a,o),l=this.currentPath.points;return fa.arc(a,o,t,e,s,i,r,n,l),this}beginFill(t=0,e){return this.beginTextureFill({texture:us.WHITE,color:t,alpha:e})}normalizeColor(t){const e=ut.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:us.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,i){return this.drawShape(new le(t,e,s,i))}drawRoundedRect(t,e,s,i,r){return this.drawShape(new fe(t,e,s,i,r))}drawCircle(t,e,s){return this.drawShape(new ue(t,e,s))}drawEllipse(t,e,s,i){return this.drawShape(new ce(t,e,s,i))}drawPolygon(...t){let e,s=!0;const i=t[0];i.points?(s=i.closeStroke,e=i.points):e=Array.isArray(t[0])?t[0]:t;const r=new de(e);return r.closeStroke=s,this.drawShape(r),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===ae.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let i=0;i<s;i++){const s=t.batches[i],r=s.style.color,n=new Float32Array(this.vertexData.buffer,4*s.attribStart*2,2*s.attribSize),a=new Float32Array(t.uvsFloat32.buffer,4*s.attribStart*2,2*s.attribSize),o={vertexData:n,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),uvs:a,_batchRGB:ut.shared.setValue(r).toRgbArray(),_tintRGB:r,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[i]=o}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,s=this.batches.length;e<s;e++){const s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,i=this.worldAlpha,r=e.uniforms,n=s.drawCalls;r.translationMatrix=this.transform.worldTransform,ut.shared.setValue(this._tintColor).premultiply(i).toArray(r.tint),t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let a=0,o=n.length;a<o;a++)this._renderDrawCallDirect(t,s.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:s,type:i,size:r,start:n}=e,a=s.count;for(let o=0;o<a;o++)t.texture.bind(s.elements[o],o);t.geometry.draw(i,r,n)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!Ca[s]){const{maxTextures:e}=t.plugins[s],i=new Int32Array(e);for(let t=0;t<e;t++)i[t]=t;const r={tint:new Float32Array([1,1,1,1]),translationMatrix:new pe,default:ze.from({uSamplers:i},!0)},n=t.plugins[s]._shader.program;Ca[s]=new We(n,r)}e=Ca[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:i,maxY:r}=t.bounds;this._bounds.addFrame(this.transform,e,s,i,r)}containsPoint(e){return this.worldTransform.applyInverse(e,t._TEMP_POINT),this._geometry.containsPoint(t._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=ut.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,s=e.a,i=e.b,r=e.c,n=e.d,a=e.tx,o=e.ty,h=this._geometry.points,l=this.vertexData;let u=0;for(let c=0;c<h.length;c+=2){const t=h[c],e=h[c+1];l[u++]=s*t+r*e+a,l[u++]=n*e+i*t+o}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,
1super.destroy(t)}};Pa.curves=da,Pa._TEMP_POINT=new oe;let Ma=Pa;class Da{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const Ba=new oe,Na=new de,Oa=class t extends Wi{constructor(t,e,s,i=o.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||Ut.for2d(),this.drawMode=i,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=T.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(e){const s=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===o.TRIANGLES&&s.length<2*t.BATCHABLE_SIZE?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=s._tintRGB,this._texture=s.texture;const i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,s=t._updateID;if(s===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const i=this.transform.worldTransform,r=i.a,n=i.b,a=i.c,o=i.d,h=i.tx,l=i.ty,u=this.vertexData;for(let c=0;c<u.length/2;c++){const t=e[2*c],s=e[2*c+1];u[2*c]=r*t+a*s+h,u[2*c+1]=n*t+o*s+l}if(this._roundPixels){const t=T.RESOLUTION;for(let e=0;e<u.length;++e)u[e]=Math.round(u[e]*t)/t}this.vertexDirty=s}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Da(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,Ba);const e=this.geometry.getBuffer("aVertexPosition").data,s=Na.points,i=this.geometry.getIndex().data,r=i.length,n=4===this.drawMode?3:1;for(let a=0;a+2<r;a+=n){const t=2*i[a],r=2*i[a+1],n=2*i[a+2];if(s[0]=e[t],s[1]=e[t+1],s[2]=e[r],s[3]=e[r+1],s[4]=e[n],s[5]=e[n+1],Na.contains(Ba.x,Ba.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Oa.BATCHABLE_SIZE=100;let La=Oa;class Fa extends ee{constructor(t,e,s){super();const i=new qt(t),r=new qt(e,!0),n=new qt(s,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,u.FLOAT).addAttribute("aTextureCoord",r,2,!1,u.FLOAT).addIndex(n),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}class Ua extends We{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:pe.IDENTITY,uColor:new Float32Array([1,1,1,1])};
1(e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e)).uniforms&&Object.assign(s,e.uniforms),super(e.program||Xe.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),s),this._colorDirty=!1,this.uvMatrix=new ws(t),this.batchable=void 0===e.program,this.pluginName=e.pluginName,this._tintColor=new ut(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;ut.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class ka{constructor(t,e,s){this.geometry=new ee,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let i=0;i<t.length;++i){let s=t[i];s={attributeName:s.attributeName,size:s.size,uploadFunction:s.uploadFunction,type:s.type||u.FLOAT,offset:s.offset},e[i]?this.dynamicProperties.push(s):this.staticProperties.push(s)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new qt(function(t,e=null){const s=6*t;if((e=e||new Uint16Array(s)).length!==s)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${s}`);for(let i=0,r=0;i<s;i+=6,r+=4)e[i+0]=r+0,e[i+1]=r+1,e[i+2]=r+2,e[i+3]=r+0,e[i+4]=r+2,e[i+5]=r+3;return e}(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let n=0;n<this.dynamicProperties.length;++n){const t=this.dynamicProperties[n];t.offset=e,e+=t.size,this.dynamicStride+=t.size}const s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new qt(this.dynamicData,!1,!1);let i=0;this.staticStride=0;for(let n=0;n<this.staticProperties.length;++n){const t=this.staticProperties[n];t.offset=i,i+=t.size,this.staticStride+=t.size}const r=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(r),this.staticDataUint32=new Uint32Array(r),this.staticBuffer=new qt(this.staticData,!0,!1);for(let n=0;n<this.dynamicProperties.length;++n){const e=this.dynamicProperties[n];t.addAttribute(e.attributeName,this.dynamicBuffer,0,e.type===u.UNSIGNED_BYTE,e.type,4*this.dynamicStride,4*e.offset)}for(let n=0;n<this.staticProperties.length;++n){const e=this.staticProperties[n];t.addAttribute(e.attributeName,this.staticBuffer,0,e.type===u.UNSIGNED_BYTE,e.type,4*this.staticStride,4*e.offset)}}uploadDynamic(t,e,s){for(let i=0;i<this.dynamicProperties.length;i++){const r=this.dynamicProperties[i];r.uploadFunction(t,e,s,r.type===u.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,r.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,s){for(let i=0;i<this.staticProperties.length;i++){const r=this.staticProperties[i];r.uploadFunction(t,e,s,r.type===u.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStri
1de,r.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}class Ga extends Ye{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new pe,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:u.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=We.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),this.state=Ut.for2d()}render(t){const e=t.children,s=t._maxSize,i=t._batchSize,r=this.renderer;let n=e.length;if(0===n)return;n>s&&!t.autoResize&&(n=s);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const o=e[0]._texture.baseTexture,h=o.alphaMode>0;this.state.blendMode=dt(t.blendMode,h),r.state.set(this.state);const l=r.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(r.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=ut.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=o,this.renderer.shader.bind(this.shader);let c=!1;for(let d=0,f=0;d<n;d+=i,f+=1){let s=n-d;s>i&&(s=i),f>=a.length&&a.push(this._generateOneMoreBuffer(t));const o=a[f];o.uploadDynamic(e,d,s);const h=t._bufferUpdateIDs[f]||0;c=c||o._updateID<h,c&&(o._updateID=t._updateID,o.uploadStatic(e,d,s)),r.geometry.bind(o.geometry),l.drawElements(l.TRIANGLES,6*s,l.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,i=t._batchSize,r=t._properties;for(let n=0;n<s;n+=i)e.push(new ka(this.properties,r,i));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new ka(this.properties,s,e)}uploadVertices(t,e,s,i,r,n){let a=0,o=0,h=0,l=0;for(let u=0;u<s;++u){const s=t[e+u],c=s._texture,d=s.scale.x,f=s.scale.y,p=c.trim,m=c.orig;p?(o=p.x-s.anchor.x*m.width,a=o+p.width,l=p.y-s.anchor.y*m.height,h=l+p.height):(a=m.width*(1-s.anchor.x),o=m.width*-s.anchor.x,h=m.height*(1-s.anchor.y),l=m.height*-s.anchor.y),i[n]=o*d,i[n+1]=l*f,i[n+r]=a*d,i[n+r+1]=l*f,i[n+2*r]=a*d,i[n+2*r+1]=h*f,i[n+3*r]=o*d,i[n+3*r+1]=h*f,n+=4*r}}uploadPosition(t,e,s,i,r,n){for(let a=0;a<s;a++){const s=t[e+a].position;i[n]=s.x,i[n+1]=s.y,i[n+r]=s.x,i[n+r+1]=s.y,i[n+2*r]=s.x,i[n+2*r+1]=s.y,i[n+3*r]=s.x,i[n+3*r+1]=s.y,n+=4*r}}uploadRotation(t,e,s,i,r,n){for(let a=0;a<s;a++){const s=t[e+a].rotation;i[n]=s,i[n+r]=s,i[n+2*r]=s,i[n+3*r]=s,n+=4*r}}uploadUvs(t,e,s,i,r,n){for(let a=0;a<s;++a){const s=t[e+a]._texture._uvs;s?(i[n]=s.x0,i[n+1]=s.y0,i[n+r]=s.x1,i[n+r+1]=s.y1,i[n+2*r]=s.x2,i[n+2*r+1]=s.y2,i[n+3*r]=s.x3,i[n+3*r+1]=s.y3,n+=4*r):(i[n]=0,i[n+1]=0,i[n+r]=0,i[n+r+1]=0,i[n+2*r]=0,i[n+2*r+1]=0,i[n+3*r]=0,i[n+3*r+1]=0,n+=4*r)}}uploadTint(t,e,s,i,r,n){for(let a=0;a<s;++a){const s=t[e+a],o=ut.shared.setValue(s._tintRGB).toPremultiplied(s.alpha,s.texture.baseTexture.alphaMode>0);i[n]=o,i[n+r]=o,i[n+2*r]=o,i[n+3*r]=o,n+=4*r}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Ga.extension={name:"particle",type:Mt.RendererPlugin},Nt.add(Ga);var Ha=(t=>(t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",t))(Ha||{});const Xa={willReadFrequently:!0}
1,Va=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0!==e){const s=T.ADAPTER.getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in s||"textLetterSpacing"in s}return e}constructor(t,e,s,i,r,n,a,o,h){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=r,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=o,this.fontProperties=h}static measureText(e,s,i,r=t._canvas){i=i??s.wordWrap;const n=s.toFontString(),a=t.measureFont(n);0===a.fontSize&&(a.fontSize=s.fontSize,a.ascent=s.fontSize);const o=r.getContext("2d",Xa);o.font=n;const h=(i?t.wordWrap(e,s,r):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let p=0;p<h.length;p++){const e=t._measureText(h[p],s.letterSpacing,o);l[p]=e,u=Math.max(u,e)}let c=u+s.strokeThickness;s.dropShadow&&(c+=s.dropShadowDistance);const d=s.lineHeight||a.fontSize+s.strokeThickness;let f=Math.max(d,a.fontSize+2*s.strokeThickness)+s.leading+(h.length-1)*(d+s.leading);return s.dropShadow&&(f+=s.dropShadowDistance),new t(e,s,c,f,h,l,d+s.leading,u,a)}static _measureText(e,s,i){let r=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(i.letterSpacing=`${s}px`,i.textLetterSpacing=`${s}px`,r=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(e).width;return n>0&&(r?n-=s:n+=(t.graphemeSegmenter(e).length-1)*s),n}static wordWrap(e,s,i=t._canvas){const r=i.getContext("2d",Xa);let n=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=s,c=t.collapseSpaces(u),d=t.collapseNewlines(u);let f=!c;const p=s.wordWrapWidth+l,m=t.tokenize(e);for(let g=0;g<m.length;g++){let e=m[g];if(t.isNewline(e)){if(!d){o+=t.addLine(a),f=!c,a="",n=0;continue}e=" "}if(c){const s=t.isBreakingSpace(e),i=t.isBreakingSpace(a[a.length-1]);if(s&&i)continue}const i=t.getFromCache(e,l,h,r);if(i>p)if(""!==a&&(o+=t.addLine(a),a="",n=0),t.canBreakWords(e,s.breakWords)){const i=t.wordWrapSplit(e);for(let u=0;u<i.length;u++){let c=i[u],d=c,m=1;for(;i[u+m];){const r=i[u+m];if(t.canBreakChars(d,r,e,u,s.breakWords))break;c+=r,d=r,m++}u+=m-1;const g=t.getFromCache(c,l,h,r);g+n>p&&(o+=t.addLine(a),f=!1,a="",n=0),a+=c,n+=g}}else{a.length>0&&(o+=t.addLine(a),a="",n=0);const s=g===m.length-1;o+=t.addLine(e,!s),f=!1,a="",n=0}else i+n>p&&(f=!1,o+=t.addLine(a),a="",n=0),(a.length>0||!t.isBreakingSpace(e)||f)&&(a+=e,n+=i)}return o+=t.addLine(a,!1),o}static addLine(e,s=!0){return e=t.trimRight(e),e=s?`${e}\n`:e}static getFromCache(e,s,i,r){let n=i[e];return"number"!=typeof n&&(n=t._measureText(e,s,r)+s,i[e]=n),n}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(e){if("string"!=typeof e)return"";for(let s=e.length-1;s>=0;s--){const i=e[s];if(!t.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return"string"==typeof e&&t._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,s){return"string"==typeof e&&t._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const s=[];let i="";if("string"!=typeof e)return s;for(let r=0;r<e.length;r++){const n=e[r],a=e[r+1];t.isBreakingSpace(n,a)||t.isNewline(n)?(""!==i&&(s.push(i),i=""),s.push(n)):i+=n}return""!==i&&s.push(i),s}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,i,r){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];const s={ascent:0,descent:0,fontSize:0},i=t._canvas,r=t._context;r.font=e;const n=t.METRICS_STRING+t.BASELINE_SYMBOL,a=Math.ceil(r.measureText(n).width);let o=Math.ceil(r.measureText(t.BASELINE_SYMBOL).width);const h=Math.ceil(t.HEIGHT_MULTIPLIER*o);if(o=o*t.BASELINE_MULTIPLIER|0,0===a||0===h)return t._fonts[e]=s,s;i.width=a,i.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=e,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,o);const l=r.getImageData(0,0,a,h).data,u=l.length,c=4*a;let d=0,f=0,p=!1;for(d=0;d<o;++d){for(let t=0;t<c;t+=4)if(255!==l[f+t]){p=!0;break}if(p)break;f+=c}for(s.ascent=o-d,f=u-c,p=!1,d=h;d>o;--d){for(let t=0;t<c;t+=4)if(255!==l[f+t]){p=!0;break}if(p)break;f-=c}return s.descent=d-o,s.fontSize=s.ascent+s.descent,t._fonts[e]=s,s}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{const s=new OffscreenCanvas(0,0);if(s.getContext("2d",Xa)?.measureText)return t.__canvas=s,s;e=T.ADAPTER.createCanvas()}catch{e=T.ADAPTER.createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",Xa)),t.__context}};Va.METRICS_STRING="|\xc9q\xc5",Va.BASELINE_SYMBOL="M",Va.BASELINE_MULTIPLIER=1.4,Va.HEIGHT_MULTIPLIER=2,Va.graphemeSegmenter=(()=>
1{if("function"==typeof Intl?.Segmenter){const t=new Intl.Segmenter;return e=>[...t.segment(e)].map((t=>t.segment))}return t=>[...t]})(),Va.experimentalLetterSpacing=!1,Va._fonts={},Va._newlines=[10,13],Va._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let za=Va;const Wa=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ja=class t{constructor(t){this.styleID=0,this.reset(),qa(this,t,t)}clone(){const e={};return qa(e,this,t.defaultStyle),new t(e)}reset(){qa(this,t.defaultStyle,t.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=Ya(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=Ya(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let s=0;s<t.length;++s)if(t[s]!==e[s])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=Ya(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t="number"==typeof this.fontSize?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let t=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(t)&&!Wa.includes(t)&&(t=`"${t}"`),e[s]=t}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};ja.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ha.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let $a=ja;function Ya(t){const e=ut.shared,s=t=>{const s=e.setValue(t);return 1===s.alpha?s.toHex():s.toRgbaString()};return Array.isArray(t)?t.map(s):s(t)}function qa(t,e,s){for(const i in s)Array.isArray(e[i])?t[i]=e[i].slice():t[i]=e[i]}const Ka={texture:!0,children:!1,baseTexture:!0},Za=class t extends Yi{constructor(e,s,i){let r=!1;i||(i=T.ADAPTER.createCanvas(),r=!0),i.width=3,i.height=3;const n=us.from(i);n.orig=new le,n.trim=new le,super(n),this._ownCanvas=r,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=t.defaultResolution??T.RESOLUTION,this._autoResolution=t.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=s,this.localStyleID=-1}static get experimentalLetterSpacing(){return za.experimentalLetterSpacing}static set experimentalLetterSpacing(t){I("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),za.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const s=this.context,i=za.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),r=i.width,n=i.height,a=i.lines,o=i.lineHeight,h=i.lineWidths,l=i.maxLineWidth,u=i.fontProperties;let c,d;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,r)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,n)+2*e.padding)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=e.strokeThickness,s.textBaseline=e.textBaseline,s.lineJoin=e.lineJoin,s.miterLimit=e.miterLimit;const f=e.dropShadow?2:1;for(let p=0;p<f;++p){const t=e.dropShadow&&0===p,r=t?Math.ceil(Math.max(1,n)+2*e.padding):0,f=r*this._resolution;if(t){s.fillStyle="black",s.strokeStyle="black";const t=e.dropShadowColor,i=e.dropShadowBlur*this._resolution,r=e.dropShadowDistance*this._resolution;s.shadowColor=ut.shared.setValue(t).setAlpha(e.dropShadowAlpha).toRgbaString(),s.shadowBlur=i,s.shadowOffsetX=Math.cos(e.dropShadowAngle)*r,s.shadowOffsetY=Math.sin(e.dropShadowAngle)*r+f}else s.fillStyle=this._generateFillStyle(e,a,i),s.strokeStyle=e.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let m=(o-u.fontSize)/2;o-u.fontSize<0&&(m=0);for(let s=0;s<a.length;s++)c=e.strokeThickness/2,d=e.strokeThickness/2+s*o+u.ascent+m,"right"===e.align?c+=l-h[s]:"center"===e.align&&(c+=(l-h[s])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[s],c+e.padding,d+e.padding-r,!0),e.fill&&this.drawLetterSpacing(a[s],c+e.padding,d+e.padding-r)}this.updateTexture()}drawLetterSpacing(t,e,s,i=!1){const r=this._style.letterSpacing;let n=!1;if(za.experimentalLetterSpacingSupported&&(za.experimentalLetterSpacing?(this.context.letterSpacing=`${r}px`,this.context.textLetterSpacing=`${r}px`,n=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),0===r||n)return void(i?this.context.strokeText(t,e,s):this.context.fillText(t,e,s));let a=e;const o=za.graphemeSegmenter(t);let h=this.context.measureText(t).width,l=0;for(let u=0;u<o.length;++u){const t=o[u];i?this.context.strokeText(t,a,s):this.context.fillText(t,a,s);let e="";for(let s=u+1;s<o.length;++s)e+=o[s];l=this.context.measureText(e).width,a+=h-l+r,h=l}}updateTexture(){const t=this.canvas;if(this._style.trim){const e=Ct(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}const e=this._texture,s=this._style,i=s.trim?0:s.padding,r=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-i,e.trim.y=-i,e.orig.width=e._frame.width-2*i,e.orig.height=e._frame.height-2*i,this._onTextureUpdate(),r.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),-1===this._textureID&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,s){const i=t.fill;if(!Array.isArray(i))return i;if(1===i.length)return i[0];let r;const n=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,o=this.canvas.width/this._resolution-n-2*a,h=this.canvas.height/this._resolution-n-2*a,l=i.slice(),u=t.fillGradientStops.slice();if(!u.length){const t=l.length+1;for(let e=1;e<t;++e)u.push(e/t)}if(l.unshift(i[0]),u.unshift(0),l.push(i[i.length-1]),u.push(1),t.fillGradientType===Ha.LINEAR_VERTICAL){r=this.context.createLinearGradient(o/2,a,o/2,h+a);const i=s.fontProperties.fontSize+t.strokeThickness;for(let t=0;t<e.length;t++){const n=s.lineHeight*(t-1)+i,a=s.lineHeight*t;let o=a;t>0&&n>a&&(o=(a+n)/2);const c=a+i,d=s.lineHeight*(t+1);let f=c;t+1<e.length&&d<c&&(f=(c+d)/2);const p=(f-o)/h;for(let t=0;t<l.length;t++){let e=0;e="number"==typeof u[t]?u[t]:t/l.length;let s=Math.min(1,Math.max(0,o/h+e*p));s=Number(s.toFixed(5)),r.addColorStop(s,l[t])}}}else{r=this.context.createLinearGradient(a,h/2,o+a,h/2);const t=l.length+1;let e=1;for(let s=0;s<l.length;s++){let i;i="number"==typeof u[s]?u[s]:e/t,r.addColorStop(i,l[s]),e++}}return r}destroy(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},Ka,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=xt(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=xt(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},this._style=t instanceof $a?t:new $a(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Za.defaultAutoResolution=!0;let Ja=Za;class Qa{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function to(t,e){let s=!1;if(t?._textures?.length)for(let i=0;i<t._textures.length;i++)if(t._textures[i]instanceof us){const r=t._textures[i].baseTexture;e.includes(r)||(e.push(r),s=!0)}return s}function eo(t,e){if(t.baseTexture instanceof jt){const s=t.baseTexture;return e.includes(s)||e.push(s),!0}return!1}function so(t,e){if(t._texture&&t._texture instanceof us){const s=t._texture.baseTexture;return e.includes(s)||e.push(s),!0}return!1}function io(t,e){return e instanceof Ja&&(e.updateText(!0),!0)}function ro(t,e){if(e instanceof $a){const t=e.toFontString();return za.measureFont(t),!0}return!1}function no(t,e){if(t instanceof Ja){e.includes(t.style)||e.push(t.style),e.includes(t)||e.push(t);const s=t._texture.baseTexture;return e.includes(s)||e.push(s),!0}return!1}function ao(t,e){return t instanceof $a&&(e.includes(t)||e.push(t),!0)}const oo=class t{constructor(e){this.limiter=new Qa(t.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(no),this.registerFindHook(ao),this.registerFindHook(to),this.registerFindHook(eo),this.registerFindHook(so),this.registerUploadHook(io),this.registerUploadHook(ro)}upload(t){return new Promise((e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,bi.system.addOnce(this.tick,this,xi.UTILITY))):e()}))}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed)for(let s=0,i=this.uploadHooks.length;s<i;s++)if(this.uploadHooks[s](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}e||this.queue.shift()}if(this.queue.length)bi.system.addOnce(this.tick,this,xi.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,s=t.length;e<s;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,s=this.addHooks.length;e<s&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Wi)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&bi.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};oo.uploadsPerFrame=4;let ho=oo;function lo(t,e){return e instanceof jt&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function uo(t,e){if(!(e instanceof Ma))return!1;const{geometry:s}=e;e.finishPoly(),s.updateBatches();const{batches:i}=s;for(let r=0;r<i.length;r++){const{texture:e}=i[r].style;e&&lo(t,e.baseTexture)}return s.batchable||t.geometry.bind(s,e._resolveDirectShader(t)),!0}function co(t,e){return t instanceof Ma&&(e.push(t),!0)}Object.defineProperties(T,{UPLOADS_PER_FRAME:{get:()=>ho.uploadsPerFrame,set(t){I("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),ho.uploadsPerFrame=t}}});class fo extends ho{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(co),this.registerUploadHook(lo),this.registerUploadHook(uo)}}fo.extension={name:"prepare",type:Mt.RendererSystem},Nt.add(fo);new oe;var po="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";const mo=new pe;class go extends Ye{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new ps,this.state=Ut.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=We.from(po,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",e),this.shader=t.context.webGLVersion>1?We.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",e):We.from(po,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",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 r=t.uvRespectAnchor?t.anchor.x:0,n=t.uvRespectAnchor?t.anchor.y:0;i=s.uvs,i[0]=i[6]=-r,i[1]=i[3]=-n,i[2]=i[4]=1-r,i[5]=i[7]=1-n,s.invalidate();const a=t._texture,o=a.baseTexture,h=o.alphaMode>0,l=t.tileTransform.localTransform,u=t.uvMatrix;let c=o.isPowerOfTwo&&a.frame.width===o.width&&a.frame.height===o.height;c&&(o._glTextures[e.CONTEXT_UID]?c=o.wrapMode!==f.CLAMP:o.wrapMode===f.CLAMP&&(o.wrapMode=f.REPEAT));const d=c?this.simpleShader:this.shader,p=a.width,m=a.height,g=t._width,_=t._height;mo.set(l.a*p/g,l.b*p/_,l.c*m/g,l.d*m/_,l.tx/g,l.ty/_),mo.invert(),c?mo.prepend(u.mapCoord):(d.uniforms.uMapCoord=u.mapCoord.toArray(!0),d.uniforms.uClampFrame=u.uClampFrame,d.uniforms.uClampOffset=u.uClampOffset),d.uniforms.uTransform=mo.toArray(!0),d.uniforms.uColor=ut.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(d.uniforms.uColor),d.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),d.uniforms.uSampler=a,e.shader.bind(d),e.geometry.bind(s),this.state.blendMode=dt(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}go.extension={name:"tilingSprite",type:Mt.RendererPlugin},Nt.add(go);const _o=class t{constructor(t,e,s){this.linkedSheets=[],(t instanceof jt||t instanceof us)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:i,data:r,resolutionFilename:n=null,cachePrefix:a=""}=t;this.cachePrefix=a,this._texture=i instanceof us?i:null,this.baseTexture=i instanceof jt?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=r;const o=this.baseTexture.resource;this.resolution=this._updateResolution(n||(o?o.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=Pt(t,null);return null===s&&(s="number"==typeof e?e:parseFloat(e??"1")),1!==s&&this.baseTexture.setRe
1solution(s),s}parse(){return new Promise((e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}_processFrames(e){let s=e;const i=t.BATCH_SIZE;for(;s-e<i&&s<this._frameKeys.length;){const t=this._frameKeys[s],e=this._frames[t],i=e.frame;if(i){let s=null,r=null;const n=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,a=new le(0,0,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution);s=e.rotated?new le(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.h)/this.resolution,Math.floor(i.w)/this.resolution):new le(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(r=new le(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution)),this.textures[t]=new us(this.baseTexture,s,a,r,e.rotated?2:0,e.anchor,e.borders),us.addToCache(this.textures[t],this.cachePrefix+t.toString())}s++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const i=t[e][s];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())}),0)}destroy(t=!1){for(const e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};_o.BATCH_SIZE=1e3;let xo=_o;const yo=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function vo(t,e,s){const i={};if(t.forEach((t=>{i[t]=e})),Object.keys(e.textures).forEach((t=>{i[`${e.cachePrefix}${t}`]=e.textures[t]})),!s){const s=M.dirname(t[0]);e.linkedSheets.forEach(((t,r)=>{Object.assign(i,vo([`${s}/${e.data.meta.related_multi_packs[r]}`],t,!0))}))}return i}const bo={extension:Mt.Asset,cache:{test:t=>t instanceof xo,getCacheableAssets:(t,e)=>vo(t,e,!1)},resolver:{test:t=>{const e=t.split("?")[0].split("."),s=e.pop(),i=e.pop();return"json"===s&&yo.includes(i)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(T.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:Mt.LoadParser,priority:Sr.Normal},testParse:async(t,e)=>".json"===M.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,s){const{texture:i,imageFilename:r,cachePrefix:n}=e?.data??{};let a,o=M.dirname(e.src);if(o&&o.lastIndexOf("/")!==o.length-1&&(o+="/"),i&&i.baseTexture)a=i;else{const i=pn(o+(r??t.meta.image),e.src);a=(await s.load([i]))[i]}const h=new xo({texture:a.baseTexture,data:t,resolutionFilename:e.src,cachePrefix:n});await h.parse();const l=t?.meta?.related_multi_packs;if(Array.isArray(l)){const t=[];for(const r of l){if("string"!=typeof r)continue;let i=o+r;e.data?.ignoreMultiPack||(i=pn(i,e.src),t.push(s.load({src:i,data:{ignoreMultiPack:!0}})))}const i=await Promise.all(t);h.linkedSheets=i,i.forEach((t=>{t.linkedSheets=[h].concat(h.linkedSheets.filter((e=>e!==t)))}))}return h},unload(t){t.destroy(!0)}}};Nt.add(bo);class To{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Eo{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const r in e){const t=e[r].match(/^[a-z]+/gm)[0],i=e[r].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),n={};for(const e in i){const t=i[e].split("="),s=t[0],r=t[1].replace(/"/gm,""),a=parseFloat(r),o=isNaN(a)?r:a;n[s]=o}s[t].push(n)}const i=new To;return s.info.forEach((t=>i.info.push({face:t.face,size:parseInt(t.size,10)}))),s.common.forEach((t=>i.common.push({lineHeight:parseInt(t.lineHeight,10)}))),s.page.forEach((t=>i.page.push({id:parseInt(t.id,10),file:t.file}))),s.char.forEach((t=>i.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)}))),s.kerning.forEach((t=>i.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)}))),s.distanceField.forEach((t=>i.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType}))),i}}class Ao{static test(t){const e=t;return"string"!=typeof t&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){const e=new To,s=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),r=t.getElementsByTagName("page"),n=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let h=0;h<s.length;h++)e.info.push({face:s[h].getAttribute("face"),size:parseInt(s[h].getAttribute("size"),10)});for(let h=0;h<i.length;h++)e.common.push({lineHeight:parseInt(i[h].getAttribute("lineHeight"),10)});for(let h=0;h<r.length;h++)e.page.push({id:parseInt(r[h].getAttribute("id"),10)||0,file:r[h].getAttribute("file")});for(let h=0;h<n.length;h++){const t=n[h];e.char.push({id:parseInt(t.getAttribute("id"),10),page:parseInt(t.getAttribute("page"),10)||0,x:parseInt(t.getAttribute("x"),10),y:parseInt(t.getAttribute("y"),10),width:parseInt(t.getAttribute("width"),10),height:parseInt(t.getAttribute("height"),10),xoffset:parseInt(t.getAttribute("xoffset"),10),yoffset:parseInt(t.getAttribute("yoffset"),10),xadvance:parseInt(t.getAttribute("xadvance"),10)})}for(let h=0;h<a.length;h++)e.kerning.push({first:parseInt(a[h].getAttribute("first"),10),second:parseInt(a[h].getAttribute("second"),10),amount:parseInt(a[h].getAttribute("amount"),10)});for(let h=0;h<o.length;
1h++)e.distanceField.push({fieldType:o[h].getAttribute("fieldType"),distanceRange:parseInt(o[h].getAttribute("distanceRange"),10)});return e}}class wo{static test(t){return!("string"!=typeof t||!t.includes("<font>"))&&Ao.test(T.ADAPTER.parseXML(t))}static parse(t){return Ao.parse(T.ADAPTER.parseXML(t))}}const So=[Eo,Ao,wo];function Ro(t,e,s,i,r,n,a){const o=s.text,h=s.fontProperties;e.translate(i,r),e.scale(n,n);const l=a.strokeThickness/2,u=-a.strokeThickness/2;if(e.font=a.toFontString(),e.lineWidth=a.strokeThickness,e.textBaseline=a.textBaseline,e.lineJoin=a.lineJoin,e.miterLimit=a.miterLimit,e.fillStyle=function(t,e,s,i,r,n){const a=s.fill;if(!Array.isArray(a))return a;if(1===a.length)return a[0];let o;const h=s.dropShadow?s.dropShadowDistance:0,l=s.padding||0,u=t.width/i-h-2*l,c=t.height/i-h-2*l,d=a.slice(),f=s.fillGradientStops.slice();if(!f.length){const t=d.length+1;for(let e=1;e<t;++e)f.push(e/t)}if(d.unshift(a[0]),f.unshift(0),d.push(a[a.length-1]),f.push(1),s.fillGradientType===Ha.LINEAR_VERTICAL){o=e.createLinearGradient(u/2,l,u/2,c+l);let t=0;const i=(n.fontProperties.fontSize+s.strokeThickness)/c;for(let e=0;e<r.length;e++){const s=n.lineHeight*e;for(let e=0;e<d.length;e++){let r=0;r="number"==typeof f[e]?f[e]:e/d.length;const n=s/c+r*i;let a=Math.max(t,n);a=Math.min(a,1),o.addColorStop(a,d[e]),t=a}}}else{o=e.createLinearGradient(l,c/2,u+l,c/2);const t=d.length+1;let s=1;for(let e=0;e<d.length;e++){let i;i="number"==typeof f[e]?f[e]:s/t,o.addColorStop(i,d[e]),s++}}return o}(t,e,a,n,[o],s),e.strokeStyle=a.stroke,a.dropShadow){const t=a.dropShadowColor,s=a.dropShadowBlur*n,i=a.dropShadowDistance*n;e.shadowColor=ut.shared.setValue(t).setAlpha(a.dropShadowAlpha).toRgbaString(),e.shadowBlur=s,e.shadowOffsetX=Math.cos(a.dropShadowAngle)*i,e.shadowOffsetY=Math.sin(a.dropShadowAngle)*i}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;a.stroke&&a.strokeThickness&&e.strokeText(o,l,u+s.lineHeight-h.descent),a.fill&&e.fillText(o,l,u+s.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function Io(t){return Array.from?Array.from(t):t.split("")}function Co(t){return t.codePointAt?t.codePointAt(0):t.charCodeAt(0)}const Po=class t{constructor(t,e,s){const[i]=t.info,[r]=t.common,[n]=t.page,[a]=t.distanceField,o=Pt(n.file),h={};this._ownsTextures=s,this.font=i.face,this.size=i.size,this.lineHeight=r.lineHeight/o,this.chars={},this.pageTextures=h;for(let l=0;l<t.page.length;l++){const{id:s,file:i}=t.page[l];h[s]=e instanceof Array?e[l]:e[i],a?.fieldType&&"none"!==a.fieldType&&(h[s].baseTexture.alphaMode=m.NO_PREMULTIPLIED_ALPHA,h[s].baseTexture.mipmap=p.OFF)}for(let l=0;l<t.char.length;l++){const{id:e,page:s}=t.char[l];let{x:i,y:r,width:n,height:a,xoffset:u,yoffset:c,xadvance:d}=t.char[l];i/=o,r/=o,n/=o,a/=o,u/=o,c/=o,d/=o;const f=new le(i+h[s].frame.x/o,r+h[s].frame.y/o,n,a);this.chars[e]={xOffset:u,yOffset:c,xAdvance:d,kerning:{},texture:new us(h[s].baseTexture,f),page:s}}for(let l=0;l<t.kerning.length;l++){let{first:e,second:s,amount:i}=t.kerning[l];e/=o,s/=o,i/=o,this.chars[s]&&(this.chars[s].kerning[e]=i)}this.distanceFieldRange=a?.distanceRange,this.distanceFieldType=a?.fieldType?.toLowerCase()??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(e,s,i){let r;if(e instanceof To)r=e;else{const t=function(t){for(let e=0;e<So.length;e++)if(So[e].test(t))return So[e];return null}(e);if(!t)throw new Error("Unrecognized data format for font.");r=t.parse(e)}s instanceof us&&(s=[s]);const n=new t(r,s,i);return t.available[n.font]=n,n}static uninstall(e){const s=t.available[e];if(!s)throw new Error(`No font found named '${e}'`);s.destroy(),delete t.available[e]}static from(e,s,i){if(!e)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:a,textureWidth:o,textureHeight:h,...l}=Object.assign({},t.defaultOptions,i),u=function(t){"string"==typeof t&&(t=[t]);const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s];if(Array.isArray(i)){if(2!==i.length)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);
1const t=i[0].charCodeAt(0),s=i[1].charCodeAt(0);if(s<t)throw new Error("[BitmapFont]: Invalid character range.");for(let i=t,r=s;i<=r;i++)e.push(String.fromCharCode(i))}else e.push(...Io(i))}if(0===e.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}(r),c=s instanceof $a?s:new $a(s),d=o,f=new To;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p,m,g,_=0,x=0,y=0;const v=[],b=[];for(let t=0;t<u.length;t++){p||(p=T.ADAPTER.createCanvas(),p.width=o,p.height=h,m=p.getContext("2d"),g=new jt(p,{resolution:a,...l}),v.push(g),b.push(new us(g)),f.page.push({id:b.length-1,file:""}));const e=u[t],s=za.measureText(e,c,!1,p),i=s.width,r=Math.ceil(s.height),E=Math.ceil(("italic"===c.fontStyle?2:1)*i);if(x>=h-r*a){if(0===x)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,p=null,m=null,g=null,x=0,_=0,y=0;continue}if(y=Math.max(r+s.fontProperties.descent,y),E*a+_>=d){if(0===_)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,x+=y*a,x=Math.ceil(x),_=0,y=0;continue}Ro(p,m,s,_,x,a,c);const A=Co(s.text);f.char.push({id:A,page:b.length-1,x:_/a,y:x/a,width:E,height:r,xoffset:0,yoffset:0,xadvance:i-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),_+=(E+2*n)*a,_=Math.ceil(_)}if(!i?.skipKerning)for(let t=0,T=u.length;t<T;t++){const e=u[t];for(let t=0;t<T;t++){const s=u[t],i=m.measureText(e).width,r=m.measureText(s).width,n=m.measureText(e+s).width-(i+r);n&&f.kerning.push({first:Co(e),second:Co(s),amount:n})}}const E=new t(f,b,!0);return void 0!==t.available[e]&&t.uninstall(e),t.available[e]=E,E}};Po.ALPHA=[["a","z"],["A","Z"]," "],Po.NUMERIC=[["0","9"]],Po.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Po.ASCII=[[" ","~"]],Po.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Po.ALPHANUMERIC},Po.available={};let Mo=Po;const Do=[],Bo=[],No=[],Oo=class t extends Wi{constructor(e,s={}){super();const{align:i,tint:r,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},t.styleDefaults,s);if(!Mo.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new ut(r),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=e,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new Ee((()=>{this.dirty=!0}),this,0,0),this._roundPixels=T.ROUND_PIXELS,this.dirty=!0,this._resolution=T.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const t=Mo.available[this._fontName],e=this.fontSize,s=e/t.size,i=new oe,r=[],n=[],o=[],h=Io(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),l=this._maxWidth*t.size/e,u="none"===t.distanceFieldType?Do:Bo;let c=null,d=0,f=0,p=0,m=-1,g=0,_=0,x=0,y=0;for(let a=0;a<h.length;a++){const e=h[a],s=Co(e);if(/(?:\s)/.test(e)&&(m=a,g=d,y++),"\r"===e||"\n"===e){n.push(d),o.push(-1),f=Math.max(f,d),++p,++_,i.x=0,i.y+=t.lineHeight,c=null,y=0;continue}const u=t.chars[s];if(!u)continue;c&&u.kerning[c]&&(i.x+=u.kerning[c]);const v=No.pop()||{texture:us.EMPTY,line:0,charCode:0,prevSpaces:0,position:new oe};v.texture=u.texture,v.line=p,v.charCode=s,v.position.x=Math.round(i.x+u.xOffset+this._letterSpacing/2),v.position.y=Math.round(i.y+u.yOffset),v.prevSpaces=y,r.push(v),d=v.position.x+Math.max(u.xAdvance-u.xOffset,u.texture.orig.width),i.x+=u.xAdvance+this._letterSpacing,x=Math.max(x,u.yOffset+u.texture.height),c=s,-1!==m&&l>0&&i.x>l&&(++_,_t(r,1+m-_,1+a-m),a=m,m=-1,n.push(g),o.push(r.length>0?r[r.length-1].prevSpaces:0),f=Math.max(f,g),p++,i.x=0,i.y+=t.lineHeight,c=null,y=0)}const v=h[h.length-1];"\r"!==v&&"\n"!==v&&(/(?:\s)/.test(v)&&(d=g),n.push(d),f=Math.max(f,d),o.push(-1));const b=[];for(let a=0;a<=p;a++){let t=0;"right"===this._align?t=f-n[a]:"center"===this._align?t=(f-n[a])/2:"justify"===this._align&&(t=o[a]<0?0:(f-n[a])/o[a]),b.pu
1sh(t)}const T=r.length,E={},A=[],w=this._activePagesMeshData;u.push(...w);for(let S=0;S<T;S++){const e=r[S].texture,s=e.baseTexture.uid;if(!E[s]){let i=u.pop();if(!i){const e=new Fa;let s,r;"none"===t.distanceFieldType?(s=new Ua(us.EMPTY),r=a.NORMAL):(s=new Ua(us.EMPTY,{program:Xe.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n // MSDF\r\n float median = texColor.r + texColor.g + texColor.b -\r\n min(texColor.r, min(texColor.g, texColor.b)) -\r\n max(texColor.r, max(texColor.g, texColor.b));\r\n // SDF\r\n median = min(median, texColor.a);\r\n\r\n float screenPxDistance = uFWidth * (median - 0.5);\r\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n if (median < 0.01) {\r\n alpha = 0.0;\r\n } else if (median > 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // Gamma correction for coverage-like alpha\r\n float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r\n float gamma = mix(1.0, 1.0 / 2.2, luma);\r\n float coverage = pow(uColor.a * alpha, gamma); \r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, coverage);\r\n}\r\n"),uniforms:{uFWidth:0}}),r=a.NORMAL_NPM);const n=new La(e,s);n.blendMode=r,i={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:n,vertices:null,uvs:null,indices:null}}i.index=0,i.indexCount=0,i.vertexCount=0,i.uvsCount=0,i.total=0;const{_textureCache:r}=this;r[s]=r[s]||new us(e.baseTexture),i.mesh.texture=r[s],i.mesh.tint=this._tintColor.value,A.push(i),E[s]=i}E[s].total++}for(let a=0;a<w.length;a++)A.includes(w[a])||this.removeChild(w[a].mesh);for(let a=0;a<A.length;a++)A[a].mesh.parent!==this&&this.addChild(A[a].mesh);this._activePagesMeshData=A;for(const a in E){const t=E[a],e=t.total;if(!(t.indices?.length>6*e)||t.vertices.length<2*La.BATCHABLE_SIZE)t.vertices=new Float32Array(8*e),t.uvs=new Float32Array(8*e),t.indices=new Uint16Array(6*e);else{const e=t.total,s=t.vertices;for(let t=4*e*2;t<s.length;t++)s[t]=0}t.mesh.size=6*e}for(let a=0;a<T;a++){const t=r[a];let e=t.position.x+b[t.line]*("justify"===this._align?t.prevSpaces:1);this._roundPixels&&(e=Math.round(e));const i=e*s,n=t.position.y*s,o=t.texture,h=E[o.baseTexture.uid],l=o.frame,u=o._uvs,c=h.index++;h.indices[6*c+0]=0+4*c,h.indices[6*c+1]=1+4*c,h.indices[6*c+2]=2+4*c,h.indices[6*c+3]=0+4*c,h.indices[6*c+4]=2+4*c,h.indices[6*c+5]=3+4*c,h.vertices[8*c+0]=i,h.vertices[8*c+1]=n,h.vertices[8*c+2]=i+l.width*s,h.vertices[8*c+3]=n,h.vertices[8*c+4]=i+l.width*s,h.vertices[8*c+5]=n+l.height*s,h.vertices[8*c+6]=i,h.vertices[8*c+7]=n+l.height*s,h.uvs[8*c+0]=u.x0,h.uvs[8*c+1]=u.y0,h.uvs[8*c+2]=u.x1,h.uvs[8*c+3]=u.y1,h.uvs[8*c+4]=u.x2,h.uvs[8*c+5]=u.y2,h.uvs[8*c+6]=u.x3,h.uvs[8*c+7]=u.y3}this._textWidth=f*s,this._textHeight=(i.y+t.lineHeight)*s;for(const a in E){const t=E[a];if(0!==this.anchor.x||0!==this.anchor.y){let e=0;const s=this._textWidth*this.anchor.x,i=this._textHeight*this.anchor.y;for(let r=0;r<t.total;r++)t.vertices[e++]-=s,t.vertices[e++]-=i,t.vertices[e++]-=s,t.vertices[e++]-=i,t.vertices[e++]-=s,t.vertices[e++]-=i,t.vertices[e++]-=s,t.vertices[e++]-=i}this._maxLineHeight=x*s;const e=t.mesh.geometry.getBuffer("aVertexPosition"),i=t.mesh.geometry.getBuffer("aTextureCoord"),r=t.mesh.geometry.getIndex();
1e.data=t.vertices,i.data=t.uvs,r.data=t.indices,e.update(),i.update(),r.update()}for(let a=0;a<r.length;a++)No.push(r[a]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:s,size:i}=Mo.available[this._fontName];if("none"!==s){const{a:s,b:r,c:n,d:a}=this.worldTransform,o=Math.sqrt(s*s+r*r),h=Math.sqrt(n*n+a*a),l=(Math.abs(o)+Math.abs(h))/2,u=this.fontSize/i,c=t._view.resolution;for(const t of this._activePagesMeshData)t.mesh.shader.uniforms.uFWidth=l*e*u*c}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=Mo.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(!Mo.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Mo.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,s="none"===Mo.available[this._fontName].distanceFieldType?Do:Bo;s.push(...this._activePagesMeshData);for(const i of this._activePagesMeshData)this.removeChild(i.mesh);this._activePagesMeshData=[],s.filter((t=>e[t.mesh.texture.baseTexture.uid])).forEach((t=>{t.mesh.texture=us.EMPTY}));for(const i in e)e[i].destroy(),delete e[i];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Oo.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const Lo=[".xml",".fnt"],Fo={extension:{type:Mt.LoadParser,priority:Sr.Normal},name:"loadBitmapFont",test:t=>Lo.includes(M.extname(t).toLowerCase()),testParse:async t=>Eo.test(t)||wo.test(t),async parse(t,e,s){const i=Eo.test(t)?Eo.parse(t):wo.parse(t),{src:r}=e,{page:n}=i,a=[];for(let l=0;l<n.length;++l){const t=n[l].file;let e=M.join(M.dirname(r),t);e=pn(e,r),a.push(e)}const o=await s.load(a),h=a.map((t=>o[t]));return Mo.install(i,h,!0)},load:async(t,e)=>(await T.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};Nt.add(Fo);const Uo=class t extends $a{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new t(Object.keys(t.defaultOptions).reduce(((t,s)=>({...t,[s]:e[s]})),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach((e=>{URL.revokeObjectURL(e.src),e.refs--,0===e.refs&&(e.fontFace&&document.fonts.delete(e.fontFace),delete t.availableFonts[e.originalUrl])})),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,s={}){const{availableFonts:i}=t;if(i[e]){const t=i[e];return this._fonts.push(t),t.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return T.ADAPTER.fetch(e).then((t=>t.blob())).then((async t=>new Promise(((e,s)=>{const i=URL.createObjectURL(t),r=new FileReader;r.onload=()=>
1e([i,r.result]),r.onerror=s,r.readAsDataURL(t)})))).then((async([t,r])=>{const n=Object.assign({family:M.basename(e,M.extname(e)),weight:"normal",style:"normal",display:"auto",src:t,dataSrc:r,refs:1,originalUrl:e,fontFace:null},s);i[e]=n,this._fonts.push(n),this.styleID++;const a=new FontFace(n.family,`url(${n.src})`,{weight:n.weight,style:n.style,display:n.display});n.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0}))}addOverride(...t){const e=t.filter((t=>!this._overrides.includes(t)));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter((t=>this._overrides.includes(t)));e.length>0&&(this._overrides=this._overrides.filter((t=>!e.includes(t))),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?["word-wrap: "+(this.breakWords?"break-all":"break-word"),`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce(((t,e)=>`${t}\n @font-face {\n font-family: "${e.family}";\n src: url('${e.dataSrc}');\n font-weight: ${e.weight};\n font-style: ${e.style};\n font-display: ${e.display};\n }`),this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(s=t,I("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),t=ut.shared.setValue(s).toNumber()),"number"==typeof t?(e=t,I("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),ut.shared.setValue(e).toHex()):t;var e,s}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+=(255*e|0).toString(16).padStart(2,"0"));const r=`${s}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${r} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${r} ${t}`}reset(){Object.assign(this,t.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise((t=>setTimeout(t,100))):Promise.resolve()}get isSafari(){const{userAgent:t}=T.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}};Uo.availableFonts={},Uo.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 ko=Uo;const Go=class t extends Yi{constructor(e="",s={}){super(us.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,r=us.from(i,{scaleMode:T.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new le,r.trim=new le,this.texture=r;const n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",o=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),u=document.createElementNS(a,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",o.appendChild(h),this.maxWidth=t.defaultMaxWidth,this.maxHeight=t.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=o,this._foreignObject=h,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=t.defaultAutoResolution,this._resolution=t.defaultResolution??T.RESOLUTION,this.text=e,this.style=s}measureText(t){const{text:e,style:s,resolution:i}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:s.toCSS(i)}),this._styleElement.textContent=s.toGlobalCSS(),document.body.appendChild(this._svgRoot);const r=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:n,height:a}=r;(n>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const o=Math.min(this.maxWidth,Math.ceil(n)),h=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",h.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),s!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(i)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:o+2*s.padding,height:h+2*s.padding}}async updateText(t=!0){const{style:e,_image:s,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:r,height:n}=this.measureText();s.width=i.width=Math.ceil(Math.max(1,r)),s.height=i.height=Math.ceil(Math.max(1,n)),this._updateID++;const a=this._updateID;await new Promise((t=>{i.onload=async()=>{a<this._updateID||(await e.onBeforeDraw(),s.src=i.src,i.onload=null,i.src="",this.updateTexture()),t()};const r=(new XMLSerializer).serializeToString(this._svgRoot);i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(r)}`}))}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:s,resolution:i}=this,{padding:r}=t,{baseTexture:n}=e;e.trim.width=e._frame.width=s.width/i,e.trim.height=e._frame.height=s.height/i,e.trim.x=-r,e.trim.y=-r,e.orig.width=e._frame.width-2*r,e.orig.height=e._frame.height-2*r,this._onTextureUpdate(),n.setRealSize(s.width,s.height,i),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},t.defaultDestroyOptions,e),super.destroy(e);const s=null;this.ownsStyle&&this._style?.cleanFonts(),this._style=s,this._svgRoot?.remove(),this._svgRoot=s,this._domElement?.remove(),this._domElement=s,this._foreignObject?.remove(),this._foreignObject=s,this._styleElement?.remove(),this._styleElement=s,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=s,this._image.src="",this._image=s}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=xt(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=xt(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&((t=t||{})instanceof ko?(this.ownsStyle=!1,this._style=t):t instanceof $a?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=ko.from(t)):(this.ownsStyle=!0,this._style=new ko(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(""===t||null===t||void 0===t?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};Go.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Go.defaultMaxWidth=2024,Go.defaultMaxHeight=2024,Go.defaultAutoResolution=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.