/*! * pixi.js - v7.4.2 * Compiled Wed, 20 Mar 2024 19:55:28 UTC * * pixi.js is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */var De=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(De||{}),ao=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(ao||{}),lr=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(lr||{}),H=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(H||{}),Wt=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Wt||{}),T=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(T||{}),je=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(je||{}),U=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(U||{}),M=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(M||{}),ee=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(ee||{}),re=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(re||{}),Zt=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(Zt||{}),Et=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(Et||{}),jt=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(jt||{}),on=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(on||{}),Rt=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Rt||{}),ut=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(ut||{}),Wh=(i=>(i[i.RED=1]="RED",i[i.GREEN=2]="GREEN",i[i.BLUE=4]="BLUE",i[i.ALPHA=8]="ALPHA",i))(Wh||{}),ht=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(ht||{}),qt=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(qt||{});const Yh={createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var i;return(i=document.baseURI)!=null?i:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},O={ADAPTER:Yh,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Fi=/iPhone/i,xn=/iPod/i,bn=/iPad/i,En=/\biOS-universal(?:.+)Mac\b/i,Ni=/\bAndroid(?:.+)Mobile\b/i,Tn=/Android/i,Be=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ds=/Silk/i,Jt=/Windows Phone/i,An=/\bWindows(?:.+)ARM\b/i,wn=/BlackBerry/i,Sn=/BB10/i,Rn=/Opera Mini/i,In=/\b(CriOS|Chrome)(?:.+)Mobile/i,Cn=/Mobile(?:.+)Firefox\b/i,Pn=function(i){return typeof i!="undefined"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream=="undefined"};function qh(i){return function(t){return t.test(i)}}function Mn(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]!="undefined"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]!="undefined"&&(e=s[0]);var r=qh(e),n={apple:{phone:r(Fi)&&!r(Jt),ipod:r(xn),tablet:!r(Fi)&&(r(bn)||Pn(t))&&!r(Jt),universal:r(En),device:(r(Fi)||r(xn)||r(bn)||r(En)||Pn(t))&&!r(Jt)},amazon:{phone:r(Be),tablet:!r(Be)&&r(Ds),device:r(Be)||r(Ds)},android:{phone:!r(Jt)&&r(Be)||!r(Jt)&&r(Ni),tablet:!r(Jt)&&!r(Be)&&!r(Ni)&&(r(Ds)||r(Tn)),device:!r(Jt)&&(r(Be)||r(Ds)||r(Ni)||r(Tn))||r(/\bokhttp\b/i)},windows:{phone:r(Jt),tablet:r(An),device:r(Jt)||r(An)},other:{blackberry:r(wn),blackberry10:r(Sn),opera:r(Rn),firefox:r(Cn),chrome:r(In),device:r(wn)||r(Sn)||r(Rn)||r(Cn)||r(In)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}var Dn;const Kh=(Dn=Mn.default)!=null?Dn:Mn,Yt=Kh(globalThis.navigator);O.RETINA_PREFIX=/@([0-9\.]+)x/;O.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Li=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function oo(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var hn={exports:{}},Om=hn.exports;(function(i){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new r(u,c||h,d),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,l){--h._eventsCount===0?h._events=new s:delete h._events[l]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},o.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,f=c.length,p=new Array(f);d80*e){o=l=i[0],h=u=i[1];for(var p=e;pl&&(l=c),d>u&&(u=d);f=Math.max(l-o,u-h),f=f!==0?32767/f:0}return vs(n,a,e,o,h,f,0),a}function ho(i,t,e,s,r){var n,a;if(r===dr(i,t,e,s)>0)for(n=t;n=t;n-=s)a=On(n,i[n],i[n+1],a);return a&&wi(a,a.next)&&(xs(a),a=a.next),a}function Pe(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(wi(e,e.next)||st(e.prev,e,e.next)===0)){if(xs(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function vs(i,t,e,s,r,n,a){if(i){!a&&n&&ol(i,s,r,n);for(var o=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,n?Jh(i,s,r,n):Qh(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),xs(i),i=l.next,o=l.next;continue}if(i=l,i===o){a?a===1?(i=tl(Pe(i),t,e),vs(i,t,e,s,r,n,2)):a===2&&el(i,t,e,s,r,n):vs(Pe(i),t,e,s,r,n,1);break}}}}function Qh(i){var t=i.prev,e=i,s=i.next;if(st(t,e,s)>=0)return!1;for(var r=t.x,n=e.x,a=s.x,o=t.y,h=e.y,l=s.y,u=rn?r>a?r:a:n>a?n:a,f=o>h?o>l?o:l:h>l?h:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&Xe(r,o,n,h,a,l,p.x,p.y)&&st(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Jh(i,t,e,s){var r=i.prev,n=i,a=i.next;if(st(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,l=a.x,u=r.y,c=n.y,d=a.y,f=oh?o>l?o:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,v=ur(f,p,t,e,s),x=ur(m,g,t,e,s),_=i.prevZ,y=i.nextZ;_&&_.z>=v&&y&&y.z<=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&Xe(o,u,h,c,l,d,_.x,_.y)&&st(_.prev,_,_.next)>=0||(_=_.prevZ,y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&Xe(o,u,h,c,l,d,y.x,y.y)&&st(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;_&&_.z>=v;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&Xe(o,u,h,c,l,d,_.x,_.y)&&st(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;y&&y.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&Xe(o,u,h,c,l,d,y.x,y.y)&&st(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function tl(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!wi(r,n)&&lo(r,s,s.next,n)&&ys(r,n)&&ys(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),xs(s),xs(s.next),s=i=n),s=s.next}while(s!==i);return Pe(s)}function el(i,t,e,s,r,n){var a=i;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&ul(a,o)){var h=uo(a,o);a=Pe(a,a.next),h=Pe(h,h.next),vs(a,t,e,s,r,n,0),vs(h,t,e,s,r,n,0);return}o=o.next}a=a.next}while(a!==i)}function sl(i,t,e,s){var r=[],n,a,o,h,l;for(n=0,a=t.length;n=e.next.y&&e.next.y!==e.y){var o=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=s&&o>n&&(n=o,a=e.x=e.x&&e.x>=l&&s!==e.x&&Xe(ra.x||e.x===a.x&&al(a,e)))&&(a=e,c=d)),e=e.next;while(e!==h);return a}function al(i,t){return st(i.prev,i,t.prev)<0&&st(t.next,i,i.next)<0}function ol(i,t,e,s){var r=i;do r.z===0&&(r.z=ur(r.x,r.y,t,e,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,hl(r)}function hl(i){var t,e,s,r,n,a,o,h,l=1;do{for(e=i,i=null,n=null,a=0;e;){for(a++,s=e,o=0,t=0;t0||h>0&&s;)o!==0&&(h===0||!s||e.z<=s.z)?(r=e,e=e.nextZ,o--):(r=s,s=s.nextZ,h--),n?n.nextZ=r:i=r,r.prevZ=n,n=r;e=s}n.nextZ=null,l*=2}while(a>1);return i}function ur(i,t,e,s,r){return i=(i-e)*r|0,t=(t-s)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function ll(i){var t=i,e=i;do(t.x=(i-a)*(n-o)&&(i-a)*(s-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(r-a)*(s-o)}function ul(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!cl(i,t)&&(ys(i,t)&&ys(t,i)&&dl(i,t)&&(st(i.prev,i,t.prev)||st(i,t.prev,t))||wi(i,t)&&st(i.prev,i,i.next)>0&&st(t.prev,t,t.next)>0)}function st(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function wi(i,t){return i.x===t.x&&i.y===t.y}function lo(i,t,e,s){var r=Bs(st(i,t,e)),n=Bs(st(i,t,s)),a=Bs(st(e,s,i)),o=Bs(st(e,s,t));return!!(r!==n&&a!==o||r===0&&Os(i,e,t)||n===0&&Os(i,s,t)||a===0&&Os(e,i,s)||o===0&&Os(e,t,s))}function Os(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Bs(i){return i>0?1:i<0?-1:0}function cl(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&lo(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function ys(i,t){return st(i.prev,i,i.next)<0?st(i,t,i.next)>=0&&st(i,i.prev,t)>=0:st(i,t,i.prev)<0||st(i,i.next,t)<0}function dl(i,t){var e=i,s=!1,r=(i.x+t.x)/2,n=(i.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==i);return s}function uo(i,t){var e=new cr(i.i,i.x,i.y),s=new cr(t.i,t.x,t.y),r=i.next,n=t.prev;return i.next=t,t.prev=i,e.next=r,r.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function On(i,t,e,s){var r=new cr(i,t,e);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function xs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function cr(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ai.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,a=Math.abs(dr(i,0,n,e));if(r)for(var o=0,h=t.length;o0&&(s+=i[r-1].length,e.holes.push(s))}return e};var fl=Ti.exports,co=oo(fl),Rs={},li={exports:{}};/*! https://mths.be/punycode v1.3.2 by @mathias */var Nm=li.exports;(function(i,t){(function(e){var s=t&&!t.nodeType&&t,r=i&&!i.nodeType&&i,n=typeof Li=="object"&&Li;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,o=2147483647,h=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,v=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=h-l,E=Math.floor,P=String.fromCharCode,w;function A(I){throw RangeError(_[I])}function B(I,R){for(var Y=I.length,Z=[];Y--;)Z[Y]=R(I[Y]);return Z}function k(I,R){var Y=I.split("@"),Z="";Y.length>1&&(Z=Y[0]+"@",I=Y[1]),I=I.replace(x,".");var Q=I.split("."),dt=B(Q,R).join(".");return Z+dt}function W(I){for(var R=[],Y=0,Z=I.length,Q,dt;Y=55296&&Q<=56319&&Y65535&&(R-=65536,Y+=P(R>>>10&1023|55296),R=56320|R&1023),Y+=P(R),Y}).join("")}function b(I){return I-48<10?I-22:I-65<26?I-65:I-97<26?I-97:h}function S(I,R){return I+22+75*(I<26)-((R!=0)<<5)}function G(I,R,Y){var Z=0;for(I=Y?E(I/d):I>>1,I+=E(I/R);I>y*u>>1;Z+=h)I=E(I/y);return E(Z+(y+1)*I/(I+c))}function z(I){var R=[],Y=I.length,Z,Q=0,dt=p,at=f,ft,yt,Tt,mt,J,ot,lt,kt,Gt;for(ft=I.lastIndexOf(m),ft<0&&(ft=0),yt=0;yt=128&&A("not-basic"),R.push(I.charCodeAt(yt));for(Tt=ft>0?ft+1:0;Tt=Y&&A("invalid-input"),lt=b(I.charCodeAt(Tt++)),(lt>=h||lt>E((o-Q)/J))&&A("overflow"),Q+=lt*J,kt=ot<=at?l:ot>=at+u?u:ot-at,!(ltE(o/Gt)&&A("overflow"),J*=Gt;Z=R.length+1,at=G(Q-mt,Z,mt==0),E(Q/Z)>o-dt&&A("overflow"),dt+=E(Q/Z),Q%=Z,R.splice(Q++,0,dt)}return F(R)}function $(I){var R,Y,Z,Q,dt,at,ft,yt,Tt,mt,J,ot=[],lt,kt,Gt,ts;for(I=W(I),lt=I.length,R=p,Y=0,dt=f,at=0;at=R&&JE((o-Y)/kt)&&A("overflow"),Y+=(ft-R)*kt,R=ft,at=0;ato&&A("overflow"),J==R){for(yt=Y,Tt=h;mt=Tt<=dt?l:Tt>=dt+u?u:Tt-dt,!(yt0&&o>a&&(o=a);for(var h=0;h=0?(c=l.substr(0,u),d=l.substr(u+1)):(c=l,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),gl(r,f)?Array.isArray(r[f])?r[f].push(p):r[f]=[r[f],p]:r[f]=p}return r};var es=function(i){switch(typeof i){case"string":return i;case"boolean":return i?"true":"false";case"number":return isFinite(i)?i:"";default:return""}},vl=function(i,t,e,s){return t=t||"&",e=e||"=",i===null&&(i=void 0),typeof i=="object"?Object.keys(i).map(function(r){var n=encodeURIComponent(es(r))+e;return Array.isArray(i[r])?i[r].map(function(a){return n+encodeURIComponent(es(a))}).join(t):n+encodeURIComponent(es(i[r]))}).join(t):s?encodeURIComponent(es(s))+e+encodeURIComponent(es(i)):""};var yl,xl,Lm=bs.decode=xl=bs.parse=_l,Um=bs.encode=yl=bs.stringify=vl,bl=pl,zt=ml,El=Rs.parse=Is,Tl=Rs.resolve=Bl,km=Rs.resolveObject=Fl,Al=Rs.format=Ol,Gm=Rs.Url=Ct;function Ct(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var wl=/^([a-z0-9.+-]+:)/i,Sl=/:[0-9]*$/,Rl=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Il=["<",">",'"',"`"," ","\r",` `," "],Cl=["{","}","|","\\","^","`"].concat(Il),fr=["'"].concat(Cl),Bn=["%","/","?",";","#"].concat(fr),Fn=["/","?","#"],Pl=255,Nn=/^[+a-z0-9A-Z_-]{0,63}$/,Ml=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Dl={javascript:!0,"javascript:":!0},pr={javascript:!0,"javascript:":!0},ze={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},mr=bs;function Is(i,t,e){if(i&&zt.isObject(i)&&i instanceof Ct)return i;var s=new Ct;return s.parse(i,t,e),s}Ct.prototype.parse=function(i,t,e){if(!zt.isString(i))throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var s=i.indexOf("?"),r=s!==-1&&s127?E+="x":E+=y[P];if(!E.match(Nn)){var A=x.slice(0,f),B=x.slice(f+1),k=y.match(Ml);k&&(A.push(k[1]),B.unshift(k[2])),B.length&&(o="/"+B.join(".")+o),this.hostname=A.join(".");break}}}this.hostname.length>Pl?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=bl.toASCII(this.hostname));var W=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+W,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!Dl[u])for(var f=0,_=fr.length;f<_;f++){var b=fr[f];if(o.indexOf(b)!==-1){var S=encodeURIComponent(b);S===b&&(S=escape(b)),o=o.split(b).join(S)}}var G=o.indexOf("#");G!==-1&&(this.hash=o.substr(G),o=o.slice(0,G));var z=o.indexOf("?");if(z!==-1?(this.search=o.substr(z),this.query=o.substr(z+1),t&&(this.query=mr.parse(this.query)),o=o.slice(0,z)):t&&(this.search="",this.query={}),o&&(this.pathname=o),ze[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var W=this.pathname||"",$=this.search||"";this.path=W+$}return this.href=this.format(),this};function Ol(i){return zt.isString(i)&&(i=Is(i)),i instanceof Ct?i.format():Ct.prototype.format.call(i)}Ct.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",s=this.hash||"",r=!1,n="";this.host?r=i+this.host:this.hostname&&(r=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&zt.isObject(this.query)&&Object.keys(this.query).length&&(n=mr.stringify(this.query));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||ze[t])&&r!==!1?(r="//"+(r||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):r||(r=""),s&&s.charAt(0)!=="#"&&(s="#"+s),a&&a.charAt(0)!=="?"&&(a="?"+a),e=e.replace(/[?#]/g,function(o){return encodeURIComponent(o)}),a=a.replace("#","%23"),t+r+e+a+s};function Bl(i,t){return Is(i,!1,!0).resolve(t)}Ct.prototype.resolve=function(i){return this.resolveObject(Is(i,!1,!0)).format()};function Fl(i,t){return i?Is(i,!1,!0).resolveObject(t):t}Ct.prototype.resolveObject=function(i){if(zt.isString(i)){var t=new Ct;t.parse(i,!1,!0),i=t}for(var e=new Ct,s=Object.keys(this),r=0;r0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.host=e.hostname=E.shift())}return e.search=i.search,e.query=i.query,(!zt.isNull(e.pathname)||!zt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var P=x.slice(-1)[0],w=(e.host||i.host||x.length>1)&&(P==="."||P==="..")||P==="",A=0,B=x.length;B>=0;B--)P=x[B],P==="."?x.splice(B,1):P===".."?(x.splice(B,1),A++):A&&(x.splice(B,1),A--);if(!g&&!v)for(;A--;A)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),w&&x.join("/").substr(-1)!=="/"&&x.push("");var k=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(y){e.hostname=e.host=k?"":x.length?x.shift():"";var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.host=e.hostname=E.shift())}return g=g||e.host&&x.length,g&&!k&&x.unshift(""),x.length?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(!zt.isNull(e.pathname)||!zt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};Ct.prototype.parseHost=function(){var i=this.host,t=Sl.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};const Ln={};function fo(i,t,e=3){if(Ln[t])return;let s=new Error().stack;typeof s=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${i}`):(s=s.split(` `).splice(e).join(` `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${i}`),console.warn(s))),Ln[t]=!0}const Nl={get parse(){return El},get format(){return Al},get resolve(){return Tl}};function Dt(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ss(i){return i.split("?")[0].split("#")[0]}function Ll(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ul(i,t,e){return i.replace(new RegExp(Ll(t),"g"),e)}function kl(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let o=0;o<=i.length;++o){if(o2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",s=0):(e=e.slice(0,h),s=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,o)}`:e=i.slice(r+1,o),s=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const ct={toPosix(i){return Ul(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){Dt(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(Dt(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=ss(this.toPosix(t!=null?t:O.ADAPTER.getBaseUrl())),r=ss(this.toPosix(e!=null?e:this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?ct.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(Dt(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=kl(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return Dt(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){var t;if(i.length===0)return".";let e;for(let s=0;s0)if(e===void 0)e=r;else{const n=(t=i[s-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(Dt(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let o=i.length-1;o>=1;--o)if(t=i.charCodeAt(o),t===47){if(!r){s=o;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){Dt(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){Dt(i),t&&Dt(t),i=ss(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let a=t.length-1,o=-1;for(n=i.length-1;n>=0;--n){const h=i.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=o))}return e===s?s=o:s===-1&&(s=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){Dt(i),i=ss(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const o=i.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":i.slice(t,s)},parse(i){Dt(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ss(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;const n="";t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let a=-1,o=0,h=-1,l=!0,u=i.length-1,c=0;for(;u>=r;--u){if(e=i.charCodeAt(u),e===47){if(!l){o=u+1;break}continue}h===-1&&(l=!1,h=u+1),e===46?a===-1?a=u:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||h===-1||c===0||c===1&&a===h-1&&a===o+1?h!==-1&&(o===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(o,h)):(o===0&&s?(t.name=i.slice(1,a),t.base=i.slice(1,h)):(t.name=i.slice(o,a),t.base=i.slice(o,h)),t.ext=i.slice(a,h)),t.dir=this.dirname(i),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let Ui;async function po(){return Ui!=null||(Ui=(async()=>{var i;const t=document.createElement("canvas").getContext("webgl");if(!t)return Et.UNPACK;const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return Et.UNPACK;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(s),(i=t.getExtension("WEBGL_lose_context"))==null||i.loseContext(),n[0]<=n[3]?Et.PMA:Et.UNPACK})()),Ui}function Gl(){}function $l(){}let ki;function mo(){return typeof ki=="undefined"&&(ki=function(){var i;const t={stencil:!0,failIfMajorPerformanceCaveat:O.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!O.ADAPTER.getWebGLRenderingContext())return!1;const e=O.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const r=!!((i=s==null?void 0:s.getContextAttributes())!=null&&i.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch(e){return!1}}()),ki}var Hl={grad:.9,turn:360,rad:360/(2*Math.PI)},te=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},pt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},It=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},go=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Un=function(i){return{r:It(i.r,0,255),g:It(i.g,0,255),b:It(i.b,0,255),a:It(i.a)}},Gi=function(i){return{r:pt(i.r),g:pt(i.g),b:pt(i.b),a:pt(i.a,3)}},Xl=/^#([0-9a-f]{3,8})$/i,Fs=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},_o=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),o=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},vo=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),o=s*(1-(t-n)*e),h=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,o,a,a,h,s][l],g:255*[h,s,s,o,a,a][l],b:255*[a,a,h,s,s,o][l],a:r}},kn=function(i){return{h:go(i.h),s:It(i.s,0,100),l:It(i.l,0,100),a:It(i.a)}},Gn=function(i){return{h:pt(i.h),s:pt(i.s),l:pt(i.l),a:pt(i.a,3)}},$n=function(i){return vo((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},_s=function(i){return{h:(t=_o(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},Vl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,jl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Wl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gr={string:[[function(i){var t=Xl.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?pt(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?pt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=zl.exec(i)||Wl.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Un({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Vl.exec(i)||jl.exec(i);if(!t)return null;var e,s,r=kn({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Hl[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return $n(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return te(t)&&te(e)&&te(s)?Un({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!te(t)||!te(e)||!te(s))return null;var a=kn({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return $n(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!te(t)||!te(e)||!te(s))return null;var a=function(o){return{h:go(o.h),s:It(o.s,0,100),v:It(o.v,0,100),a:It(o.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return vo(a)},"hsv"]]},Hn=function(i,t){for(var e=0;e=.5},i.prototype.toHex=function(){return t=Gi(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?Fs(pt(255*n)):"","#"+Fs(e)+Fs(s)+Fs(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return Gi(this.rgba)},i.prototype.toRgbString=function(){return t=Gi(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return Gn(_s(this.rgba))},i.prototype.toHslString=function(){return t=Gn(_s(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=_o(this.rgba),{h:pt(t.h),s:pt(t.s),v:pt(t.v),a:pt(t.a,3)};var t},i.prototype.invert=function(){return $t({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),$t($i(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),$t($i(this.rgba,-t))},i.prototype.grayscale=function(){return $t($i(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),$t(Xn(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),$t(Xn(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?$t({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):pt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=_s(this.rgba);return typeof t=="number"?$t({h:t,s:e.s,l:e.l,a:e.a}):pt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===$t(t).toHex()},i}(),$t=function(i){return i instanceof _r?i:new _r(i)},Vn=[],ql=function(i){i.forEach(function(t){Vn.indexOf(t)<0&&(t(_r,gr),Vn.push(t))})};function Kl(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,l=s[this.toHex()];if(l)return l;if(a!=null&&a.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new i(e[f]).toRgb();for(var p in e){var m=(o=u,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));mt in i?Zl(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,tu=(i,t)=>{for(var e in t||(t={}))Ql.call(t,e)&&zn(i,e,t[e]);if(jn)for(var e of jn(t))Jl.call(t,e)&&zn(i,e,t[e]);return i};ql([Kl]);const Le=class ti{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof ti)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?tu({},t):t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return t=t!=null?t:[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t!=null?t:[];const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=ti.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t!=null?t:[];const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=ti.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=$t(t);a.isValid()&&({r:e,g:s,b:r,a:n}=a.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}};Le.shared=new Le,Le.temp=new Le,Le.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let K=Le;function eu(i,t=[]){return K.shared.setValue(i).toRgbArray(t)}function yo(i){return K.shared.setValue(i).toHex()}function su(i){return K.shared.setValue(i).toNumber()}function xo(i){return K.shared.setValue(i).toNumber()}function iu(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[H.NORMAL_NPM]=H.NORMAL,i[H.ADD_NPM]=H.ADD,i[H.SCREEN_NPM]=H.SCREEN,t[H.NORMAL]=H.NORMAL_NPM,t[H.ADD]=H.ADD_NPM,t[H.SCREEN]=H.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const ln=iu();function un(i,t){return ln[t?1:0][i]}function ru(i,t,e,s=!0){return K.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}function nu(i,t){return K.shared.setValue(i).toPremultiplied(t)}function au(i,t,e,s=!0){return K.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}const bo=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function Eo(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,r=0;s>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function vr(i){return!(i&i-1)&&!!i}function yr(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Ie(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;rt in i?fu(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zn=(i,t)=>{for(var e in t||(t={}))gu.call(t,e)&&Kn(i,e,t[e]);if(qn)for(var e of qn(t))_u.call(t,e)&&Kn(i,e,t[e]);return i},vu=(i,t)=>pu(i,mu(t)),C=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(C||{});const Tr=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){const t=typeof i.extension!="object"?{type:i.extension}:i.extension;i=vu(Zn({},t),{ref:i})}if(typeof i=="object")i=Zn({},i);else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Qn=(i,t)=>{var e;return(e=Tr(i).priority)!=null?e:t},N={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Tr).forEach(t=>{t.type.forEach(e=>{var s,r;return(r=(s=this._removeHandlers)[e])==null?void 0:r.call(s,t)})}),this},add(...i){return i.map(Tr).forEach(t=>{t.type.forEach(e=>{var s,r;const n=this._addHandlers,a=this._queue;n[e]?(r=n[e])==null||r.call(n,t):(a[e]=a[e]||[],(s=a[e])==null||s.push(t))})}),this},handle(i,t,e){var s;const r=this._addHandlers,n=this._removeHandlers;r[i]=t,n[i]=e;const a=this._queue;return a[i]&&((s=a[i])==null||s.forEach(o=>t(o)),delete a[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>Qn(n,e)-Qn(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Ar{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const yu=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `);function xu(i){let t="";for(let e=0;e0&&(t+=` else `),e=0;--s){const r=wr[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class Pt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Pt.prototype,{dispatch:{value:Pt.prototype.emit},run:{value:Pt.prototype.emit}});class Ts{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Pt("setRealSize"),this.onUpdate=new Pt("update"),this.onError=new Pt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class Ri extends Ts{constructor(t,e){var s;const{width:r,height:n}=e||{};if(!r||!n)throw new Error("BufferResource width or height invalid");super(r,n),this.data=t,this.unpackAlignment=(s=e.unpackAlignment)!=null?s:4}upload(t,e,s){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Et.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,r.texImage2D(e.target,0,s.internalFormat,n,a,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}var Eu=Object.defineProperty,Jn=Object.getOwnPropertySymbols,Tu=Object.prototype.hasOwnProperty,Au=Object.prototype.propertyIsEnumerable,ta=(i,t,e)=>t in i?Eu(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wu=(i,t)=>{for(var e in t||(t={}))Tu.call(t,e)&&ta(i,e,t[e]);if(Jn)for(var e of Jn(t))Au.call(t,e)&&ta(i,e,t[e]);return i};const Su={scaleMode:ee.NEAREST,alphaMode:Et.NPM},Sr=class Ue extends Qe{constructor(t=null,e=null){super(),e=Object.assign({},Ue.defaultOptions,e);const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Ts)&&(t=Ro(t,p),t.internal=!0),this.resolution=f||O.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=fe(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=vr(this.realWidth)&&vr(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete wt[this.cacheId],delete xt[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ue.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,s=O.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${fe()}`}n=t._pixiId}let a=wt[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new Ue(t,e),a.cacheId=n,Ue.addToCache(a,n)),a}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new Ri(t,wu({width:e,height:s},r==null?void 0:r.resourceOptions));let a,o;return t instanceof Float32Array?(a=T.RGBA,o=U.FLOAT):t instanceof Int32Array?(a=T.RGBA_INTEGER,o=U.INT):t instanceof Uint32Array?(a=T.RGBA_INTEGER,o=U.UNSIGNED_INT):t instanceof Int16Array?(a=T.RGBA_INTEGER,o=U.SHORT):t instanceof Uint16Array?(a=T.RGBA_INTEGER,o=U.UNSIGNED_SHORT):t instanceof Int8Array?(a=T.RGBA,o=U.BYTE):(a=T.RGBA,o=U.UNSIGNED_BYTE),n.internal=!0,new Ue(n,Object.assign({},Su,{type:o,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),wt[e]&&wt[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),wt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=wt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete wt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e1){for(let c=0;c(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(_t||{});class q{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new q(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}}const Ns=[new q,new q,new q,new q];class j{constructor(t=0,e=0,s=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(r),this.type=_t.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new j(0,0,0,0)}clone(){return new j(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&et.right?t.right:this.right)<=A)return!1;const B=this.yt.bottom?t.bottom:this.bottom)>B}const s=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=s||a<=n)return!1;const o=Ns[0].set(t.left,t.top),h=Ns[1].set(t.left,t.bottom),l=Ns[2].set(t.right,t.top),u=Ns[3].set(t.right,t.bottom);if(l.x<=o.x||h.y<=o.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(o,o),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(o.x,h.x,l.x,u.x)<=s||Math.min(o.x,h.x,l.x,u.x)>=r||Math.max(o.y,h.y,l.y,u.y)<=n||Math.min(o.y,h.y,l.y,u.y)>=a))return!1;const d=c*(h.y-o.y),f=c*(o.x-h.x),p=d*s+f*n,m=d*r+f*n,g=d*s+f*a,v=d*r+f*a;if(Math.max(p,m,g,v)<=d*o.x+f*o.y||Math.min(p,m,g,v)>=d*u.x+f*u.y)return!1;const x=c*(o.y-l.y),_=c*(l.x-o.x),y=x*s+_*n,E=x*r+_*n,P=x*s+_*a,w=x*r+_*a;return!(Math.max(y,E,P,w)<=x*o.x+_*o.y||Math.min(y,E,P,w)>=x*u.x+_*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}}class cn{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=_t.CIRC}clone(){return new cn(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=s}getBounds(){return new j(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class dn{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=_t.ELIP}clone(){return new dn(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,r=(e-this.y)/this.height;return s*=s,r*=r,s+r<=1}getBounds(){return new j(this.x-this.width,this.y-this.height,this.width,this.height)}}class We{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let r=0,n=e.length;re!=u>e&&t<(l-o)*((e-h)/(u-h))+o&&(s=!s)}return s}}class fn{constructor(t=0,e=0,s=0,r=0,n=20){this.x=t,this.y=e,this.width=s,this.height=r,this.radius=n,this.type=_t.RREC}clone(){return new fn(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let r=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(r*r+n*n<=a||(r=t-(this.x+this.width-s),r*r+n*n<=a)||(n=e-(this.y+this.height-s),r*r+n*n<=a)||(r=t-(this.x+s),r*r+n*n<=a))return!0}return!1}}class tt{constructor(t=1,e=0,s=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,r,n,a){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new q;const s=t.x,r=t.y;return e.x=this.a*s+this.c*r+this.tx,e.y=this.b*s+this.d*r+this.ty,e}applyInverse(t,e){e=e||new q;const s=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*s*r+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*r+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*s,this.b=r*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=a*e-this.ty*s,this.ty=a*s+this.ty*e,this}append(t){const e=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,r,n,a,o,h,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(s*this.a+r*this.c),this.ty=e-(s*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,r=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-r,n),h=Math.atan2(s,e),l=Math.abs(o+h);return l<1e-5||Math.abs(ci-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(a.x*e+a.y*r),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,a=t*r-e*s;return this.a=r/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new tt;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new tt}static get TEMP_MATRIX(){return new tt}}const be=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ee=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Te=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ae=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ir=[],Co=[],Ls=Math.sign;function Bu(){for(let i=0;i<16;i++){const t=[];Ir.push(t);for(let e=0;e<16;e++){const s=Ls(be[i]*be[e]+Te[i]*Ee[e]),r=Ls(Ee[i]*be[e]+Ae[i]*Ee[e]),n=Ls(be[i]*Te[e]+Te[i]*Ae[e]),a=Ls(Ee[i]*Te[e]+Ae[i]*Ae[e]);for(let o=0;o<16;o++)if(be[o]===s&&Ee[o]===r&&Te[o]===n&&Ae[o]===a){t.push(o);break}}}for(let i=0;i<16;i++){const t=new tt;t.set(be[i],Ee[i],Te[i],Ae[i],0,0),Co.push(t)}}Bu();const et={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>be[i],uY:i=>Ee[i],vX:i=>Te[i],vY:i=>Ae[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Ir[i][t],sub:(i,t)=>Ir[i][et.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?et.S:et.N:Math.abs(t)*2<=Math.abs(i)?i>0?et.E:et.W:t>0?i>0?et.SE:et.SW:i>0?et.NE:et.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=Co[et.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class ce{constructor(t,e,s=0,r=0){this._x=s,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new ce(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}const Cr=class{constructor(){this.worldTransform=new tt,this.localTransform=new tt,this.position=new ce(this.onChange,this,0,0),this.scale=new ce(this.onChange,this,1,1),this.pivot=new ce(this.onChange,this,0,0),this.skew=new ce(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const s=t.worldTransform,r=this.worldTransform;r.a=e.a*s.a+e.b*s.c,r.b=e.a*s.b+e.b*s.d,r.c=e.c*s.a+e.d*s.c,r.d=e.c*s.b+e.d*s.d,r.tx=e.tx*s.a+e.ty*s.c+s.tx,r.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};Cr.IDENTITY=new Cr;let pn=Cr;var Fu=`varying vec2 vTextureCoord; uniform sampler2D uSampler; void main(void){ gl_FragColor *= texture2D(uSampler, vTextureCoord); }`,Nu=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; void main(void){ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; } `;function sa(i,t,e){const s=i.createShader(t);return i.shaderSource(s,e),i.compileShader(s),s}function qi(i){const t=new Array(i);for(let e=0;ei.type==="float"&&i.size===1&&!i.isArray,code:i=>` if(uv["${i}"] !== ud["${i}"].value) { ud["${i}"].value = uv["${i}"] gl.uniform1f(ud["${i}"].location, uv["${i}"]) } `},{test:(i,t)=>(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(t==null||t.castToBaseTexture!==void 0),code:i=>`t = syncData.textureCount++; renderer.texture.bind(uv["${i}"], t); if(ud["${i}"].value !== t) { ud["${i}"].value = t; gl.uniform1i(ud["${i}"].location, t); ; // eslint-disable-line max-len }`},{test:(i,t)=>i.type==="mat3"&&i.size===1&&!i.isArray&&t.a!==void 0,code:i=>` gl.uniformMatrix3fv(ud["${i}"].location, false, uv["${i}"].toArray(true)); `,codeUbo:i=>` var ${i}_matrix = uv.${i}.toArray(true); data[offset] = ${i}_matrix[0]; data[offset+1] = ${i}_matrix[1]; data[offset+2] = ${i}_matrix[2]; data[offset + 4] = ${i}_matrix[3]; data[offset + 5] = ${i}_matrix[4]; data[offset + 6] = ${i}_matrix[5]; data[offset + 8] = ${i}_matrix[6]; data[offset + 9] = ${i}_matrix[7]; data[offset + 10] = ${i}_matrix[8]; `},{test:(i,t)=>i.type==="vec2"&&i.size===1&&!i.isArray&&t.x!==void 0,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v.x || cv[1] !== v.y) { cv[0] = v.x; cv[1] = v.y; gl.uniform2f(ud["${i}"].location, v.x, v.y); }`,codeUbo:i=>` v = uv.${i}; data[offset] = v.x; data[offset+1] = v.y; `},{test:i=>i.type==="vec2"&&i.size===1&&!i.isArray,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2f(ud["${i}"].location, v[0], v[1]); } `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.width!==void 0,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { cv[0] = v.x; cv[1] = v.y; cv[2] = v.width; cv[3] = v.height; gl.uniform4f(ud["${i}"].location, v.x, v.y, v.width, v.height) }`,codeUbo:i=>` v = uv.${i}; data[offset] = v.x; data[offset+1] = v.y; data[offset+2] = v.width; data[offset+3] = v.height; `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; cv[3] = v.alpha; gl.uniform4f(ud["${i}"].location, v.red, v.green, v.blue, v.alpha) }`,codeUbo:i=>` v = uv.${i}; data[offset] = v.red; data[offset+1] = v.green; data[offset+2] = v.blue; data[offset+3] = v.alpha; `},{test:(i,t)=>i.type==="vec3"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; gl.uniform3f(ud["${i}"].location, v.red, v.green, v.blue) }`,codeUbo:i=>` v = uv.${i}; data[offset] = v.red; data[offset+1] = v.green; data[offset+2] = v.blue; `},{test:i=>i.type==="vec4"&&i.size===1&&!i.isArray,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3]) }`}],Lu={float:` if (cv !== v) { cu.value = v; gl.uniform1f(location, v); }`,vec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2f(location, v[0], v[1]) }`,vec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3f(location, v[0], v[1], v[2]) }`,vec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4f(location, v[0], v[1], v[2], v[3]); }`,int:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,ivec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2i(location, v[0], v[1]); }`,ivec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3i(location, v[0], v[1], v[2]); }`,ivec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); }`,uint:` if (cv !== v) { cu.value = v; gl.uniform1ui(location, v); }`,uvec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2ui(location, v[0], v[1]); }`,uvec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3ui(location, v[0], v[1], v[2]); }`,uvec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4ui(location, v[0], v[1], v[2], v[3]); }`,bool:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,bvec2:` if (cv[0] != v[0] || cv[1] != v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2i(location, v[0], v[1]); }`,bvec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3i(location, v[0], v[1], v[2]); }`,bvec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,samplerCube:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,sampler2DArray:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`},Uu={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function ku(i,t){var e;const s=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; `];for(const r in i.uniforms){const n=t[r];if(!n){((e=i.uniforms[r])==null?void 0:e.group)===!0&&(i.uniforms[r].ubo?s.push(` renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}'); `):s.push(` renderer.shader.syncUniformGroup(uv.${r}, syncData); `));continue}const a=i.uniforms[r];let o=!1;for(let h=0;h=De.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),is=t}return is}let Us;function $u(){if(!Us){Us=Rt.MEDIUM;const i=Gu();if(i&&i.getShaderPrecisionFormat){const t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(Us=t.precision?Rt.HIGH:Rt.MEDIUM)}}return Us}function ia(i,t){const e=i.getShaderSource(t).split(` `).map((l,u)=>`${u}: ${l}`),s=i.getShaderInfoLog(t),r=s.split(` `),n={},a=r.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),o=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(` `);o[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function Hu(i,t,e,s){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||ia(i,e),i.getShaderParameter(s,i.COMPILE_STATUS)||ia(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}const Xu={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 Do(i){return Xu[i]}let ks=null;const ra={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 Oo(i,t){if(!ks){const e=Object.keys(ra);ks={};for(let s=0;s0&&(e+=` else `),sthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=Bt._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++X._globalBatch,h=0,l=s[0],u=0;r.copyBoundTextures(n,e);for(let c=0;c=e&&(r.boundArray(l,n,o,e),this.buildDrawCalls(l,u,c),u=c,l=s[++h],++o),d._batchEnabled=o,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(r.boundArray(l,n,o,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let c=0;c0);for(let m=0;m=0;--r)t[r]=s[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,s,r){const{elements:n,ids:a,count:o}=t;let h=0;for(let l=0;l=0&&c=De.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}fi.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},fi.extension={type:C.RendererSystem,name:"context"};N.add(fi);class Or{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 Pt("disposeFramebuffer"),this.multisample=ht.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new X(null,{scaleMode:ee.NEAREST,resolution:1,mipmap:Zt.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new X(null,{scaleMode:ee.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Zt.OFF,format:T.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{const r=this.source;this.url=r.src;const n=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};r.complete&&r.src?n():(r.onload=n,r.onerror=a=>{s(a),this.onError.emit(a)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Et.UNPACK?"premultiply":"none"})).then(r=>this.destroyed?Promise.reject():(this.bitmap=r,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,s){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==s&&o.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement!="undefined"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Lo{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const r=e.width,n=e.height;if(s){const a=t.width/2/r,o=t.height/2/n,h=t.x/r+a,l=t.y/n+o;s=et.add(s,et.NW),this.x0=h+a*et.uX(s),this.y0=l+o*et.uY(s),s=et.add(s,2),this.x1=h+a*et.uX(s),this.y1=l+o*et.uY(s),s=et.add(s,2),this.x2=h+a*et.uX(s),this.y2=l+o*et.uY(s),s=et.add(s,2),this.x3=h+a*et.uX(s),this.y3=l+o*et.uY(s)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}const oa=new Lo;function $s(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class D extends Qe{constructor(t,e,s,r,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new j(0,0,1,1)),t instanceof D&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=oa,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=a?new q(a.x,a.y):new q(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&xt[e.url]&&D.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,D.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var t;const e=this._frame.clone(),s=this._frame===this.orig?e:this.orig.clone(),r=new D(this.baseTexture,!this.noFrame&&e,s,(t=this.trim)==null?void 0:t.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=e),r}updateUvs(){this._uvs===oa&&(this._uvs=new Lo),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=O.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof X){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${fe()}`,X.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${fe()}`}n=t._pixiId}let a=xt[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof X)?(e.resolution||(e.resolution=Qt(t)),a=new D(new X(t,e)),a.baseTexture.cacheId=n,X.addToCache(a.baseTexture,n),D.addToCache(a,n)):!a&&t instanceof X&&(a=new D(t),D.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=D.from(t,Object.assign({resourceOptions:s},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,s,r){return new D(X.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new X(t,Object.assign({scaleMode:X.defaultOptions.scaleMode,resolution:Qt(e)},r)),{resource:a}=n;a instanceof No&&(a.url=e);const o=new D(n);return s||(s=e),X.addToCache(o.baseTexture,s),D.addToCache(o,s),s!==e&&(X.addToCache(o.baseTexture,e),D.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),xt[e]&&xt[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),xt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=xt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete xt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;ethis.baseTexture.width,o=s+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,u=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=r&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return D._EMPTY||(D._EMPTY=new D(new X),$s(D._EMPTY),$s(D._EMPTY.baseTexture)),D._EMPTY}static get WHITE(){if(!D._WHITE){const t=O.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),D._WHITE=new D(X.from(t)),$s(D._WHITE),$s(D._WHITE.baseTexture)}return D._WHITE}}class Oe extends D{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const r=this.baseTexture.resolution,n=Math.round(t*r)/r,a=Math.round(e*r)/r;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,s&&this.baseTexture.resize(n,a),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new Oe(new Fo(t))}}class Uo{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=ht.NONE){const r=new Fo(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Oe(r)}getOptimalTexture(t,e,s=1,r=ht.NONE){let n;t=Math.max(Math.ceil(t*s-1e-6),1),e=Math.max(Math.ceil(e*s-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=Es(t),e=Es(e),n=((t&65535)<<16|e&65535)>>>0,r>1&&(n+=r*4294967296)):n=r>1?-r:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,r)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||ht.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let r=0;r0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let r=0;r1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),s[c].apply(this,l,u,jt.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,h.renderTexture,jt.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=jt.CLEAR){const{renderTexture:s,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t!=null&&t.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,s.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=r.stateId&1||this.forceClear;(e===jt.CLEAR||e===jt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Wt.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Wt.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:r}=this.activeState,{orig:n}=e._texture,a=t.set(r.width,0,0,r.height,s.x,s.y),o=e.worldTransform.copyTo(tt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(e.anchor.x,e.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,r=ht.NONE){return this.texturePool.getOptimalTexture(t,e,s,r)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||ht.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Hs[0],r=Hs[1],n=Hs[2],a=Hs[3];s.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(r,r),t.apply(n,n),t.apply(a,a);const o=Math.min(s.x,r.x,n.x,a.x),h=Math.min(s.y,r.y,n.y,a.y),l=Math.max(s.x,r.x,n.x,a.x),u=Math.max(s.y,r.y,n.y,a.y);e.x=o,e.y=h,e.width=l-o,e.height=u-h}roundFrame(t,e,s,r,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:o,c:h,d:l}=n;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?Ki.copyFrom(n):Ki.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Go.extension={type:C.RendererSystem,name:"filter"};N.add(Go);class sc{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ht.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const ic=new j;class $o{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Or(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new j,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;O.PREFER_ENV===De.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:r}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=s),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a>s,o=e.height>>s,h=a/e.width;this.setViewport(e.x*h,e.y*h,a,o)}else{const a=t.width>>s,o=t.height>>s;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),r=Math.round(r),(n.width!==s||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=r,this.gl.viewport(t,e,s,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,r,n=lr.COLOR|lr.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new sc(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){e.bindRenderbuffer(e.RENDERBUFFER,s.stencil);let a;this.renderer.context.webGLVersion===1?a=e.DEPTH_STENCIL:t.depth&&t.stencil?a=e.DEPTH24_STENCIL8:t.depth?a=e.DEPTH_COMPONENT24:a=e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||s.createRenderbuffer():r.msaaBuffer&&(s.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const o=[];for(let h=0;h1&&s.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||s.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(h=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(h=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,r.stencil),r.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,h,s.RENDERBUFFER,r.stencil)}else r.stencil&&(s.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=ht.NONE;if(t<=1||e===null)return s;for(let r=0;r=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&r.deleteRenderbuffer(s.msaaBuffer),s.stencil&&r.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;ss.createVertexArrayOES(),t.bindVertexArray=r=>s.bindVertexArrayOES(r),t.deleteVertexArray=r=>s.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const s=t.getExtension("ANGLE_instanced_arrays");s?(t.vertexAttribDivisor=(r,n)=>s.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,a,o,h)=>s.drawElementsInstancedANGLE(r,n,a,o,h),t.drawArraysInstanced=(r,n,a,o)=>s.drawArraysInstancedANGLE(r,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);const a=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}Xo.extension={type:C.RendererSystem,name:"mask"};N.add(Xo);class Vo{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==s&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const la=new tt,ua=[],jo=class ei extends Vo{constructor(t){super(t),this.glConst=O.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){var e;if(t._scissorRectLocal)return;const s=t._scissorRect,{maskObject:r}=t,{renderer:n}=this,a=n.renderTexture,o=r.getBounds(!0,(e=ua.pop())!=null?e:new j);this.roundFrameToPixels(o,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),s&&o.fit(s),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:r,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||ei.isMatrixRotated(e.worldTransform)||ei.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,r,n){ei.isMatrixRotated(n)||(n=n?la.copyFrom(n):la.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,t),t.fit(r),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&ua.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};jo.extension={type:C.RendererSystem,name:"scissor"};let hc=jo;N.add(hc);class zo extends Vo{constructor(t){super(t),this.glConst=O.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,r,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,s.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=s?s._colorMask:15;r!==0&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(s._colorMask=r,e.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}zo.extension={type:C.RendererSystem,name:"stencil"};N.add(zo);class Wo{constructor(t){this.renderer=t,this.plugins={}}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}Wo.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"_plugin"};N.add(Wo);class Yo{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new tt,this.transform=null}update(t,e,s,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,r),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,s,r){const n=this.projectionMatrix,a=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=a*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-a-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Yo.extension={type:C.RendererSystem,name:"projection"};N.add(Yo);var ca=Object.getOwnPropertySymbols,lc=Object.prototype.hasOwnProperty,uc=Object.prototype.propertyIsEnumerable,cc=(i,t)=>{var e={};for(var s in i)lc.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&ca)for(var s of ca(i))t.indexOf(s)<0&&uc.call(i,s)&&(e[s]=i[s]);return e};const dc=new pn,da=new j;class qo{constructor(t){this.renderer=t,this._tempMatrix=new tt}generateTexture(t,e){var s;const r=e||{},{region:n}=r,a=cc(r,["region"]),o=(n==null?void 0:n.copyTo(da))||t.getLocalBounds(da,!0),h=a.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/h),o.height=Math.max(o.height,1/h),a.width=o.width,a.height=o.height,a.resolution=h,(s=a.multisample)!=null||(a.multisample=this.renderer.multisample);const l=Oe.create(a);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;const u=t.transform;return t.transform=dc,this.renderer.render(t,{renderTexture:l,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=u,l}destroy(){}}qo.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"textureGenerator"};N.add(qo);const ye=new j,ns=new j;class Ko{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new j,this.destinationFrame=new j,this.viewportFrame=new j}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(t=null,e,s){const r=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(ye.width=t.frame.width,ye.height=t.frame.height,e=ye),s||(ns.x=t.frame.x,ns.y=t.frame.y,ns.width=e.width,ns.height=e.height,s=ns),a=n.framebuffer):(o=r.resolution,e||(ye.width=r._view.screen.width,ye.height=r._view.screen.height,e=ye),s||(s=ye,s.width=e.width,s.height=e.height));const h=this.viewportFrame;h.x=s.x*o,h.y=s.y*o,h.width=s.width*o,h.height=s.height*o,t||(h.y=r.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(s,e,o,!a),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=K.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Ko.extension={type:C.RendererSystem,name:"renderTexture"};N.add(Ko);class Vm{}class fc{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 pc(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let r=0;rl>u?1:-1);for(let l=0;l({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,r=0;for(let n=0;n1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const o=s%e%16;s+=o,r+=o}s+e>16?(r=Math.ceil(r/16)*16,a.offset=r,r+=e,s=e):(a.offset=r,s+=e,r+=e)}return r=Math.ceil(r/16)*16,{uboElements:t,size:r}}function xc(i,t){const e=[];for(const s in i)t[s]&&e.push(t[s]);return e.sort((s,r)=>s.index-r.index),e}function bc(i,t){if(!i.autoManage)return{size:0,syncFunc:_c};const e=xc(i.uniforms,t),{uboElements:s,size:r}=yc(e),n=[` var v = null; var v2 = null; var cv = null; var t = 0; var gl = renderer.gl var index = 0; var data = buffer.data; `];for(let a=0;a1){const c=Do(o.data.type),d=Math.max(Zo[o.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(` cv = ud.${l}.value; v = uv.${l}; offset = ${o.offset/4}; t = 0; for(var i=0; i < ${o.data.size*d}; i++) { for(var j = 0; j < ${f}; j++) { data[offset++] = v[t++]; } offset += ${p}; } `)}else{const c=vc[o.data.type];n.push(` cv = ud.${l}.value; v = uv.${l}; offset = ${o.offset/4}; ${c}; `)}}return n.push(` renderer.buffer.update(buffer); `),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(` `))}}let Ec=0;const Xs={textureCount:0,uboCount:0};class Qo{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=Ec++}systemCheck(){if(!Vu())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,r=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(r.program)),e||(Xs.textureCount=0,Xs.uboCount=0,this.syncUniformGroup(t.uniformGroup,Xs)),r}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=ku(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const r=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),r(s.uniformData,t.uniforms,this.renderer,Xs,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=bc(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const r=t.uniforms,n=[`${s}-`];for(const a in r)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,r=gc(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Qo.extension={type:C.RendererSystem,name:"shader"};N.add(Qo);class pi{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(){}}pi.defaultOptions={hello:!1},pi.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"startup"};N.add(pi);function Tc(i,t=[]){return t[H.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.ADD]=[i.ONE,i.ONE],t[H.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.NONE]=[0,0],t[H.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[H.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[H.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[H.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[H.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[H.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[H.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[H.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[H.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[H.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const Ac=0,wc=1,Sc=2,Rc=3,Ic=4,Cc=5,Jo=class Br{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=H.NONE,this._blendEq=!1,this.map=[],this.map[Ac]=this.setBlend,this.map[wc]=this.setOffset,this.map[Sc]=this.setCullFace,this.map[Rc]=this.setDepthTest,this.map[Ic]=this.setFrontFace,this.map[Cc]=this.setDepthMask,this.checks=[],this.defaultState=new ae,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Tc(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<>1,s++;this.stateId=t.data}for(let e=0;et.systems[n]),r=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of r)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Pt(e)})}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const r in this.runners)this.runners[r].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=s.find(a=>this._systemsHash[a]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const us=class si{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=si.defaultMaxIdle,this.checkCountMax=si.defaultCheckCountMax,this.mode=si.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==on.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let r=0;rthis.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,s=!0)}if(s){let r=0;for(let n=0;n=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};us.defaultMode=on.AUTO,us.defaultMaxIdle=60*60,us.defaultCheckCountMax=60*10,us.extension={type:C.RendererSystem,name:"textureGC"};let Se=us;N.add(Se);class Qi{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=T.RGBA,this.samplerType=0}}function Dc(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:M.FLOAT,[i.RGBA]:M.FLOAT,[i.ALPHA]:M.FLOAT,[i.LUMINANCE]:M.FLOAT,[i.LUMINANCE_ALPHA]:M.FLOAT,[i.R8]:M.FLOAT,[i.R8_SNORM]:M.FLOAT,[i.RG8]:M.FLOAT,[i.RG8_SNORM]:M.FLOAT,[i.RGB8]:M.FLOAT,[i.RGB8_SNORM]:M.FLOAT,[i.RGB565]:M.FLOAT,[i.RGBA4]:M.FLOAT,[i.RGB5_A1]:M.FLOAT,[i.RGBA8]:M.FLOAT,[i.RGBA8_SNORM]:M.FLOAT,[i.RGB10_A2]:M.FLOAT,[i.RGB10_A2UI]:M.FLOAT,[i.SRGB8]:M.FLOAT,[i.SRGB8_ALPHA8]:M.FLOAT,[i.R16F]:M.FLOAT,[i.RG16F]:M.FLOAT,[i.RGB16F]:M.FLOAT,[i.RGBA16F]:M.FLOAT,[i.R32F]:M.FLOAT,[i.RG32F]:M.FLOAT,[i.RGB32F]:M.FLOAT,[i.RGBA32F]:M.FLOAT,[i.R11F_G11F_B10F]:M.FLOAT,[i.RGB9_E5]:M.FLOAT,[i.R8I]:M.INT,[i.R8UI]:M.UINT,[i.R16I]:M.INT,[i.R16UI]:M.UINT,[i.R32I]:M.INT,[i.R32UI]:M.UINT,[i.RG8I]:M.INT,[i.RG8UI]:M.UINT,[i.RG16I]:M.INT,[i.RG16UI]:M.UINT,[i.RG32I]:M.INT,[i.RG32UI]:M.UINT,[i.RGB8I]:M.INT,[i.RGB8UI]:M.UINT,[i.RGB16I]:M.INT,[i.RGB16UI]:M.UINT,[i.RGB32I]:M.INT,[i.RGB32UI]:M.UINT,[i.RGBA8I]:M.INT,[i.RGBA8UI]:M.UINT,[i.RGBA16I]:M.INT,[i.RGBA16UI]:M.UINT,[i.RGBA32I]:M.INT,[i.RGBA32UI]:M.UINT,[i.DEPTH_COMPONENT16]:M.FLOAT,[i.DEPTH_COMPONENT24]:M.FLOAT,[i.DEPTH_COMPONENT32F]:M.FLOAT,[i.DEPTH_STENCIL]:M.FLOAT,[i.DEPTH24_STENCIL8]:M.FLOAT,[i.DEPTH32F_STENCIL8]:M.FLOAT}:t={[i.RGB]:M.FLOAT,[i.RGBA]:M.FLOAT,[i.ALPHA]:M.FLOAT,[i.LUMINANCE]:M.FLOAT,[i.LUMINANCE_ALPHA]:M.FLOAT,[i.DEPTH_STENCIL]:M.FLOAT},t}function Oc(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[U.UNSIGNED_BYTE]:{[T.RGBA]:i.RGBA8,[T.RGB]:i.RGB8,[T.RG]:i.RG8,[T.RED]:i.R8,[T.RGBA_INTEGER]:i.RGBA8UI,[T.RGB_INTEGER]:i.RGB8UI,[T.RG_INTEGER]:i.RG8UI,[T.RED_INTEGER]:i.R8UI,[T.ALPHA]:i.ALPHA,[T.LUMINANCE]:i.LUMINANCE,[T.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[U.BYTE]:{[T.RGBA]:i.RGBA8_SNORM,[T.RGB]:i.RGB8_SNORM,[T.RG]:i.RG8_SNORM,[T.RED]:i.R8_SNORM,[T.RGBA_INTEGER]:i.RGBA8I,[T.RGB_INTEGER]:i.RGB8I,[T.RG_INTEGER]:i.RG8I,[T.RED_INTEGER]:i.R8I},[U.UNSIGNED_SHORT]:{[T.RGBA_INTEGER]:i.RGBA16UI,[T.RGB_INTEGER]:i.RGB16UI,[T.RG_INTEGER]:i.RG16UI,[T.RED_INTEGER]:i.R16UI,[T.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[U.SHORT]:{[T.RGBA_INTEGER]:i.RGBA16I,[T.RGB_INTEGER]:i.RGB16I,[T.RG_INTEGER]:i.RG16I,[T.RED_INTEGER]:i.R16I},[U.UNSIGNED_INT]:{[T.RGBA_INTEGER]:i.RGBA32UI,[T.RGB_INTEGER]:i.RGB32UI,[T.RG_INTEGER]:i.RG32UI,[T.RED_INTEGER]:i.R32UI,[T.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[U.INT]:{[T.RGBA_INTEGER]:i.RGBA32I,[T.RGB_INTEGER]:i.RGB32I,[T.RG_INTEGER]:i.RG32I,[T.RED_INTEGER]:i.R32I},[U.FLOAT]:{[T.RGBA]:i.RGBA32F,[T.RGB]:i.RGB32F,[T.RG]:i.RG32F,[T.RED]:i.R32F,[T.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[U.HALF_FLOAT]:{[T.RGBA]:i.RGBA16F,[T.RGB]:i.RGB16F,[T.RG]:i.RG16F,[T.RED]:i.R16F},[U.UNSIGNED_SHORT_5_6_5]:{[T.RGB]:i.RGB565},[U.UNSIGNED_SHORT_4_4_4_4]:{[T.RGBA]:i.RGBA4},[U.UNSIGNED_SHORT_5_5_5_1]:{[T.RGBA]:i.RGB5_A1},[U.UNSIGNED_INT_2_10_10_10_REV]:{[T.RGBA]:i.RGB10_A2,[T.RGBA_INTEGER]:i.RGB10_A2UI},[U.UNSIGNED_INT_10F_11F_11F_REV]:{[T.RGB]:i.R11F_G11F_B10F},[U.UNSIGNED_INT_5_9_9_9_REV]:{[T.RGB]:i.RGB9_E5},[U.UNSIGNED_INT_24_8]:{[T.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[U.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[T.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[U.UNSIGNED_BYTE]:{[T.RGBA]:i.RGBA,[T.RGB]:i.RGB,[T.ALPHA]:i.ALPHA,[T.LUMINANCE]:i.LUMINANCE,[T.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[U.UNSIGNED_SHORT_5_6_5]:{[T.RGB]:i.RGB},[U.UNSIGNED_SHORT_4_4_4_4]:{[T.RGBA]:i.RGBA},[U.UNSIGNED_SHORT_5_5_5_1]:{[T.RGBA]:i.RGBA}},t}class th{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new X,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=Oc(t),this.samplerTypes=Dc(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let r=0;r=0;--n){const a=e[n];a&&a._glTextures[r].samplerType!==M.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Qi(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var s,r,n;e.internalFormat=(r=(s=this.internalFormats[t.type])==null?void 0:s[t.format])!=null?r:t.format,e.samplerType=(n=this.samplerTypes[e.internalFormat])!=null?n:M.FLOAT,this.webGLVersion===2&&t.type===U.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var e;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const r=this.renderer;if(this.initTextureType(t,s),(e=t.resource)!=null&&e.upload(r,t,s))s.samplerType!==M.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,o=r.gl;(s.width!==n||s.height!==a||s.dirtyId<0)&&(s.width=n,s.height=a,o.texImage2D(t.target,0,s.internalFormat,n,a,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const r=this.managedTextures.indexOf(t);r!==-1&&Ie(this.managedTextures,r,1)}}updateTextureStyle(t){var e;const s=t._glTextures[this.CONTEXT_UID];s&&((t.mipmap===Zt.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?s.mipmap=!1:s.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?s.wrapMode=re.CLAMP:s.wrapMode=t.wrapMode,(e=t.resource)!=null&&e.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==Zt.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===ee.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===ee.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===ee.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===ee.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}th.extension={type:C.RendererSystem,name:"texture"};N.add(th);class eh{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:r}=this;e&&r.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;at in i?Bc(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vs=(i,t)=>{for(var e in t||(t={}))Fc.call(t,e)&&pa(i,e,t[e]);if(fa)for(var e of fa(t))Nc.call(t,e)&&pa(i,e,t[e]);return i};O.PREFER_ENV=De.WEBGL2;O.STRICT_TEXTURE_CACHE=!1;O.RENDER_OPTIONS=Vs(Vs(Vs(Vs({},fi.defaultOptions),di.defaultOptions),mi.defaultOptions),pi.defaultOptions);Object.defineProperties(O,{WRAP_MODE:{get(){return X.defaultOptions.wrapMode},set(i){X.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return X.defaultOptions.scaleMode},set(i){X.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return X.defaultOptions.mipmap},set(i){X.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return X.defaultOptions.anisotropicLevel},set(i){X.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return bt.defaultResolution},set(i){bt.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return bt.defaultMultisample},set(i){bt.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return we.defaultMaxTextures},set(i){we.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return we.defaultBatchSize},set(i){we.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return we.canUploadSameBuffer},set(i){we.canUploadSameBuffer=i}},GC_MODE:{get(){return Se.defaultMode},set(i){Se.defaultMode=i}},GC_MAX_IDLE:{get(){return Se.defaultMaxIdle},set(i){Se.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Se.defaultCheckCountMax},set(i){Se.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return ie.defaultVertexPrecision},set(i){ie.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return ie.defaultFragmentPrecision},set(i){ie.defaultFragmentPrecision=i}}});var me=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(me||{});class Ji{constructor(t,e=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=r}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const sh=class At{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 Ji(null,null,1/0),this.deltaMS=1/At.targetFPMS,this.elapsedMS=1/At.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=me.NORMAL){return this._addListener(new Ji(t,e,s))}addOnce(t,e,s=me.NORMAL){return this._addListener(new Ji(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?vt.shared:new vt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}ih.extension=C.Application;N.add(ih);const rh=[];N.handleByList(C.Renderer,rh);function Lc(i){for(const t of rh)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var Uc=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; void main(void) { gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; }`,kc=`attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vTextureCoord = filterTextureCoord(); } `;const Gc=Uc,nh=kc;class ah{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}e>=ht.HIGH?this.multisample=ht.HIGH:e>=ht.MEDIUM?this.multisample=ht.MEDIUM:e>=ht.LOW?this.multisample=ht.LOW:this.multisample=ht.NONE}destroy(){}}ah.extension={type:C.RendererSystem,name:"_multisample"};N.add(ah);class $c{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class oh{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:r,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),s&&(e||r.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;se.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}class Hc extends lh{constructor(t,e){const{width:s,height:r}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=je.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:a}=this,{gl:o}=t;s.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let h=0;h0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=je.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const r=this.itemDirtyIds;for(let n=0;n{if(this.url===null){t(this);return}try{const s=await O.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Et.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(s){if(this.destroyed)return;e(s),this.onError.emit(s)}}),this._load)}upload(t,e,s){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap!="undefined"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){var t;return Ve._EMPTY=(t=Ve._EMPTY)!=null?t:O.ADAPTER.createCanvas(0,0),Ve._EMPTY}}const Nr=class ri extends ne{constructor(t,e){e=e||{},super(O.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},ri.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;ne.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),r=Math.round(r),n=Math.round(n);const a=this.source;a.width=r,a.height=n,a._pixiId=`canvas_${fe()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=ri.SVG_SIZE.exec(t),s={};return e&&(s[e[1]]=Math.round(parseFloat(e[3])),s[e[5]]=Math.round(parseFloat(e[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&ri.SVG_XML.test(t)}};Nr.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Lr=Nr;class jc extends ne{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Ur=class kr extends ne{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");e.autoLoad!==!1&&s.setAttribute("preload","auto"),e.playsinline!==!1&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),e.muted===!0&&(s.setAttribute("muted",""),s.muted=!0),e.loop===!0&&s.setAttribute("loop",""),e.autoPlay!==!1&&s.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const r=t[0].src||t[0];ne.crossOrigin(s,r,e.crossorigin);for(let n=0;n{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&&(vt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(vt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(vt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||kr.TYPES.includes(e)}};Ur.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ur.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let ch=Ur;wr.push(Ve,No,Xc,ch,jc,Lr,Ri,Vc,Hc);class jm{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new Pt("disposeTransformFeedback")}bindBuffer(t,e){this.buffers[t]=e}destroy(){this.disposeRunner.emit(this,!1)}}const zm="7.4.2";class gi{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?j.EMPTY:(t=t||new j(0,0,1,1),t.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:r,c:n,d:a,tx:o,ty:h}=t,l=s*e.x+n*e.y+o,u=r*e.x+a*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,s=this.minY,r=this.maxX,n=this.maxY,a=t[0],o=t[1];e=ar?a:r,n=o>n?o:n,a=t[2],o=t[3],e=ar?a:r,n=o>n?o:n,a=t[4],o=t[5],e=ar?a:r,n=o>n?o:n,a=t[6],o=t[7],e=ar?a:r,n=o>n?o:n,this.minX=e,this.minY=s,this.maxX=r,this.maxY=n}addFrame(t,e,s,r,n){this.addFrameMatrix(t.worldTransform,e,s,r,n)}addFrameMatrix(t,e,s,r,n){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,g=a*e+h*s+u,v=o*e+l*s+c;d=gp?g:p,m=v>m?v:m,g=a*r+h*s+u,v=o*r+l*s+c,d=gp?g:p,m=v>m?v:m,g=a*e+h*n+u,v=o*e+l*n+c,d=gp?g:p,m=v>m?v:m,g=a*r+h*n+u,v=o*r+l*n+c,d=gp?g:p,m=v>m?v:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let r=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let h=e;ha?l:a,o=u>o?u:o}this.minX=r,this.minY=n,this.maxX=a,this.maxY=o}addVertices(t,e,s,r){this.addVerticesMatrix(t.worldTransform,e,s,r)}addVerticesMatrix(t,e,s,r,n=0,a=n){const o=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let v=s;vr?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxXl?n:l,this.maxY=a>u?a:u}}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,r=t.minY>e.y?t.minY:e.y,n=t.maxXl?n:l,this.maxY=a>u?a:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,r,n,a){t-=n,e-=a,s+=n,r+=a,this.minX=this.minXs?this.maxX:s,this.minY=this.minYr?this.maxY:r}}class it extends Qe{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new pn,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 gi,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;s1)for(let e=0;ethis.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),r=this.getChildIndex(e);this.children[s]=e,this.children[r]=t,this.onChildrenChange(s=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);Ie(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;e0&&n<=r){a=this.children.splice(s,n);for(let o=0;o1&&this.children.sort(Yc),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;t0&&e.height>0))return;let s,r;this.cullArea?(s=this.cullArea,r=this.worldTransform):this._render!==Gr.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=Wc.copyFrom(r),r.prepend(n)):r=n),s&&e.intersects(s,r))this._render(t);else if(this.cullArea)return;for(let a=0,o=this.children.length;a=r&&as.x=n&&as.y=e&&(a=i-o-1),h=h.replace("%value%",t[a].toString()),r+=h,r+=` `}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}const sd=` attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; uniform float strength; varying vec2 vBlurTexCoords[%size%]; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vec2 textureCoord = filterTextureCoord(); %blur% }`;function id(i,t){const e=Math.ceil(i/2);let s=sd,r="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a 0.0) { c.rgb /= c.a; } vec4 result; result.r = (m[0] * c.r); result.r += (m[1] * c.g); result.r += (m[2] * c.b); result.r += (m[3] * c.a); result.r += m[4]; result.g = (m[5] * c.r); result.g += (m[6] * c.g); result.g += (m[7] * c.b); result.g += (m[8] * c.a); result.g += m[9]; result.b = (m[10] * c.r); result.b += (m[11] * c.g); result.b += (m[12] * c.b); result.b += (m[13] * c.a); result.b += m[14]; result.a = (m[15] * c.r); result.a += (m[16] * c.g); result.a += (m[17] * c.b); result.a += (m[18] * c.a); result.a += m[19]; vec3 rgb = mix(c.rgb, result.rgb, uAlpha); // Premultiply alpha again. rgb *= result.a; gl_FragColor = vec4(rgb, result.a); } `;class Hr extends bt{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(nh,nd,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,r,n]=K.shared.setValue(t).toArray(),a=[s,0,0,0,0,0,r,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),r=Math.sin(t),n=Math.sqrt,a=1/3,o=n(a),h=s+(1-s)*a,l=a*(1-s)-o*r,u=a*(1-s)+o*r,c=a*(1-s)+o*r,d=s+a*(1-s),f=a*(1-s)-o*r,p=a*(1-s)-o*r,m=a*(1-s)+o*r,g=s+a*(1-s),v=[h,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(v,e)}contrast(t,e){const s=(t||0)+1,r=-.5*(s-1),n=[s,0,0,0,r,0,s,0,0,r,0,0,s,0,r,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,r=(s-1)*-.5,n=[s,r,r,0,0,r,s,r,0,0,r,r,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,r,n){t=t||.2,e=e||.15,s=s||16770432,r=r||3375104;const a=K.shared,[o,h,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(r).toArray(),f=[.3,.59,.11,0,0,o,h,l,t,0,u,c,d,e,0,o-u,h-c,l-d,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const s=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,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){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!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}}Hr.prototype.grayscale=Hr.prototype.greyscale;var ad=`varying vec2 vFilterCoord; varying vec2 vTextureCoord; uniform vec2 scale; uniform mat2 rotation; uniform sampler2D uSampler; uniform sampler2D mapSampler; uniform highp vec4 inputSize; uniform vec4 inputClamp; void main(void) { vec4 map = texture2D(mapSampler, vFilterCoord); map -= 0.5; map.xy = scale * inputSize.zw * (rotation * map.xy); gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw)); } `,od=`attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; uniform mat3 filterMatrix; varying vec2 vTextureCoord; varying vec2 vFilterCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vTextureCoord = filterTextureCoord(); vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy; } `;class hd extends bt{constructor(t,e){const s=new tt;t.renderable=!1,super(od,ad,{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=s,e==null&&(e=20),this.scale=new q(e,e)}apply(t,e,s,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&o!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,s,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var ld=`varying vec2 v_rgbNW; varying vec2 v_rgbNE; varying vec2 v_rgbSW; varying vec2 v_rgbSE; varying vec2 v_rgbM; varying vec2 vFragCoord; uniform sampler2D uSampler; uniform highp vec4 inputSize; /** Basic FXAA implementation based on the code on geeks3d.com with the modification that the texture2DLod stuff was removed since it's unsupported by WebGL. -- From: https://github.com/mitsuhiko/webgl-meincraft Copyright (c) 2011 by Armin Ronacher. Some rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef FXAA_REDUCE_MIN #define FXAA_REDUCE_MIN (1.0/ 128.0) #endif #ifndef FXAA_REDUCE_MUL #define FXAA_REDUCE_MUL (1.0 / 8.0) #endif #ifndef FXAA_SPAN_MAX #define FXAA_SPAN_MAX 8.0 #endif //optimized version for mobile, where dependent //texture reads can be a bottleneck vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP, vec2 v_rgbNW, vec2 v_rgbNE, vec2 v_rgbSW, vec2 v_rgbSE, vec2 v_rgbM) { vec4 color; vec3 rgbNW = texture2D(tex, v_rgbNW).xyz; vec3 rgbNE = texture2D(tex, v_rgbNE).xyz; vec3 rgbSW = texture2D(tex, v_rgbSW).xyz; vec3 rgbSE = texture2D(tex, v_rgbSE).xyz; vec4 texColor = texture2D(tex, v_rgbM); vec3 rgbM = texColor.xyz; vec3 luma = vec3(0.299, 0.587, 0.114); float lumaNW = dot(rgbNW, luma); float lumaNE = dot(rgbNE, luma); float lumaSW = dot(rgbSW, luma); float lumaSE = dot(rgbSE, luma); float lumaM = dot(rgbM, luma); float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); mediump vec2 dir; dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * inverseVP; vec3 rgbA = 0.5 * ( texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); vec3 rgbB = rgbA * 0.5 + 0.25 * ( texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz); float lumaB = dot(rgbB, luma); if ((lumaB < lumaMin) || (lumaB > lumaMax)) color = vec4(rgbA, texColor.a); else color = vec4(rgbB, texColor.a); return color; } void main() { vec4 color; color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); gl_FragColor = color; } `,ud=` attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; varying vec2 v_rgbNW; varying vec2 v_rgbNE; varying vec2 v_rgbSW; varying vec2 v_rgbSE; varying vec2 v_rgbM; varying vec2 vFragCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } void texcoords(vec2 fragCoord, vec2 inverseVP, out vec2 v_rgbNW, out vec2 v_rgbNE, out vec2 v_rgbSW, out vec2 v_rgbSE, out vec2 v_rgbM) { v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; v_rgbM = vec2(fragCoord * inverseVP); } void main(void) { gl_Position = filterVertexPosition(); vFragCoord = aVertexPosition * outputFrame.zw; texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); } `;class cd extends bt{constructor(){super(ud,ld)}}var dd=`precision highp float; varying vec2 vTextureCoord; varying vec4 vColor; uniform float uNoise; uniform float uSeed; uniform sampler2D uSampler; float rand(vec2 co) { return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); } void main() { vec4 color = texture2D(uSampler, vTextureCoord); float randomValue = rand(gl_FragCoord.xy * uSeed); float diff = (randomValue - 0.5) * uNoise; // Un-premultiply alpha before applying the color matrix. See issue #3539. if (color.a > 0.0) { color.rgb /= color.a; } color.r += diff; color.g += diff; color.b += diff; // Premultiply alpha again. color.rgb *= color.a; gl_FragColor = color; } `;class fd extends bt{constructor(t=.5,e=Math.random()){super(nh,dd,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const ma={AlphaFilter:Qc,BlurFilter:rd,BlurFilterPass:$r,ColorMatrixFilter:Hr,DisplacementFilter:hd,FXAAFilter:cd,NoiseFilter:fd};Object.entries(ma).forEach(([i,t])=>{Object.defineProperty(ma,i,{get(){return fo("7.1.0",`filters.${i} has moved to ${i}`),t}})});let pd=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||(vt.system.add(this.tickerUpdate,this,me.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(vt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTimes.priority-r.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,r=e.length;s=0;r--)if(t.currentTarget=s[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,r,n,a||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:o?this._hitElements:h&&!n(t,s)&&r(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,r,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(ue.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,r,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const a=this._isInteractive(e),o=t.isInteractive();return a&&r(t,s)?o?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,tr),!t.hitArea.contains(tr.x,tr.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((s=r.containsPoint)!=null&&s.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var s,r;e=e!=null?e:t.type;const n=`on${e}`;(r=(s=t.currentTarget)[n])==null||r.call(s,t);const a=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,a),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,s,r;if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const n=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const a=n.pointerType==="mouse"||n.pointerType==="pen",o=this.trackingData(t.pointerId),h=this.findMountedTarget(o.overTargets);if(((e=o.overTargets)==null?void 0:e.length)>0&&h!==n.target){const c=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,c,h);if(this.dispatchEvent(d,"pointerout"),a&&this.dispatchEvent(d,"mouseout"),!n.composedPath().includes(h)){const f=this.createPointerEvent(t,"pointerleave",h);for(f.eventPhase=f.AT_TARGET;f.target&&!n.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),a&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(d)}if(h!==n.target){const c=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(n,c);this.dispatchEvent(d,"pointerover"),a&&this.dispatchEvent(d,"mouseover");let f=h==null?void 0:h.parent;for(;f&&f!==this.rootTarget.parent&&f!==n.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const p=this.clonePointerEvent(n,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==h&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),a&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(d)}const l=[],u=(s=this.enableGlobalMoveEvents)!=null?s:!0;this.moveOnAll?l.push("pointermove"):this.dispatchEvent(n,"pointermove"),u&&l.push("globalpointermove"),n.pointerType==="touch"&&(this.moveOnAll?l.splice(1,0,"touchmove"):this.dispatchEvent(n,"touchmove"),u&&l.push("globaltouchmove")),a&&(this.moveOnAll?l.splice(1,0,"mousemove"):this.dispatchEvent(n,"mousemove"),u&&l.push("globalmousemove"),this.cursor=(r=n.target)==null?void 0:r.cursor),l.length>0&&this.all(n,l),this._allInteractiveElements.length=0,this._hitElements.length=0,o.overTargets=n.composedPath(),this.freeEvent(n)}mapPointerOver(t){var e;if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t),n=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),n&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=(e=r.target)==null?void 0:e.cursor);const a=this.clonePointerEvent(r,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),n&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(a)}mapPointerOut(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const s=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.dispatchEvent(s,o?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let o=n;for(;o&&!s.composedPath().includes(o);){if(s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete r.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(s,"click");o.target=a,o.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const h=r.clicksByButton[t.button];if(h.target===o.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=o.target,h.timeStamp=e,o.detail=h.clickCount,o.pointerType==="mouse"){const l=o.button===2;this.dispatchEvent(o,l?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(s){let n=s;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof qe)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}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;st in i?vd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bd=(i,t)=>{for(var e in t||(t={}))yd.call(t,e)&&_a(i,e,t[e]);if(ga)for(var e of ga(t))xd.call(t,e)&&_a(i,e,t[e]);return i};const Ed=1,Td={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Xr=class Vr{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new _d(null),ue.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ft(null),this.rootWheelEvent=new qe(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(bd({},Vr.defaultEventFeatures),{set:(e,s,r)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[s]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){var e,s;const{view:r,resolution:n}=this.renderer;this.setTargetElement(r),this.resolution=n,Vr._defaultEventMode=(e=t.eventMode)!=null?e:"auto",Object.assign(this.features,(s=t.eventFeatures)!=null?s:{}),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);break}else e&&typeof t=="string"&&!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,r=e.length;s0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n{h.off(i,o,a)}),n?h.once(i,o,a):h.on(i,o,a)},removeEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;i=s?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,r)},dispatchEvent(i){if(!(i instanceof Cs))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};it.mixin(Ad);const wd={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};it.mixin(wd);const Sd=9,js=100,Rd=0,Id=0,ya=2,xa=1,Cd=-1e3,Pd=-1e3,Md=2;class ph{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,(Yt.tablet||Yt.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${js}px`,e.style.height=`${js}px`,e.style.position="absolute",e.style.top=`${Rd}px`,e.style.left=`${Id}px`,e.style.zIndex=ya.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=`${xa}px`,t.style.height=`${xa}px`,t.style.position="absolute",t.style.top=`${Cd}px`,t.style.left=`${Pd}px`,t.style.zIndex=Md.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(){var t;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),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!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),(t=this.div.parentNode)==null||t.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 title : ${t.title}
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=`${js}px`,e.style.height=`${js}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=ya.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&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&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,r=this.renderer.events.rootBoundary,n=Object.assign(new Cs(r),{target:s});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>r.dispatchEvent(n,a))}_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){t.keyCode===Sd&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||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}}ph.extension={name:"accessibility",type:[C.RendererPlugin,C.CanvasRendererPlugin]};N.add(ph);const mh=class zr{constructor(t){this.stage=new Mt,t=Object.assign({forceCanvas:!1},t),this.renderer=Lc(t),zr._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const s=zr._plugins.slice(0);s.reverse(),s.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};mh._plugins=[];let Dd=mh;N.handleByList(C.Application,Dd._plugins);class gh{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(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;this.cancelResize();let e,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,s=n}this.renderer.resize(e,s),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}}gh.extension=C.Application;N.add(gh);const ba={loader:C.LoadParser,resolver:C.ResolveParser,cache:C.CacheParser,detection:C.DetectionParser};N.handle(C.Asset,i=>{const t=i.ref;Object.entries(ba).filter(([e])=>!!t[e]).forEach(([e,s])=>{var r;return N.add(Object.assign(t[e],{extension:(r=t[e].extension)!=null?r:s}))})},i=>{const t=i.ref;Object.keys(ba).filter(e=>!!t[e]).forEach(e=>N.remove(t[e]))});class Od{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),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(Array.isArray(i)||(i=[i]),t?i.map(s=>typeof s=="string"||e?t(s):s):i),Wr=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function _h(i,t,e,s,r){const n=t[e];for(let a=0;a{const a=n.substring(1,n.length-1).split(",");r.push(a)}),_h(i,r,0,e,s)}else s.push(i);return s}const vi=i=>!Array.isArray(i);let Fd=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){return this._cache.get(t)}set(t,e){const s=Nt(t);let r;for(let o=0;o{r[o]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:s};if(s.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o),this._cache.set(o,r[o])}),e instanceof D){const o=e;s.forEach(h=>{o.baseTexture!==D.EMPTY.baseTexture&&X.addToCache(o.baseTexture,h),D.addToCache(o,h)})}}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}};const Re=new Fd;var Nd=Object.defineProperty,Ld=Object.defineProperties,Ud=Object.getOwnPropertyDescriptors,Ea=Object.getOwnPropertySymbols,kd=Object.prototype.hasOwnProperty,Gd=Object.prototype.propertyIsEnumerable,Ta=(i,t,e)=>t in i?Nd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$d=(i,t)=>{for(var e in t||(t={}))kd.call(t,e)&&Ta(i,e,t[e]);if(Ea)for(var e of Ea(t))Gd.call(t,e)&&Ta(i,e,t[e]);return i},Hd=(i,t)=>Ld(i,Ud(t));class Xd{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()=>{var r,n;let a=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser]),!o){for(let h=0;h({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const u=ct.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),r[l.src]=await this.promiseCache[u].promise,e&&e(++s/o)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}. ${c}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=Nt(t,s=>({alias:[s],src:s})).map(async s=>{var r,n;const a=ct.toAbsolute(s.src),o=this.promiseCache[a];if(o){const h=await o.promise;delete this.promiseCache[a],(n=(r=o.parser)==null?void 0:r.unload)==null||n.call(r,h,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name],Hd($d({},t),{[e.name]:e})),{})}}var Ut=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Ut||{});const Vd=".json",jd="application/json",zd={extension:{type:C.LoadParser,priority:Ut.Low},name:"loadJson",test(i){return Je(i,jd)||ve(i,Vd)},async load(i){return await(await O.ADAPTER.fetch(i)).json()}};N.add(zd);const Wd=".txt",Yd="text/plain",qd={name:"loadTxt",extension:{type:C.LoadParser,priority:Ut.Low},test(i){return Je(i,Yd)||ve(i,Wd)},async load(i){return await(await O.ADAPTER.fetch(i)).text()}};N.add(qd);var Kd=Object.defineProperty,Zd=Object.defineProperties,Qd=Object.getOwnPropertyDescriptors,Aa=Object.getOwnPropertySymbols,Jd=Object.prototype.hasOwnProperty,tf=Object.prototype.propertyIsEnumerable,wa=(i,t,e)=>t in i?Kd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ef=(i,t)=>{for(var e in t||(t={}))Jd.call(t,e)&&wa(i,e,t[e]);if(Aa)for(var e of Aa(t))tf.call(t,e)&&wa(i,e,t[e]);return i},sf=(i,t)=>Zd(i,Qd(t));const rf=["normal","bold","100","200","300","400","500","600","700","800","900"],nf=[".ttf",".otf",".woff",".woff2"],af=["font/ttf","font/otf","font/woff","font/woff2"],of=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function hf(i){const t=ct.extname(i),e=ct.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(of)){s=!1;break}let r=e.join(" ");return s||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const lf=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function uf(i){return lf.test(i)?i:encodeURI(i)}const cf={extension:{type:C.LoadParser,priority:Ut.Low},name:"loadWebFont",test(i){return Je(i,af)||ve(i,nf)},async load(i,t){var e,s,r,n,a,o;const h=O.ADAPTER.getFontFaceSet();if(h){const l=[],u=(s=(e=t.data)==null?void 0:e.family)!=null?s:hf(i),c=(a=(n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(f=>rf.includes(f)))!=null?a:["normal"],d=(o=t.data)!=null?o:{};for(let f=0;fO.ADAPTER.getFontFaceSet().delete(t))}};N.add(cf);const df=`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})(); `;let Ke=null,Yr=class{constructor(){Ke||(Ke=URL.createObjectURL(new Blob([df],{type:"application/javascript"}))),this.worker=new Worker(Ke)}};Yr.revokeObjectURL=function(){Ke&&(URL.revokeObjectURL(Ke),Ke=null)};const ff='(function(){"use strict";async function e(t){const a=await fetch(t);if(!a.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${t}: ${a.status} ${a.statusText}`);const s=await a.blob();return await createImageBitmap(s)}self.onmessage=async t=>{try{const a=await e(t.data.data[0]);self.postMessage({data:a,uuid:t.data.uuid,id:t.data.id},[a])}catch(a){self.postMessage({error:a,uuid:t.data.uuid,id:t.data.id})}}})();\n';let Ze=null;class vh{constructor(){Ze||(Ze=URL.createObjectURL(new Blob([ff],{type:"application/javascript"}))),this.worker=new Worker(Ze)}}vh.revokeObjectURL=function(){Ze&&(URL.revokeObjectURL(Ze),Ze=null)};let Sa=0,er,pf=class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new Yr;e.addEventListener("message",s=>{e.terminate(),Yr.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){er===void 0&&(er=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise((r,n)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[Sa]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Sa++,id:s})}};const Ra=new pf;function Ps(i,t,e){i.resource.internal=!0;const s=new D(i),r=()=>{delete t.promiseCache[e],Re.has(e)&&Re.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),r())}),s.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),s}var mf=Object.defineProperty,Ia=Object.getOwnPropertySymbols,gf=Object.prototype.hasOwnProperty,_f=Object.prototype.propertyIsEnumerable,Ca=(i,t,e)=>t in i?mf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Pa=(i,t)=>{for(var e in t||(t={}))gf.call(t,e)&&Ca(i,e,t[e]);if(Ia)for(var e of Ia(t))_f.call(t,e)&&Ca(i,e,t[e]);return i};const vf=[".jpeg",".jpg",".png",".webp",".avif"],yf=["image/jpeg","image/png","image/webp","image/avif"];async function xf(i){const t=await O.ADAPTER.fetch(i);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Ci={name:"loadTextures",extension:{type:C.LoadParser,priority:Ut.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return Je(i,yf)||ve(i,vf)},async load(i,t,e){var s,r;const n=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let a;n?this.config.preferWorkers&&await Ra.isImageBitmapSupported()?a=await Ra.loadImageBitmap(i):a=await xf(i):a=await new Promise((l,u)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=i,c.complete?l(c):(c.onload=()=>l(c),c.onerror=d=>u(d))});const o=Pa({},t.data);(s=o.resolution)!=null||(o.resolution=Qt(i)),n&&((r=o.resourceOptions)==null?void 0:r.ownsImageBitmap)===void 0&&(o.resourceOptions=Pa({},o.resourceOptions),o.resourceOptions.ownsImageBitmap=!0);const h=new X(a,o);return h.resource.src=i,Ps(h,e,i)},unload(i){i.destroy(!0)}};N.add(Ci);var bf=Object.defineProperty,Ma=Object.getOwnPropertySymbols,Ef=Object.prototype.hasOwnProperty,Tf=Object.prototype.propertyIsEnumerable,Da=(i,t,e)=>t in i?bf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Af=(i,t)=>{for(var e in t||(t={}))Ef.call(t,e)&&Da(i,e,t[e]);if(Ma)for(var e of Ma(t))Tf.call(t,e)&&Da(i,e,t[e]);return i};const wf=".svg",Sf="image/svg+xml",Rf={extension:{type:C.LoadParser,priority:Ut.High},name:"loadSVG",test(i){return Je(i,Sf)||ve(i,wf)},async testParse(i){return Lr.test(i)},async parse(i,t,e){var s;const r=new Lr(i,(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions);await r.load();const n=new X(r,Af({resolution:Qt(i)},t==null?void 0:t.data));return n.resource.src=t.src,Ps(n,e,t.src)},async load(i,t){return(await O.ADAPTER.fetch(i)).text()},unload:Ci.unload};N.add(Rf);var If=Object.defineProperty,Cf=Object.defineProperties,Pf=Object.getOwnPropertyDescriptors,Oa=Object.getOwnPropertySymbols,Mf=Object.prototype.hasOwnProperty,Df=Object.prototype.propertyIsEnumerable,Ba=(i,t,e)=>t in i?If(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fa=(i,t)=>{for(var e in t||(t={}))Mf.call(t,e)&&Ba(i,e,t[e]);if(Oa)for(var e of Oa(t))Df.call(t,e)&&Ba(i,e,t[e]);return i},Of=(i,t)=>Cf(i,Pf(t));const Bf=[".mp4",".m4v",".webm",".ogv"],Ff=["video/mp4","video/webm","video/ogg"],Nf={name:"loadVideo",extension:{type:C.LoadParser,priority:Ut.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(i){return Je(i,Ff)||ve(i,Bf)},async load(i,t,e){var s;let r;const n=await(await O.ADAPTER.fetch(i)).blob(),a=URL.createObjectURL(n);try{const o=Of(Fa({autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline},(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions),{autoLoad:!0}),h=new ch(a,o);await h.load();const l=new X(h,Fa({alphaMode:await po(),resolution:Qt(i)},t==null?void 0:t.data));l.resource.src=i,r=Ps(l,e,i),r.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(a)})}catch(o){throw URL.revokeObjectURL(a),o}return r},unload(i){i.destroy(!0)}};N.add(Nf);var Lf=Object.defineProperty,Uf=Object.defineProperties,kf=Object.getOwnPropertyDescriptors,Na=Object.getOwnPropertySymbols,Gf=Object.prototype.hasOwnProperty,$f=Object.prototype.propertyIsEnumerable,La=(i,t,e)=>t in i?Lf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fe=(i,t)=>{for(var e in t||(t={}))Gf.call(t,e)&&La(i,e,t[e]);if(Na)for(var e of Na(t))$f.call(t,e)&&La(i,e,t[e]);return i},Ua=(i,t)=>Uf(i,kf(t));class Hf{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){var e,s,r;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(s=t.createBundleAssetId)!=null?s:this._createBundleAssetId,this._extractAssetIdFromBundle=(r=t.extractAssetIdFromBundle)!=null?r:this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,name:s,src:r,srcs:n}=t;return Nt(e||s||r||n,a=>{var o;return typeof a=="string"?a:Array.isArray(a)?a.map(h=>{var l,u;return(u=(l=h==null?void 0:h.src)!=null?l:h==null?void 0:h.srcs)!=null?u:h}):a!=null&&a.src||a!=null&&a.srcs?(o=a.src)!=null?o:a.srcs:a},!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(r=>{var n,a;const o=(n=r.src)!=null?n:r.srcs,h=(a=r.alias)!=null?a:r.name;let l;if(typeof h=="string"){const u=this._createBundleAssetId(t,h);s.push(u),l=[h,u]}else{const u=h.map(c=>this._createBundleAssetId(t,c));s.push(...u),l=[...h,...u]}this.add(Ua(Fe({},r),{alias:l,src:o}))}):Object.keys(e).forEach(r=>{var n;const a=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:a,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:a,src:e[r]});else{const o=e[r],h=(n=o.src)!=null?n:o.srcs;this.add(Ua(Fe({},o),{alias:a,src:Array.isArray(h)?h:[h]}))}s.push(...a)}),this._bundles[t]=s}add(t,e,s,r,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?a.push({alias:t,src:e,data:s,format:r,loadParser:n}):Array.isArray(t)?a.push(...t):a.push(t);let o;Nt(a).forEach(h=>{const{src:l,srcs:u}=h;let{data:c,format:d,loadParser:f}=h;const p=Nt(l||u).map(v=>typeof v=="string"?Bd(v):Array.isArray(v)?v:[v]),m=this.getAlias(h),g=[];p.forEach(v=>{v.forEach(x=>{var _,y,E;let P={};if(typeof x!="object"){P.src=x;for(let w=0;w{this._assetMap[v]=g})})}resolveBundle(t){const e=vi(t);t=Nt(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(r,h)]=l}s[r]=o}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const r in e)s[r]=e[r].src;return s}return e.src}resolve(t){const e=vi(t);t=Nt(t);const s={};return t.forEach(r=>{var n;if(!this._resolverHash[r])if(this._assetMap[r]){let a=this._assetMap[r];const o=a[0],h=this._getPreferredOrder(a);h==null||h.priority.forEach(l=>{h.params[l].forEach(u=>{const c=a.filter(d=>d[l]?d[l]===u:!1);c.length&&(a=c)})}),this._resolverHash[r]=(n=a[0])!=null?n:o}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){var s,r;const{aliases:n,data:a,loadParser:o,format:h}=e;return(this._basePath||this._rootPath)&&(t.src=ct.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(s=n!=null?n:t.alias)!=null?s:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=Fe(Fe({},a||{}),t.data),t.loadParser=o!=null?o:t.loadParser,t.format=(r=h!=null?h:t.format)!=null?r:ct.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class Xf{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Hf,this.loader=new Xd,this.cache=Re,this._backgroundLoader=new Od(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,s,r;if(this._initialized)return;if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const n=(s=(e=t.texturePreference)==null?void 0:e.resolution)!=null?s:1,a=typeof n=="number"?[n]:n,o=await this._detectFormats({preferredFormats:(r=t.texturePreference)==null?void 0:r.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:a}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,r,n){this.resolver.add(t,e,s,r,n)}async load(t,e){this._initialized||await this.init();const s=vi(t),r=Nt(t).map(o=>{if(typeof o!="string"){const h=this.resolver.getAlias(o);return h.some(l=>!this.resolver.hasKey(l))&&this.add(o),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return s?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let o=0,h=0;const l=()=>{e==null||e(++o/h)},u=a.map(c=>{const d=r[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[c]=f})});return await Promise.all(u),s?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Re.get(t);const e={};for(let s=0;s{const l=n[o.src],u=[o.src];o.alias&&u.push(...o.alias),a[r[h]]=l,Re.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=Nt(t).map(r=>typeof r!="string"?r.src:r),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Nt(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Re.remove(s.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((s,r)=>e.indexOf(s)===r),e}get detections(){return this._detections}get preferWorkers(){return Ci.config.preferWorkers}set preferWorkers(t){this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const zs=new Xf;N.handleByList(C.LoadParser,zs.loader.parsers).handleByList(C.ResolveParser,zs.resolver.parsers).handleByList(C.CacheParser,zs.cache.parsers).handleByList(C.DetectionParser,zs.detections);const Vf={extension:C.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof D),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};N.add(Vf);async function yh(i){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(i)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}const jf={extension:{type:C.DetectionParser,priority:1},test:async()=>yh("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};N.add(jf);const zf={extension:{type:C.DetectionParser,priority:0},test:async()=>yh("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};N.add(zf);const ka=["png","jpg","jpeg"],Wf={extension:{type:C.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...ka],remove:async i=>i.filter(t=>!ka.includes(t))};N.add(Wf);const Yf="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function _n(i){return Yf?!1:document.createElement("video").canPlayType(i)!==""}const qf={extension:{type:C.DetectionParser,priority:0},test:async()=>_n("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};N.add(qf);const Kf={extension:{type:C.DetectionParser,priority:0},test:async()=>_n("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};N.add(Kf);const Zf={extension:{type:C.DetectionParser,priority:0},test:async()=>_n("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};N.add(Zf);const Qf={extension:C.ResolveParser,test:Ci.test,parse:i=>{var t,e;return{resolution:parseFloat((e=(t=O.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:ct.extname(i).slice(1),src:i}}};N.add(Qf);var gt=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i))(gt||{});const yi={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 Ht,Ge;function Ga(){Ge={bptc:Ht.getExtension("EXT_texture_compression_bptc"),astc:Ht.getExtension("WEBGL_compressed_texture_astc"),etc:Ht.getExtension("WEBGL_compressed_texture_etc"),s3tc:Ht.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ht.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Ht.getExtension("WEBGL_compressed_texture_pvrtc")||Ht.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Ht.getExtension("WEBGL_compressed_texture_etc1"),atc:Ht.getExtension("WEBGL_compressed_texture_atc")}}const Jf={extension:{type:C.DetectionParser,priority:2},test:async()=>{const i=O.ADAPTER.createCanvas().getContext("webgl");return i?(Ht=i,!0):!1},add:async i=>{Ge||Ga();const t=[];for(const e in Ge)Ge[e]&&t.push(e);return[...t,...i]},remove:async i=>(Ge||Ga(),i.filter(t=>!(t in Ge)))};N.add(Jf);class tp extends Ri{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,r;typeof t=="string"?(s=t,r=new Uint8Array):(s=null,r=t),super(r,e),this.origin=s,this.buffer=r?new Ar(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?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 Ar(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ce extends tp{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=Ce._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ce._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const r=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;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n=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(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,s,r,n,a,o){const h=new Array(s);let l=t.byteOffset,u=a,c=o,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*yi[e];for(let m=0;m1?u:d,levelHeight:s>1?c:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,u=u>>1||1,c=c>>1||1,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*yi[e];return h}}const sr=4,Ws=124,ep=32,$a=20,sp=542327876,Ys={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},ip={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},qs={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},rp=1,np=2,ap=4,op=64,hp=512,lp=131072,up=827611204,cp=861165636,dp=894720068,fp=808540228,pp=4,mp={[up]:gt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[cp]:gt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[dp]:gt.COMPRESSED_RGBA_S3TC_DXT5_EXT},gp={70:gt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:gt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:gt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:gt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:gt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:gt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:gt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:gt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:gt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:gt.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:gt.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:gt.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:gt.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function _p(i){const t=new Uint32Array(i);if(t[0]!==sp)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,Ws/Uint32Array.BYTES_PER_ELEMENT),s=e[Ys.HEIGHT],r=e[Ys.WIDTH],n=e[Ys.MIPMAP_COUNT],a=new Uint32Array(i,Ys.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,ep/Uint32Array.BYTES_PER_ELEMENT),o=a[rp];if(o&ap){const h=a[ip.FOURCC];if(h!==fp){const x=mp[h],_=sr+Ws,y=new Uint8Array(i,_);return[new Ce(y,{format:x,width:r,height:s,levels:n})]}const l=sr+Ws,u=new Uint32Array(t.buffer,l,$a/Uint32Array.BYTES_PER_ELEMENT),c=u[qs.DXGI_FORMAT],d=u[qs.RESOURCE_DIMENSION],f=u[qs.MISC_FLAG],p=u[qs.ARRAY_SIZE],m=gp[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===pp)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,v=sr+Ws+$a;if(p===1)g.push(new Uint8Array(i,v));else{const x=yi[m];let _=0,y=r,E=s;for(let w=0;w>>1,E=E>>>1}let P=v;for(let w=0;wnew Ce(x,{format:m,width:r,height:s,levels:n}))}throw o&op?new Error("DDSParser does not support uncompressed texture data."):o&hp?new Error("DDSParser does not supported YUV uncompressed texture data."):o&lp?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&np?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!")}const Ha=[171,75,84,88,32,49,49,187,13,10,26,10],vp=67305985,Ot={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},qr=64,Xa={[U.UNSIGNED_BYTE]:1,[U.UNSIGNED_SHORT]:2,[U.INT]:4,[U.UNSIGNED_INT]:4,[U.FLOAT]:4,[U.HALF_FLOAT]:8},yp={[T.RGBA]:4,[T.RGB]:3,[T.RG]:2,[T.RED]:1,[T.LUMINANCE]:1,[T.LUMINANCE_ALPHA]:2,[T.ALPHA]:1},xp={[U.UNSIGNED_SHORT_4_4_4_4]:2,[U.UNSIGNED_SHORT_5_5_5_1]:2,[U.UNSIGNED_SHORT_5_6_5]:2};function bp(i,t,e=!1){const s=new DataView(t);if(!Ep(i,s))return null;const r=s.getUint32(Ot.ENDIANNESS,!0)===vp,n=s.getUint32(Ot.GL_TYPE,r),a=s.getUint32(Ot.GL_FORMAT,r),o=s.getUint32(Ot.GL_INTERNAL_FORMAT,r),h=s.getUint32(Ot.PIXEL_WIDTH,r),l=s.getUint32(Ot.PIXEL_HEIGHT,r)||1,u=s.getUint32(Ot.PIXEL_DEPTH,r)||1,c=s.getUint32(Ot.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(Ot.NUMBER_OF_FACES,r),f=s.getUint32(Ot.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(Ot.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,v=h+3&-4,x=l+3&-4,_=new Array(c);let y=h*l;n===0&&(y=v*x);let E;if(n!==0?Xa[n]?E=Xa[n]*yp[a]:E=xp[n]:E=yi[o],E===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const P=e?Ap(s,p,r):null;let w=y*E,A=h,B=l,k=v,W=x,F=qr+p;for(let b=0;b1||n!==0?A:k,levelHeight:f>1||n!==0?B:W,levelBuffer:new Uint8Array(t,G,w)},G+=w}F+=S+4,F=F%4!==0?F+4-F%4:F,A=A>>1||1,B=B>>1||1,k=A+m-1&~(m-1),W=B+g-1&~(g-1),w=k*W*E}return n!==0?{uncompressed:_.map(b=>{let S=b[0].levelBuffer,G=!1;return n===U.FLOAT?S=new Float32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4):n===U.UNSIGNED_INT?(G=!0,S=new Uint32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)):n===U.INT&&(G=!0,S=new Int32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)),{resource:new Ri(S,{width:b[0].levelWidth,height:b[0].levelHeight}),type:n,format:G?Tp(a):a}}),kvData:P}:{compressed:_.map(b=>new Ce(null,{format:o,width:h,height:l,levels:f,levelBuffers:b})),kvData:P}}function Ep(i,t){for(let e=0;et-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;ht in i?wp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ip=(i,t)=>{for(var e in t||(t={}))Sp.call(t,e)&&ja(i,e,t[e]);if(Va)for(var e of Va(t))Rp.call(t,e)&&ja(i,e,t[e]);return i};const Cp={extension:{type:C.LoadParser,priority:Ut.High},name:"loadDDS",test(i){return ve(i,".dds")},async load(i,t,e){const s=await(await O.ADAPTER.fetch(i)).arrayBuffer(),r=_p(s).map(n=>{const a=new X(n,Ip({mipmap:Zt.OFF,alphaMode:Et.NO_PREMULTIPLIED_ALPHA,resolution:Qt(i)},t.data));return Ps(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};N.add(Cp);var Pp=Object.defineProperty,za=Object.getOwnPropertySymbols,Mp=Object.prototype.hasOwnProperty,Dp=Object.prototype.propertyIsEnumerable,Wa=(i,t,e)=>t in i?Pp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Op=(i,t)=>{for(var e in t||(t={}))Mp.call(t,e)&&Wa(i,e,t[e]);if(za)for(var e of za(t))Dp.call(t,e)&&Wa(i,e,t[e]);return i};const Bp={extension:{type:C.LoadParser,priority:Ut.High},name:"loadKTX",test(i){return ve(i,".ktx")},async load(i,t,e){const s=await(await O.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=bp(i,s),o=r!=null?r:n,h=Op({mipmap:Zt.OFF,alphaMode:Et.NO_PREMULTIPLIED_ALPHA,resolution:Qt(i)},t.data),l=o.map(u=>{var c;o===n&&Object.assign(h,{type:u.type,format:u.format});const d=(c=u.resource)!=null?c:u,f=new X(d,h);return f.ktxKeyValueData=a,Ps(f,e,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};N.add(Bp);const Fp=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],Np={extension:C.ResolveParser,test:i=>{const t=ct.extname(i).slice(1);return["basis","ktx","dds"].includes(t)},parse:i=>{var t,e,s,r;const n=i.split("."),a=n.pop();if(["ktx","dds"].includes(a)){const o=n.pop();if(Fp.includes(o))return{resolution:parseFloat((e=(t=O.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:o,src:i}}return{resolution:parseFloat((r=(s=O.RETINA_PREFIX.exec(i))==null?void 0:s[1])!=null?r:"1"),format:a,src:i}}};N.add(Np);const Ks=new j,Lp=4,xh=class ds{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(t,e,s,r){const n=new Image;return n.src=await this.base64(t,e,s,r),n}async base64(t,e,s,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);a&&ds._flipY(s,r,n),o&&ds._unpremultiplyAlpha(s);const h=new To(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);return a&&ds._flipY(s,r,n),o&&ds._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let r,n=!1,a=!1,o,h=!1;t&&(t instanceof Oe?o=t:(o=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),h=!0,e&&(Ks.width=e.width,Ks.height=e.height,e=Ks)));const l=s.gl;if(o){if(r=o.baseTexture.resolution,e=e!=null?e:o.frame,n=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===T.RGBA,!h){s.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else r=s.resolution,e||(e=Ks,e.width=s.width/r,e.height=s.height/r),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),d=new Uint8Array(Lp*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(o==null||o.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const r=e<<2,n=s>>1,a=new Uint8Array(r);for(let o=0;o=0&&o>=0&&r>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),l=h*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=s+n,t[2]=t[4]=e-r,t[5]=t[7]=s-n;return}let u=0,c=h*4+(r?2:0)+2,d=c,f=l;{const p=r+a,m=n,g=e+p,v=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=v,n){const _=s-m;t[d++]=v,t[d++]=_,t[--f]=_,t[--f]=g}}for(let p=1;p0||t&&s<=0){const r=e/2;for(let n=r+r%2;n=6){Ya(e,!1);const a=[];for(let l=0;l=0&&n>=0&&a.push(e,s,e+r,s,e+r,s+n,e,s+n)},triangulate(i,t){const e=i.points,s=t.points;if(e.length===0)return;const r=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},Eh={build(i){As.build(i)},triangulate(i,t){As.triangulate(i,t)}};var St=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(St||{}),de=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(de||{});const Me={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,t=20){if(!this.adaptive||!i||isNaN(i))return t;let e=Math.ceil(i/this.maxLength);return ethis.maxSegments&&(e=this.maxSegments),e}},Zm=Me;class Kr{static curveTo(t,e,s,r,n,a){const o=a[a.length-2],h=a[a.length-1]-e,l=o-t,u=r-e,c=s-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=h*h+l*l,p=u*u+c*c,m=h*u+l*c,g=n*Math.sqrt(f)/d,v=n*Math.sqrt(p)/d,x=g*m/f,_=v*m/p,y=g*c+v*l,E=g*u+v*h,P=l*(v+x),w=h*(v+x),A=c*(g+_),B=u*(g+_),k=Math.atan2(w-E,P-y),W=Math.atan2(B-E,A-y);return{cx:y+t,cy:E+e,radius:n,startAngle:k,endAngle:W,anticlockwise:l*u>c*h}}static arc(t,e,s,r,n,a,o,h,l){const u=o-a,c=Me._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/ci)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,v=g%1/g;for(let x=0;x<=g;++x){const _=x+v*x,y=d+a+f*_,E=Math.cos(y),P=-Math.sin(y);l.push((p*E+m*P)*n+s,(p*-P+m*E)*n+r)}}}class Th{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}}class Pi{static curveLength(t,e,s,r,n,a,o,h){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,v=0,x=0,_=0,y=t,E=e;for(let P=1;P<=10;++P)u=P/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,g=m*t+3*p*u*s+3*f*c*n+d*o,v=m*e+3*p*u*r+3*f*c*a+d*h,x=y-g,_=E-v,y=g,E=v,l+=Math.sqrt(x*x+_*_);return l}static curveTo(t,e,s,r,n,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const u=Me._segmentsCount(Pi.curveLength(h,l,t,e,s,r,n,a));let c=0,d=0,f=0,p=0,m=0;o.push(h,l);for(let g=1,v=0;g<=u;++g)v=g/u,c=1-v,d=c*c,f=d*c,p=v*v,m=p*v,o.push(f*h+3*d*v*t+3*c*p*s+m*n,f*l+3*d*v*e+3*c*p*r+m*a)}}function qa(i,t,e,s,r,n,a,o){const h=i-e*r,l=t-s*r,u=i+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=h+d,m=l+f,g=u+d,v=c+f;return o.push(p,m,g,v),2}function xe(i,t,e,s,r,n,a,o){const h=e-i,l=s-t;let u=Math.atan2(h,l),c=Math.atan2(r-i,n-t);o&&uc&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,v=f/g;if(d+=v,o){a.push(i,t,e,s);for(let x=1,_=d;x=0&&(n.join===St.ROUND?d+=xe(_,y,_-w*b,y-A*b,_-B*b,y-k*b,u,!1)+4:d+=2,u.push(_-B*S,y-k*S,_+B*b,y+k*b));continue}const dt=(-w+v)*(-A+y)-(-w+_)*(-A+x),at=(-B+E)*(-k+y)-(-B+_)*(-k+P),ft=(V*at-I*dt)/Z,yt=(R*dt-rt*at)/Z,Tt=(ft-_)*(ft-_)+(yt-y)*(yt-y),mt=_+(ft-_)*b,J=y+(yt-y)*b,ot=_-(ft-_)*S,lt=y-(yt-y)*S,kt=Math.min(V*V+rt*rt,I*I+R*R),Gt=Q?b:S,ts=kt+Gt*Gt*m,zh=Tt<=ts;let Ms=n.join;if(Ms===St.MITER&&Tt/m>g&&(Ms=St.BEVEL),zh)switch(Ms){case St.MITER:{u.push(mt,J,ot,lt);break}case St.BEVEL:{Q?u.push(mt,J,_+w*S,y+A*S,mt,J,_+B*S,y+k*S):u.push(_-w*b,y-A*b,ot,lt,_-B*b,y-k*b,ot,lt),d+=2;break}case St.ROUND:{Q?(u.push(mt,J,_+w*S,y+A*S),d+=xe(_,y,_+w*S,y+A*S,_+B*S,y+k*S,u,!0)+4,u.push(mt,J,_+B*S,y+k*S)):(u.push(_-w*b,y-A*b,ot,lt),d+=xe(_,y,_-w*b,y-A*b,_-B*b,y-k*b,u,!1)+4,u.push(_-B*b,y-k*b,ot,lt));break}}else{switch(u.push(_-w*b,y-A*b,_+w*S,y+A*S),Ms){case St.MITER:{Q?u.push(ot,lt,ot,lt):u.push(mt,J,mt,J),d+=2;break}case St.ROUND:{Q?d+=xe(_,y,_+w*S,y+A*S,_+B*S,y+k*S,u,!0)+2:d+=xe(_,y,_-w*b,y-A*b,_-B*b,y-k*b,u,!1)+2;break}}u.push(_-B*b,y-k*b,_+B*S,y+k*S),d+=2}}v=s[(c-2)*2],x=s[(c-2)*2+1],_=s[(c-1)*2],y=s[(c-1)*2+1],w=-(x-y),A=v-_,W=Math.sqrt(w*w+A*A),w/=W,A/=W,w*=p,A*=p,u.push(_-w*b,y-A*b,_+w*S,y+A*S),h||(n.cap===de.ROUND?d+=xe(_-w*(b-S)*.5,y-A*(b-S)*.5,_-w*b,y-A*b,_+w*S,y+A*S,u,!1)+2:n.cap===de.SQUARE&&(d+=qa(_,y,w,A,b,S,!1,u)));const G=t.indices,z=Me.epsilon*Me.epsilon;for(let $=f;$0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,r=null){const n=new xi(t,e,s,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new xi(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=r.lineStyle,r.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t0&&(s=this.batches[this.batches.length-1],r=s.style);for(let h=this.shapeIndex;h65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?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;t65535*2)return!1;const t=this.batches;for(let e=0;e0&&(r=fs.pop(),r||(r=new Rr,r.texArray=new Mr),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=re.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,u+=d.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,o,d.attribSize,d.attribStart)}X._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),o=new Uint32Array(n);let h=0;for(let l=0;l0&&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 We,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new We,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,r=s[s.length-2],n=s[s.length-1];return(r!==t||n!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Mi.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),Pi.curveTo(t,e,s,r,n,a,this.currentPath.points),this}arcTo(t,e,s,r,n){this._initCurve(t,e);const a=this.currentPath.points,o=Kr.curveTo(t,e,s,r,n,a);if(o){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=o;this.arc(h,l,u,c,d,f)}return this}arc(t,e,s,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=ci:a&&r<=n&&(r+=ci),n-r===0)return this;const o=t+Math.cos(r)*s,h=e+Math.sin(r)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-o),d=Math.abs(u[u.length-1]-h);c0;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,r){return this.drawShape(new j(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new fn(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new cn(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new dn(t,e,s,r))}drawPolygon(...t){let e,s=!0;const r=t[0];r.points?(s=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new We(e);return n.closeStroke=s,this.drawShape(n),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 t.length===1&&t[0].shape.type===_t.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 r=0;r0){const p=h.x-t[d].x,m=h.y-t[d].y,g=Math.sqrt(p*p+m*m);h=t[d],o+=g/l}else o=d/(u-1);n[f]=o,n[f+1]=0,n[f+2]=o,n[f+3]=1}let c=0;for(let d=0;d0?this.textureScale*this._width/2:this._width/2;for(let l=0;l1&&(d=1);const f=Math.sqrt(r*r+n*n);f<1e-6?(r=0,n=0):(r/=f,n/=f,r*=h,n*=h),a[c]=u.x+r,a[c+1]=u.y+n,a[c+2]=u.x-r,a[c+3]=u.y-n,e=u}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class Wp extends ws{constructor(t,e,s){const r=new jp(t.width,t.height,e,s),n=new Ss(D.WHITE);super(r,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}const Zs=10;class Jm extends Wp{constructor(t,e,s,r,n){var a,o,h,l,u,c,d,f;super(D.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=(o=e!=null?e:(a=t.defaultBorders)==null?void 0:a.left)!=null?o:Zs,this._rightWidth=(l=r!=null?r:(h=t.defaultBorders)==null?void 0:h.right)!=null?l:Zs,this._topHeight=(c=s!=null?s:(u=t.defaultBorders)==null?void 0:u.top)!=null?c:Zs,this._bottomHeight=(f=n!=null?n:(d=t.defaultBorders)==null?void 0:d.bottom)!=null?f:Zs,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,s=this._topHeight+this._bottomHeight,r=this._height>s?1:this._height/s;return Math.min(e,r)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const s=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class tg extends ws{constructor(t=D.EMPTY,e,s,r,n){const a=new Oi(e,s,r);a.getBuffer("aVertexPosition").static=!1;const o=new Ss(t);super(a,o,null,n),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class eg extends ws{constructor(t,e,s=0){const r=new zp(t.height,e,s),n=new Ss(t);s>0&&(t.baseTexture.wrapMode=re.REPEAT),super(r,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class sg extends Mt{constructor(t=1500,e,s=16384,r=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=H.NORMAL,this.autoResize=r,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new K(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.lengths&&!t.autoResize&&(a=s);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=un(t.blendMode,l),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=K.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;fr&&(m=r),p>=o.length&&o.push(this._generateOneMoreBuffer(t));const g=o[p];g.uploadDynamic(e,f,m);const v=t._bufferUpdateIDs[p]||0;d=d||g._updateID0);r[a]=l,r[a+n]=l,r[a+n*2]=l,r[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Ch.extension={name:"particle",type:C.RendererPlugin};N.add(Ch);var Bi=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(Bi||{});const Qs={willReadFrequently:!0},Xt=class L{static get experimentalLetterSpacingSupported(){let t=L._experimentalLetterSpacingSupported;if(t!==void 0){const e=O.ADAPTER.getCanvasRenderingContext2D().prototype;t=L._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,r,n,a,o,h,l){this.text=t,this.style=e,this.width=s,this.height=r,this.lines=n,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,s,r=L._canvas){s=s==null?e.wordWrap:s;const n=e.toFontString(),a=L.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const o=r.getContext("2d",Qs);o.font=n;const h=(s?L.wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let p=0;p0&&(r?n-=e:n+=(L.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=L._canvas){const r=s.getContext("2d",Qs);let n=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=L.collapseSpaces(u),d=L.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+l,m=L.tokenize(t);for(let g=0;gp)if(a!==""&&(o+=L.addLine(a),a="",n=0),L.canBreakWords(v,e.breakWords)){const _=L.wordWrapSplit(v);for(let y=0;y<_.length;y++){let E=_[y],P=E,w=1;for(;_[y+w];){const B=_[y+w];if(!L.canBreakChars(P,B,v,y,e.breakWords))E+=B;else break;P=B,w++}y+=w-1;const A=L.getFromCache(E,l,h,r);A+n>p&&(o+=L.addLine(a),f=!1,a="",n=0),a+=E,n+=A}}else{a.length>0&&(o+=L.addLine(a),a="",n=0);const _=g===m.length-1;o+=L.addLine(v,!_),f=!1,a="",n=0}else x+n>p&&(f=!1,o+=L.addLine(a),a="",n=0),(a.length>0||!L.isBreakingSpace(v)||f)&&(a+=v,n+=x)}return o+=L.addLine(a,!1),o}static addLine(t,e=!0){return t=L.trimRight(t),t=e?`${t} `:t,t}static getFromCache(t,e,s,r){let n=s[t];return typeof n!="number"&&(n=L._measureText(t,e,r)+e,s[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!L.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:L._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:L._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let r=0;ro;--d){for(let m=0;m{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})(),Xt.experimentalLetterSpacing=!1,Xt._fonts={},Xt._newlines=[10,13],Xt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let le=Xt;const Kp=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Ph=class ps{constructor(t){this.styleID=0,this.reset(),ar(this,t,t)}clone(){const t={};return ar(t,this,ps.defaultStyle),new ps(t)}reset(){ar(this,ps.defaultStyle,ps.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=nr(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=nr(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){Zp(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=nr(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=typeof this.fontSize=="number"?`${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 r=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!Kp.includes(r)&&(r=`"${r}"`),e[s]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Ph.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Bi.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 ge=Ph;function nr(i){const t=K.shared,e=s=>{const r=t.setValue(s);return r.alpha===1?r.toHex():r.toRgbaString()};return Array.isArray(i)?i.map(e):e(i)}function Zp(i,t){if(!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length)return!1;for(let e=0;e0&&p>m&&(g=(m+p)/2);const v=m+d,x=s.lineHeight*(f+1);let _=v;f+10}}function tm(i,t){var e;let s=!1;if((e=i==null?void 0:i._textures)!=null&&e.length){for(let r=0;r{this.queue&&this.prepareItems()},this.registerFindHook(nm),this.registerFindHook(am),this.registerFindHook(tm),this.registerFindHook(em),this.registerFindHook(sm),this.registerUploadHook(im),this.registerUploadHook(rm)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,vt.system.addOnce(this.tick,this,me.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,r=this.uploadHooks.length;s=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&vt.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}};Oh.uploadsPerFrame=4;let en=Oh;Object.defineProperties(O,{UPLOADS_PER_FRAME:{get(){return en.uploadsPerFrame},set(i){en.uploadsPerFrame=i}}});function Fh(i,t){return t instanceof X?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function om(i,t){if(!(t instanceof Sh))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let r=0;r=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this.updateTexture())}updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;sthis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(vt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(vt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const os=new q;class Lh extends _e{constructor(t,e=100,s=100){super(t),this.tileTransform=new pn,this._width=e,this._height=s,this.uvMatrix=this.texture.uvMatrix||new mn(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(t){const e=this._texture;!e||!e.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){const t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,s=this._width*(1-this._anchor._x),r=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,s,r)}getLocalBounds(t){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,os);const e=this._width,s=this._height,r=-e*this.anchor._x;if(os.x>=r&&os.x=n&&os.y1?Kt.from(um,lm,e):Kt.from(Qa,cm,e)}render(t){const e=this.renderer,s=this.quad;let r=s.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;r=s.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,s.invalidate();const o=t._texture,h=o.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==re.CLAMP:h.wrapMode===re.CLAMP&&(h.wrapMode=re.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,v=t._height;Js.set(u.a*p/g,u.b*p/v,u.c*m/g,u.d*m/v,u.tx/g,u.ty/v),Js.invert(),d?Js.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=Js.toArray(!0),f.uniforms.uColor=K.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=un(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Uh.extension={name:"tilingSprite",type:C.RendererPlugin};N.add(Uh);const kh=class ms{constructor(t,e,s){this.linkedSheets=[],(t instanceof X||t instanceof D)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:r,data:n,resolutionFilename:a=null,cachePrefix:o=""}=t;this.cachePrefix=o,this._texture=r instanceof D?r:null,this.baseTexture=r instanceof X?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const h=this.baseTexture.resource;this.resolution=this._updateResolution(a||(h?h.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=Qt(t,null);return s===null&&(s=typeof e=="number"?e:parseFloat(e!=null?e:"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ms.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=ms.BATCH_SIZE;for(;e-t{this._batchIndex*ms.BATCH_SIZE{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=ct.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,Gh([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const pm={extension:C.Asset,cache:{test:i=>i instanceof Ja,getCacheableAssets:(i,t)=>Gh(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&fm.includes(s)},parse:i=>{var t,e;const s=i.split(".");return{resolution:parseFloat((e=(t=O.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:s[s.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:C.LoadParser,priority:Ut.Normal},async testParse(i,t){return ct.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var s,r,n;const{texture:a,imageFilename:o,cachePrefix:h}=(s=t==null?void 0:t.data)!=null?s:{};let l=ct.dirname(t.src);l&&l.lastIndexOf("/")!==l.length-1&&(l+="/");let u;if(a&&a.baseTexture)u=a;else{const f=Wr(l+(o!=null?o:i.meta.image),t.src);u=(await e.load([f]))[f]}const c=new Ja({texture:u.baseTexture,data:i,resolutionFilename:t.src,cachePrefix:h});await c.parse();const d=(r=i==null?void 0:i.meta)==null?void 0:r.related_multi_packs;if(Array.isArray(d)){const f=[];for(const m of d){if(typeof m!="string")continue;let g=l+m;(n=t.data)!=null&&n.ignoreMultiPack||(g=Wr(g,t.src),f.push(e.load({src:g,data:{ignoreMultiPack:!0}})))}const p=await Promise.all(f);c.linkedSheets=p,p.forEach(m=>{m.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==m))})}return c},unload(i){i.destroy(!0)}}};N.add(pm);class bi{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class oi{static test(t){return typeof t=="string"&&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 n in e){const a=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in o){const u=o[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;h[c]=p}s[a].push(h)}const r=new bi;return s.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),s.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class rn{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new bi,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l")?rn.test(O.ADAPTER.parseXML(t)):!1}static parse(t){return rn.parse(O.ADAPTER.parseXML(t))}}const or=[oi,rn,nn];function mm(i){for(let t=0;tt in i?ym(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,xm=(i,t)=>{for(var e in t||(t={}))Hh.call(t,e)&&to(i,e,t[e]);if(Ei)for(var e of Ei(t))Xh.call(t,e)&&to(i,e,t[e]);return i},bm=(i,t)=>{var e={};for(var s in i)Hh.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&Ei)for(var s of Ei(i))t.indexOf(s)<0&&Xh.call(i,s)&&(e[s]=i[s]);return e};const oe=class Vt{constructor(t,e,s){var r,n;const[a]=t.info,[o]=t.common,[h]=t.page,[l]=t.distanceField,u=Qt(h.file),c={};this._ownsTextures=s,this.font=a.face,this.size=a.size,this.lineHeight=o.lineHeight/u,this.chars={},this.pageTextures=c;for(let d=0;d=l-F*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${l}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${B}')`);--A,v=null,x=null,_=null,g=0,m=0,y=0;continue}if(y=Math.max(F+k.fontProperties.descent,y),b*o+m>=f){if(m===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${B}')`);--A,g+=y*o,g=Math.ceil(g),m=0,y=0;continue}_m(v,x,k,m,g,o,d);const S=hi(k.text);p.char.push({id:S,page:P.length-1,x:m/o,y:g/o,width:b,height:F,xoffset:0,yoffset:0,xadvance:W-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),m+=(b+2*a)*o,m=Math.ceil(m)}if(!(s!=null&&s.skipKerning))for(let A=0,B=c.length;A 0.99) {\r alpha = 1.0;\r }\r \r // Gamma correction for coverage-like alpha\r float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r float gamma = mix(1.0, 1.0 / 2.2, luma);\r float coverage = pow(uColor.a * alpha, gamma); \r \r // NPM Textures, NPM outputs\r gl_FragColor = vec4(uColor.rgb, coverage);\r }\r `,Tm=`// Mesh material default fragment\r attribute vec2 aVertexPosition;\r attribute vec2 aTextureCoord;\r \r uniform mat3 projectionMatrix;\r uniform mat3 translationMatrix;\r uniform mat3 uTextureMatrix;\r \r varying vec2 vTextureCoord;\r \r void main(void)\r {\r gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r \r vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r }\r `;const eo=[],so=[],io=[],Vh=class jh extends Mt{constructor(t,e={}){super();const{align:s,tint:r,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},jh.styleDefaults,e);if(!he.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new K(r),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new ce(()=>{this.dirty=!0},this,0,0),this._roundPixels=O.ROUND_PIXELS,this.dirty=!0,this._resolution=O.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var t;const e=he.available[this._fontName],s=this.fontSize,r=s/e.size,n=new q,a=[],o=[],h=[],l=this._text.replace(/(?:\r\n|\r)/g,` `)||" ",u=$h(l),c=this._maxWidth*e.size/s,d=e.distanceFieldType==="none"?eo:so;let f=null,p=0,m=0,g=0,v=-1,x=0,_=0,y=0,E=0;for(let F=0;F0&&n.x>c&&(++_,Ie(a,1+v-_,1+F-v),F=v,v=-1,o.push(x),h.push(a.length>0?a[a.length-1].prevSpaces:0),m=Math.max(m,x),g++,n.x=0,n.y+=e.lineHeight,f=null,E=0)}const P=u[u.length-1];P!=="\r"&&P!==` `&&(/(?:\s)/.test(P)&&(p=x),o.push(p),m=Math.max(m,p),h.push(-1));const w=[];for(let F=0;F<=g;F++){let b=0;this._align==="right"?b=m-o[F]:this._align==="center"?b=(m-o[F])/2:this._align==="justify"&&(b=h[F]<0?0:(m-o[F])/h[F]),w.push(b)}const A=a.length,B={},k=[],W=this._activePagesMeshData;d.push(...W);for(let F=0;F6*S)||b.vertices.lengthe[r.mesh.texture.baseTexture.uid]).forEach(r=>{r.mesh.texture=D.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Vh.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let rg=Vh;const Am=[".xml",".fnt"],wm={extension:{type:C.LoadParser,priority:Ut.Normal},name:"loadBitmapFont",test(i){return Am.includes(ct.extname(i).toLowerCase())},async testParse(i){return oi.test(i)||nn.test(i)},async parse(i,t,e){const s=oi.test(i)?oi.parse(i):nn.parse(i),{src:r}=t,{page:n}=s,a=[];for(let l=0;lo[l]);return he.install(s,h,!0)},async load(i,t){return(await O.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};N.add(wm);var Sm=Object.defineProperty,Rm=Object.defineProperties,Im=Object.getOwnPropertyDescriptors,ro=Object.getOwnPropertySymbols,Cm=Object.prototype.hasOwnProperty,Pm=Object.prototype.propertyIsEnumerable,no=(i,t,e)=>t in i?Sm(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Mm=(i,t)=>{for(var e in t||(t={}))Cm.call(t,e)&&no(i,e,t[e]);if(ro)for(var e of ro(t))Pm.call(t,e)&&no(i,e,t[e]);return i},Dm=(i,t)=>Rm(i,Im(t));const an=class $e extends ge{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new $e(Object.keys($e.defaultOptions).reduce((e,s)=>Dm(Mm({},e),{[s]:t[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete $e.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=$e;if(s[t]){const r=s[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return O.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,a)=>{const o=URL.createObjectURL(r),h=new FileReader;h.onload=()=>n([o,h.result]),h.onerror=a,h.readAsDataURL(r)})).then(async([r,n])=>{const a=Object.assign({family:ct.basename(t,ct.extname(t)),weight:"normal",style:"normal",display:"auto",src:r,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const o=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(s=>!this._overrides.includes(s));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(s=>this._overrides.includes(s));e.length>0&&(this._overrides=this._overrides.filter(s=>!e.includes(s)),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} @font-face { font-family: "${e.family}"; src: url('${e.dataSrc}'); font-weight: ${e.weight}; font-style: ${e.style}; font-display: ${e.display}; }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=xo(t)),typeof t=="number"?yo(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,$e.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=O.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}};an.availableFonts={},an.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 hr=an;const gs=class He extends _e{constructor(t="",e={}){var s;super(D.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const r=new Image,n=D.from(r,{scaleMode:O.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new j,n.trim=new j,this.texture=n;const a="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",h=document.createElementNS(a,"svg"),l=document.createElementNS(a,"foreignObject"),u=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");l.setAttribute("width","10000"),l.setAttribute("height","10000"),l.style.overflow="hidden",h.appendChild(l),this.maxWidth=He.defaultMaxWidth,this.maxHeight=He.defaultMaxHeight,this._domElement=u,this._styleElement=c,this._svgRoot=h,this._foreignObject=l,this._foreignObject.appendChild(c),this._foreignObject.appendChild(u),this._image=r,this._loadImage=new Image,this._autoResolution=He.defaultAutoResolution,this._resolution=(s=He.defaultResolution)!=null?s:O.RESOLUTION,this.text=t,this.style=e}measureText(t){var e,s;const{text:r,style:n,resolution:a}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:r,style:n.toCSS(a)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);const o=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:h,height:l}=o,u=Math.min(this.maxWidth,Math.ceil(h)),c=Math.min(this.maxHeight,Math.ceil(l));return this._svgRoot.setAttribute("width",u.toString()),this._svgRoot.setAttribute("height",c.toString()),r!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:(e=this._style)==null?void 0:e.toCSS(a)}),this._styleElement.textContent=(s=this._style)==null?void 0:s.toGlobalCSS()),{width:u+n.padding*2,height:c+n.padding*2}}async updateText(t=!0){const{style:e,_image:s,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();s.width=r.width=Math.ceil(Math.max(1,n)),s.height=r.height=Math.ceil(Math.max(1,a)),this._updateID++;const o=this._updateID;await new Promise(h=>{r.onload=async()=>{if(o/gi,"

").replace(/
/gi,"
").replace(/ /gi," ")}};gs.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},gs.defaultMaxWidth=2024,gs.defaultMaxHeight=2024,gs.defaultAutoResolution=!0;let ng=gs;export{Et as ALPHA_MODES,lh as AbstractMultiResource,ph as AccessibilityManager,Qc as AlphaFilter,sn as AnimatedSprite,Dd as Application,Hc as ArrayResource,zs as Assets,Xf as AssetsClass,ui as Attribute,H as BLEND_MODES,lr as BUFFER_BITS,qt as BUFFER_TYPE,di as BackgroundSystem,ne as BaseImageResource,en as BasePrepare,Fo as BaseRenderTexture,X as BaseTexture,Rr as BatchDrawCall,Io as BatchGeometry,we as BatchRenderer,Wu as BatchShaderGenerator,Bo as BatchSystem,Mr as BatchTextureArray,he as BitmapFont,bi as BitmapFontData,rg as BitmapText,tp as BlobResource,rd as BlurFilter,$r as BlurFilterPass,gi as Bounds,Yh as BrowserAdapter,nt as Buffer,Ri as BufferResource,oh as BufferSystem,jt as CLEAR_MODES,Wh as COLOR_MASK_BITS,Re as Cache,Xc as CanvasResource,cn as Circle,K as Color,Hr as ColorMatrixFilter,Ce as CompressedTextureResource,Mt as Container,fi as ContextSystem,Jp as CountLimiter,Vc as CubeResource,Ou as DEG_TO_RAD,Wt as DRAW_MODES,hd as DisplacementFilter,it as DisplayObject,De as ENV,dn as Ellipse,_d as EventBoundary,jr as EventSystem,C as ExtensionType,Up as Extract,T as FORMATS,yp as FORMATS_TO_COMPONENTS,cd as FXAAFilter,Ad as FederatedDisplayObject,Cs as FederatedEvent,_i as FederatedMouseEvent,Ft as FederatedPointerEvent,qe as FederatedWheelEvent,Di as FillStyle,bt as Filter,ec as FilterState,Go as FilterSystem,Or as Framebuffer,$o as FramebufferSystem,on as GC_MODES,sc as GLFramebuffer,fc as GLProgram,Qi as GLTexture,Zm as GRAPHICS_CURVES,qo as GenerateTextureSystem,pe as Geometry,Ho as GeometrySystem,Sh as Graphics,xi as GraphicsData,$p as GraphicsGeometry,ng as HTMLText,hr as HTMLTextStyle,Vm as IGLUniformData,wr as INSTALLED,gt as INTERNAL_FORMATS,yi as INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,Ve as ImageBitmapResource,No as ImageResource,de as LINE_CAP,St as LINE_JOIN,yn as LineStyle,Ut as LoaderParserPriority,ut as MASK_TYPES,Zt as MIPMAP_MODES,ht as MSAA_QUALITY,oc as MaskData,Xo as MaskSystem,tt as Matrix,ws as Mesh,Hp as MeshBatchUvs,Oi as MeshGeometry,Ss as MeshMaterial,ah as MultisampleSystem,Jm as NineSlicePlane,fd as NoiseFilter,Ii as ObjectRenderer,hh as ObjectRendererSystem,ce as ObservablePoint,ci as PI_2,Rt as PRECISION,sg as ParticleContainer,Ch as ParticleRenderer,jp as PlaneGeometry,Wo as PluginSystem,q as Point,We as Polygon,Nh as Prepare,ie as Program,Yo as ProjectionSystem,tc as Quad,ko as QuadUv,Du as RAD_TO_DEG,ao as RENDERER_TYPE,j as Rectangle,Oe as RenderTexture,Uo as RenderTexturePool,Ko as RenderTextureSystem,gn as Renderer,gh as ResizePlugin,Ts as Resource,zp as RopeGeometry,fn as RoundedRectangle,Pt as Runner,M as SAMPLER_TYPES,ee as SCALE_MODES,_t as SHAPES,Lr as SVGResource,hc as ScissorSystem,Kt as Shader,Qo as ShaderSystem,tg as SimpleMesh,Wp as SimplePlane,eg as SimpleRope,_e as Sprite,ac as SpriteMaskFilter,Ja as Spritesheet,pi as StartupSystem,ae as State,Pc as StateSystem,zo as StencilSystem,Mc as SystemManager,je as TARGETS,Bi as TEXT_GRADIENT,U as TYPES,Xa as TYPES_TO_BYTES_PER_COMPONENT,xp as TYPES_TO_BYTES_PER_PIXEL,zc as TemporaryDisplayObject,Dh as Text,oi as TextFormat,le as TextMetrics,ge as TextStyle,D as Texture,Se as TextureGCSystem,mn as TextureMatrix,th as TextureSystem,Lo as TextureUvs,vt as Ticker,ih as TickerPlugin,Lh as TilingSprite,Uh as TilingSpriteRenderer,ig as TimeLimiter,pn as Transform,jm as TransformFeedback,eh as TransformFeedbackSystem,me as UPDATE_PRIORITY,Lt as UniformGroup,zm as VERSION,ch as VideoResource,mi as ViewSystem,Ar as ViewableBuffer,re as WRAP_MODES,rn as XMLFormat,nn as XMLStringFormat,wd as accessibleTarget,mm as autoDetectFormat,Lc as autoDetectRenderer,Ro as autoDetectResource,Vf as cacheTextureArray,Je as checkDataUrl,ve as checkExtension,bu as checkMaxIfStatementsInShader,Nt as convertToList,Wr as copySearchParams,Bd as createStringVariations,Ps as createTexture,yc as createUBOElements,Me as curves,nh as defaultFilterVertex,Gc as defaultVertex,jf as detectAvif,Jf as detectCompressedTextures,Wf as detectDefaults,Kf as detectMp4,Zf as detectOgv,qf as detectWebm,zf as detectWebp,N as extensions,ma as filters,gc as generateProgram,bc as generateUniformBufferSync,hf as getFontFamilyName,Gu as getTestContext,xc as getUBOData,Qm as graphicsUtils,et as groupD8,Yt as isMobile,vi as isSingleItem,wm as loadBitmapFont,Cp as loadDDS,xf as loadImageBitmap,zd as loadJson,Bp as loadKTX,Rf as loadSVG,Ci as loadTextures,qd as loadTxt,Nf as loadVideo,cf as loadWebFont,_p as parseDDS,bp as parseKTX,Np as resolveCompressedTextureUrl,Qf as resolveTextureUrl,O as settings,pm as spritesheetAsset,Ye as uniformParsers,Vu as unsafeEvalSupported,Hm as utils}; //# sourceMappingURL=pixi.min.mjs.map