lyb-pixi-js 1.5.2 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lyb-pixi.js CHANGED
@@ -1,21 +1,21 @@
1
- (function(Ns){typeof define=="function"&&define.amd?define(Ns):Ns()})(function(){"use strict";var Ns=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ns||{}),Td=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Td||{}),Pl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Pl||{}),W=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(W||{}),xs=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(xs||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),Wr=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Wr||{}),tt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(tt||{}),j=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(j||{}),je=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(je||{}),Fi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Fi||{}),vs=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(vs||{}),Re=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Re||{}),Vs=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Vs||{}),Rl=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Rl||{}),os=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(os||{}),ce=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(ce||{}),ie=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(ie||{}),Us=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Us||{});const z={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Ml=/iPhone/i,Ad=/iPod/i,Sd=/iPad/i,Cd=/\biOS-universal(?:.+)Mac\b/i,Fl=/\bAndroid(?:.+)Mobile\b/i,Id=/Android/i,zr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Uo=/Silk/i,di=/Windows Phone/i,Pd=/\bWindows(?:.+)ARM\b/i,Rd=/BlackBerry/i,Md=/BB10/i,Fd=/Opera Mini/i,kd=/\b(CriOS|Chrome)(?:.+)Mobile/i,Bd=/Mobile(?:.+)Firefox\b/i,Dd=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function dy(r){return function(t){return t.test(r)}}function Od(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]<"u"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]<"u"&&(e=s[0]);var i=dy(e),n={apple:{phone:i(Ml)&&!i(di),ipod:i(Ad),tablet:!i(Ml)&&(i(Sd)||Dd(t))&&!i(di),universal:i(Cd),device:(i(Ml)||i(Ad)||i(Sd)||i(Cd)||Dd(t))&&!i(di)},amazon:{phone:i(zr),tablet:!i(zr)&&i(Uo),device:i(zr)||i(Uo)},android:{phone:!i(di)&&i(zr)||!i(di)&&i(Fl),tablet:!i(di)&&!i(zr)&&!i(Fl)&&(i(Uo)||i(Id)),device:!i(di)&&(i(zr)||i(Uo)||i(Fl)||i(Id))||i(/\bokhttp\b/i)},windows:{phone:i(di),tablet:i(Pd),device:i(di)||i(Pd)},other:{blackberry:i(Rd),blackberry10:i(Md),opera:i(Fd),firefox:i(Bd),chrome:i(kd),device:i(Rd)||i(Md)||i(Fd)||i(Bd)||i(kd)},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}const fy=Od.default??Od,fi=fy(globalThis.navigator);z.RETINA_PREFIX=/@([0-9\.]+)x/,z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ld(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function py(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),e}var Nd={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(o,l,u){this.fn=o,this.context=l,this.once=u||!1}function n(o,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new i(u,c||o,d),p=e?e+l:l;return o._events[p]?o._events[p].fn?o._events[p]=[o._events[p],f]:o._events[p].push(f):(o._events[p]=f,o._eventsCount++),o}function a(o,l){--o._eventsCount===0?o._events=new s:delete o._events[l]}function h(){this._events=new s,this._eventsCount=0}h.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},h.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);d<f;d++)p[d]=c[d].fn;return p},h.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},h.prototype.emit=function(l,u,c,d,f,p){var m=e?e+l:l;if(!this._events[m])return!1;var g=this._events[m],_=arguments.length,x,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),_){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,d),!0;case 5:return g.fn.call(g.context,u,c,d,f),!0;case 6:return g.fn.call(g.context,u,c,d,f,p),!0}for(y=1,x=new Array(_-1);y<_;y++)x[y-1]=arguments[y];g.fn.apply(g.context,x)}else{var v=g.length,b;for(y=0;y<v;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),_){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,u);break;case 3:g[y].fn.call(g[y].context,u,c);break;case 4:g[y].fn.call(g[y].context,u,c,d);break;default:if(!x)for(b=1,x=new Array(_-1);b<_;b++)x[b-1]=arguments[b];g[y].fn.apply(g[y].context,x)}}return!0},h.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},h.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},h.prototype.removeListener=function(l,u,c,d){var f=e?e+l:l;if(!this._events[f])return this;if(!u)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!d||p.once)&&(!c||p.context===c)&&a(this,f);else{for(var m=0,g=[],_=p.length;m<_;m++)(p[m].fn!==u||d&&!p[m].once||c&&p[m].context!==c)&&g.push(p[m]);g.length?this._events[f]=g.length===1?g[0]:g:a(this,f)}return this},h.prototype.removeAllListeners=function(l){var u;return l?(u=e?e+l:l,this._events[u]&&a(this,u)):(this._events=new s,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=e,h.EventEmitter=h,r.exports=h})(Nd);var my=Nd.exports;const Xs=Ld(my);var kl={exports:{}};kl.exports=Go,kl.exports.default=Go;function Go(r,t,e){e=e||2;var s=t&&t.length,i=s?t[0]*e:r.length,n=Vd(r,0,i,e,!0),a=[];if(!n||n.next===n.prev)return a;var h,o,l,u,c,d,f;if(s&&(n=vy(r,t,n,e)),r.length>80*e){h=l=r[0],o=u=r[1];for(var p=e;p<i;p+=e)c=r[p],d=r[p+1],c<h&&(h=c),d<o&&(o=d),c>l&&(l=c),d>u&&(u=d);f=Math.max(l-h,u-o),f=f!==0?32767/f:0}return Xn(n,a,e,h,o,f,0),a}function Vd(r,t,e,s,i){var n,a;if(i===Ol(r,t,e,s)>0)for(n=t;n<e;n+=s)a=Xd(n,r[n],r[n+1],a);else for(n=e-s;n>=t;n-=s)a=Xd(n,r[n],r[n+1],a);return a&&Xo(a,a.next)&&(Hn(a),a=a.next),a}function dr(r,t){if(!r)return r;t||(t=r);var e=r,s;do if(s=!1,!e.steiner&&(Xo(e,e.next)||Lt(e.prev,e,e.next)===0)){if(Hn(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function Xn(r,t,e,s,i,n,a){if(r){!a&&n&&Ay(r,s,i,n);for(var h=r,o,l;r.prev!==r.next;){if(o=r.prev,l=r.next,n?_y(r,s,i,n):gy(r)){t.push(o.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Hn(r),r=l.next,h=l.next;continue}if(r=l,r===h){a?a===1?(r=yy(dr(r),t,e),Xn(r,t,e,s,i,n,2)):a===2&&xy(r,t,e,s,i,n):Xn(dr(r),t,e,s,i,n,1);break}}}}function gy(r){var t=r.prev,e=r,s=r.next;if(Lt(t,e,s)>=0)return!1;for(var i=t.x,n=e.x,a=s.x,h=t.y,o=e.y,l=s.y,u=i<n?i<a?i:a:n<a?n:a,c=h<o?h<l?h:l:o<l?o:l,d=i>n?i>a?i:a:n>a?n:a,f=h>o?h>l?h:l:o>l?o:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&jr(i,h,n,o,a,l,p.x,p.y)&&Lt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function _y(r,t,e,s){var i=r.prev,n=r,a=r.next;if(Lt(i,n,a)>=0)return!1;for(var h=i.x,o=n.x,l=a.x,u=i.y,c=n.y,d=a.y,f=h<o?h<l?h:l:o<l?o:l,p=u<c?u<d?u:d:c<d?c:d,m=h>o?h>l?h:l:o>l?o:l,g=u>c?u>d?u:d:c>d?c:d,_=Bl(f,p,t,e,s),x=Bl(m,g,t,e,s),y=r.prevZ,v=r.nextZ;y&&y.z>=_&&v&&v.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==i&&y!==a&&jr(h,u,o,c,l,d,y.x,y.y)&&Lt(y.prev,y,y.next)>=0||(y=y.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==i&&v!==a&&jr(h,u,o,c,l,d,v.x,v.y)&&Lt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;y&&y.z>=_;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==i&&y!==a&&jr(h,u,o,c,l,d,y.x,y.y)&&Lt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==i&&v!==a&&jr(h,u,o,c,l,d,v.x,v.y)&&Lt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function yy(r,t,e){var s=r;do{var i=s.prev,n=s.next.next;!Xo(i,n)&&Ud(i,s,s.next,n)&&$n(i,n)&&$n(n,i)&&(t.push(i.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),Hn(s),Hn(s.next),s=r=n),s=s.next}while(s!==r);return dr(s)}function xy(r,t,e,s,i,n){var a=r;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&Iy(a,h)){var o=Gd(a,h);a=dr(a,a.next),o=dr(o,o.next),Xn(a,t,e,s,i,n,0),Xn(o,t,e,s,i,n,0);return}h=h.next}a=a.next}while(a!==r)}function vy(r,t,e,s){var i=[],n,a,h,o,l;for(n=0,a=t.length;n<a;n++)h=t[n]*s,o=n<a-1?t[n+1]*s:r.length,l=Vd(r,h,o,s,!1),l===l.next&&(l.steiner=!0),i.push(Cy(l));for(i.sort(by),n=0;n<i.length;n++)e=wy(i[n],e);return e}function by(r,t){return r.x-t.x}function wy(r,t){var e=Ey(r,t);if(!e)return t;var s=Gd(e,r);return dr(s,s.next),dr(e,e.next)}function Ey(r,t){var e=t,s=r.x,i=r.y,n=-1/0,a;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){var h=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=s&&h>n&&(n=h,a=e.x<e.next.x?e:e.next,h===s))return a}e=e.next}while(e!==t);if(!a)return null;var o=a,l=a.x,u=a.y,c=1/0,d;e=a;do s>=e.x&&e.x>=l&&s!==e.x&&jr(i<u?s:n,i,l,u,i<u?n:s,i,e.x,e.y)&&(d=Math.abs(i-e.y)/(s-e.x),$n(e,r)&&(d<c||d===c&&(e.x>a.x||e.x===a.x&&Ty(a,e)))&&(a=e,c=d)),e=e.next;while(e!==o);return a}function Ty(r,t){return Lt(r.prev,r,t.prev)<0&&Lt(t.next,r,r.next)<0}function Ay(r,t,e,s){var i=r;do i.z===0&&(i.z=Bl(i.x,i.y,t,e,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Sy(i)}function Sy(r){var t,e,s,i,n,a,h,o,l=1;do{for(e=r,r=null,n=null,a=0;e;){for(a++,s=e,h=0,t=0;t<l&&(h++,s=s.nextZ,!!s);t++);for(o=l;h>0||o>0&&s;)h!==0&&(o===0||!s||e.z<=s.z)?(i=e,e=e.nextZ,h--):(i=s,s=s.nextZ,o--),n?n.nextZ=i:r=i,i.prevZ=n,n=i;e=s}n.nextZ=null,l*=2}while(a>1);return r}function Bl(r,t,e,s,i){return r=(r-e)*i|0,t=(t-s)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Cy(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function jr(r,t,e,s,i,n,a,h){return(i-a)*(t-h)>=(r-a)*(n-h)&&(r-a)*(s-h)>=(e-a)*(t-h)&&(e-a)*(n-h)>=(i-a)*(s-h)}function Iy(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Py(r,t)&&($n(r,t)&&$n(t,r)&&Ry(r,t)&&(Lt(r.prev,r,t.prev)||Lt(r,t.prev,t))||Xo(r,t)&&Lt(r.prev,r,r.next)>0&&Lt(t.prev,t,t.next)>0)}function Lt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Xo(r,t){return r.x===t.x&&r.y===t.y}function Ud(r,t,e,s){var i=Ho(Lt(r,t,e)),n=Ho(Lt(r,t,s)),a=Ho(Lt(e,s,r)),h=Ho(Lt(e,s,t));return!!(i!==n&&a!==h||i===0&&$o(r,e,t)||n===0&&$o(r,s,t)||a===0&&$o(e,r,s)||h===0&&$o(e,t,s))}function $o(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Ho(r){return r>0?1:r<0?-1:0}function Py(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Ud(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function $n(r,t){return Lt(r.prev,r,r.next)<0?Lt(r,t,r.next)>=0&&Lt(r,r.prev,t)>=0:Lt(r,t,r.prev)<0||Lt(r,r.next,t)<0}function Ry(r,t){var e=r,s=!1,i=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==r);return s}function Gd(r,t){var e=new Dl(r.i,r.x,r.y),s=new Dl(t.i,t.x,t.y),i=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Xd(r,t,e,s){var i=new Dl(r,t,e);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function Hn(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Dl(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Go.deviation=function(r,t,e,s){var i=t&&t.length,n=i?t[0]*e:r.length,a=Math.abs(Ol(r,0,n,e));if(i)for(var h=0,o=t.length;h<o;h++){var l=t[h]*e,u=h<o-1?t[h+1]*e:r.length;a-=Math.abs(Ol(r,l,u,e))}var c=0;for(h=0;h<s.length;h+=3){var d=s[h]*e,f=s[h+1]*e,p=s[h+2]*e;c+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return a===0&&c===0?0:Math.abs((c-a)/a)};function Ol(r,t,e,s){for(var i=0,n=t,a=e-s;n<e;n+=s)i+=(r[a]-r[n])*(r[n+1]+r[a+1]),a=n;return i}Go.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},s=0,i=0;i<r.length;i++){for(var n=0;n<r[i].length;n++)for(var a=0;a<t;a++)e.vertices.push(r[i][n][a]);i>0&&(s+=r[i-1].length,e.holes.push(s))}return e};var My=kl.exports;const Fy=Ld(My);var Yo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Yo.exports,function(r,t){(function(e){var s=t&&!t.nodeType&&t,i=r&&!r.nodeType&&r,n=typeof Gs=="object"&&Gs;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,h=2147483647,o=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=o-l,b=Math.floor,w=String.fromCharCode,E;function T(O){throw new RangeError(y[O])}function A(O,N){for(var Z=O.length,Q=[];Z--;)Q[Z]=N(O[Z]);return Q}function I(O,N){var Z=O.split("@"),Q="";Z.length>1&&(Q=Z[0]+"@",O=Z[1]),O=O.replace(x,".");var Y=O.split("."),lt=A(Y,N).join(".");return Q+lt}function M(O){for(var N=[],Z=0,Q=O.length,Y,lt;Z<Q;)Y=O.charCodeAt(Z++),Y>=55296&&Y<=56319&&Z<Q?(lt=O.charCodeAt(Z++),(lt&64512)==56320?N.push(((Y&1023)<<10)+(lt&1023)+65536):(N.push(Y),Z--)):N.push(Y);return N}function R(O){return A(O,function(N){var Z="";return N>65535&&(N-=65536,Z+=w(N>>>10&1023|55296),N=56320|N&1023),Z+=w(N),Z}).join("")}function C(O){return O-48<10?O-22:O-65<26?O-65:O-97<26?O-97:o}function P(O,N){return O+22+75*(O<26)-((N!=0)<<5)}function k(O,N,Z){var Q=0;for(O=Z?b(O/d):O>>1,O+=b(O/N);O>v*u>>1;Q+=o)O=b(O/v);return b(Q+(v+1)*O/(O+c))}function U(O){var N=[],Z=O.length,Q,Y=0,lt=p,Tt=f,_t,Bt,zt,Qt,Rt,jt,Ot,ze,rs;for(_t=O.lastIndexOf(m),_t<0&&(_t=0),Bt=0;Bt<_t;++Bt)O.charCodeAt(Bt)>=128&&T("not-basic"),N.push(O.charCodeAt(Bt));for(zt=_t>0?_t+1:0;zt<Z;){for(Qt=Y,Rt=1,jt=o;zt>=Z&&T("invalid-input"),Ot=C(O.charCodeAt(zt++)),(Ot>=o||Ot>b((h-Y)/Rt))&&T("overflow"),Y+=Ot*Rt,ze=jt<=Tt?l:jt>=Tt+u?u:jt-Tt,!(Ot<ze);jt+=o)rs=o-ze,Rt>b(h/rs)&&T("overflow"),Rt*=rs;Q=N.length+1,Tt=k(Y-Qt,Q,Qt==0),b(Y/Q)>h-lt&&T("overflow"),lt+=b(Y/Q),Y%=Q,N.splice(Y++,0,lt)}return R(N)}function V(O){var N,Z,Q,Y,lt,Tt,_t,Bt,zt,Qt,Rt,jt=[],Ot,ze,rs,lr;for(O=M(O),Ot=O.length,N=p,Z=0,lt=f,Tt=0;Tt<Ot;++Tt)Rt=O[Tt],Rt<128&&jt.push(w(Rt));for(Q=Y=jt.length,Y&&jt.push(m);Q<Ot;){for(_t=h,Tt=0;Tt<Ot;++Tt)Rt=O[Tt],Rt>=N&&Rt<_t&&(_t=Rt);for(ze=Q+1,_t-N>b((h-Z)/ze)&&T("overflow"),Z+=(_t-N)*ze,N=_t,Tt=0;Tt<Ot;++Tt)if(Rt=O[Tt],Rt<N&&++Z>h&&T("overflow"),Rt==N){for(Bt=Z,zt=o;Qt=zt<=lt?l:zt>=lt+u?u:zt-lt,!(Bt<Qt);zt+=o)lr=Bt-Qt,rs=o-Qt,jt.push(w(P(Qt+lr%rs,0))),Bt=b(lr/rs);jt.push(w(P(Bt,0))),lt=k(Z,ze,Q==Y),Z=0,++Q}++Z,++N}return jt.join("")}function L(O){return I(O,function(N){return g.test(N)?U(N.slice(4).toLowerCase()):N})}function $(O){return I(O,function(N){return _.test(N)?"xn--"+V(N):N})}if(a={version:"1.4.1",ucs2:{decode:M,encode:R},decode:U,encode:V,toASCII:$,toUnicode:L},s&&i)if(r.exports==s)i.exports=a;else for(E in a)a.hasOwnProperty(E)&&(s[E]=a[E]);else e.punycode=a})(Gs)}(Yo,Yo.exports);var ky=Yo.exports,qr=TypeError;const By=py(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ll=typeof Map=="function"&&Map.prototype,Nl=Object.getOwnPropertyDescriptor&&Ll?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Wo=Ll&&Nl&&typeof Nl.get=="function"?Nl.get:null,$d=Ll&&Map.prototype.forEach,Vl=typeof Set=="function"&&Set.prototype,Ul=Object.getOwnPropertyDescriptor&&Vl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,zo=Vl&&Ul&&typeof Ul.get=="function"?Ul.get:null,Hd=Vl&&Set.prototype.forEach,Dy=typeof WeakMap=="function"&&WeakMap.prototype,Yn=Dy?WeakMap.prototype.has:null,Oy=typeof WeakSet=="function"&&WeakSet.prototype,Wn=Oy?WeakSet.prototype.has:null,Ly=typeof WeakRef=="function"&&WeakRef.prototype,Yd=Ly?WeakRef.prototype.deref:null,Ny=Boolean.prototype.valueOf,Vy=Object.prototype.toString,Uy=Function.prototype.toString,Gy=String.prototype.match,Gl=String.prototype.slice,ki=String.prototype.replace,Xy=String.prototype.toUpperCase,Wd=String.prototype.toLowerCase,zd=RegExp.prototype.test,jd=Array.prototype.concat,$s=Array.prototype.join,$y=Array.prototype.slice,qd=Math.floor,Xl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,$l=Object.getOwnPropertySymbols,Hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Zr=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Zr||"symbol")?Symbol.toStringTag:null,Zd=Object.prototype.propertyIsEnumerable,Kd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Qd(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||zd.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var s=r<0?-qd(-r):qd(r);if(s!==r){var i=String(s),n=Gl.call(t,i.length+1);return ki.call(i,e,"$&_")+"."+ki.call(ki.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ki.call(t,e,"$&_")}var Yl=By,Jd=Yl.custom,tf=nf(Jd)?Jd:null,ef={__proto__:null,double:'"',single:"'"},Hy={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},jo=function r(t,e,s,i){var n=e||{};if(pi(n,"quoteStyle")&&!pi(ef,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pi(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=pi(n,"customInspect")?n.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(pi(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(pi(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var h=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return af(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var o=String(t);return h?Qd(t,o):o}if(typeof t=="bigint"){var l=String(t)+"n";return h?Qd(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof s>"u"&&(s=0),s>=u&&u>0&&typeof t=="object")return Wl(t)?"[Array]":"[Object]";var c=lx(n,s);if(typeof i>"u")i=[];else if(of(i,t)>=0)return"[Circular]";function d(C,P,k){if(P&&(i=$y.call(i),i.push(P)),k){var U={depth:n.depth};return pi(n,"quoteStyle")&&(U.quoteStyle=n.quoteStyle),r(C,U,s+1,i)}return r(C,n,s+1,i)}if(typeof t=="function"&&!rf(t)){var f=Jy(t),p=qo(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+$s.call(p,", ")+" }":"")}if(nf(t)){var m=Zr?ki.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Hl.call(t);return typeof t=="object"&&!Zr?zn(m):m}if(nx(t)){for(var g="<"+Wd.call(String(t.nodeName)),_=t.attributes||[],x=0;x<_.length;x++)g+=" "+_[x].name+"="+sf(Yy(_[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+Wd.call(String(t.nodeName))+">",g}if(Wl(t)){if(t.length===0)return"[]";var y=qo(t,d);return c&&!ax(y)?"["+jl(y,c)+"]":"[ "+$s.call(y,", ")+" ]"}if(zy(t)){var v=qo(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!Zd.call(t,"cause")?"{ ["+String(t)+"] "+$s.call(jd.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$s.call(v,", ")+" }"}if(typeof t=="object"&&a){if(tf&&typeof t[tf]=="function"&&Yl)return Yl(t,{depth:u-s});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(tx(t)){var b=[];return $d&&$d.call(t,function(C,P){b.push(d(P,t,!0)+" => "+d(C,t))}),lf("Map",Wo.call(t),b,c)}if(ix(t)){var w=[];return Hd&&Hd.call(t,function(C){w.push(d(C,t))}),lf("Set",zo.call(t),w,c)}if(ex(t))return zl("WeakMap");if(rx(t))return zl("WeakSet");if(sx(t))return zl("WeakRef");if(qy(t))return zn(d(Number(t)));if(Ky(t))return zn(d(Xl.call(t)));if(Zy(t))return zn(Ny.call(t));if(jy(t))return zn(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Gs<"u"&&t===Gs)return"{ [object globalThis] }";if(!Wy(t)&&!rf(t)){var E=qo(t,d),T=Kd?Kd(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",I=!T&&Te&&Object(t)===t&&Te in t?Gl.call(Bi(t),8,-1):A?"Object":"",M=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",R=M+(I||A?"["+$s.call(jd.call([],I||[],A||[]),": ")+"] ":"");return E.length===0?R+"{}":c?R+"{"+jl(E,c)+"}":R+"{ "+$s.call(E,", ")+" }"}return String(t)};function sf(r,t,e){var s=e.quoteStyle||t,i=ef[s];return i+r+i}function Yy(r){return ki.call(String(r),/"/g,"&quot;")}function Wl(r){return Bi(r)==="[object Array]"&&(!Te||!(typeof r=="object"&&Te in r))}function Wy(r){return Bi(r)==="[object Date]"&&(!Te||!(typeof r=="object"&&Te in r))}function rf(r){return Bi(r)==="[object RegExp]"&&(!Te||!(typeof r=="object"&&Te in r))}function zy(r){return Bi(r)==="[object Error]"&&(!Te||!(typeof r=="object"&&Te in r))}function jy(r){return Bi(r)==="[object String]"&&(!Te||!(typeof r=="object"&&Te in r))}function qy(r){return Bi(r)==="[object Number]"&&(!Te||!(typeof r=="object"&&Te in r))}function Zy(r){return Bi(r)==="[object Boolean]"&&(!Te||!(typeof r=="object"&&Te in r))}function nf(r){if(Zr)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Hl)return!1;try{return Hl.call(r),!0}catch{}return!1}function Ky(r){if(!r||typeof r!="object"||!Xl)return!1;try{return Xl.call(r),!0}catch{}return!1}var Qy=Object.prototype.hasOwnProperty||function(r){return r in this};function pi(r,t){return Qy.call(r,t)}function Bi(r){return Vy.call(r)}function Jy(r){if(r.name)return r.name;var t=Gy.call(Uy.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function of(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,s=r.length;e<s;e++)if(r[e]===t)return e;return-1}function tx(r){if(!Wo||!r||typeof r!="object")return!1;try{Wo.call(r);try{zo.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function ex(r){if(!Yn||!r||typeof r!="object")return!1;try{Yn.call(r,Yn);try{Wn.call(r,Wn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function sx(r){if(!Yd||!r||typeof r!="object")return!1;try{return Yd.call(r),!0}catch{}return!1}function ix(r){if(!zo||!r||typeof r!="object")return!1;try{zo.call(r);try{Wo.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function rx(r){if(!Wn||!r||typeof r!="object")return!1;try{Wn.call(r,Wn);try{Yn.call(r,Yn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function nx(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function af(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,s="... "+e+" more character"+(e>1?"s":"");return af(Gl.call(r,0,t.maxStringLength),t)+s}var i=Hy[t.quoteStyle||"single"];i.lastIndex=0;var n=ki.call(ki.call(r,i,"\\$1"),/[\x00-\x1f]/g,ox);return sf(n,"single",t)}function ox(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Xy.call(t.toString(16))}function zn(r){return"Object("+r+")"}function zl(r){return r+" { ? }"}function lf(r,t,e,s){var i=s?jl(e,s):$s.call(e,", ");return r+" ("+t+") {"+i+"}"}function ax(r){for(var t=0;t<r.length;t++)if(of(r[t],`
2
- `)>=0)return!1;return!0}function lx(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=$s.call(Array(r.indent+1)," ");else return null;return{base:e,prev:$s.call(Array(t+1),e)}}function jl(r,t){if(r.length===0)return"";var e=`
1
+ (function(Ns){typeof define=="function"&&define.amd?define(Ns):Ns()})(function(){"use strict";var Ns=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ns||{}),bd=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(bd||{}),Pl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Pl||{}),W=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(W||{}),xs=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(xs||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),Wr=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Wr||{}),tt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(tt||{}),j=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(j||{}),je=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(je||{}),Fi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Fi||{}),vs=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(vs||{}),Re=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Re||{}),Vs=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Vs||{}),Rl=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Rl||{}),os=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(os||{}),ce=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(ce||{}),ie=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(ie||{}),Us=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Us||{});const z={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Ml=/iPhone/i,wd=/iPod/i,Ed=/iPad/i,Td=/\biOS-universal(?:.+)Mac\b/i,Fl=/\bAndroid(?:.+)Mobile\b/i,Ad=/Android/i,zr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Uo=/Silk/i,di=/Windows Phone/i,Sd=/\bWindows(?:.+)ARM\b/i,Cd=/BlackBerry/i,Id=/BB10/i,Pd=/Opera Mini/i,Rd=/\b(CriOS|Chrome)(?:.+)Mobile/i,Md=/Mobile(?:.+)Firefox\b/i,Fd=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function ay(r){return function(t){return t.test(r)}}function kd(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]<"u"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]<"u"&&(e=s[0]);var i=ay(e),n={apple:{phone:i(Ml)&&!i(di),ipod:i(wd),tablet:!i(Ml)&&(i(Ed)||Fd(t))&&!i(di),universal:i(Td),device:(i(Ml)||i(wd)||i(Ed)||i(Td)||Fd(t))&&!i(di)},amazon:{phone:i(zr),tablet:!i(zr)&&i(Uo),device:i(zr)||i(Uo)},android:{phone:!i(di)&&i(zr)||!i(di)&&i(Fl),tablet:!i(di)&&!i(zr)&&!i(Fl)&&(i(Uo)||i(Ad)),device:!i(di)&&(i(zr)||i(Uo)||i(Fl)||i(Ad))||i(/\bokhttp\b/i)},windows:{phone:i(di),tablet:i(Sd),device:i(di)||i(Sd)},other:{blackberry:i(Cd),blackberry10:i(Id),opera:i(Pd),firefox:i(Md),chrome:i(Rd),device:i(Cd)||i(Id)||i(Pd)||i(Md)||i(Rd)},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}const ly=kd.default??kd,fi=ly(globalThis.navigator);z.RETINA_PREFIX=/@([0-9\.]+)x/,z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function hy(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),e}var Dd={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(o,l,u){this.fn=o,this.context=l,this.once=u||!1}function n(o,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new i(u,c||o,d),p=e?e+l:l;return o._events[p]?o._events[p].fn?o._events[p]=[o._events[p],f]:o._events[p].push(f):(o._events[p]=f,o._eventsCount++),o}function a(o,l){--o._eventsCount===0?o._events=new s:delete o._events[l]}function h(){this._events=new s,this._eventsCount=0}h.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},h.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);d<f;d++)p[d]=c[d].fn;return p},h.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},h.prototype.emit=function(l,u,c,d,f,p){var m=e?e+l:l;if(!this._events[m])return!1;var g=this._events[m],_=arguments.length,x,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),_){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,d),!0;case 5:return g.fn.call(g.context,u,c,d,f),!0;case 6:return g.fn.call(g.context,u,c,d,f,p),!0}for(y=1,x=new Array(_-1);y<_;y++)x[y-1]=arguments[y];g.fn.apply(g.context,x)}else{var v=g.length,b;for(y=0;y<v;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),_){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,u);break;case 3:g[y].fn.call(g[y].context,u,c);break;case 4:g[y].fn.call(g[y].context,u,c,d);break;default:if(!x)for(b=1,x=new Array(_-1);b<_;b++)x[b-1]=arguments[b];g[y].fn.apply(g[y].context,x)}}return!0},h.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},h.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},h.prototype.removeListener=function(l,u,c,d){var f=e?e+l:l;if(!this._events[f])return this;if(!u)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!d||p.once)&&(!c||p.context===c)&&a(this,f);else{for(var m=0,g=[],_=p.length;m<_;m++)(p[m].fn!==u||d&&!p[m].once||c&&p[m].context!==c)&&g.push(p[m]);g.length?this._events[f]=g.length===1?g[0]:g:a(this,f)}return this},h.prototype.removeAllListeners=function(l){var u;return l?(u=e?e+l:l,this._events[u]&&a(this,u)):(this._events=new s,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=e,h.EventEmitter=h,r.exports=h})(Dd);var cy=Dd.exports;const Xs=Bd(cy);var kl={exports:{}};kl.exports=Go,kl.exports.default=Go;function Go(r,t,e){e=e||2;var s=t&&t.length,i=s?t[0]*e:r.length,n=Od(r,0,i,e,!0),a=[];if(!n||n.next===n.prev)return a;var h,o,l,u,c,d,f;if(s&&(n=my(r,t,n,e)),r.length>80*e){h=l=r[0],o=u=r[1];for(var p=e;p<i;p+=e)c=r[p],d=r[p+1],c<h&&(h=c),d<o&&(o=d),c>l&&(l=c),d>u&&(u=d);f=Math.max(l-h,u-o),f=f!==0?32767/f:0}return Xn(n,a,e,h,o,f,0),a}function Od(r,t,e,s,i){var n,a;if(i===Ol(r,t,e,s)>0)for(n=t;n<e;n+=s)a=Vd(n,r[n],r[n+1],a);else for(n=e-s;n>=t;n-=s)a=Vd(n,r[n],r[n+1],a);return a&&Xo(a,a.next)&&(Hn(a),a=a.next),a}function dr(r,t){if(!r)return r;t||(t=r);var e=r,s;do if(s=!1,!e.steiner&&(Xo(e,e.next)||Lt(e.prev,e,e.next)===0)){if(Hn(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function Xn(r,t,e,s,i,n,a){if(r){!a&&n&&vy(r,s,i,n);for(var h=r,o,l;r.prev!==r.next;){if(o=r.prev,l=r.next,n?dy(r,s,i,n):uy(r)){t.push(o.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Hn(r),r=l.next,h=l.next;continue}if(r=l,r===h){a?a===1?(r=fy(dr(r),t,e),Xn(r,t,e,s,i,n,2)):a===2&&py(r,t,e,s,i,n):Xn(dr(r),t,e,s,i,n,1);break}}}}function uy(r){var t=r.prev,e=r,s=r.next;if(Lt(t,e,s)>=0)return!1;for(var i=t.x,n=e.x,a=s.x,h=t.y,o=e.y,l=s.y,u=i<n?i<a?i:a:n<a?n:a,c=h<o?h<l?h:l:o<l?o:l,d=i>n?i>a?i:a:n>a?n:a,f=h>o?h>l?h:l:o>l?o:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&jr(i,h,n,o,a,l,p.x,p.y)&&Lt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function dy(r,t,e,s){var i=r.prev,n=r,a=r.next;if(Lt(i,n,a)>=0)return!1;for(var h=i.x,o=n.x,l=a.x,u=i.y,c=n.y,d=a.y,f=h<o?h<l?h:l:o<l?o:l,p=u<c?u<d?u:d:c<d?c:d,m=h>o?h>l?h:l:o>l?o:l,g=u>c?u>d?u:d:c>d?c:d,_=Bl(f,p,t,e,s),x=Bl(m,g,t,e,s),y=r.prevZ,v=r.nextZ;y&&y.z>=_&&v&&v.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==i&&y!==a&&jr(h,u,o,c,l,d,y.x,y.y)&&Lt(y.prev,y,y.next)>=0||(y=y.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==i&&v!==a&&jr(h,u,o,c,l,d,v.x,v.y)&&Lt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;y&&y.z>=_;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==i&&y!==a&&jr(h,u,o,c,l,d,y.x,y.y)&&Lt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==i&&v!==a&&jr(h,u,o,c,l,d,v.x,v.y)&&Lt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function fy(r,t,e){var s=r;do{var i=s.prev,n=s.next.next;!Xo(i,n)&&Ld(i,s,s.next,n)&&$n(i,n)&&$n(n,i)&&(t.push(i.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),Hn(s),Hn(s.next),s=r=n),s=s.next}while(s!==r);return dr(s)}function py(r,t,e,s,i,n){var a=r;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&Ey(a,h)){var o=Nd(a,h);a=dr(a,a.next),o=dr(o,o.next),Xn(a,t,e,s,i,n,0),Xn(o,t,e,s,i,n,0);return}h=h.next}a=a.next}while(a!==r)}function my(r,t,e,s){var i=[],n,a,h,o,l;for(n=0,a=t.length;n<a;n++)h=t[n]*s,o=n<a-1?t[n+1]*s:r.length,l=Od(r,h,o,s,!1),l===l.next&&(l.steiner=!0),i.push(wy(l));for(i.sort(gy),n=0;n<i.length;n++)e=_y(i[n],e);return e}function gy(r,t){return r.x-t.x}function _y(r,t){var e=yy(r,t);if(!e)return t;var s=Nd(e,r);return dr(s,s.next),dr(e,e.next)}function yy(r,t){var e=t,s=r.x,i=r.y,n=-1/0,a;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){var h=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=s&&h>n&&(n=h,a=e.x<e.next.x?e:e.next,h===s))return a}e=e.next}while(e!==t);if(!a)return null;var o=a,l=a.x,u=a.y,c=1/0,d;e=a;do s>=e.x&&e.x>=l&&s!==e.x&&jr(i<u?s:n,i,l,u,i<u?n:s,i,e.x,e.y)&&(d=Math.abs(i-e.y)/(s-e.x),$n(e,r)&&(d<c||d===c&&(e.x>a.x||e.x===a.x&&xy(a,e)))&&(a=e,c=d)),e=e.next;while(e!==o);return a}function xy(r,t){return Lt(r.prev,r,t.prev)<0&&Lt(t.next,r,r.next)<0}function vy(r,t,e,s){var i=r;do i.z===0&&(i.z=Bl(i.x,i.y,t,e,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,by(i)}function by(r){var t,e,s,i,n,a,h,o,l=1;do{for(e=r,r=null,n=null,a=0;e;){for(a++,s=e,h=0,t=0;t<l&&(h++,s=s.nextZ,!!s);t++);for(o=l;h>0||o>0&&s;)h!==0&&(o===0||!s||e.z<=s.z)?(i=e,e=e.nextZ,h--):(i=s,s=s.nextZ,o--),n?n.nextZ=i:r=i,i.prevZ=n,n=i;e=s}n.nextZ=null,l*=2}while(a>1);return r}function Bl(r,t,e,s,i){return r=(r-e)*i|0,t=(t-s)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function wy(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function jr(r,t,e,s,i,n,a,h){return(i-a)*(t-h)>=(r-a)*(n-h)&&(r-a)*(s-h)>=(e-a)*(t-h)&&(e-a)*(n-h)>=(i-a)*(s-h)}function Ey(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Ty(r,t)&&($n(r,t)&&$n(t,r)&&Ay(r,t)&&(Lt(r.prev,r,t.prev)||Lt(r,t.prev,t))||Xo(r,t)&&Lt(r.prev,r,r.next)>0&&Lt(t.prev,t,t.next)>0)}function Lt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Xo(r,t){return r.x===t.x&&r.y===t.y}function Ld(r,t,e,s){var i=Ho(Lt(r,t,e)),n=Ho(Lt(r,t,s)),a=Ho(Lt(e,s,r)),h=Ho(Lt(e,s,t));return!!(i!==n&&a!==h||i===0&&$o(r,e,t)||n===0&&$o(r,s,t)||a===0&&$o(e,r,s)||h===0&&$o(e,t,s))}function $o(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Ho(r){return r>0?1:r<0?-1:0}function Ty(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Ld(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function $n(r,t){return Lt(r.prev,r,r.next)<0?Lt(r,t,r.next)>=0&&Lt(r,r.prev,t)>=0:Lt(r,t,r.prev)<0||Lt(r,r.next,t)<0}function Ay(r,t){var e=r,s=!1,i=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==r);return s}function Nd(r,t){var e=new Dl(r.i,r.x,r.y),s=new Dl(t.i,t.x,t.y),i=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Vd(r,t,e,s){var i=new Dl(r,t,e);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function Hn(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Dl(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Go.deviation=function(r,t,e,s){var i=t&&t.length,n=i?t[0]*e:r.length,a=Math.abs(Ol(r,0,n,e));if(i)for(var h=0,o=t.length;h<o;h++){var l=t[h]*e,u=h<o-1?t[h+1]*e:r.length;a-=Math.abs(Ol(r,l,u,e))}var c=0;for(h=0;h<s.length;h+=3){var d=s[h]*e,f=s[h+1]*e,p=s[h+2]*e;c+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return a===0&&c===0?0:Math.abs((c-a)/a)};function Ol(r,t,e,s){for(var i=0,n=t,a=e-s;n<e;n+=s)i+=(r[a]-r[n])*(r[n+1]+r[a+1]),a=n;return i}Go.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},s=0,i=0;i<r.length;i++){for(var n=0;n<r[i].length;n++)for(var a=0;a<t;a++)e.vertices.push(r[i][n][a]);i>0&&(s+=r[i-1].length,e.holes.push(s))}return e};var Sy=kl.exports;const Cy=Bd(Sy);var Yo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Yo.exports,function(r,t){(function(e){var s=t&&!t.nodeType&&t,i=r&&!r.nodeType&&r,n=typeof Gs=="object"&&Gs;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,h=2147483647,o=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=o-l,b=Math.floor,w=String.fromCharCode,E;function T(O){throw new RangeError(y[O])}function A(O,N){for(var Z=O.length,Q=[];Z--;)Q[Z]=N(O[Z]);return Q}function I(O,N){var Z=O.split("@"),Q="";Z.length>1&&(Q=Z[0]+"@",O=Z[1]),O=O.replace(x,".");var Y=O.split("."),lt=A(Y,N).join(".");return Q+lt}function M(O){for(var N=[],Z=0,Q=O.length,Y,lt;Z<Q;)Y=O.charCodeAt(Z++),Y>=55296&&Y<=56319&&Z<Q?(lt=O.charCodeAt(Z++),(lt&64512)==56320?N.push(((Y&1023)<<10)+(lt&1023)+65536):(N.push(Y),Z--)):N.push(Y);return N}function R(O){return A(O,function(N){var Z="";return N>65535&&(N-=65536,Z+=w(N>>>10&1023|55296),N=56320|N&1023),Z+=w(N),Z}).join("")}function C(O){return O-48<10?O-22:O-65<26?O-65:O-97<26?O-97:o}function P(O,N){return O+22+75*(O<26)-((N!=0)<<5)}function k(O,N,Z){var Q=0;for(O=Z?b(O/d):O>>1,O+=b(O/N);O>v*u>>1;Q+=o)O=b(O/v);return b(Q+(v+1)*O/(O+c))}function U(O){var N=[],Z=O.length,Q,Y=0,lt=p,Tt=f,_t,Bt,zt,Qt,Rt,jt,Ot,ze,rs;for(_t=O.lastIndexOf(m),_t<0&&(_t=0),Bt=0;Bt<_t;++Bt)O.charCodeAt(Bt)>=128&&T("not-basic"),N.push(O.charCodeAt(Bt));for(zt=_t>0?_t+1:0;zt<Z;){for(Qt=Y,Rt=1,jt=o;zt>=Z&&T("invalid-input"),Ot=C(O.charCodeAt(zt++)),(Ot>=o||Ot>b((h-Y)/Rt))&&T("overflow"),Y+=Ot*Rt,ze=jt<=Tt?l:jt>=Tt+u?u:jt-Tt,!(Ot<ze);jt+=o)rs=o-ze,Rt>b(h/rs)&&T("overflow"),Rt*=rs;Q=N.length+1,Tt=k(Y-Qt,Q,Qt==0),b(Y/Q)>h-lt&&T("overflow"),lt+=b(Y/Q),Y%=Q,N.splice(Y++,0,lt)}return R(N)}function V(O){var N,Z,Q,Y,lt,Tt,_t,Bt,zt,Qt,Rt,jt=[],Ot,ze,rs,lr;for(O=M(O),Ot=O.length,N=p,Z=0,lt=f,Tt=0;Tt<Ot;++Tt)Rt=O[Tt],Rt<128&&jt.push(w(Rt));for(Q=Y=jt.length,Y&&jt.push(m);Q<Ot;){for(_t=h,Tt=0;Tt<Ot;++Tt)Rt=O[Tt],Rt>=N&&Rt<_t&&(_t=Rt);for(ze=Q+1,_t-N>b((h-Z)/ze)&&T("overflow"),Z+=(_t-N)*ze,N=_t,Tt=0;Tt<Ot;++Tt)if(Rt=O[Tt],Rt<N&&++Z>h&&T("overflow"),Rt==N){for(Bt=Z,zt=o;Qt=zt<=lt?l:zt>=lt+u?u:zt-lt,!(Bt<Qt);zt+=o)lr=Bt-Qt,rs=o-Qt,jt.push(w(P(Qt+lr%rs,0))),Bt=b(lr/rs);jt.push(w(P(Bt,0))),lt=k(Z,ze,Q==Y),Z=0,++Q}++Z,++N}return jt.join("")}function L(O){return I(O,function(N){return g.test(N)?U(N.slice(4).toLowerCase()):N})}function $(O){return I(O,function(N){return _.test(N)?"xn--"+V(N):N})}if(a={version:"1.4.1",ucs2:{decode:M,encode:R},decode:U,encode:V,toASCII:$,toUnicode:L},s&&i)if(r.exports==s)i.exports=a;else for(E in a)a.hasOwnProperty(E)&&(s[E]=a[E]);else e.punycode=a})(Gs)}(Yo,Yo.exports);var Iy=Yo.exports,qr=TypeError;const Py=hy(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ll=typeof Map=="function"&&Map.prototype,Nl=Object.getOwnPropertyDescriptor&&Ll?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Wo=Ll&&Nl&&typeof Nl.get=="function"?Nl.get:null,Ud=Ll&&Map.prototype.forEach,Vl=typeof Set=="function"&&Set.prototype,Ul=Object.getOwnPropertyDescriptor&&Vl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,zo=Vl&&Ul&&typeof Ul.get=="function"?Ul.get:null,Gd=Vl&&Set.prototype.forEach,Ry=typeof WeakMap=="function"&&WeakMap.prototype,Yn=Ry?WeakMap.prototype.has:null,My=typeof WeakSet=="function"&&WeakSet.prototype,Wn=My?WeakSet.prototype.has:null,Fy=typeof WeakRef=="function"&&WeakRef.prototype,Xd=Fy?WeakRef.prototype.deref:null,ky=Boolean.prototype.valueOf,By=Object.prototype.toString,Dy=Function.prototype.toString,Oy=String.prototype.match,Gl=String.prototype.slice,ki=String.prototype.replace,Ly=String.prototype.toUpperCase,$d=String.prototype.toLowerCase,Hd=RegExp.prototype.test,Yd=Array.prototype.concat,$s=Array.prototype.join,Ny=Array.prototype.slice,Wd=Math.floor,Xl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,$l=Object.getOwnPropertySymbols,Hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Zr=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Zr||"symbol")?Symbol.toStringTag:null,zd=Object.prototype.propertyIsEnumerable,jd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function qd(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Hd.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var s=r<0?-Wd(-r):Wd(r);if(s!==r){var i=String(s),n=Gl.call(t,i.length+1);return ki.call(i,e,"$&_")+"."+ki.call(ki.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ki.call(t,e,"$&_")}var Yl=Py,Zd=Yl.custom,Kd=ef(Zd)?Zd:null,Qd={__proto__:null,double:'"',single:"'"},Vy={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},jo=function r(t,e,s,i){var n=e||{};if(pi(n,"quoteStyle")&&!pi(Qd,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pi(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=pi(n,"customInspect")?n.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(pi(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(pi(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var h=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return rf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var o=String(t);return h?qd(t,o):o}if(typeof t=="bigint"){var l=String(t)+"n";return h?qd(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof s>"u"&&(s=0),s>=u&&u>0&&typeof t=="object")return Wl(t)?"[Array]":"[Object]";var c=ix(n,s);if(typeof i>"u")i=[];else if(sf(i,t)>=0)return"[Circular]";function d(C,P,k){if(P&&(i=Ny.call(i),i.push(P)),k){var U={depth:n.depth};return pi(n,"quoteStyle")&&(U.quoteStyle=n.quoteStyle),r(C,U,s+1,i)}return r(C,n,s+1,i)}if(typeof t=="function"&&!tf(t)){var f=jy(t),p=qo(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+$s.call(p,", ")+" }":"")}if(ef(t)){var m=Zr?ki.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Hl.call(t);return typeof t=="object"&&!Zr?zn(m):m}if(tx(t)){for(var g="<"+$d.call(String(t.nodeName)),_=t.attributes||[],x=0;x<_.length;x++)g+=" "+_[x].name+"="+Jd(Uy(_[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+$d.call(String(t.nodeName))+">",g}if(Wl(t)){if(t.length===0)return"[]";var y=qo(t,d);return c&&!sx(y)?"["+jl(y,c)+"]":"[ "+$s.call(y,", ")+" ]"}if(Xy(t)){var v=qo(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!zd.call(t,"cause")?"{ ["+String(t)+"] "+$s.call(Yd.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$s.call(v,", ")+" }"}if(typeof t=="object"&&a){if(Kd&&typeof t[Kd]=="function"&&Yl)return Yl(t,{depth:u-s});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(qy(t)){var b=[];return Ud&&Ud.call(t,function(C,P){b.push(d(P,t,!0)+" => "+d(C,t))}),nf("Map",Wo.call(t),b,c)}if(Qy(t)){var w=[];return Gd&&Gd.call(t,function(C){w.push(d(C,t))}),nf("Set",zo.call(t),w,c)}if(Zy(t))return zl("WeakMap");if(Jy(t))return zl("WeakSet");if(Ky(t))return zl("WeakRef");if(Hy(t))return zn(d(Number(t)));if(Wy(t))return zn(d(Xl.call(t)));if(Yy(t))return zn(ky.call(t));if($y(t))return zn(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Gs<"u"&&t===Gs)return"{ [object globalThis] }";if(!Gy(t)&&!tf(t)){var E=qo(t,d),T=jd?jd(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",I=!T&&Te&&Object(t)===t&&Te in t?Gl.call(Bi(t),8,-1):A?"Object":"",M=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",R=M+(I||A?"["+$s.call(Yd.call([],I||[],A||[]),": ")+"] ":"");return E.length===0?R+"{}":c?R+"{"+jl(E,c)+"}":R+"{ "+$s.call(E,", ")+" }"}return String(t)};function Jd(r,t,e){var s=e.quoteStyle||t,i=Qd[s];return i+r+i}function Uy(r){return ki.call(String(r),/"/g,"&quot;")}function Wl(r){return Bi(r)==="[object Array]"&&(!Te||!(typeof r=="object"&&Te in r))}function Gy(r){return Bi(r)==="[object Date]"&&(!Te||!(typeof r=="object"&&Te in r))}function tf(r){return Bi(r)==="[object RegExp]"&&(!Te||!(typeof r=="object"&&Te in r))}function Xy(r){return Bi(r)==="[object Error]"&&(!Te||!(typeof r=="object"&&Te in r))}function $y(r){return Bi(r)==="[object String]"&&(!Te||!(typeof r=="object"&&Te in r))}function Hy(r){return Bi(r)==="[object Number]"&&(!Te||!(typeof r=="object"&&Te in r))}function Yy(r){return Bi(r)==="[object Boolean]"&&(!Te||!(typeof r=="object"&&Te in r))}function ef(r){if(Zr)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Hl)return!1;try{return Hl.call(r),!0}catch{}return!1}function Wy(r){if(!r||typeof r!="object"||!Xl)return!1;try{return Xl.call(r),!0}catch{}return!1}var zy=Object.prototype.hasOwnProperty||function(r){return r in this};function pi(r,t){return zy.call(r,t)}function Bi(r){return By.call(r)}function jy(r){if(r.name)return r.name;var t=Oy.call(Dy.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function sf(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,s=r.length;e<s;e++)if(r[e]===t)return e;return-1}function qy(r){if(!Wo||!r||typeof r!="object")return!1;try{Wo.call(r);try{zo.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function Zy(r){if(!Yn||!r||typeof r!="object")return!1;try{Yn.call(r,Yn);try{Wn.call(r,Wn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function Ky(r){if(!Xd||!r||typeof r!="object")return!1;try{return Xd.call(r),!0}catch{}return!1}function Qy(r){if(!zo||!r||typeof r!="object")return!1;try{zo.call(r);try{Wo.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function Jy(r){if(!Wn||!r||typeof r!="object")return!1;try{Wn.call(r,Wn);try{Yn.call(r,Yn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function tx(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function rf(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,s="... "+e+" more character"+(e>1?"s":"");return rf(Gl.call(r,0,t.maxStringLength),t)+s}var i=Vy[t.quoteStyle||"single"];i.lastIndex=0;var n=ki.call(ki.call(r,i,"\\$1"),/[\x00-\x1f]/g,ex);return Jd(n,"single",t)}function ex(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Ly.call(t.toString(16))}function zn(r){return"Object("+r+")"}function zl(r){return r+" { ? }"}function nf(r,t,e,s){var i=s?jl(e,s):$s.call(e,", ");return r+" ("+t+") {"+i+"}"}function sx(r){for(var t=0;t<r.length;t++)if(sf(r[t],`
2
+ `)>=0)return!1;return!0}function ix(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=$s.call(Array(r.indent+1)," ");else return null;return{base:e,prev:$s.call(Array(t+1),e)}}function jl(r,t){if(r.length===0)return"";var e=`
3
3
  `+t.prev+t.base;return e+$s.call(r,","+e)+`
4
- `+t.prev}function qo(r,t){var e=Wl(r),s=[];if(e){s.length=r.length;for(var i=0;i<r.length;i++)s[i]=pi(r,i)?t(r[i],r):""}var n=typeof $l=="function"?$l(r):[],a;if(Zr){a={};for(var h=0;h<n.length;h++)a["$"+n[h]]=n[h]}for(var o in r)pi(r,o)&&(e&&String(Number(o))===o&&o<r.length||Zr&&a["$"+o]instanceof Symbol||(zd.call(/[^\w$]/,o)?s.push(t(o,r)+": "+t(r[o],r)):s.push(o+": "+t(r[o],r))));if(typeof $l=="function")for(var l=0;l<n.length;l++)Zd.call(r,n[l])&&s.push("["+t(n[l])+"]: "+t(r[n[l]],r));return s}var hx=jo,cx=qr,Zo=function(r,t,e){for(var s=r,i;(i=s.next)!=null;s=i)if(i.key===t)return s.next=i.next,e||(i.next=r.next,r.next=i),i},ux=function(r,t){if(r){var e=Zo(r,t);return e&&e.value}},dx=function(r,t,e){var s=Zo(r,t);s?s.value=e:r.next={key:t,next:r.next,value:e}},fx=function(r,t){return r?!!Zo(r,t):!1},px=function(r,t){if(r)return Zo(r,t,!0)},mx=function(){var t,e={assert:function(s){if(!e.has(s))throw new cx("Side channel does not contain "+hx(s))},delete:function(s){var i=t&&t.next,n=px(t,s);return n&&i&&i===n&&(t=void 0),!!n},get:function(s){return ux(t,s)},has:function(s){return fx(t,s)},set:function(s,i){t||(t={next:void 0}),dx(t,s,i)}};return e},hf=Object,gx=Error,_x=EvalError,yx=RangeError,xx=ReferenceError,vx=SyntaxError,bx=URIError,wx=Math.abs,Ex=Math.floor,Tx=Math.max,Ax=Math.min,Sx=Math.pow,Cx=Math.round,Ix=Number.isNaN||function(t){return t!==t},Px=Ix,Rx=function(t){return Px(t)||t===0?t:t<0?-1:1},Mx=Object.getOwnPropertyDescriptor,Ko=Mx;if(Ko)try{Ko([],"length")}catch{Ko=null}var cf=Ko,Qo=Object.defineProperty||!1;if(Qo)try{Qo({},"a",{value:1})}catch{Qo=!1}var Fx=Qo,ql,uf;function kx(){return uf||(uf=1,ql=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),s=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var i=42;t[e]=i;for(var n in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==i||h.enumerable!==!0)return!1}return!0}),ql}var Zl,df;function Bx(){if(df)return Zl;df=1;var r=typeof Symbol<"u"&&Symbol,t=kx();return Zl=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Zl}var Kl,ff;function pf(){return ff||(ff=1,Kl=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Kl}var Ql,mf;function gf(){if(mf)return Ql;mf=1;var r=hf;return Ql=r.getPrototypeOf||null,Ql}var Jl,_f;function Dx(){if(_f)return Jl;_f=1;var r="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,s="[object Function]",i=function(o,l){for(var u=[],c=0;c<o.length;c+=1)u[c]=o[c];for(var d=0;d<l.length;d+=1)u[d+o.length]=l[d];return u},n=function(o,l){for(var u=[],c=l||0,d=0;c<o.length;c+=1,d+=1)u[d]=o[c];return u},a=function(h,o){for(var l="",u=0;u<h.length;u+=1)l+=h[u],u+1<h.length&&(l+=o);return l};return Jl=function(o){var l=this;if(typeof l!="function"||t.apply(l)!==s)throw new TypeError(r+l);for(var u=n(arguments,1),c,d=function(){if(this instanceof c){var _=l.apply(this,i(u,arguments));return Object(_)===_?_:this}return l.apply(o,i(u,arguments))},f=e(0,l.length-u.length),p=[],m=0;m<f;m++)p[m]="$"+m;if(c=Function("binder","return function ("+a(p,",")+"){ return binder.apply(this,arguments); }")(d),l.prototype){var g=function(){};g.prototype=l.prototype,c.prototype=new g,g.prototype=null}return c},Jl}var th,yf;function Jo(){if(yf)return th;yf=1;var r=Dx();return th=Function.prototype.bind||r,th}var eh,xf;function sh(){return xf||(xf=1,eh=Function.prototype.call),eh}var ih,vf;function bf(){return vf||(vf=1,ih=Function.prototype.apply),ih}var Ox=typeof Reflect<"u"&&Reflect&&Reflect.apply,Lx=Jo(),Nx=bf(),Vx=sh(),Ux=Ox,Gx=Ux||Lx.call(Vx,Nx),Xx=Jo(),$x=qr,Hx=sh(),Yx=Gx,wf=function(t){if(t.length<1||typeof t[0]!="function")throw new $x("a function is required");return Yx(Xx,Hx,t)},rh,Ef;function Wx(){if(Ef)return rh;Ef=1;var r=wf,t=cf,e;try{e=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var s=!!e&&t&&t(Object.prototype,"__proto__"),i=Object,n=i.getPrototypeOf;return rh=s&&typeof s.get=="function"?r([s.get]):typeof n=="function"?function(h){return n(h==null?h:i(h))}:!1,rh}var nh,Tf;function zx(){if(Tf)return nh;Tf=1;var r=pf(),t=gf(),e=Wx();return nh=r?function(i){return r(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:e?function(i){return e(i)}:null,nh}var oh,Af;function jx(){if(Af)return oh;Af=1;var r=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=Jo();return oh=e.call(r,t),oh}var ht,qx=hf,Zx=gx,Kx=_x,Qx=yx,Jx=xx,Kr=vx,Qr=qr,tv=bx,ev=wx,sv=Ex,iv=Tx,rv=Ax,nv=Sx,ov=Cx,av=Rx,Sf=Function,ah=function(r){try{return Sf('"use strict"; return ('+r+").constructor;")()}catch{}},jn=cf,lv=Fx,lh=function(){throw new Qr},hv=jn?function(){try{return arguments.callee,lh}catch{try{return jn(arguments,"callee").get}catch{return lh}}}():lh,Jr=Bx()(),de=zx(),cv=gf(),uv=pf(),Cf=bf(),qn=sh(),tn={},dv=typeof Uint8Array>"u"||!de?ht:de(Uint8Array),fr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ht:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ht:ArrayBuffer,"%ArrayIteratorPrototype%":Jr&&de?de([][Symbol.iterator]()):ht,"%AsyncFromSyncIteratorPrototype%":ht,"%AsyncFunction%":tn,"%AsyncGenerator%":tn,"%AsyncGeneratorFunction%":tn,"%AsyncIteratorPrototype%":tn,"%Atomics%":typeof Atomics>"u"?ht:Atomics,"%BigInt%":typeof BigInt>"u"?ht:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ht:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ht:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ht:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Zx,"%eval%":eval,"%EvalError%":Kx,"%Float32Array%":typeof Float32Array>"u"?ht:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ht:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ht:FinalizationRegistry,"%Function%":Sf,"%GeneratorFunction%":tn,"%Int8Array%":typeof Int8Array>"u"?ht:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ht:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ht:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Jr&&de?de(de([][Symbol.iterator]())):ht,"%JSON%":typeof JSON=="object"?JSON:ht,"%Map%":typeof Map>"u"?ht:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Jr||!de?ht:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":qx,"%Object.getOwnPropertyDescriptor%":jn,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ht:Promise,"%Proxy%":typeof Proxy>"u"?ht:Proxy,"%RangeError%":Qx,"%ReferenceError%":Jx,"%Reflect%":typeof Reflect>"u"?ht:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ht:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Jr||!de?ht:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ht:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Jr&&de?de(""[Symbol.iterator]()):ht,"%Symbol%":Jr?Symbol:ht,"%SyntaxError%":Kr,"%ThrowTypeError%":hv,"%TypedArray%":dv,"%TypeError%":Qr,"%Uint8Array%":typeof Uint8Array>"u"?ht:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ht:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ht:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ht:Uint32Array,"%URIError%":tv,"%WeakMap%":typeof WeakMap>"u"?ht:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ht:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ht:WeakSet,"%Function.prototype.call%":qn,"%Function.prototype.apply%":Cf,"%Object.defineProperty%":lv,"%Object.getPrototypeOf%":cv,"%Math.abs%":ev,"%Math.floor%":sv,"%Math.max%":iv,"%Math.min%":rv,"%Math.pow%":nv,"%Math.round%":ov,"%Math.sign%":av,"%Reflect.getPrototypeOf%":uv};if(de)try{null.error}catch(r){var fv=de(de(r));fr["%Error.prototype%"]=fv}var pv=function r(t){var e;if(t==="%AsyncFunction%")e=ah("async function () {}");else if(t==="%GeneratorFunction%")e=ah("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ah("async function* () {}");else if(t==="%AsyncGenerator%"){var s=r("%AsyncGeneratorFunction%");s&&(e=s.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&de&&(e=de(i.prototype))}return fr[t]=e,e},If={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Zn=Jo(),ta=jx(),mv=Zn.call(qn,Array.prototype.concat),gv=Zn.call(Cf,Array.prototype.splice),Pf=Zn.call(qn,String.prototype.replace),ea=Zn.call(qn,String.prototype.slice),_v=Zn.call(qn,RegExp.prototype.exec),yv=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,xv=/\\(\\)?/g,vv=function(t){var e=ea(t,0,1),s=ea(t,-1);if(e==="%"&&s!=="%")throw new Kr("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&e!=="%")throw new Kr("invalid intrinsic syntax, expected opening `%`");var i=[];return Pf(t,yv,function(n,a,h,o){i[i.length]=h?Pf(o,xv,"$1"):a||n}),i},bv=function(t,e){var s=t,i;if(ta(If,s)&&(i=If[s],s="%"+i[0]+"%"),ta(fr,s)){var n=fr[s];if(n===tn&&(n=pv(s)),typeof n>"u"&&!e)throw new Qr("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:s,value:n}}throw new Kr("intrinsic "+t+" does not exist!")},hh=function(t,e){if(typeof t!="string"||t.length===0)throw new Qr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Qr('"allowMissing" argument must be a boolean');if(_v(/^%?[^%]*%?$/,t)===null)throw new Kr("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=vv(t),i=s.length>0?s[0]:"",n=bv("%"+i+"%",e),a=n.name,h=n.value,o=!1,l=n.alias;l&&(i=l[0],gv(s,mv([0,1],l)));for(var u=1,c=!0;u<s.length;u+=1){var d=s[u],f=ea(d,0,1),p=ea(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Kr("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(o=!0),i+="."+d,a="%"+i+"%",ta(fr,a))h=fr[a];else if(h!=null){if(!(d in h)){if(!e)throw new Qr("base intrinsic for "+t+" exists, but the property is not available.");return}if(jn&&u+1>=s.length){var m=jn(h,d);c=!!m,c&&"get"in m&&!("originalValue"in m.get)?h=m.get:h=h[d]}else c=ta(h,d),h=h[d];c&&!o&&(fr[a]=h)}}return h},Rf=hh,Mf=wf,wv=Mf([Rf("%String.prototype.indexOf%")]),Ff=function(t,e){var s=Rf(t,!!e);return typeof s=="function"&&wv(t,".prototype.")>-1?Mf([s]):s},Ev=hh,Kn=Ff,Tv=jo,Av=qr,kf=Ev("%Map%",!0),Sv=Kn("Map.prototype.get",!0),Cv=Kn("Map.prototype.set",!0),Iv=Kn("Map.prototype.has",!0),Pv=Kn("Map.prototype.delete",!0),Rv=Kn("Map.prototype.size",!0),Bf=!!kf&&function(){var t,e={assert:function(s){if(!e.has(s))throw new Av("Side channel does not contain "+Tv(s))},delete:function(s){if(t){var i=Pv(t,s);return Rv(t)===0&&(t=void 0),i}return!1},get:function(s){if(t)return Sv(t,s)},has:function(s){return t?Iv(t,s):!1},set:function(s,i){t||(t=new kf),Cv(t,s,i)}};return e},Mv=hh,sa=Ff,Fv=jo,ia=Bf,kv=qr,en=Mv("%WeakMap%",!0),Bv=sa("WeakMap.prototype.get",!0),Dv=sa("WeakMap.prototype.set",!0),Ov=sa("WeakMap.prototype.has",!0),Lv=sa("WeakMap.prototype.delete",!0),Nv=en?function(){var t,e,s={assert:function(i){if(!s.has(i))throw new kv("Side channel does not contain "+Fv(i))},delete:function(i){if(en&&i&&(typeof i=="object"||typeof i=="function")){if(t)return Lv(t,i)}else if(ia&&e)return e.delete(i);return!1},get:function(i){return en&&i&&(typeof i=="object"||typeof i=="function")&&t?Bv(t,i):e&&e.get(i)},has:function(i){return en&&i&&(typeof i=="object"||typeof i=="function")&&t?Ov(t,i):!!e&&e.has(i)},set:function(i,n){en&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new en),Dv(t,i,n)):ia&&(e||(e=ia()),e.set(i,n))}};return s}:ia,Vv=qr,Uv=jo,Gv=mx,Xv=Bf,$v=Nv,Hv=$v||Xv||Gv,Yv=function(){var t,e={assert:function(s){if(!e.has(s))throw new Vv("Side channel does not contain "+Uv(s))},delete:function(s){return!!t&&t.delete(s)},get:function(s){return t&&t.get(s)},has:function(s){return!!t&&t.has(s)},set:function(s,i){t||(t=Hv()),t.set(s,i)}};return e},Wv=String.prototype.replace,zv=/%20/g,ch={RFC1738:"RFC1738",RFC3986:"RFC3986"},uh={default:ch.RFC3986,formatters:{RFC1738:function(r){return Wv.call(r,zv,"+")},RFC3986:function(r){return String(r)}},RFC1738:ch.RFC1738,RFC3986:ch.RFC3986},jv=uh,dh=Object.prototype.hasOwnProperty,pr=Array.isArray,Hs=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),qv=function(t){for(;t.length>1;){var e=t.pop(),s=e.obj[e.prop];if(pr(s)){for(var i=[],n=0;n<s.length;++n)typeof s[n]<"u"&&i.push(s[n]);e.obj[e.prop]=i}}},Df=function(t,e){for(var s=e&&e.plainObjects?{__proto__:null}:{},i=0;i<t.length;++i)typeof t[i]<"u"&&(s[i]=t[i]);return s},Zv=function r(t,e,s){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(pr(t))t.push(e);else if(t&&typeof t=="object")(s&&(s.plainObjects||s.allowPrototypes)||!dh.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var i=t;return pr(t)&&!pr(e)&&(i=Df(t,s)),pr(t)&&pr(e)?(e.forEach(function(n,a){if(dh.call(t,a)){var h=t[a];h&&typeof h=="object"&&n&&typeof n=="object"?t[a]=r(h,n,s):t.push(n)}else t[a]=n}),t):Object.keys(e).reduce(function(n,a){var h=e[a];return dh.call(n,a)?n[a]=r(n[a],h,s):n[a]=h,n},i)},Kv=function(t,e){return Object.keys(e).reduce(function(s,i){return s[i]=e[i],s},t)},Qv=function(r,t,e){var s=r.replace(/\+/g," ");if(e==="iso-8859-1")return s.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(s)}catch{return s}},fh=1024,Jv=function(t,e,s,i,n){if(t.length===0)return t;var a=t;if(typeof t=="symbol"?a=Symbol.prototype.toString.call(t):typeof t!="string"&&(a=String(t)),s==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var h="",o=0;o<a.length;o+=fh){for(var l=a.length>=fh?a.slice(o,o+fh):a,u=[],c=0;c<l.length;++c){var d=l.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||n===jv.RFC1738&&(d===40||d===41)){u[u.length]=l.charAt(c);continue}if(d<128){u[u.length]=Hs[d];continue}if(d<2048){u[u.length]=Hs[192|d>>6]+Hs[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=Hs[224|d>>12]+Hs[128|d>>6&63]+Hs[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|l.charCodeAt(c)&1023),u[u.length]=Hs[240|d>>18]+Hs[128|d>>12&63]+Hs[128|d>>6&63]+Hs[128|d&63]}h+=u.join("")}return h},tb=function(t){for(var e=[{obj:{o:t},prop:"o"}],s=[],i=0;i<e.length;++i)for(var n=e[i],a=n.obj[n.prop],h=Object.keys(a),o=0;o<h.length;++o){var l=h[o],u=a[l];typeof u=="object"&&u!==null&&s.indexOf(u)===-1&&(e.push({obj:a,prop:l}),s.push(u))}return qv(e),t},eb=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},sb=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},ib=function(t,e){return[].concat(t,e)},rb=function(t,e){if(pr(t)){for(var s=[],i=0;i<t.length;i+=1)s.push(e(t[i]));return s}return e(t)},Of={arrayToObject:Df,assign:Kv,combine:ib,compact:tb,decode:Qv,encode:Jv,isBuffer:sb,isRegExp:eb,maybeMap:rb,merge:Zv},Lf=Yv,ra=Of,Qn=uh,nb=Object.prototype.hasOwnProperty,Nf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ys=Array.isArray,ob=Array.prototype.push,Vf=function(r,t){ob.apply(r,Ys(t)?t:[t])},ab=Date.prototype.toISOString,Uf=Qn.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ra.encode,encodeValuesOnly:!1,filter:void 0,format:Uf,formatter:Qn.formatters[Uf],indices:!1,serializeDate:function(t){return ab.call(t)},skipNulls:!1,strictNullHandling:!1},lb=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},ph={},hb=function r(t,e,s,i,n,a,h,o,l,u,c,d,f,p,m,g,_,x){for(var y=t,v=x,b=0,w=!1;(v=v.get(ph))!==void 0&&!w;){var E=v.get(t);if(b+=1,typeof E<"u"){if(E===b)throw new RangeError("Cyclic object value");w=!0}typeof v.get(ph)>"u"&&(b=0)}if(typeof u=="function"?y=u(e,y):y instanceof Date?y=f(y):s==="comma"&&Ys(y)&&(y=ra.maybeMap(y,function(O){return O instanceof Date?f(O):O})),y===null){if(a)return l&&!g?l(e,ue.encoder,_,"key",p):e;y=""}if(lb(y)||ra.isBuffer(y)){if(l){var T=g?e:l(e,ue.encoder,_,"key",p);return[m(T)+"="+m(l(y,ue.encoder,_,"value",p))]}return[m(e)+"="+m(String(y))]}var A=[];if(typeof y>"u")return A;var I;if(s==="comma"&&Ys(y))g&&l&&(y=ra.maybeMap(y,l)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(Ys(u))I=u;else{var M=Object.keys(y);I=c?M.sort(c):M}var R=o?String(e).replace(/\./g,"%2E"):String(e),C=i&&Ys(y)&&y.length===1?R+"[]":R;if(n&&Ys(y)&&y.length===0)return C+"[]";for(var P=0;P<I.length;++P){var k=I[P],U=typeof k=="object"&&k&&typeof k.value<"u"?k.value:y[k];if(!(h&&U===null)){var V=d&&o?String(k).replace(/\./g,"%2E"):String(k),L=Ys(y)?typeof s=="function"?s(C,V):C:C+(d?"."+V:"["+V+"]");x.set(t,b);var $=Lf();$.set(ph,x),Vf(A,r(U,L,s,i,n,a,h,o,s==="comma"&&g&&Ys(y)?null:l,u,c,d,f,p,m,g,_,$))}}return A},cb=function(t){if(!t)return ue;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var s=Qn.default;if(typeof t.format<"u"){if(!nb.call(Qn.formatters,t.format))throw new TypeError("Unknown format option provided.");s=t.format}var i=Qn.formatters[s],n=ue.filter;(typeof t.filter=="function"||Ys(t.filter))&&(n=t.filter);var a;if(t.arrayFormat in Nf?a=t.arrayFormat:"indices"in t?a=t.indices?"indices":"repeat":a=ue.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ue.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:h,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ue.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ue.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:s,formatter:i,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},ub=function(r,t){var e=r,s=cb(t),i,n;typeof s.filter=="function"?(n=s.filter,e=n("",e)):Ys(s.filter)&&(n=s.filter,i=n);var a=[];if(typeof e!="object"||e===null)return"";var h=Nf[s.arrayFormat],o=h==="comma"&&s.commaRoundTrip;i||(i=Object.keys(e)),s.sort&&i.sort(s.sort);for(var l=Lf(),u=0;u<i.length;++u){var c=i[u],d=e[c];s.skipNulls&&d===null||Vf(a,hb(d,c,h,o,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,l))}var f=a.join(s.delimiter),p=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},mr=Of,mh=Object.prototype.hasOwnProperty,Gf=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:mr.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},db=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Xf=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},fb="utf8=%26%2310003%3B",pb="utf8=%E2%9C%93",mb=function(t,e){var s={__proto__:null},i=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,a=i.split(e.delimiter,e.throwOnLimitExceeded?n+1:n);if(e.throwOnLimitExceeded&&a.length>n)throw new RangeError("Parameter limit exceeded. Only "+n+" parameter"+(n===1?"":"s")+" allowed.");var h=-1,o,l=e.charset;if(e.charsetSentinel)for(o=0;o<a.length;++o)a[o].indexOf("utf8=")===0&&(a[o]===pb?l="utf-8":a[o]===fb&&(l="iso-8859-1"),h=o,o=a.length);for(o=0;o<a.length;++o)if(o!==h){var u=a[o],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,f,p;d===-1?(f=e.decoder(u,qt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(u.slice(0,d),qt.decoder,l,"key"),p=mr.maybeMap(Xf(u.slice(d+1),e,Gf(s[f])?s[f].length:0),function(g){return e.decoder(g,qt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=db(String(p))),u.indexOf("[]=")>-1&&(p=Gf(p)?[p]:p);var m=mh.call(s,f);m&&e.duplicates==="combine"?s[f]=mr.combine(s[f],p):(!m||e.duplicates==="last")&&(s[f]=p)}return s},gb=function(r,t,e,s){var i=0;if(r.length>0&&r[r.length-1]==="[]"){var n=r.slice(0,-1).join("");i=Array.isArray(t)&&t[n]?t[n].length:0}for(var a=s?t:Xf(t,e,i),h=r.length-1;h>=0;--h){var o,l=r[h];if(l==="[]"&&e.parseArrays)o=e.allowEmptyArrays&&(a===""||e.strictNullHandling&&a===null)?[]:mr.combine([],a);else{o=e.plainObjects?{__proto__:null}:{};var u=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,c=e.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(c,10);!e.parseArrays&&c===""?o={0:a}:!isNaN(d)&&l!==c&&String(d)===c&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(o=[],o[d]=a):c!=="__proto__"&&(o[c]=a)}a=o}return a},_b=function(t,e,s,i){if(t){var n=s.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,h=/(\[[^[\]]*])/g,o=s.depth>0&&a.exec(n),l=o?n.slice(0,o.index):n,u=[];if(l){if(!s.plainObjects&&mh.call(Object.prototype,l)&&!s.allowPrototypes)return;u.push(l)}for(var c=0;s.depth>0&&(o=h.exec(n))!==null&&c<s.depth;){if(c+=1,!s.plainObjects&&mh.call(Object.prototype,o[1].slice(1,-1))&&!s.allowPrototypes)return;u.push(o[1])}if(o){if(s.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+s.depth+" and strictDepth is true");u.push("["+n.slice(o.index)+"]")}return gb(u,e,s,i)}},yb=function(t){if(!t)return qt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?qt.charset:t.charset,s=typeof t.duplicates>"u"?qt.duplicates:t.duplicates;if(s!=="combine"&&s!=="first"&&s!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var i=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:i,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:qt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:qt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:qt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:qt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:qt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:qt.decoder,delimiter:typeof t.delimiter=="string"||mr.isRegExp(t.delimiter)?t.delimiter:qt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:qt.depth,duplicates:s,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:qt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:qt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:qt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:qt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}},xb=function(r,t){var e=yb(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var s=typeof r=="string"?mb(r,e):r,i=e.plainObjects?{__proto__:null}:{},n=Object.keys(s),a=0;a<n.length;++a){var h=n[a],o=_b(h,s[h],e,typeof r=="string");i=mr.merge(i,o,e)}return e.allowSparse===!0?i:mr.compact(i)},vb=ub,bb=xb,wb=uh,Eb={formats:wb,parse:bb,stringify:vb},Tb=ky;function mi(){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 Ab=/^([a-z0-9.+-]+:)/i,Sb=/:[0-9]*$/,Cb=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Ib=["<",">",'"',"`"," ","\r",`
5
- `," "],Pb=["{","}","|","\\","^","`"].concat(Ib),gh=["'"].concat(Pb),$f=["%","/","?",";","#"].concat(gh),Hf=["/","?","#"],Rb=255,Yf=/^[+a-z0-9A-Z_-]{0,63}$/,Mb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Fb={javascript:!0,"javascript:":!0},_h={javascript:!0,"javascript:":!0},sn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},yh=Eb;function kb(r,t,e){if(r&&typeof r=="object"&&r instanceof mi)return r;var s=new mi;return s.parse(r,t,e),s}mi.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var s=r.indexOf("?"),i=s!==-1&&s<r.indexOf("#")?"?":"#",n=r.split(i),a=/\\/g;n[0]=n[0].replace(a,"/"),r=n.join(i);var h=r;if(h=h.trim(),!e&&r.split("#").length===1){var o=Cb.exec(h);if(o)return this.path=h,this.href=h,this.pathname=o[1],o[2]?(this.search=o[2],t?this.query=yh.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=Ab.exec(h);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,h=h.substr(l.length)}if(e||l||h.match(/^\/\/[^@/]+@[^@/]+/)){var c=h.substr(0,2)==="//";c&&!(l&&_h[l])&&(h=h.substr(2),this.slashes=!0)}if(!_h[l]&&(c||l&&!sn[l])){for(var d=-1,f=0;f<Hf.length;f++){var p=h.indexOf(Hf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=h.lastIndexOf("@"):g=h.lastIndexOf("@",d),g!==-1&&(m=h.slice(0,g),h=h.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<$f.length;f++){var p=h.indexOf($f[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=h.length),this.host=h.slice(0,d),h=h.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var x=this.hostname.split(/\./),f=0,y=x.length;f<y;f++){var v=x[f];if(v&&!v.match(Yf)){for(var b="",w=0,E=v.length;w<E;w++)v.charCodeAt(w)>127?b+="x":b+=v[w];if(!b.match(Yf)){var T=x.slice(0,f),A=x.slice(f+1),I=v.match(Mb);I&&(T.push(I[1]),A.unshift(I[2])),A.length&&(h="/"+A.join(".")+h),this.hostname=T.join(".");break}}}this.hostname.length>Rb?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=Tb.toASCII(this.hostname));var M=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+M,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),h[0]!=="/"&&(h="/"+h))}if(!Fb[u])for(var f=0,y=gh.length;f<y;f++){var C=gh[f];if(h.indexOf(C)!==-1){var P=encodeURIComponent(C);P===C&&(P=escape(C)),h=h.split(C).join(P)}}var k=h.indexOf("#");k!==-1&&(this.hash=h.substr(k),h=h.slice(0,k));var U=h.indexOf("?");if(U!==-1?(this.search=h.substr(U),this.query=h.substr(U+1),t&&(this.query=yh.parse(this.query)),h=h.slice(0,U)):t&&(this.search="",this.query={}),h&&(this.pathname=h),sn[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var M=this.pathname||"",V=this.search||"";this.path=M+V}return this.href=this.format(),this},mi.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",s=this.hash||"",i=!1,n="";this.host?i=r+this.host:this.hostname&&(i=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=yh.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||sn[t])&&i!==!1?(i="//"+(i||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):i||(i=""),s&&s.charAt(0)!=="#"&&(s="#"+s),a&&a.charAt(0)!=="?"&&(a="?"+a),e=e.replace(/[?#]/g,function(h){return encodeURIComponent(h)}),a=a.replace("#","%23"),t+i+e+a+s},mi.prototype.resolve=function(r){return this.resolveObject(kb(r,!1,!0)).format()},mi.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new mi;t.parse(r,!1,!0),r=t}for(var e=new mi,s=Object.keys(this),i=0;i<s.length;i++){var n=s[i];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var a=Object.keys(r),h=0;h<a.length;h++){var o=a[h];o!=="protocol"&&(e[o]=r[o])}return sn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!sn[r.protocol]){for(var l=Object.keys(r),u=0;u<l.length;u++){var c=l[u];e[c]=r[c]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!_h[r.protocol]){for(var y=(r.pathname||"").split("/");y.length&&!(r.host=y.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||e.host&&r.pathname,_=g,x=e.pathname&&e.pathname.split("/")||[],y=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!sn[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(y[0]===""?y[0]=r.host:y.unshift(r.host)),r.host=null),g=g&&(y[0]===""||x[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,x=y;else if(y.length)x||(x=[]),x.pop(),x=x.concat(y),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=x.shift(),e.hostname=e.host;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(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 w=x.slice(-1)[0],E=(e.host||r.host||x.length>1)&&(w==="."||w==="..")||w==="",T=0,A=x.length;A>=0;A--)w=x[A],w==="."?x.splice(A,1):w===".."?(x.splice(A,1),T++):T&&(x.splice(A,1),T--);if(!g&&!_)for(;T--;T)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),E&&x.join("/").substr(-1)!=="/"&&x.push("");var I=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=I?"":x.length?x.shift():"",e.host=e.hostname;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!I&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},mi.prototype.parseHost=function(){var r=this.host,t=Sb.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Wf={};function ot(r,t,e=3){if(Wf[t])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
4
+ `+t.prev}function qo(r,t){var e=Wl(r),s=[];if(e){s.length=r.length;for(var i=0;i<r.length;i++)s[i]=pi(r,i)?t(r[i],r):""}var n=typeof $l=="function"?$l(r):[],a;if(Zr){a={};for(var h=0;h<n.length;h++)a["$"+n[h]]=n[h]}for(var o in r)pi(r,o)&&(e&&String(Number(o))===o&&o<r.length||Zr&&a["$"+o]instanceof Symbol||(Hd.call(/[^\w$]/,o)?s.push(t(o,r)+": "+t(r[o],r)):s.push(o+": "+t(r[o],r))));if(typeof $l=="function")for(var l=0;l<n.length;l++)zd.call(r,n[l])&&s.push("["+t(n[l])+"]: "+t(r[n[l]],r));return s}var rx=jo,nx=qr,Zo=function(r,t,e){for(var s=r,i;(i=s.next)!=null;s=i)if(i.key===t)return s.next=i.next,e||(i.next=r.next,r.next=i),i},ox=function(r,t){if(r){var e=Zo(r,t);return e&&e.value}},ax=function(r,t,e){var s=Zo(r,t);s?s.value=e:r.next={key:t,next:r.next,value:e}},lx=function(r,t){return r?!!Zo(r,t):!1},hx=function(r,t){if(r)return Zo(r,t,!0)},cx=function(){var t,e={assert:function(s){if(!e.has(s))throw new nx("Side channel does not contain "+rx(s))},delete:function(s){var i=t&&t.next,n=hx(t,s);return n&&i&&i===n&&(t=void 0),!!n},get:function(s){return ox(t,s)},has:function(s){return lx(t,s)},set:function(s,i){t||(t={next:void 0}),ax(t,s,i)}};return e},of=Object,ux=Error,dx=EvalError,fx=RangeError,px=ReferenceError,mx=SyntaxError,gx=URIError,_x=Math.abs,yx=Math.floor,xx=Math.max,vx=Math.min,bx=Math.pow,wx=Math.round,Ex=Number.isNaN||function(t){return t!==t},Tx=Ex,Ax=function(t){return Tx(t)||t===0?t:t<0?-1:1},Sx=Object.getOwnPropertyDescriptor,Ko=Sx;if(Ko)try{Ko([],"length")}catch{Ko=null}var af=Ko,Qo=Object.defineProperty||!1;if(Qo)try{Qo({},"a",{value:1})}catch{Qo=!1}var Cx=Qo,ql,lf;function Ix(){return lf||(lf=1,ql=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),s=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var i=42;t[e]=i;for(var n in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==i||h.enumerable!==!0)return!1}return!0}),ql}var Zl,hf;function Px(){if(hf)return Zl;hf=1;var r=typeof Symbol<"u"&&Symbol,t=Ix();return Zl=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Zl}var Kl,cf;function uf(){return cf||(cf=1,Kl=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Kl}var Ql,df;function ff(){if(df)return Ql;df=1;var r=of;return Ql=r.getPrototypeOf||null,Ql}var Rx="Function.prototype.bind called on incompatible ",Mx=Object.prototype.toString,Fx=Math.max,kx="[object Function]",pf=function(t,e){for(var s=[],i=0;i<t.length;i+=1)s[i]=t[i];for(var n=0;n<e.length;n+=1)s[n+t.length]=e[n];return s},Bx=function(t,e){for(var s=[],i=e||0,n=0;i<t.length;i+=1,n+=1)s[n]=t[i];return s},Dx=function(r,t){for(var e="",s=0;s<r.length;s+=1)e+=r[s],s+1<r.length&&(e+=t);return e},Ox=function(t){var e=this;if(typeof e!="function"||Mx.apply(e)!==kx)throw new TypeError(Rx+e);for(var s=Bx(arguments,1),i,n=function(){if(this instanceof i){var u=e.apply(this,pf(s,arguments));return Object(u)===u?u:this}return e.apply(t,pf(s,arguments))},a=Fx(0,e.length-s.length),h=[],o=0;o<a;o++)h[o]="$"+o;if(i=Function("binder","return function ("+Dx(h,",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,i.prototype=new l,l.prototype=null}return i},Lx=Ox,Jo=Function.prototype.bind||Lx,Jl=Function.prototype.call,th,mf;function gf(){return mf||(mf=1,th=Function.prototype.apply),th}var Nx=typeof Reflect<"u"&&Reflect&&Reflect.apply,Vx=Jo,Ux=gf(),Gx=Jl,Xx=Nx,$x=Xx||Vx.call(Gx,Ux),Hx=Jo,Yx=qr,Wx=Jl,zx=$x,_f=function(t){if(t.length<1||typeof t[0]!="function")throw new Yx("a function is required");return zx(Hx,Wx,t)},eh,yf;function jx(){if(yf)return eh;yf=1;var r=_f,t=af,e;try{e=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var s=!!e&&t&&t(Object.prototype,"__proto__"),i=Object,n=i.getPrototypeOf;return eh=s&&typeof s.get=="function"?r([s.get]):typeof n=="function"?function(h){return n(h==null?h:i(h))}:!1,eh}var sh,xf;function qx(){if(xf)return sh;xf=1;var r=uf(),t=ff(),e=jx();return sh=r?function(i){return r(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:e?function(i){return e(i)}:null,sh}var ih,vf;function Zx(){if(vf)return ih;vf=1;var r=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=Jo;return ih=e.call(r,t),ih}var ht,Kx=of,Qx=ux,Jx=dx,tv=fx,ev=px,Kr=mx,Qr=qr,sv=gx,iv=_x,rv=yx,nv=xx,ov=vx,av=bx,lv=wx,hv=Ax,bf=Function,rh=function(r){try{return bf('"use strict"; return ('+r+").constructor;")()}catch{}},jn=af,cv=Cx,nh=function(){throw new Qr},uv=jn?function(){try{return arguments.callee,nh}catch{try{return jn(arguments,"callee").get}catch{return nh}}}():nh,Jr=Px()(),de=qx(),dv=ff(),fv=uf(),wf=gf(),qn=Jl,tn={},pv=typeof Uint8Array>"u"||!de?ht:de(Uint8Array),fr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ht:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ht:ArrayBuffer,"%ArrayIteratorPrototype%":Jr&&de?de([][Symbol.iterator]()):ht,"%AsyncFromSyncIteratorPrototype%":ht,"%AsyncFunction%":tn,"%AsyncGenerator%":tn,"%AsyncGeneratorFunction%":tn,"%AsyncIteratorPrototype%":tn,"%Atomics%":typeof Atomics>"u"?ht:Atomics,"%BigInt%":typeof BigInt>"u"?ht:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ht:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ht:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ht:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Qx,"%eval%":eval,"%EvalError%":Jx,"%Float32Array%":typeof Float32Array>"u"?ht:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ht:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ht:FinalizationRegistry,"%Function%":bf,"%GeneratorFunction%":tn,"%Int8Array%":typeof Int8Array>"u"?ht:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ht:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ht:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Jr&&de?de(de([][Symbol.iterator]())):ht,"%JSON%":typeof JSON=="object"?JSON:ht,"%Map%":typeof Map>"u"?ht:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Jr||!de?ht:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Kx,"%Object.getOwnPropertyDescriptor%":jn,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ht:Promise,"%Proxy%":typeof Proxy>"u"?ht:Proxy,"%RangeError%":tv,"%ReferenceError%":ev,"%Reflect%":typeof Reflect>"u"?ht:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ht:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Jr||!de?ht:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ht:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Jr&&de?de(""[Symbol.iterator]()):ht,"%Symbol%":Jr?Symbol:ht,"%SyntaxError%":Kr,"%ThrowTypeError%":uv,"%TypedArray%":pv,"%TypeError%":Qr,"%Uint8Array%":typeof Uint8Array>"u"?ht:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ht:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ht:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ht:Uint32Array,"%URIError%":sv,"%WeakMap%":typeof WeakMap>"u"?ht:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ht:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ht:WeakSet,"%Function.prototype.call%":qn,"%Function.prototype.apply%":wf,"%Object.defineProperty%":cv,"%Object.getPrototypeOf%":dv,"%Math.abs%":iv,"%Math.floor%":rv,"%Math.max%":nv,"%Math.min%":ov,"%Math.pow%":av,"%Math.round%":lv,"%Math.sign%":hv,"%Reflect.getPrototypeOf%":fv};if(de)try{null.error}catch(r){var mv=de(de(r));fr["%Error.prototype%"]=mv}var gv=function r(t){var e;if(t==="%AsyncFunction%")e=rh("async function () {}");else if(t==="%GeneratorFunction%")e=rh("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=rh("async function* () {}");else if(t==="%AsyncGenerator%"){var s=r("%AsyncGeneratorFunction%");s&&(e=s.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&de&&(e=de(i.prototype))}return fr[t]=e,e},Ef={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Zn=Jo,ta=Zx(),_v=Zn.call(qn,Array.prototype.concat),yv=Zn.call(wf,Array.prototype.splice),Tf=Zn.call(qn,String.prototype.replace),ea=Zn.call(qn,String.prototype.slice),xv=Zn.call(qn,RegExp.prototype.exec),vv=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,bv=/\\(\\)?/g,wv=function(t){var e=ea(t,0,1),s=ea(t,-1);if(e==="%"&&s!=="%")throw new Kr("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&e!=="%")throw new Kr("invalid intrinsic syntax, expected opening `%`");var i=[];return Tf(t,vv,function(n,a,h,o){i[i.length]=h?Tf(o,bv,"$1"):a||n}),i},Ev=function(t,e){var s=t,i;if(ta(Ef,s)&&(i=Ef[s],s="%"+i[0]+"%"),ta(fr,s)){var n=fr[s];if(n===tn&&(n=gv(s)),typeof n>"u"&&!e)throw new Qr("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:s,value:n}}throw new Kr("intrinsic "+t+" does not exist!")},oh=function(t,e){if(typeof t!="string"||t.length===0)throw new Qr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Qr('"allowMissing" argument must be a boolean');if(xv(/^%?[^%]*%?$/,t)===null)throw new Kr("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=wv(t),i=s.length>0?s[0]:"",n=Ev("%"+i+"%",e),a=n.name,h=n.value,o=!1,l=n.alias;l&&(i=l[0],yv(s,_v([0,1],l)));for(var u=1,c=!0;u<s.length;u+=1){var d=s[u],f=ea(d,0,1),p=ea(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Kr("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(o=!0),i+="."+d,a="%"+i+"%",ta(fr,a))h=fr[a];else if(h!=null){if(!(d in h)){if(!e)throw new Qr("base intrinsic for "+t+" exists, but the property is not available.");return}if(jn&&u+1>=s.length){var m=jn(h,d);c=!!m,c&&"get"in m&&!("originalValue"in m.get)?h=m.get:h=h[d]}else c=ta(h,d),h=h[d];c&&!o&&(fr[a]=h)}}return h},Af=oh,Sf=_f,Tv=Sf([Af("%String.prototype.indexOf%")]),Cf=function(t,e){var s=Af(t,!!e);return typeof s=="function"&&Tv(t,".prototype.")>-1?Sf([s]):s},Av=oh,Kn=Cf,Sv=jo,Cv=qr,If=Av("%Map%",!0),Iv=Kn("Map.prototype.get",!0),Pv=Kn("Map.prototype.set",!0),Rv=Kn("Map.prototype.has",!0),Mv=Kn("Map.prototype.delete",!0),Fv=Kn("Map.prototype.size",!0),Pf=!!If&&function(){var t,e={assert:function(s){if(!e.has(s))throw new Cv("Side channel does not contain "+Sv(s))},delete:function(s){if(t){var i=Mv(t,s);return Fv(t)===0&&(t=void 0),i}return!1},get:function(s){if(t)return Iv(t,s)},has:function(s){return t?Rv(t,s):!1},set:function(s,i){t||(t=new If),Pv(t,s,i)}};return e},kv=oh,sa=Cf,Bv=jo,ia=Pf,Dv=qr,en=kv("%WeakMap%",!0),Ov=sa("WeakMap.prototype.get",!0),Lv=sa("WeakMap.prototype.set",!0),Nv=sa("WeakMap.prototype.has",!0),Vv=sa("WeakMap.prototype.delete",!0),Uv=en?function(){var t,e,s={assert:function(i){if(!s.has(i))throw new Dv("Side channel does not contain "+Bv(i))},delete:function(i){if(en&&i&&(typeof i=="object"||typeof i=="function")){if(t)return Vv(t,i)}else if(ia&&e)return e.delete(i);return!1},get:function(i){return en&&i&&(typeof i=="object"||typeof i=="function")&&t?Ov(t,i):e&&e.get(i)},has:function(i){return en&&i&&(typeof i=="object"||typeof i=="function")&&t?Nv(t,i):!!e&&e.has(i)},set:function(i,n){en&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new en),Lv(t,i,n)):ia&&(e||(e=ia()),e.set(i,n))}};return s}:ia,Gv=qr,Xv=jo,$v=cx,Hv=Pf,Yv=Uv,Wv=Yv||Hv||$v,zv=function(){var t,e={assert:function(s){if(!e.has(s))throw new Gv("Side channel does not contain "+Xv(s))},delete:function(s){return!!t&&t.delete(s)},get:function(s){return t&&t.get(s)},has:function(s){return!!t&&t.has(s)},set:function(s,i){t||(t=Wv()),t.set(s,i)}};return e},jv=String.prototype.replace,qv=/%20/g,ah={RFC1738:"RFC1738",RFC3986:"RFC3986"},lh={default:ah.RFC3986,formatters:{RFC1738:function(r){return jv.call(r,qv,"+")},RFC3986:function(r){return String(r)}},RFC1738:ah.RFC1738,RFC3986:ah.RFC3986},Zv=lh,hh=Object.prototype.hasOwnProperty,pr=Array.isArray,Hs=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),Kv=function(t){for(;t.length>1;){var e=t.pop(),s=e.obj[e.prop];if(pr(s)){for(var i=[],n=0;n<s.length;++n)typeof s[n]<"u"&&i.push(s[n]);e.obj[e.prop]=i}}},Rf=function(t,e){for(var s=e&&e.plainObjects?{__proto__:null}:{},i=0;i<t.length;++i)typeof t[i]<"u"&&(s[i]=t[i]);return s},Qv=function r(t,e,s){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(pr(t))t.push(e);else if(t&&typeof t=="object")(s&&(s.plainObjects||s.allowPrototypes)||!hh.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var i=t;return pr(t)&&!pr(e)&&(i=Rf(t,s)),pr(t)&&pr(e)?(e.forEach(function(n,a){if(hh.call(t,a)){var h=t[a];h&&typeof h=="object"&&n&&typeof n=="object"?t[a]=r(h,n,s):t.push(n)}else t[a]=n}),t):Object.keys(e).reduce(function(n,a){var h=e[a];return hh.call(n,a)?n[a]=r(n[a],h,s):n[a]=h,n},i)},Jv=function(t,e){return Object.keys(e).reduce(function(s,i){return s[i]=e[i],s},t)},tb=function(r,t,e){var s=r.replace(/\+/g," ");if(e==="iso-8859-1")return s.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(s)}catch{return s}},ch=1024,eb=function(t,e,s,i,n){if(t.length===0)return t;var a=t;if(typeof t=="symbol"?a=Symbol.prototype.toString.call(t):typeof t!="string"&&(a=String(t)),s==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var h="",o=0;o<a.length;o+=ch){for(var l=a.length>=ch?a.slice(o,o+ch):a,u=[],c=0;c<l.length;++c){var d=l.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||n===Zv.RFC1738&&(d===40||d===41)){u[u.length]=l.charAt(c);continue}if(d<128){u[u.length]=Hs[d];continue}if(d<2048){u[u.length]=Hs[192|d>>6]+Hs[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=Hs[224|d>>12]+Hs[128|d>>6&63]+Hs[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|l.charCodeAt(c)&1023),u[u.length]=Hs[240|d>>18]+Hs[128|d>>12&63]+Hs[128|d>>6&63]+Hs[128|d&63]}h+=u.join("")}return h},sb=function(t){for(var e=[{obj:{o:t},prop:"o"}],s=[],i=0;i<e.length;++i)for(var n=e[i],a=n.obj[n.prop],h=Object.keys(a),o=0;o<h.length;++o){var l=h[o],u=a[l];typeof u=="object"&&u!==null&&s.indexOf(u)===-1&&(e.push({obj:a,prop:l}),s.push(u))}return Kv(e),t},ib=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},rb=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},nb=function(t,e){return[].concat(t,e)},ob=function(t,e){if(pr(t)){for(var s=[],i=0;i<t.length;i+=1)s.push(e(t[i]));return s}return e(t)},Mf={arrayToObject:Rf,assign:Jv,combine:nb,compact:sb,decode:tb,encode:eb,isBuffer:rb,isRegExp:ib,maybeMap:ob,merge:Qv},Ff=zv,ra=Mf,Qn=lh,ab=Object.prototype.hasOwnProperty,kf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ys=Array.isArray,lb=Array.prototype.push,Bf=function(r,t){lb.apply(r,Ys(t)?t:[t])},hb=Date.prototype.toISOString,Df=Qn.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ra.encode,encodeValuesOnly:!1,filter:void 0,format:Df,formatter:Qn.formatters[Df],indices:!1,serializeDate:function(t){return hb.call(t)},skipNulls:!1,strictNullHandling:!1},cb=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},uh={},ub=function r(t,e,s,i,n,a,h,o,l,u,c,d,f,p,m,g,_,x){for(var y=t,v=x,b=0,w=!1;(v=v.get(uh))!==void 0&&!w;){var E=v.get(t);if(b+=1,typeof E<"u"){if(E===b)throw new RangeError("Cyclic object value");w=!0}typeof v.get(uh)>"u"&&(b=0)}if(typeof u=="function"?y=u(e,y):y instanceof Date?y=f(y):s==="comma"&&Ys(y)&&(y=ra.maybeMap(y,function(O){return O instanceof Date?f(O):O})),y===null){if(a)return l&&!g?l(e,ue.encoder,_,"key",p):e;y=""}if(cb(y)||ra.isBuffer(y)){if(l){var T=g?e:l(e,ue.encoder,_,"key",p);return[m(T)+"="+m(l(y,ue.encoder,_,"value",p))]}return[m(e)+"="+m(String(y))]}var A=[];if(typeof y>"u")return A;var I;if(s==="comma"&&Ys(y))g&&l&&(y=ra.maybeMap(y,l)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(Ys(u))I=u;else{var M=Object.keys(y);I=c?M.sort(c):M}var R=o?String(e).replace(/\./g,"%2E"):String(e),C=i&&Ys(y)&&y.length===1?R+"[]":R;if(n&&Ys(y)&&y.length===0)return C+"[]";for(var P=0;P<I.length;++P){var k=I[P],U=typeof k=="object"&&k&&typeof k.value<"u"?k.value:y[k];if(!(h&&U===null)){var V=d&&o?String(k).replace(/\./g,"%2E"):String(k),L=Ys(y)?typeof s=="function"?s(C,V):C:C+(d?"."+V:"["+V+"]");x.set(t,b);var $=Ff();$.set(uh,x),Bf(A,r(U,L,s,i,n,a,h,o,s==="comma"&&g&&Ys(y)?null:l,u,c,d,f,p,m,g,_,$))}}return A},db=function(t){if(!t)return ue;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var s=Qn.default;if(typeof t.format<"u"){if(!ab.call(Qn.formatters,t.format))throw new TypeError("Unknown format option provided.");s=t.format}var i=Qn.formatters[s],n=ue.filter;(typeof t.filter=="function"||Ys(t.filter))&&(n=t.filter);var a;if(t.arrayFormat in kf?a=t.arrayFormat:"indices"in t?a=t.indices?"indices":"repeat":a=ue.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ue.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:h,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ue.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ue.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:s,formatter:i,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},fb=function(r,t){var e=r,s=db(t),i,n;typeof s.filter=="function"?(n=s.filter,e=n("",e)):Ys(s.filter)&&(n=s.filter,i=n);var a=[];if(typeof e!="object"||e===null)return"";var h=kf[s.arrayFormat],o=h==="comma"&&s.commaRoundTrip;i||(i=Object.keys(e)),s.sort&&i.sort(s.sort);for(var l=Ff(),u=0;u<i.length;++u){var c=i[u],d=e[c];s.skipNulls&&d===null||Bf(a,ub(d,c,h,o,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,l))}var f=a.join(s.delimiter),p=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},mr=Mf,dh=Object.prototype.hasOwnProperty,Of=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:mr.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},pb=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Lf=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},mb="utf8=%26%2310003%3B",gb="utf8=%E2%9C%93",_b=function(t,e){var s={__proto__:null},i=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,a=i.split(e.delimiter,e.throwOnLimitExceeded?n+1:n);if(e.throwOnLimitExceeded&&a.length>n)throw new RangeError("Parameter limit exceeded. Only "+n+" parameter"+(n===1?"":"s")+" allowed.");var h=-1,o,l=e.charset;if(e.charsetSentinel)for(o=0;o<a.length;++o)a[o].indexOf("utf8=")===0&&(a[o]===gb?l="utf-8":a[o]===mb&&(l="iso-8859-1"),h=o,o=a.length);for(o=0;o<a.length;++o)if(o!==h){var u=a[o],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,f,p;d===-1?(f=e.decoder(u,qt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(u.slice(0,d),qt.decoder,l,"key"),p=mr.maybeMap(Lf(u.slice(d+1),e,Of(s[f])?s[f].length:0),function(g){return e.decoder(g,qt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=pb(String(p))),u.indexOf("[]=")>-1&&(p=Of(p)?[p]:p);var m=dh.call(s,f);m&&e.duplicates==="combine"?s[f]=mr.combine(s[f],p):(!m||e.duplicates==="last")&&(s[f]=p)}return s},yb=function(r,t,e,s){var i=0;if(r.length>0&&r[r.length-1]==="[]"){var n=r.slice(0,-1).join("");i=Array.isArray(t)&&t[n]?t[n].length:0}for(var a=s?t:Lf(t,e,i),h=r.length-1;h>=0;--h){var o,l=r[h];if(l==="[]"&&e.parseArrays)o=e.allowEmptyArrays&&(a===""||e.strictNullHandling&&a===null)?[]:mr.combine([],a);else{o=e.plainObjects?{__proto__:null}:{};var u=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,c=e.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(c,10);!e.parseArrays&&c===""?o={0:a}:!isNaN(d)&&l!==c&&String(d)===c&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(o=[],o[d]=a):c!=="__proto__"&&(o[c]=a)}a=o}return a},xb=function(t,e,s,i){if(t){var n=s.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,h=/(\[[^[\]]*])/g,o=s.depth>0&&a.exec(n),l=o?n.slice(0,o.index):n,u=[];if(l){if(!s.plainObjects&&dh.call(Object.prototype,l)&&!s.allowPrototypes)return;u.push(l)}for(var c=0;s.depth>0&&(o=h.exec(n))!==null&&c<s.depth;){if(c+=1,!s.plainObjects&&dh.call(Object.prototype,o[1].slice(1,-1))&&!s.allowPrototypes)return;u.push(o[1])}if(o){if(s.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+s.depth+" and strictDepth is true");u.push("["+n.slice(o.index)+"]")}return yb(u,e,s,i)}},vb=function(t){if(!t)return qt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?qt.charset:t.charset,s=typeof t.duplicates>"u"?qt.duplicates:t.duplicates;if(s!=="combine"&&s!=="first"&&s!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var i=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:i,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:qt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:qt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:qt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:qt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:qt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:qt.decoder,delimiter:typeof t.delimiter=="string"||mr.isRegExp(t.delimiter)?t.delimiter:qt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:qt.depth,duplicates:s,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:qt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:qt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:qt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:qt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}},bb=function(r,t){var e=vb(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var s=typeof r=="string"?_b(r,e):r,i=e.plainObjects?{__proto__:null}:{},n=Object.keys(s),a=0;a<n.length;++a){var h=n[a],o=xb(h,s[h],e,typeof r=="string");i=mr.merge(i,o,e)}return e.allowSparse===!0?i:mr.compact(i)},wb=fb,Eb=bb,Tb=lh,Ab={formats:Tb,parse:Eb,stringify:wb},Sb=Iy;function mi(){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 Cb=/^([a-z0-9.+-]+:)/i,Ib=/:[0-9]*$/,Pb=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Rb=["<",">",'"',"`"," ","\r",`
5
+ `," "],Mb=["{","}","|","\\","^","`"].concat(Rb),fh=["'"].concat(Mb),Nf=["%","/","?",";","#"].concat(fh),Vf=["/","?","#"],Fb=255,Uf=/^[+a-z0-9A-Z_-]{0,63}$/,kb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Bb={javascript:!0,"javascript:":!0},ph={javascript:!0,"javascript:":!0},sn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},mh=Ab;function Db(r,t,e){if(r&&typeof r=="object"&&r instanceof mi)return r;var s=new mi;return s.parse(r,t,e),s}mi.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var s=r.indexOf("?"),i=s!==-1&&s<r.indexOf("#")?"?":"#",n=r.split(i),a=/\\/g;n[0]=n[0].replace(a,"/"),r=n.join(i);var h=r;if(h=h.trim(),!e&&r.split("#").length===1){var o=Pb.exec(h);if(o)return this.path=h,this.href=h,this.pathname=o[1],o[2]?(this.search=o[2],t?this.query=mh.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=Cb.exec(h);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,h=h.substr(l.length)}if(e||l||h.match(/^\/\/[^@/]+@[^@/]+/)){var c=h.substr(0,2)==="//";c&&!(l&&ph[l])&&(h=h.substr(2),this.slashes=!0)}if(!ph[l]&&(c||l&&!sn[l])){for(var d=-1,f=0;f<Vf.length;f++){var p=h.indexOf(Vf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=h.lastIndexOf("@"):g=h.lastIndexOf("@",d),g!==-1&&(m=h.slice(0,g),h=h.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Nf.length;f++){var p=h.indexOf(Nf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=h.length),this.host=h.slice(0,d),h=h.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var x=this.hostname.split(/\./),f=0,y=x.length;f<y;f++){var v=x[f];if(v&&!v.match(Uf)){for(var b="",w=0,E=v.length;w<E;w++)v.charCodeAt(w)>127?b+="x":b+=v[w];if(!b.match(Uf)){var T=x.slice(0,f),A=x.slice(f+1),I=v.match(kb);I&&(T.push(I[1]),A.unshift(I[2])),A.length&&(h="/"+A.join(".")+h),this.hostname=T.join(".");break}}}this.hostname.length>Fb?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=Sb.toASCII(this.hostname));var M=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+M,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),h[0]!=="/"&&(h="/"+h))}if(!Bb[u])for(var f=0,y=fh.length;f<y;f++){var C=fh[f];if(h.indexOf(C)!==-1){var P=encodeURIComponent(C);P===C&&(P=escape(C)),h=h.split(C).join(P)}}var k=h.indexOf("#");k!==-1&&(this.hash=h.substr(k),h=h.slice(0,k));var U=h.indexOf("?");if(U!==-1?(this.search=h.substr(U),this.query=h.substr(U+1),t&&(this.query=mh.parse(this.query)),h=h.slice(0,U)):t&&(this.search="",this.query={}),h&&(this.pathname=h),sn[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var M=this.pathname||"",V=this.search||"";this.path=M+V}return this.href=this.format(),this},mi.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",s=this.hash||"",i=!1,n="";this.host?i=r+this.host:this.hostname&&(i=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=mh.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||sn[t])&&i!==!1?(i="//"+(i||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):i||(i=""),s&&s.charAt(0)!=="#"&&(s="#"+s),a&&a.charAt(0)!=="?"&&(a="?"+a),e=e.replace(/[?#]/g,function(h){return encodeURIComponent(h)}),a=a.replace("#","%23"),t+i+e+a+s},mi.prototype.resolve=function(r){return this.resolveObject(Db(r,!1,!0)).format()},mi.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new mi;t.parse(r,!1,!0),r=t}for(var e=new mi,s=Object.keys(this),i=0;i<s.length;i++){var n=s[i];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var a=Object.keys(r),h=0;h<a.length;h++){var o=a[h];o!=="protocol"&&(e[o]=r[o])}return sn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!sn[r.protocol]){for(var l=Object.keys(r),u=0;u<l.length;u++){var c=l[u];e[c]=r[c]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!ph[r.protocol]){for(var y=(r.pathname||"").split("/");y.length&&!(r.host=y.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||e.host&&r.pathname,_=g,x=e.pathname&&e.pathname.split("/")||[],y=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!sn[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(y[0]===""?y[0]=r.host:y.unshift(r.host)),r.host=null),g=g&&(y[0]===""||x[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,x=y;else if(y.length)x||(x=[]),x.pop(),x=x.concat(y),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=x.shift(),e.hostname=e.host;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(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 w=x.slice(-1)[0],E=(e.host||r.host||x.length>1)&&(w==="."||w==="..")||w==="",T=0,A=x.length;A>=0;A--)w=x[A],w==="."?x.splice(A,1):w===".."?(x.splice(A,1),T++):T&&(x.splice(A,1),T--);if(!g&&!_)for(;T--;T)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),E&&x.join("/").substr(-1)!=="/"&&x.push("");var I=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=I?"":x.length?x.shift():"",e.host=e.hostname;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!I&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},mi.prototype.parseHost=function(){var r=this.host,t=Ib.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Gf={};function ot(r,t,e=3){if(Gf[t])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
6
6
  Deprecated since v${r}`):(s=s.split(`
7
7
  `).splice(e).join(`
8
8
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
9
9
  Deprecated since v${r}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
10
- Deprecated since v${r}`),console.warn(s))),Wf[t]=!0}function bs(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Jn(r){return r.split("?")[0].split("#")[0]}function Bb(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Db(r,t,e){return r.replace(new RegExp(Bb(t),"g"),e)}function Ob(r,t){let e="",s=0,i=-1,n=0,a=-1;for(let h=0;h<=r.length;++h){if(h<r.length)a=r.charCodeAt(h);else{if(a===47)break;a=47}if(a===47){if(!(i===h-1||n===1))if(i!==h-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const o=e.lastIndexOf("/");if(o!==e.length-1){o===-1?(e="",s=0):(e=e.slice(0,o),s=e.length-1-e.lastIndexOf("/")),i=h,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=h,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${r.slice(i+1,h)}`:e=r.slice(i+1,h),s=h-i-1;i=h,n=0}else a===46&&n!==-1?++n:n=-1}return e}const bt={toPosix(r){return Db(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){bs(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(bs(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=Jn(this.toPosix(t??z.ADAPTER.getBaseUrl())),i=Jn(this.toPosix(e??this.rootname(s)));return r=this.toPosix(r),r.startsWith("/")?bt.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if(bs(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=Ob(r,!1),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return bs(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const s=r[e];if(bs(s),s.length>0)if(t===void 0)t=s;else{const i=r[e-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(bs(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let s=-1,i=!0;const n=this.getProtocol(r),a=r;r=r.slice(n.length);for(let h=r.length-1;h>=1;--h)if(t=r.charCodeAt(h),t===47){if(!i){s=h;break}}else i=!1;return s===-1?e?"/":this.isUrl(a)?n+r:n:e&&s===1?"//":n+r.slice(0,s)},rootname(r){bs(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){bs(r),t&&bs(t),r=Jn(this.toPosix(r));let e=0,s=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let a=t.length-1,h=-1;for(n=r.length-1;n>=0;--n){const o=r.charCodeAt(n);if(o===47){if(!i){e=n+1;break}}else h===-1&&(i=!1,h=n+1),a>=0&&(o===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=h))}return e===s?s=h:s===-1&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!i){e=n+1;break}}else s===-1&&(i=!1,s=n+1);return s===-1?"":r.slice(e,s)},extname(r){bs(r),r=Jn(this.toPosix(r));let t=-1,e=0,s=-1,i=!0,n=0;for(let a=r.length-1;a>=0;--a){const h=r.charCodeAt(a);if(h===47){if(!i){e=a+1;break}continue}s===-1&&(i=!1,s=a+1),h===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){bs(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Jn(this.toPosix(r));let e=r.charCodeAt(0);const s=this.isAbsolute(r);let i;t.root=this.rootname(r),s||this.hasProtocol(r)?i=1:i=0;let n=-1,a=0,h=-1,o=!0,l=r.length-1,u=0;for(;l>=i;--l){if(e=r.charCodeAt(l),e===47){if(!o){a=l+1;break}continue}h===-1&&(o=!1,h=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&s?t.base=t.name=r.slice(1,h):t.base=t.name=r.slice(a,h)):(a===0&&s?(t.name=r.slice(1,n),t.base=r.slice(1,h)):(t.name=r.slice(a,n),t.base=r.slice(a,h)),t.ext=r.slice(n,h)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let xh;async function Lb(){return xh??(xh=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return Re.UNPACK;const t=await new Promise(a=>{const h=document.createElement("video");h.onloadeddata=()=>a(h),h.onerror=()=>a(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!t)return Re.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const i=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,i),r.deleteFramebuffer(s),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),i[0]<=i[3]?Re.PMA:Re.UNPACK})()),xh}let vh;function Nb(){return typeof vh>"u"&&(vh=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!z.ADAPTER.getWebGLRenderingContext())return!1;const e=z.ADAPTER.createCanvas();let s=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const i=!!((t=s==null?void 0:s.getContextAttributes())!=null&&t.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,i}catch{return!1}}()),vh}var Vb={grad:.9,turn:360,rad:360/(2*Math.PI)},gi=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},fe=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},as=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},zf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},jf=function(r){return{r:as(r.r,0,255),g:as(r.g,0,255),b:as(r.b,0,255),a:as(r.a)}},bh=function(r){return{r:fe(r.r),g:fe(r.g),b:fe(r.b),a:fe(r.a,3)}},Ub=/^#([0-9a-f]{3,8})$/i,na=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},qf=function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),h=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(h<0?h+6:h),s:n?a/n*100:0,v:n/255*100,a:i}},Zf=function(r){var t=r.h,e=r.s,s=r.v,i=r.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),h=s*(1-(t-n)*e),o=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,h,a,a,o,s][l],g:255*[o,s,s,h,a,a][l],b:255*[a,a,o,s,s,h][l],a:i}},Kf=function(r){return{h:zf(r.h),s:as(r.s,0,100),l:as(r.l,0,100),a:as(r.a)}},Qf=function(r){return{h:fe(r.h),s:fe(r.s),l:fe(r.l),a:fe(r.a,3)}},Jf=function(r){return Zf((e=(t=r).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},to=function(r){return{h:(t=qf(r)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},Gb=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xb=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$b=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wh={string:[[function(r){var t=Ub.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?fe(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?fe(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=$b.exec(r)||Hb.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:jf({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(r){var t=Gb.exec(r)||Xb.exec(r);if(!t)return null;var e,s,i=Kf({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Vb[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Jf(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=i===void 0?1:i;return gi(t)&&gi(e)&&gi(s)?jf({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,s=r.l,i=r.a,n=i===void 0?1:i;if(!gi(t)||!gi(e)||!gi(s))return null;var a=Kf({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Jf(a)},"hsl"],[function(r){var t=r.h,e=r.s,s=r.v,i=r.a,n=i===void 0?1:i;if(!gi(t)||!gi(e)||!gi(s))return null;var a=function(h){return{h:zf(h.h),s:as(h.s,0,100),v:as(h.v,0,100),a:as(h.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return Zf(a)},"hsv"]]},tp=function(r,t){for(var e=0;e<t.length;e++){var s=t[e][0](r);if(s)return[s,t[e][1]]}return[null,void 0]},Yb=function(r){return typeof r=="string"?tp(r.trim(),wh.string):typeof r=="object"&&r!==null?tp(r,wh.object):[null,void 0]},Eh=function(r,t){var e=to(r);return{h:e.h,s:as(e.s+100*t,0,100),l:e.l,a:e.a}},Th=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},ep=function(r,t){var e=to(r);return{h:e.h,s:e.s,l:as(e.l+100*t,0,100),a:e.a}},Ah=function(){function r(t){this.parsed=Yb(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return fe(Th(this.rgba),2)},r.prototype.isDark=function(){return Th(this.rgba)<.5},r.prototype.isLight=function(){return Th(this.rgba)>=.5},r.prototype.toHex=function(){return t=bh(this.rgba),e=t.r,s=t.g,i=t.b,a=(n=t.a)<1?na(fe(255*n)):"","#"+na(e)+na(s)+na(i)+a;var t,e,s,i,n,a},r.prototype.toRgb=function(){return bh(this.rgba)},r.prototype.toRgbString=function(){return t=bh(this.rgba),e=t.r,s=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+i+", "+n+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,n},r.prototype.toHsl=function(){return Qf(to(this.rgba))},r.prototype.toHslString=function(){return t=Qf(to(this.rgba)),e=t.h,s=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+n+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,n},r.prototype.toHsv=function(){return t=qf(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},r.prototype.invert=function(){return Ws({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Ws(Eh(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ws(Eh(this.rgba,-t))},r.prototype.grayscale=function(){return Ws(Eh(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ws(ep(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ws(ep(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Ws({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=to(this.rgba);return typeof t=="number"?Ws({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ws(t).toHex()},r}(),Ws=function(r){return r instanceof Ah?r:new Ah(r)},sp=[],Wb=function(r){r.forEach(function(t){sp.indexOf(t)<0&&(t(Ah,wh),sp.push(t))})};function zb(r,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 i in e)s[e[i]]=i;var n={};r.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var h,o,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 r(e[f]).toRgb();for(var p in e){var m=(h=u,o=n[p],Math.pow(h.r-o.r,2)+Math.pow(h.g-o.g,2)+Math.pow(h.b-o.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(a){var h=a.toLowerCase(),o=h==="transparent"?"#0000":e[h];return o?new r(o).toRgb():null},"name"])}Wb([zb]);const rn=class Tl{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 Tl)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?{...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((i,n)=>i===e[n]);if(t!==null&&e!==null){const i=Object.keys(t),n=Object.keys(e);return i.length!==n.length?!1:i.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(i*255),t}toRgbArray(t){t=t??[];const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,i,n]=Tl.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,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,i=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(i<<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,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,s,i,n]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=n,t}normalize(t){let e,s,i,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,i=(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,i,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,i,n=255]=t,e/=255,s/=255,i/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const h=Tl.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}const a=Ws(t);a.isValid()&&({r:e,g:s,b:i,a:n}=a.rgba,e/=255,s/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=i,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((i,n)=>{t[n]=Math.min(Math.max(i,e),s)}),t)}};rn.shared=new rn,rn.temp=new rn,rn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ct=rn;function ip(r,t=[]){return ot("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),Ct.shared.setValue(r).toRgbArray(t)}function jb(r){return ot("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ct.shared.setValue(r).toHex()}function eo(r){return ot("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ct.shared.setValue(r).toNumber()}function qb(){const r=[],t=[];for(let s=0;s<32;s++)r[s]=s,t[s]=s;r[W.NORMAL_NPM]=W.NORMAL,r[W.ADD_NPM]=W.ADD,r[W.SCREEN_NPM]=W.SCREEN,t[W.NORMAL]=W.NORMAL_NPM,t[W.ADD]=W.ADD_NPM,t[W.SCREEN]=W.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const rp=qb();function np(r,t){return rp[t?1:0][r]}function Zb(r,t=null){const e=r*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,i=0;s<e;s+=6,i+=4)t[s+0]=i+0,t[s+1]=i+1,t[s+2]=i+2,t[s+3]=i+0,t[s+4]=i+2,t[s+5]=i+3;return t}function op(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function oa(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function ap(r){return!(r&r-1)&&!!r}function lp(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function nn(r,t,e){const s=r.length;let i;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(i=t;i<n;++i)r[i]=r[i+e];r.length=n}function Di(r){return r===0?0:r<0?-1:1}let Kb=0;function gr(){return++Kb}const Sh=class{constructor(r,t,e,s){this.left=r,this.top=t,this.right=e,this.bottom=s}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Sh.EMPTY=new Sh(0,0,0,0);let hp=Sh;const cp={},zs=Object.create(null),Oi=Object.create(null);class Qb{constructor(t,e,s){this._canvas=z.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||z.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function up(r,t,e){for(let s=0,i=4*e*t;s<t;++s,i+=4)if(r[i+3]!==0)return!1;return!0}function dp(r,t,e,s,i){const n=4*t;for(let a=s,h=s*n+4*e;a<=i;++a,h+=n)if(r[h+3]!==0)return!1;return!0}function Jb(r){const{width:t,height:e}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const i=s.getImageData(0,0,t,e).data;let n=0,a=0,h=t-1,o=e-1;for(;a<e&&up(i,t,a);)++a;if(a===e)return hp.EMPTY;for(;up(i,t,o);)--o;for(;dp(i,t,n,a,o);)++n;for(;dp(i,t,h,a,o);)--h;return++h,++o,new hp(n,a,h,o)}function t1(r){const t=Jb(r),{width:e,height:s}=t;let i=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");i=n.getImageData(t.left,t.top,e,s)}return{width:e,height:s,data:i}}function e1(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function _i(r,t=1){var s;const e=(s=z.RETINA_PREFIX)==null?void 0:s.exec(r);return e?parseFloat(e[1]):t}var H=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(H||{});const Ch=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},fp=(r,t)=>Ch(r).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Ch).forEach(t=>{t.type.forEach(e=>{var s,i;return(i=(s=this._removeHandlers)[e])==null?void 0:i.call(s,t)})}),this},add(...r){return r.map(Ch).forEach(t=>{t.type.forEach(e=>{var n,a;const s=this._addHandlers,i=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(i[e]=i[e]||[],(a=i[e])==null||a.push(t))})}),this},handle(r,t,e){var a;const s=this._addHandlers,i=this._removeHandlers;if(s[r]||i[r])throw new Error(`Extension type ${r} already has a handler`);s[r]=t,i[r]=e;const n=this._queue;return n[r]&&((a=n[r])==null||a.forEach(h=>t(h)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,n)=>fp(n,e)-fp(i,e)))},s=>{const i=t.indexOf(s.ref);i!==-1&&t.splice(i,1)})}};class Ih{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 s1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
- `);function i1(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
12
- else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function r1(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=s1.replace(/%forloop%/gi,i1(r));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const Ph=0,Rh=1,Mh=2,Fh=3,kh=4,Bh=5;class js{constructor(){this.data=0,this.blendMode=W.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ph)}set blend(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph)}get offsets(){return!!(this.data&1<<Rh)}set offsets(t){!!(this.data&1<<Rh)!==t&&(this.data^=1<<Rh)}get culling(){return!!(this.data&1<<Mh)}set culling(t){!!(this.data&1<<Mh)!==t&&(this.data^=1<<Mh)}get depthTest(){return!!(this.data&1<<Fh)}set depthTest(t){!!(this.data&1<<Fh)!==t&&(this.data^=1<<Fh)}get depthMask(){return!!(this.data&1<<Bh)}set depthMask(t){!!(this.data&1<<Bh)!==t&&(this.data^=1<<Bh)}get clockwiseFrontFace(){return!!(this.data&1<<kh)}set clockwiseFrontFace(t){!!(this.data&1<<kh)!==t&&(this.data^=1<<kh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==W.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new js;return t.depthTest=!1,t.blend=!0,t}}js.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Dh=[];function pp(r,t){if(!r)return null;let e="";if(typeof r=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);s&&(e=s[1].toLowerCase())}for(let s=Dh.length-1;s>=0;--s){const i=Dh[s];if(i.test&&i.test(r,e))return new i(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ws{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,i,n,a,h,o){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,s,i,n,a,h,o);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ws.prototype,{dispatch:{value:ws.prototype.emit},run:{value:ws.prototype.emit}});class so{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ws("setRealSize"),this.onUpdate=new ws("update"),this.onError=new ws("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 aa extends so{constructor(t,e){const{width:s,height:i}=e||{};if(!s||!i)throw new Error("BufferResource width or height invalid");super(s,i),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,s){const i=t.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?i.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,i.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}}const n1={scaleMode:je.NEAREST,alphaMode:Re.NPM},Oh=class On extends Xs{constructor(t=null,e=null){super(),e=Object.assign({},On.defaultOptions,e);const{alphaMode:s,mipmap:i,anisotropicLevel:n,scaleMode:a,width:h,height:o,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof so)&&(t=pp(t,p),t.internal=!0),this.resolution=f||z.RESOLUTION,this.width=Math.round((h||0)*this.resolution)/this.resolution,this.height=Math.round((o||0)*this.resolution)/this.resolution,this._mipmap=i,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=gr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=h>0&&o>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=ap(this.realWidth)&&ap(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 Oi[this.cacheId],delete zs[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),On.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=z.STRICT_TEXTURE_CACHE){const i=typeof t=="string";let n=null;if(i)n=t;else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gr()}`}n=t._pixiId}let a=Oi[n];if(i&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new On(t,e),a.cacheId=n,On.addToCache(a,n)),a}static fromBuffer(t,e,s,i){t=t||new Float32Array(e*s*4);const n=new aa(t,{width:e,height:s,...i==null?void 0:i.resourceOptions});let a,h;return t instanceof Float32Array?(a=G.RGBA,h=tt.FLOAT):t instanceof Int32Array?(a=G.RGBA_INTEGER,h=tt.INT):t instanceof Uint32Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_INT):t instanceof Int16Array?(a=G.RGBA_INTEGER,h=tt.SHORT):t instanceof Uint16Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_SHORT):t instanceof Int8Array?(a=G.RGBA,h=tt.BYTE):(a=G.RGBA,h=tt.UNSIGNED_BYTE),n.internal=!0,new On(n,Object.assign({},n1,{type:h,format:a},i))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Oi[e]&&Oi[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Oi[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Oi[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Oi[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Oi[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Oh.defaultOptions={mipmap:vs.POW2,anisotropicLevel:0,scaleMode:je.LINEAR,wrapMode:Fi.CLAMP,alphaMode:Re.UNPACK,target:Wr.TEXTURE_2D,format:G.RGBA,type:tt.UNSIGNED_BYTE},Oh._globalBatch=0;let et=Oh;class Lh{constructor(){this.texArray=null,this.blend=0,this.type=xs.TRIANGLES,this.start=0,this.size=0,this.data=null}}let o1=0;class Jt{constructor(t,e=!0,s=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=s,this.static=e,this.id=o1++,this.disposeRunner=new ws("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Us.ELEMENT_ARRAY_BUFFER:Us.ARRAY_BUFFER}get index(){return this.type===Us.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Jt(t)}}class la{constructor(t,e=0,s=!1,i=tt.FLOAT,n,a,h,o=1){this.buffer=t,this.size=e,this.normalized=s,this.type=i,this.stride=n,this.start=a,this.instance=h,this.divisor=o}destroy(){this.buffer=null}static from(t,e,s,i,n){return new la(t,e,s,i,n)}}const a1={Float32Array,Uint32Array,Int32Array,Uint8Array};function l1(r,t){let e=0,s=0;const i={};for(let o=0;o<r.length;o++)s+=t[o],e+=r[o].length;const n=new ArrayBuffer(e*4);let a=null,h=0;for(let o=0;o<r.length;o++){const l=t[o],u=r[o],c=op(u);i[c]||(i[c]=new a1[c](n)),a=i[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+h,p=d%l;a[f+p]=u[d]}h+=l}return new Float32Array(n)}const mp={5126:4,5123:2,5121:1};let h1=0;const c1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Li{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=h1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ws("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,i=!1,n,a,h,o=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Jt||(e instanceof Array&&(e=new Float32Array(e)),e=new Jt(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,s,i,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new la(u,s,i,n,a,h,o),this.instanced=this.instanced||o,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Jt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Jt(t)),t.type=Us.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],s=new Jt;let i;for(i in this.attributes){const n=this.attributes[i],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*mp[n.type]/4),n.buffer=0}for(s.data=l1(t,e),i=0;i<this.buffers.length;i++)this.buffers[i]!==this.indexBuffer&&this.buffers[i].destroy();return this.buffers=[s],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new Li;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Jt(this.buffers[e].data.slice(0));for(const e in this.attributes){const s=this.attributes[e];t.attributes[e]=new la(s.buffer,s.size,s.normalized,s.type,s.stride,s.start,s.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Us.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Li,s=[],i=[],n=[];let a;for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)i[o]=i[o]||0,i[o]+=a.buffers[o].data.length,n[o]=0}for(let h=0;h<a.buffers.length;h++)s[h]=new c1[op(a.buffers[h].data)](i[h]),e.buffers[h]=new Jt(s[h]);for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)s[o].set(a.buffers[o].data,n[o]),n[o]+=a.buffers[o].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Us.ELEMENT_ARRAY_BUFFER;let h=0,o=0,l=0,u=0;for(let c=0;c<a.buffers.length;c++)if(a.buffers[c]!==a.indexBuffer){u=c;break}for(const c in a.attributes){const d=a.attributes[c];(d.buffer|0)===u&&(o+=d.size*mp[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=h;h+=t[c].buffers[u].data.length/o,l+=d.length}}return e}}class gp extends Li{constructor(t=!1){super(),this._buffer=new Jt(null,t,!1),this._indexBuffer=new Jt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,tt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,tt.FLOAT).addAttribute("aColor",this._buffer,4,!0,tt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,tt.FLOAT).addIndex(this._indexBuffer)}}const ha=Math.PI*2,u1=180/Math.PI,Nh=Math.PI/180;var xe=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(xe||{});class st{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new st(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}}st.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const ca=[new st,new st,new st,new st];let it=class md{constructor(t=0,e=0,s=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i),this.type=xe.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 md(0,0,0,0)}clone(){return new md(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.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const T=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=T)return!1;const A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}const s=this.left,i=this.right,n=this.top,a=this.bottom;if(i<=s||a<=n)return!1;const h=ca[0].set(t.left,t.top),o=ca[1].set(t.left,t.bottom),l=ca[2].set(t.right,t.top),u=ca[3].set(t.right,t.bottom);if(l.x<=h.x||o.y<=h.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(h,h),e.apply(o,o),e.apply(l,l),e.apply(u,u),Math.max(h.x,o.x,l.x,u.x)<=s||Math.min(h.x,o.x,l.x,u.x)>=i||Math.max(h.y,o.y,l.y,u.y)<=n||Math.min(h.y,o.y,l.y,u.y)>=a))return!1;const d=c*(o.y-h.y),f=c*(h.x-o.x),p=d*s+f*n,m=d*i+f*n,g=d*s+f*a,_=d*i+f*a;if(Math.max(p,m,g,_)<=d*h.x+f*h.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;const x=c*(h.y-l.y),y=c*(l.x-h.x),v=x*s+y*n,b=x*i+y*n,w=x*s+y*a,E=x*i+y*a;return!(Math.max(v,b,w,E)<=x*h.x+y*h.y||Math.min(v,b,w,E)>=x*u.x+y*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),i=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=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=n-i,this}};it.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ua{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=xe.CIRC}clone(){return new ua(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=s}getBounds(){return new it(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}ua.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class da{constructor(t=0,e=0,s=0,i=0){this.x=t,this.y=e,this.width=s,this.height=i,this.type=xe.ELIP}clone(){return new da(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,i=(e-this.y)/this.height;return s*=s,i*=i,s+i<=1}getBounds(){return new it(this.x-this.width,this.y-this.height,this.width,this.height)}}da.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ni{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let i=0,n=e.length;i<n;i++)s.push(e[i].x,e[i].y);e=s}this.points=e,this.type=xe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Ni(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let s=!1;const i=this.points.length/2;for(let n=0,a=i-1;n<i;a=n++){const h=this.points[n*2],o=this.points[n*2+1],l=this.points[a*2],u=this.points[a*2+1];o>e!=u>e&&t<(l-h)*((e-o)/(u-o))+h&&(s=!s)}return s}}Ni.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class fa{constructor(t=0,e=0,s=0,i=0,n=20){this.x=t,this.y=e,this.width=s,this.height=i,this.radius=n,this.type=xe.RREC}clone(){return new fa(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(i*i+n*n<=a||(i=t-(this.x+this.width-s),i*i+n*n<=a)||(n=e-(this.y+this.height-s),i*i+n*n<=a)||(i=t-(this.x+s),i*i+n*n<=a))return!0}return!1}}fa.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Mt{constructor(t=1,e=0,s=0,i=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,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,i,n,a){return this.a=t,this.b=e,this.c=s,this.d=i,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 st;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new st;const s=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*s*i+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*i+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,n=this.c,a=this.tx;return this.a=i*e-this.b*s,this.b=i*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,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,i,n,a,h,o,l){return this.a=Math.cos(h+l)*n,this.b=Math.sin(h+l)*n,this.c=-Math.sin(h-o)*a,this.d=Math.cos(h-o)*a,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,n=this.d,a=t.pivot,h=-Math.atan2(-i,n),o=Math.atan2(s,e),l=Math.abs(h+o);return l<1e-5||Math.abs(ha-l)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=h,t.skew.y=o),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(a.x*e+a.y*i),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,n=this.tx,a=t*i-e*s;return this.a=i/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-i*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 Mt;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 Mt}static get TEMP_MATRIX(){return new Mt}}Mt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const _r=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],yr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Vh=[],_p=[],pa=Math.sign;function d1(){for(let r=0;r<16;r++){const t=[];Vh.push(t);for(let e=0;e<16;e++){const s=pa(_r[r]*_r[e]+xr[r]*yr[e]),i=pa(yr[r]*_r[e]+vr[r]*yr[e]),n=pa(_r[r]*xr[e]+xr[r]*vr[e]),a=pa(yr[r]*xr[e]+vr[r]*vr[e]);for(let h=0;h<16;h++)if(_r[h]===s&&yr[h]===i&&xr[h]===n&&vr[h]===a){t.push(h);break}}}for(let r=0;r<16;r++){const t=new Mt;t.set(_r[r],yr[r],xr[r],vr[r],0,0),_p.push(t)}}d1();const Nt={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:r=>_r[r],uY:r=>yr[r],vX:r=>xr[r],vY:r=>vr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Vh[r][t],sub:(r,t)=>Vh[r][Nt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Nt.S:Nt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Nt.E:Nt.W:t>0?r>0?Nt.SE:Nt.SW:r>0?Nt.NE:Nt.NW,matrixAppendRotationInv:(r,t,e=0,s=0)=>{const i=_p[Nt.inv(t)];i.tx=e,i.ty=s,r.append(i)}};class qs{constructor(t,e,s=0,i=0){this._x=s,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new qs(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))}}qs.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Uh=class{constructor(){this.worldTransform=new Mt,this.localTransform=new Mt,this.position=new qs(this.onChange,this,0,0),this.scale=new qs(this.onChange,this,1,1),this.pivot=new qs(this.onChange,this,0,0),this.skew=new qs(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 r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const t=this.localTransform;if(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),this._parentID!==r._worldID){const e=r.worldTransform,s=this.worldTransform;s.a=t.a*e.a+t.b*e.c,s.b=t.a*e.b+t.b*e.d,s.c=t.c*e.a+t.d*e.c,s.d=t.c*e.b+t.d*e.d,s.tx=t.tx*e.a+t.ty*e.c+e.tx,s.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};Uh.IDENTITY=new Uh;let ma=Uh;ma.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var f1=`varying vec2 vTextureCoord;
10
+ Deprecated since v${r}`),console.warn(s))),Gf[t]=!0}function bs(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Jn(r){return r.split("?")[0].split("#")[0]}function Ob(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Lb(r,t,e){return r.replace(new RegExp(Ob(t),"g"),e)}function Nb(r,t){let e="",s=0,i=-1,n=0,a=-1;for(let h=0;h<=r.length;++h){if(h<r.length)a=r.charCodeAt(h);else{if(a===47)break;a=47}if(a===47){if(!(i===h-1||n===1))if(i!==h-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const o=e.lastIndexOf("/");if(o!==e.length-1){o===-1?(e="",s=0):(e=e.slice(0,o),s=e.length-1-e.lastIndexOf("/")),i=h,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=h,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${r.slice(i+1,h)}`:e=r.slice(i+1,h),s=h-i-1;i=h,n=0}else a===46&&n!==-1?++n:n=-1}return e}const bt={toPosix(r){return Lb(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){bs(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(bs(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=Jn(this.toPosix(t??z.ADAPTER.getBaseUrl())),i=Jn(this.toPosix(e??this.rootname(s)));return r=this.toPosix(r),r.startsWith("/")?bt.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if(bs(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=Nb(r,!1),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return bs(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const s=r[e];if(bs(s),s.length>0)if(t===void 0)t=s;else{const i=r[e-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(bs(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let s=-1,i=!0;const n=this.getProtocol(r),a=r;r=r.slice(n.length);for(let h=r.length-1;h>=1;--h)if(t=r.charCodeAt(h),t===47){if(!i){s=h;break}}else i=!1;return s===-1?e?"/":this.isUrl(a)?n+r:n:e&&s===1?"//":n+r.slice(0,s)},rootname(r){bs(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){bs(r),t&&bs(t),r=Jn(this.toPosix(r));let e=0,s=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let a=t.length-1,h=-1;for(n=r.length-1;n>=0;--n){const o=r.charCodeAt(n);if(o===47){if(!i){e=n+1;break}}else h===-1&&(i=!1,h=n+1),a>=0&&(o===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=h))}return e===s?s=h:s===-1&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!i){e=n+1;break}}else s===-1&&(i=!1,s=n+1);return s===-1?"":r.slice(e,s)},extname(r){bs(r),r=Jn(this.toPosix(r));let t=-1,e=0,s=-1,i=!0,n=0;for(let a=r.length-1;a>=0;--a){const h=r.charCodeAt(a);if(h===47){if(!i){e=a+1;break}continue}s===-1&&(i=!1,s=a+1),h===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){bs(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Jn(this.toPosix(r));let e=r.charCodeAt(0);const s=this.isAbsolute(r);let i;t.root=this.rootname(r),s||this.hasProtocol(r)?i=1:i=0;let n=-1,a=0,h=-1,o=!0,l=r.length-1,u=0;for(;l>=i;--l){if(e=r.charCodeAt(l),e===47){if(!o){a=l+1;break}continue}h===-1&&(o=!1,h=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&s?t.base=t.name=r.slice(1,h):t.base=t.name=r.slice(a,h)):(a===0&&s?(t.name=r.slice(1,n),t.base=r.slice(1,h)):(t.name=r.slice(a,n),t.base=r.slice(a,h)),t.ext=r.slice(n,h)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let gh;async function Vb(){return gh??(gh=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return Re.UNPACK;const t=await new Promise(a=>{const h=document.createElement("video");h.onloadeddata=()=>a(h),h.onerror=()=>a(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!t)return Re.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const i=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,i),r.deleteFramebuffer(s),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),i[0]<=i[3]?Re.PMA:Re.UNPACK})()),gh}let _h;function Ub(){return typeof _h>"u"&&(_h=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!z.ADAPTER.getWebGLRenderingContext())return!1;const e=z.ADAPTER.createCanvas();let s=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const i=!!((t=s==null?void 0:s.getContextAttributes())!=null&&t.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,i}catch{return!1}}()),_h}var Gb={grad:.9,turn:360,rad:360/(2*Math.PI)},gi=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},fe=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},as=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Xf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},$f=function(r){return{r:as(r.r,0,255),g:as(r.g,0,255),b:as(r.b,0,255),a:as(r.a)}},yh=function(r){return{r:fe(r.r),g:fe(r.g),b:fe(r.b),a:fe(r.a,3)}},Xb=/^#([0-9a-f]{3,8})$/i,na=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Hf=function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),h=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(h<0?h+6:h),s:n?a/n*100:0,v:n/255*100,a:i}},Yf=function(r){var t=r.h,e=r.s,s=r.v,i=r.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),h=s*(1-(t-n)*e),o=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,h,a,a,o,s][l],g:255*[o,s,s,h,a,a][l],b:255*[a,a,o,s,s,h][l],a:i}},Wf=function(r){return{h:Xf(r.h),s:as(r.s,0,100),l:as(r.l,0,100),a:as(r.a)}},zf=function(r){return{h:fe(r.h),s:fe(r.s),l:fe(r.l),a:fe(r.a,3)}},jf=function(r){return Yf((e=(t=r).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},to=function(r){return{h:(t=Hf(r)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},$b=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hb=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Yb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Wb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xh={string:[[function(r){var t=Xb.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?fe(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?fe(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=Yb.exec(r)||Wb.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:$f({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(r){var t=$b.exec(r)||Hb.exec(r);if(!t)return null;var e,s,i=Wf({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Gb[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return jf(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=i===void 0?1:i;return gi(t)&&gi(e)&&gi(s)?$f({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,s=r.l,i=r.a,n=i===void 0?1:i;if(!gi(t)||!gi(e)||!gi(s))return null;var a=Wf({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return jf(a)},"hsl"],[function(r){var t=r.h,e=r.s,s=r.v,i=r.a,n=i===void 0?1:i;if(!gi(t)||!gi(e)||!gi(s))return null;var a=function(h){return{h:Xf(h.h),s:as(h.s,0,100),v:as(h.v,0,100),a:as(h.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return Yf(a)},"hsv"]]},qf=function(r,t){for(var e=0;e<t.length;e++){var s=t[e][0](r);if(s)return[s,t[e][1]]}return[null,void 0]},zb=function(r){return typeof r=="string"?qf(r.trim(),xh.string):typeof r=="object"&&r!==null?qf(r,xh.object):[null,void 0]},vh=function(r,t){var e=to(r);return{h:e.h,s:as(e.s+100*t,0,100),l:e.l,a:e.a}},bh=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Zf=function(r,t){var e=to(r);return{h:e.h,s:e.s,l:as(e.l+100*t,0,100),a:e.a}},wh=function(){function r(t){this.parsed=zb(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return fe(bh(this.rgba),2)},r.prototype.isDark=function(){return bh(this.rgba)<.5},r.prototype.isLight=function(){return bh(this.rgba)>=.5},r.prototype.toHex=function(){return t=yh(this.rgba),e=t.r,s=t.g,i=t.b,a=(n=t.a)<1?na(fe(255*n)):"","#"+na(e)+na(s)+na(i)+a;var t,e,s,i,n,a},r.prototype.toRgb=function(){return yh(this.rgba)},r.prototype.toRgbString=function(){return t=yh(this.rgba),e=t.r,s=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+i+", "+n+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,n},r.prototype.toHsl=function(){return zf(to(this.rgba))},r.prototype.toHslString=function(){return t=zf(to(this.rgba)),e=t.h,s=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+n+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,n},r.prototype.toHsv=function(){return t=Hf(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},r.prototype.invert=function(){return Ws({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Ws(vh(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ws(vh(this.rgba,-t))},r.prototype.grayscale=function(){return Ws(vh(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ws(Zf(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ws(Zf(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Ws({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=to(this.rgba);return typeof t=="number"?Ws({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ws(t).toHex()},r}(),Ws=function(r){return r instanceof wh?r:new wh(r)},Kf=[],jb=function(r){r.forEach(function(t){Kf.indexOf(t)<0&&(t(wh,xh),Kf.push(t))})};function qb(r,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 i in e)s[e[i]]=i;var n={};r.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var h,o,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 r(e[f]).toRgb();for(var p in e){var m=(h=u,o=n[p],Math.pow(h.r-o.r,2)+Math.pow(h.g-o.g,2)+Math.pow(h.b-o.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(a){var h=a.toLowerCase(),o=h==="transparent"?"#0000":e[h];return o?new r(o).toRgb():null},"name"])}jb([qb]);const rn=class Tl{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 Tl)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?{...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((i,n)=>i===e[n]);if(t!==null&&e!==null){const i=Object.keys(t),n=Object.keys(e);return i.length!==n.length?!1:i.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(i*255),t}toRgbArray(t){t=t??[];const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,i,n]=Tl.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,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,i=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(i<<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,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,s,i,n]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=n,t}normalize(t){let e,s,i,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,i=(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,i,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,i,n=255]=t,e/=255,s/=255,i/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const h=Tl.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}const a=Ws(t);a.isValid()&&({r:e,g:s,b:i,a:n}=a.rgba,e/=255,s/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=i,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((i,n)=>{t[n]=Math.min(Math.max(i,e),s)}),t)}};rn.shared=new rn,rn.temp=new rn,rn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ct=rn;function Qf(r,t=[]){return ot("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),Ct.shared.setValue(r).toRgbArray(t)}function Zb(r){return ot("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ct.shared.setValue(r).toHex()}function eo(r){return ot("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ct.shared.setValue(r).toNumber()}function Kb(){const r=[],t=[];for(let s=0;s<32;s++)r[s]=s,t[s]=s;r[W.NORMAL_NPM]=W.NORMAL,r[W.ADD_NPM]=W.ADD,r[W.SCREEN_NPM]=W.SCREEN,t[W.NORMAL]=W.NORMAL_NPM,t[W.ADD]=W.ADD_NPM,t[W.SCREEN]=W.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Jf=Kb();function tp(r,t){return Jf[t?1:0][r]}function Qb(r,t=null){const e=r*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,i=0;s<e;s+=6,i+=4)t[s+0]=i+0,t[s+1]=i+1,t[s+2]=i+2,t[s+3]=i+0,t[s+4]=i+2,t[s+5]=i+3;return t}function ep(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function oa(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function sp(r){return!(r&r-1)&&!!r}function ip(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function nn(r,t,e){const s=r.length;let i;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(i=t;i<n;++i)r[i]=r[i+e];r.length=n}function Di(r){return r===0?0:r<0?-1:1}let Jb=0;function gr(){return++Jb}const Eh=class{constructor(r,t,e,s){this.left=r,this.top=t,this.right=e,this.bottom=s}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Eh.EMPTY=new Eh(0,0,0,0);let rp=Eh;const np={},zs=Object.create(null),Oi=Object.create(null);class t1{constructor(t,e,s){this._canvas=z.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||z.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function op(r,t,e){for(let s=0,i=4*e*t;s<t;++s,i+=4)if(r[i+3]!==0)return!1;return!0}function ap(r,t,e,s,i){const n=4*t;for(let a=s,h=s*n+4*e;a<=i;++a,h+=n)if(r[h+3]!==0)return!1;return!0}function e1(r){const{width:t,height:e}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const i=s.getImageData(0,0,t,e).data;let n=0,a=0,h=t-1,o=e-1;for(;a<e&&op(i,t,a);)++a;if(a===e)return rp.EMPTY;for(;op(i,t,o);)--o;for(;ap(i,t,n,a,o);)++n;for(;ap(i,t,h,a,o);)--h;return++h,++o,new rp(n,a,h,o)}function s1(r){const t=e1(r),{width:e,height:s}=t;let i=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");i=n.getImageData(t.left,t.top,e,s)}return{width:e,height:s,data:i}}function i1(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function _i(r,t=1){var s;const e=(s=z.RETINA_PREFIX)==null?void 0:s.exec(r);return e?parseFloat(e[1]):t}var H=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(H||{});const Th=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},lp=(r,t)=>Th(r).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Th).forEach(t=>{t.type.forEach(e=>{var s,i;return(i=(s=this._removeHandlers)[e])==null?void 0:i.call(s,t)})}),this},add(...r){return r.map(Th).forEach(t=>{t.type.forEach(e=>{var n,a;const s=this._addHandlers,i=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(i[e]=i[e]||[],(a=i[e])==null||a.push(t))})}),this},handle(r,t,e){var a;const s=this._addHandlers,i=this._removeHandlers;if(s[r]||i[r])throw new Error(`Extension type ${r} already has a handler`);s[r]=t,i[r]=e;const n=this._queue;return n[r]&&((a=n[r])==null||a.forEach(h=>t(h)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,n)=>lp(n,e)-lp(i,e)))},s=>{const i=t.indexOf(s.ref);i!==-1&&t.splice(i,1)})}};class Ah{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 r1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
+ `);function n1(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
12
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function o1(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=r1.replace(/%forloop%/gi,n1(r));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const Sh=0,Ch=1,Ih=2,Ph=3,Rh=4,Mh=5;class js{constructor(){this.data=0,this.blendMode=W.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Sh)}set blend(t){!!(this.data&1<<Sh)!==t&&(this.data^=1<<Sh)}get offsets(){return!!(this.data&1<<Ch)}set offsets(t){!!(this.data&1<<Ch)!==t&&(this.data^=1<<Ch)}get culling(){return!!(this.data&1<<Ih)}set culling(t){!!(this.data&1<<Ih)!==t&&(this.data^=1<<Ih)}get depthTest(){return!!(this.data&1<<Ph)}set depthTest(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph)}get depthMask(){return!!(this.data&1<<Mh)}set depthMask(t){!!(this.data&1<<Mh)!==t&&(this.data^=1<<Mh)}get clockwiseFrontFace(){return!!(this.data&1<<Rh)}set clockwiseFrontFace(t){!!(this.data&1<<Rh)!==t&&(this.data^=1<<Rh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==W.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new js;return t.depthTest=!1,t.blend=!0,t}}js.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Fh=[];function hp(r,t){if(!r)return null;let e="";if(typeof r=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);s&&(e=s[1].toLowerCase())}for(let s=Fh.length-1;s>=0;--s){const i=Fh[s];if(i.test&&i.test(r,e))return new i(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ws{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,i,n,a,h,o){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,s,i,n,a,h,o);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ws.prototype,{dispatch:{value:ws.prototype.emit},run:{value:ws.prototype.emit}});class so{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ws("setRealSize"),this.onUpdate=new ws("update"),this.onError=new ws("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 aa extends so{constructor(t,e){const{width:s,height:i}=e||{};if(!s||!i)throw new Error("BufferResource width or height invalid");super(s,i),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,s){const i=t.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?i.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,i.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}}const a1={scaleMode:je.NEAREST,alphaMode:Re.NPM},kh=class On extends Xs{constructor(t=null,e=null){super(),e=Object.assign({},On.defaultOptions,e);const{alphaMode:s,mipmap:i,anisotropicLevel:n,scaleMode:a,width:h,height:o,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof so)&&(t=hp(t,p),t.internal=!0),this.resolution=f||z.RESOLUTION,this.width=Math.round((h||0)*this.resolution)/this.resolution,this.height=Math.round((o||0)*this.resolution)/this.resolution,this._mipmap=i,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=gr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=h>0&&o>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=sp(this.realWidth)&&sp(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 Oi[this.cacheId],delete zs[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),On.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=z.STRICT_TEXTURE_CACHE){const i=typeof t=="string";let n=null;if(i)n=t;else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gr()}`}n=t._pixiId}let a=Oi[n];if(i&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new On(t,e),a.cacheId=n,On.addToCache(a,n)),a}static fromBuffer(t,e,s,i){t=t||new Float32Array(e*s*4);const n=new aa(t,{width:e,height:s,...i==null?void 0:i.resourceOptions});let a,h;return t instanceof Float32Array?(a=G.RGBA,h=tt.FLOAT):t instanceof Int32Array?(a=G.RGBA_INTEGER,h=tt.INT):t instanceof Uint32Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_INT):t instanceof Int16Array?(a=G.RGBA_INTEGER,h=tt.SHORT):t instanceof Uint16Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_SHORT):t instanceof Int8Array?(a=G.RGBA,h=tt.BYTE):(a=G.RGBA,h=tt.UNSIGNED_BYTE),n.internal=!0,new On(n,Object.assign({},a1,{type:h,format:a},i))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Oi[e]&&Oi[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Oi[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Oi[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Oi[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Oi[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};kh.defaultOptions={mipmap:vs.POW2,anisotropicLevel:0,scaleMode:je.LINEAR,wrapMode:Fi.CLAMP,alphaMode:Re.UNPACK,target:Wr.TEXTURE_2D,format:G.RGBA,type:tt.UNSIGNED_BYTE},kh._globalBatch=0;let et=kh;class Bh{constructor(){this.texArray=null,this.blend=0,this.type=xs.TRIANGLES,this.start=0,this.size=0,this.data=null}}let l1=0;class Jt{constructor(t,e=!0,s=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=s,this.static=e,this.id=l1++,this.disposeRunner=new ws("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Us.ELEMENT_ARRAY_BUFFER:Us.ARRAY_BUFFER}get index(){return this.type===Us.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Jt(t)}}class la{constructor(t,e=0,s=!1,i=tt.FLOAT,n,a,h,o=1){this.buffer=t,this.size=e,this.normalized=s,this.type=i,this.stride=n,this.start=a,this.instance=h,this.divisor=o}destroy(){this.buffer=null}static from(t,e,s,i,n){return new la(t,e,s,i,n)}}const h1={Float32Array,Uint32Array,Int32Array,Uint8Array};function c1(r,t){let e=0,s=0;const i={};for(let o=0;o<r.length;o++)s+=t[o],e+=r[o].length;const n=new ArrayBuffer(e*4);let a=null,h=0;for(let o=0;o<r.length;o++){const l=t[o],u=r[o],c=ep(u);i[c]||(i[c]=new h1[c](n)),a=i[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+h,p=d%l;a[f+p]=u[d]}h+=l}return new Float32Array(n)}const cp={5126:4,5123:2,5121:1};let u1=0;const d1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Li{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=u1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ws("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,i=!1,n,a,h,o=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Jt||(e instanceof Array&&(e=new Float32Array(e)),e=new Jt(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,s,i,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new la(u,s,i,n,a,h,o),this.instanced=this.instanced||o,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Jt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Jt(t)),t.type=Us.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],s=new Jt;let i;for(i in this.attributes){const n=this.attributes[i],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*cp[n.type]/4),n.buffer=0}for(s.data=c1(t,e),i=0;i<this.buffers.length;i++)this.buffers[i]!==this.indexBuffer&&this.buffers[i].destroy();return this.buffers=[s],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new Li;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Jt(this.buffers[e].data.slice(0));for(const e in this.attributes){const s=this.attributes[e];t.attributes[e]=new la(s.buffer,s.size,s.normalized,s.type,s.stride,s.start,s.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Us.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Li,s=[],i=[],n=[];let a;for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)i[o]=i[o]||0,i[o]+=a.buffers[o].data.length,n[o]=0}for(let h=0;h<a.buffers.length;h++)s[h]=new d1[ep(a.buffers[h].data)](i[h]),e.buffers[h]=new Jt(s[h]);for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)s[o].set(a.buffers[o].data,n[o]),n[o]+=a.buffers[o].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Us.ELEMENT_ARRAY_BUFFER;let h=0,o=0,l=0,u=0;for(let c=0;c<a.buffers.length;c++)if(a.buffers[c]!==a.indexBuffer){u=c;break}for(const c in a.attributes){const d=a.attributes[c];(d.buffer|0)===u&&(o+=d.size*cp[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=h;h+=t[c].buffers[u].data.length/o,l+=d.length}}return e}}class up extends Li{constructor(t=!1){super(),this._buffer=new Jt(null,t,!1),this._indexBuffer=new Jt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,tt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,tt.FLOAT).addAttribute("aColor",this._buffer,4,!0,tt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,tt.FLOAT).addIndex(this._indexBuffer)}}const ha=Math.PI*2,f1=180/Math.PI,Dh=Math.PI/180;var xe=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(xe||{});class st{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new st(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}}st.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const ca=[new st,new st,new st,new st];let it=class dd{constructor(t=0,e=0,s=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i),this.type=xe.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 dd(0,0,0,0)}clone(){return new dd(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.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const T=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=T)return!1;const A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}const s=this.left,i=this.right,n=this.top,a=this.bottom;if(i<=s||a<=n)return!1;const h=ca[0].set(t.left,t.top),o=ca[1].set(t.left,t.bottom),l=ca[2].set(t.right,t.top),u=ca[3].set(t.right,t.bottom);if(l.x<=h.x||o.y<=h.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(h,h),e.apply(o,o),e.apply(l,l),e.apply(u,u),Math.max(h.x,o.x,l.x,u.x)<=s||Math.min(h.x,o.x,l.x,u.x)>=i||Math.max(h.y,o.y,l.y,u.y)<=n||Math.min(h.y,o.y,l.y,u.y)>=a))return!1;const d=c*(o.y-h.y),f=c*(h.x-o.x),p=d*s+f*n,m=d*i+f*n,g=d*s+f*a,_=d*i+f*a;if(Math.max(p,m,g,_)<=d*h.x+f*h.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;const x=c*(h.y-l.y),y=c*(l.x-h.x),v=x*s+y*n,b=x*i+y*n,w=x*s+y*a,E=x*i+y*a;return!(Math.max(v,b,w,E)<=x*h.x+y*h.y||Math.min(v,b,w,E)>=x*u.x+y*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),i=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=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=n-i,this}};it.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ua{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=xe.CIRC}clone(){return new ua(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=s}getBounds(){return new it(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}ua.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class da{constructor(t=0,e=0,s=0,i=0){this.x=t,this.y=e,this.width=s,this.height=i,this.type=xe.ELIP}clone(){return new da(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,i=(e-this.y)/this.height;return s*=s,i*=i,s+i<=1}getBounds(){return new it(this.x-this.width,this.y-this.height,this.width,this.height)}}da.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ni{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let i=0,n=e.length;i<n;i++)s.push(e[i].x,e[i].y);e=s}this.points=e,this.type=xe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Ni(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let s=!1;const i=this.points.length/2;for(let n=0,a=i-1;n<i;a=n++){const h=this.points[n*2],o=this.points[n*2+1],l=this.points[a*2],u=this.points[a*2+1];o>e!=u>e&&t<(l-h)*((e-o)/(u-o))+h&&(s=!s)}return s}}Ni.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class fa{constructor(t=0,e=0,s=0,i=0,n=20){this.x=t,this.y=e,this.width=s,this.height=i,this.radius=n,this.type=xe.RREC}clone(){return new fa(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(i*i+n*n<=a||(i=t-(this.x+this.width-s),i*i+n*n<=a)||(n=e-(this.y+this.height-s),i*i+n*n<=a)||(i=t-(this.x+s),i*i+n*n<=a))return!0}return!1}}fa.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Mt{constructor(t=1,e=0,s=0,i=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,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,i,n,a){return this.a=t,this.b=e,this.c=s,this.d=i,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 st;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new st;const s=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*s*i+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*i+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,n=this.c,a=this.tx;return this.a=i*e-this.b*s,this.b=i*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,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,i,n,a,h,o,l){return this.a=Math.cos(h+l)*n,this.b=Math.sin(h+l)*n,this.c=-Math.sin(h-o)*a,this.d=Math.cos(h-o)*a,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,n=this.d,a=t.pivot,h=-Math.atan2(-i,n),o=Math.atan2(s,e),l=Math.abs(h+o);return l<1e-5||Math.abs(ha-l)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=h,t.skew.y=o),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(a.x*e+a.y*i),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,n=this.tx,a=t*i-e*s;return this.a=i/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-i*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 Mt;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 Mt}static get TEMP_MATRIX(){return new Mt}}Mt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const _r=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],yr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Oh=[],dp=[],pa=Math.sign;function p1(){for(let r=0;r<16;r++){const t=[];Oh.push(t);for(let e=0;e<16;e++){const s=pa(_r[r]*_r[e]+xr[r]*yr[e]),i=pa(yr[r]*_r[e]+vr[r]*yr[e]),n=pa(_r[r]*xr[e]+xr[r]*vr[e]),a=pa(yr[r]*xr[e]+vr[r]*vr[e]);for(let h=0;h<16;h++)if(_r[h]===s&&yr[h]===i&&xr[h]===n&&vr[h]===a){t.push(h);break}}}for(let r=0;r<16;r++){const t=new Mt;t.set(_r[r],yr[r],xr[r],vr[r],0,0),dp.push(t)}}p1();const Nt={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:r=>_r[r],uY:r=>yr[r],vX:r=>xr[r],vY:r=>vr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Oh[r][t],sub:(r,t)=>Oh[r][Nt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Nt.S:Nt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Nt.E:Nt.W:t>0?r>0?Nt.SE:Nt.SW:r>0?Nt.NE:Nt.NW,matrixAppendRotationInv:(r,t,e=0,s=0)=>{const i=dp[Nt.inv(t)];i.tx=e,i.ty=s,r.append(i)}};class qs{constructor(t,e,s=0,i=0){this._x=s,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new qs(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))}}qs.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Lh=class{constructor(){this.worldTransform=new Mt,this.localTransform=new Mt,this.position=new qs(this.onChange,this,0,0),this.scale=new qs(this.onChange,this,1,1),this.pivot=new qs(this.onChange,this,0,0),this.skew=new qs(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 r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const t=this.localTransform;if(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),this._parentID!==r._worldID){const e=r.worldTransform,s=this.worldTransform;s.a=t.a*e.a+t.b*e.c,s.b=t.a*e.b+t.b*e.d,s.c=t.c*e.a+t.d*e.c,s.d=t.c*e.b+t.d*e.d,s.tx=t.tx*e.a+t.ty*e.c+e.tx,s.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};Lh.IDENTITY=new Lh;let ma=Lh;ma.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var m1=`varying vec2 vTextureCoord;
13
13
 
14
14
  uniform sampler2D uSampler;
15
15
 
16
16
  void main(void){
17
17
  gl_FragColor *= texture2D(uSampler, vTextureCoord);
18
- }`,p1=`attribute vec2 aVertexPosition;
18
+ }`,g1=`attribute vec2 aVertexPosition;
19
19
  attribute vec2 aTextureCoord;
20
20
 
21
21
  uniform mat3 projectionMatrix;
@@ -26,7 +26,7 @@ void main(void){
26
26
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
27
27
  vTextureCoord = aTextureCoord;
28
28
  }
29
- `;function yp(r,t,e){const s=r.createShader(t);return r.shaderSource(s,e),r.compileShader(s),s}function Gh(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function xp(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Gh(2*t);case"bvec3":return Gh(3*t);case"bvec4":return Gh(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const on=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
29
+ `;function fp(r,t,e){const s=r.createShader(t);return r.shaderSource(s,e),r.compileShader(s),s}function Nh(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function pp(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Nh(2*t);case"bvec3":return Nh(3*t);case"bvec4":return Nh(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const on=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
30
30
  if(uv["${r}"] !== ud["${r}"].value)
31
31
  {
32
32
  ud["${r}"].value = uv["${r}"]
@@ -146,7 +146,7 @@ void main(void){
146
146
  cv[3] = v[3];
147
147
 
148
148
  gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
149
- }`}],m1={float:`
149
+ }`}],_1={float:`
150
150
  if (cv !== v)
151
151
  {
152
152
  cu.value = v;
@@ -282,7 +282,7 @@ void main(void){
282
282
  cu.value = v;
283
283
 
284
284
  gl.uniform1i(location, v);
285
- }`},g1={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 _1(r,t){var s;const e=[`
285
+ }`},y1={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 x1(r,t){var s;const e=[`
286
286
  var v = null;
287
287
  var cv = null;
288
288
  var cu = null;
@@ -292,18 +292,18 @@ void main(void){
292
292
  renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');
293
293
  `):e.push(`
294
294
  renderer.shader.syncUniformGroup(uv.${i}, syncData);
295
- `));continue}const a=r.uniforms[i];let h=!1;for(let o=0;o<on.length;o++)if(on[o].test(n,a)){e.push(on[o].code(i,a)),h=!0;break}if(!h){const o=(n.size===1&&!n.isArray?m1:g1)[n.type].replace("location",`ud["${i}"].location`);e.push(`
295
+ `));continue}const a=r.uniforms[i];let h=!1;for(let o=0;o<on.length;o++)if(on[o].test(n,a)){e.push(on[o].code(i,a)),h=!0;break}if(!h){const o=(n.size===1&&!n.isArray?_1:y1)[n.type].replace("location",`ud["${i}"].location`);e.push(`
296
296
  cu = ud["${i}"];
297
297
  cv = cu.value;
298
298
  v = uv["${i}"];
299
299
  ${o};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
300
- `))}const vp={};let an=vp;function y1(){if(an===vp||an!=null&&an.isContextLost()){const r=z.ADAPTER.createCanvas();let t;z.PREFER_ENV>=Ns.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),an=t}return an}let ga;function x1(){if(!ga){ga=os.MEDIUM;const r=y1();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(ga=t.precision?os.HIGH:os.MEDIUM)}}return ga}function bp(r,t){const e=r.getShaderSource(t).split(`
300
+ `))}const mp={};let an=mp;function v1(){if(an===mp||an!=null&&an.isContextLost()){const r=z.ADAPTER.createCanvas();let t;z.PREFER_ENV>=Ns.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),an=t}return an}let ga;function b1(){if(!ga){ga=os.MEDIUM;const r=v1();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(ga=t.precision?os.HIGH:os.MEDIUM)}}return ga}function gp(r,t){const e=r.getShaderSource(t).split(`
301
301
  `).map((l,u)=>`${u}: ${l}`),s=r.getShaderInfoLog(t),i=s.split(`
302
302
  `),n={},a=i.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),h=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,h.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const o=e.join(`
303
- `);h[0]=o,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...h),console.groupEnd()}function v1(r,t,e,s){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||bp(r,e),r.getShaderParameter(s,r.COMPILE_STATUS)||bp(r,s),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const b1={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 wp(r){return b1[r]}let _a=null;const Ep={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 Tp(r,t){if(!_a){const e=Object.keys(Ep);_a={};for(let s=0;s<e.length;++s){const i=e[s];_a[r[i]]=Ep[i]}}return _a[t]}function Ap(r,t,e){if(r.substring(0,9)!=="precision"){let s=t;return t===os.HIGH&&e!==os.HIGH&&(s=os.MEDIUM),`precision ${s} float;
304
- ${r}`}else if(e!==os.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let io;function w1(){if(typeof io=="boolean")return io;try{io=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{io=!1}return io}let E1=0;const ya={},Xh=class Ln{constructor(t,e,s="pixi-shader",i={}){this.extra={},this.id=E1++,this.vertexSrc=t||Ln.defaultVertexSrc,this.fragmentSrc=e||Ln.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=i,this.vertexSrc.substring(0,8)!=="#version"&&(s=s.replace(/\s+/g,"-"),ya[s]?(ya[s]++,s+=`-${ya[s]}`):ya[s]=1,this.vertexSrc=`#define SHADER_NAME ${s}
303
+ `);h[0]=o,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...h),console.groupEnd()}function w1(r,t,e,s){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||gp(r,e),r.getShaderParameter(s,r.COMPILE_STATUS)||gp(r,s),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const E1={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 _p(r){return E1[r]}let _a=null;const yp={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 xp(r,t){if(!_a){const e=Object.keys(yp);_a={};for(let s=0;s<e.length;++s){const i=e[s];_a[r[i]]=yp[i]}}return _a[t]}function vp(r,t,e){if(r.substring(0,9)!=="precision"){let s=t;return t===os.HIGH&&e!==os.HIGH&&(s=os.MEDIUM),`precision ${s} float;
304
+ ${r}`}else if(e!==os.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let io;function T1(){if(typeof io=="boolean")return io;try{io=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{io=!1}return io}let A1=0;const ya={},Vh=class Ln{constructor(t,e,s="pixi-shader",i={}){this.extra={},this.id=A1++,this.vertexSrc=t||Ln.defaultVertexSrc,this.fragmentSrc=e||Ln.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=i,this.vertexSrc.substring(0,8)!=="#version"&&(s=s.replace(/\s+/g,"-"),ya[s]?(ya[s]++,s+=`-${ya[s]}`):ya[s]=1,this.vertexSrc=`#define SHADER_NAME ${s}
305
305
  ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${s}
306
- ${this.fragmentSrc}`,this.vertexSrc=Ap(this.vertexSrc,Ln.defaultVertexPrecision,os.HIGH),this.fragmentSrc=Ap(this.fragmentSrc,Ln.defaultFragmentPrecision,x1())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return p1}static get defaultFragmentSrc(){return f1}static from(t,e,s){const i=t+e;let n=cp[i];return n||(cp[i]=n=new Ln(t,e,s)),n}};Xh.defaultVertexPrecision=os.HIGH,Xh.defaultFragmentPrecision=fi.apple.device?os.HIGH:os.MEDIUM;let yi=Xh,T1=0;class Es{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=T1++,this.static=!!e,this.ubo=!!s,t instanceof Jt?(this.buffer=t,this.buffer.type=Us.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Jt(new Float32Array(1)),this.buffer.type=Us.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,s){if(!this.ubo)this.uniforms[t]=new Es(e,s);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,s){return new Es(t,e,s)}static uboFrom(t,e){return new Es(t,e??!0,!0)}}class Zs{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Es?this.uniformGroup=e:this.uniformGroup=new Es(e):this.uniformGroup=new Es({}),this.disposeRunner=new ws("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const i=e.uniforms[s];if(i.group===!0&&this.checkUniformExists(t,i))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,s){const i=yi.from(t,e);return new Zs(i,s)}}class A1{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const s=new Int32Array(t);for(let n=0;n<t;n++)s[n]=n;this.defaultGroupCache[t]=Es.from({uSamplers:s},!0);let i=this.fragTemplate;i=i.replace(/%count%/gi,`${t}`),i=i.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new yi(this.vertexSrc,i)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Mt,default:this.defaultGroupCache[t]};return new Zs(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
306
+ ${this.fragmentSrc}`,this.vertexSrc=vp(this.vertexSrc,Ln.defaultVertexPrecision,os.HIGH),this.fragmentSrc=vp(this.fragmentSrc,Ln.defaultFragmentPrecision,b1())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return g1}static get defaultFragmentSrc(){return m1}static from(t,e,s){const i=t+e;let n=np[i];return n||(np[i]=n=new Ln(t,e,s)),n}};Vh.defaultVertexPrecision=os.HIGH,Vh.defaultFragmentPrecision=fi.apple.device?os.HIGH:os.MEDIUM;let yi=Vh,S1=0;class Es{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=S1++,this.static=!!e,this.ubo=!!s,t instanceof Jt?(this.buffer=t,this.buffer.type=Us.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Jt(new Float32Array(1)),this.buffer.type=Us.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,s){if(!this.ubo)this.uniforms[t]=new Es(e,s);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,s){return new Es(t,e,s)}static uboFrom(t,e){return new Es(t,e??!0,!0)}}class Zs{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Es?this.uniformGroup=e:this.uniformGroup=new Es(e):this.uniformGroup=new Es({}),this.disposeRunner=new ws("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const i=e.uniforms[s];if(i.group===!0&&this.checkUniformExists(t,i))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,s){const i=yi.from(t,e);return new Zs(i,s)}}class C1{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const s=new Int32Array(t);for(let n=0;n<t;n++)s[n]=n;this.defaultGroupCache[t]=Es.from({uSamplers:s},!0);let i=this.fragTemplate;i=i.replace(/%count%/gi,`${t}`),i=i.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new yi(this.vertexSrc,i)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Mt,default:this.defaultGroupCache[t]};return new Zs(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
307
307
  `,e+=`
308
308
  `;for(let s=0;s<t;s++)s>0&&(e+=`
309
309
  else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
@@ -311,7 +311,7 @@ else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
311
311
  color = texture2D(uSamplers[${s}], vTextureCoord);`,e+=`
312
312
  }`;return e+=`
313
313
  `,e+=`
314
- `,e}}class $h{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function S1(){return!fi.apple.device}function C1(r){let t=!0;const e=z.ADAPTER.getNavigator();if(fi.tablet||fi.phone){if(fi.apple.device){const s=e.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(t=!1)}if(fi.android.device){const s=e.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(t=!1)}}return t?r:4}class xa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var I1=`varying vec2 vTextureCoord;
314
+ `,e}}class Uh{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function I1(){return!fi.apple.device}function P1(r){let t=!0;const e=z.ADAPTER.getNavigator();if(fi.tablet||fi.phone){if(fi.apple.device){const s=e.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(t=!1)}if(fi.android.device){const s=e.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(t=!1)}}return t?r:4}class xa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var R1=`varying vec2 vTextureCoord;
315
315
  varying vec4 vColor;
316
316
  varying float vTextureId;
317
317
  uniform sampler2D uSamplers[%count%];
@@ -321,7 +321,7 @@ void main(void){
321
321
  %forloop%
322
322
  gl_FragColor = color * vColor;
323
323
  }
324
- `,P1=`precision highp float;
324
+ `,M1=`precision highp float;
325
325
  attribute vec2 aVertexPosition;
326
326
  attribute vec2 aTextureCoord;
327
327
  attribute vec4 aColor;
@@ -342,14 +342,14 @@ void main(void){
342
342
  vTextureId = aTextureId;
343
343
  vColor = aColor * tint;
344
344
  }
345
- `;const ro=class ks extends xa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=gp,this.vertexSize=6,this.state=js.for2d(),this.size=ks.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??C1(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??S1(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ot("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return P1}static get defaultFragmentTemplate(){return I1}setShaderGenerator({vertex:t=ks.defaultVertexSrc,fragment:e=ks.defaultFragmentTemplate}={}){this.shaderGenerator=new A1(t,e)}contextChange(){const t=this.renderer.gl;z.PREFER_ENV===Ns.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ks.defaultMaxTextures),this.maxTextures=r1(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=ks,s=this.size/4,i=Math.floor(s/this.maxTextures)+1;for(;t.length<s;)t.push(new Lh);for(;e.length<i;)e.push(new $h);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=ks._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let h=++et._globalBatch,o=0,l=s[0],u=0;i.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==h&&(l.count>=e&&(i.boundArray(l,n,h,e),this.buildDrawCalls(l,u,c),u=c,l=s[++o],++h),d._batchEnabled=h,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(i.boundArray(l,n,h,e),this.buildDrawCalls(l,u,this._bufferSize),++o,++h);for(let c=0;c<n.length;c++)n[c]=null;et._globalBatch=h}buildDrawCalls(t,e,s){const{_bufferedElements:i,_attributeBuffer:n,_indexBuffer:a,vertexSize:h}=this,o=ks._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=o[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<s;++f){const p=i[f],m=p._texture.baseTexture,g=rp[m.alphaMode?1:0][p.blendMode];i[f]=null,e<f&&d.blend!==g&&(d.size=c-d.start,e=f,d=o[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(p,n,a,u,c),u+=p.vertexData.length/2*h,c+=p.indices.length,d.blend=g}e<s&&(d.size=c-d.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let s=0;s<t.count;s++)e.bind(t.elements[s],t.ids[s]),t.elements[s]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:s}=this;ks.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:s}=this.renderer,i=ks._drawCallPool;let n=null;for(let a=0;a<t;a++){const{texArray:h,type:o,size:l,start:u,blend:c}=i[a];n!==h&&(n=h,this.bindAndClearTexArray(h)),this.state.blendMode=c,s.set(this.state),e.drawElements(o,l,e.UNSIGNED_SHORT,u*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),ks.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=oa(Math.ceil(t/8)),s=lp(e),i=e*8;this._aBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._aBuffers[i];return n||(this._aBuffers[i]=n=new Ih(i*this.vertexSize*4)),n}getIndexBuffer(t){const e=oa(Math.ceil(t/12)),s=lp(e),i=e*12;this._iBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._iBuffers[s];return n||(this._iBuffers[s]=n=new Uint16Array(i)),n}packInterleavedGeometry(t,e,s,i,n){const{uint32View:a,float32View:h}=e,o=i/this.vertexSize,l=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Ct.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<c.length;m+=2)h[i++]=c[m],h[i++]=c[m+1],h[i++]=l[m],h[i++]=l[m+1],a[i++]=p,h[i++]=d;for(let m=0;m<u.length;m++)s[n++]=o+u[m]}};ro.defaultBatchSize=4096,ro.extension={name:"batch",type:H.RendererPlugin},ro._drawCallPool=[],ro._textureArrayPool=[];let br=ro;K.add(br);var R1=`varying vec2 vTextureCoord;
345
+ `;const ro=class ks extends xa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=up,this.vertexSize=6,this.state=js.for2d(),this.size=ks.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??P1(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??I1(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ot("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return M1}static get defaultFragmentTemplate(){return R1}setShaderGenerator({vertex:t=ks.defaultVertexSrc,fragment:e=ks.defaultFragmentTemplate}={}){this.shaderGenerator=new C1(t,e)}contextChange(){const t=this.renderer.gl;z.PREFER_ENV===Ns.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ks.defaultMaxTextures),this.maxTextures=o1(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=ks,s=this.size/4,i=Math.floor(s/this.maxTextures)+1;for(;t.length<s;)t.push(new Bh);for(;e.length<i;)e.push(new Uh);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=ks._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let h=++et._globalBatch,o=0,l=s[0],u=0;i.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==h&&(l.count>=e&&(i.boundArray(l,n,h,e),this.buildDrawCalls(l,u,c),u=c,l=s[++o],++h),d._batchEnabled=h,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(i.boundArray(l,n,h,e),this.buildDrawCalls(l,u,this._bufferSize),++o,++h);for(let c=0;c<n.length;c++)n[c]=null;et._globalBatch=h}buildDrawCalls(t,e,s){const{_bufferedElements:i,_attributeBuffer:n,_indexBuffer:a,vertexSize:h}=this,o=ks._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=o[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<s;++f){const p=i[f],m=p._texture.baseTexture,g=Jf[m.alphaMode?1:0][p.blendMode];i[f]=null,e<f&&d.blend!==g&&(d.size=c-d.start,e=f,d=o[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(p,n,a,u,c),u+=p.vertexData.length/2*h,c+=p.indices.length,d.blend=g}e<s&&(d.size=c-d.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let s=0;s<t.count;s++)e.bind(t.elements[s],t.ids[s]),t.elements[s]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:s}=this;ks.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:s}=this.renderer,i=ks._drawCallPool;let n=null;for(let a=0;a<t;a++){const{texArray:h,type:o,size:l,start:u,blend:c}=i[a];n!==h&&(n=h,this.bindAndClearTexArray(h)),this.state.blendMode=c,s.set(this.state),e.drawElements(o,l,e.UNSIGNED_SHORT,u*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),ks.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=oa(Math.ceil(t/8)),s=ip(e),i=e*8;this._aBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._aBuffers[i];return n||(this._aBuffers[i]=n=new Ah(i*this.vertexSize*4)),n}getIndexBuffer(t){const e=oa(Math.ceil(t/12)),s=ip(e),i=e*12;this._iBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._iBuffers[s];return n||(this._iBuffers[s]=n=new Uint16Array(i)),n}packInterleavedGeometry(t,e,s,i,n){const{uint32View:a,float32View:h}=e,o=i/this.vertexSize,l=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Ct.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<c.length;m+=2)h[i++]=c[m],h[i++]=c[m+1],h[i++]=l[m],h[i++]=l[m+1],a[i++]=p,h[i++]=d;for(let m=0;m<u.length;m++)s[n++]=o+u[m]}};ro.defaultBatchSize=4096,ro.extension={name:"batch",type:H.RendererPlugin},ro._drawCallPool=[],ro._textureArrayPool=[];let br=ro;K.add(br);var F1=`varying vec2 vTextureCoord;
346
346
 
347
347
  uniform sampler2D uSampler;
348
348
 
349
349
  void main(void){
350
350
  gl_FragColor = texture2D(uSampler, vTextureCoord);
351
351
  }
352
- `,M1=`attribute vec2 aVertexPosition;
352
+ `,k1=`attribute vec2 aVertexPosition;
353
353
 
354
354
  uniform mat3 projectionMatrix;
355
355
 
@@ -375,7 +375,7 @@ void main(void)
375
375
  gl_Position = filterVertexPosition();
376
376
  vTextureCoord = filterTextureCoord();
377
377
  }
378
- `;const Hh=class Do extends Zs{constructor(t,e,s){const i=yi.from(t||Do.defaultVertexSrc,e||Do.defaultFragmentSrc);super(i,s),this.padding=0,this.resolution=Do.defaultResolution,this.multisample=Do.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new js}apply(t,e,s,i,n){t.applyFilter(this,e,s,i)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return M1}static get defaultFragmentSrc(){return R1}};Hh.defaultResolution=1,Hh.defaultMultisample=ie.NONE;let pe=Hh;class va{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ct(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:i}=t,n=s??e;n!==void 0&&(this.color=n),this.alpha=i}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}va.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},va.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"background"},K.add(va);class Sp{constructor(t){this.renderer=t,this.emptyRenderer=new xa(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:s}=this.renderer.texture;for(let i=e-1;i>=0;--i)t[i]=s[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,s,i){const{elements:n,ids:a,count:h}=t;let o=0;for(let l=0;l<h;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<i&&e[c]===u){a[l]=c;continue}for(;o<i;){const d=e[o];if(d&&d._batchEnabled===s&&d._batchLocation===o){o++;continue}a[l]=o,u._batchLocation=o,e[o]=u;break}}}destroy(){this.renderer=null}}Sp.extension={type:H.RendererSystem,name:"batch"},K.add(Sp);let Cp=0;class ba{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=Cp++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,s=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:s,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=Cp++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let s;if(z.PREFER_ENV>=Ns.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 i=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ba.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ba.extension={type:H.RendererSystem,name:"context"},K.add(ba);class Yh{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 ws("disposeFramebuffer"),this.multisample=ie.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new et(null,{scaleMode:je.NEAREST,resolution:1,mipmap:vs.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new et(null,{scaleMode:je.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:vs.OFF,format:G.DEPTH_COMPONENT,type:tt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s<this.colorTextures.length;s++){const i=this.colorTextures[s],n=i.resolution;i.setSize(t/n,e/n)}if(this.depthTexture){const s=this.depthTexture.resolution;this.depthTexture.setSize(t/s,e/s)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class Ip extends et{constructor(t={}){if(typeof t=="number"){const e=arguments[0],s=arguments[1],i=arguments[2],n=arguments[3];t={width:e,height:s,scaleMode:i,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=ie.NONE),super(null,t),this.mipmap=vs.OFF,this.valid=!0,this._clear=new Ct([0,0,0,0]),this.framebuffer=new Yh(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class xi extends so{constructor(t){const e=t,s=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,i=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(s,i),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){s===void 0&&!e.startsWith("data:")?t.crossOrigin=e1(e):s!==!1&&(t.crossOrigin=typeof s=="string"?s:"anonymous")}upload(t,e,s,i){const n=t.gl,a=e.realWidth,h=e.realHeight;if(i=i||this.source,typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement){if(!i.complete||i.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&i instanceof HTMLVideoElement&&i.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&s.width===a&&s.height===h?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,s.type,i):(s.width=a,s.height=h,n.texImage2D(e.target,0,s.internalFormat,e.format,s.type,i)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,s=t.naturalHeight||t.videoHeight||t.height;this.resize(e,s),super.update()}dispose(){this.source=null}}class Pp extends xi{constructor(t,e){if(e=e||{},typeof t=="string"){const s=new Image;xi.crossOrigin(s,t,e.crossorigin),s.src=t,t=s}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??z.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,s)=>{const i=this.source;this.url=i.src;const n=()=>{this.destroyed||(i.onload=null,i.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};i.complete&&i.src?n():(i.onload=n,i.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(i=>i.blob()).then(i=>e(i,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Re.UNPACK?"premultiply":"none"})).then(i=>this.destroyed?Promise.reject():(this.bitmap=i,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 i=!0;const n=e._glTextures;for(const a in n){const h=n[a];if(h!==s&&h.dirtyId!==e.dirtyId){i=!1;break}}i&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Wh{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const i=e.width,n=e.height;if(s){const a=t.width/2/i,h=t.height/2/n,o=t.x/i+a,l=t.y/n+h;s=Nt.add(s,Nt.NW),this.x0=o+a*Nt.uX(s),this.y0=l+h*Nt.uY(s),s=Nt.add(s,2),this.x1=o+a*Nt.uX(s),this.y1=l+h*Nt.uY(s),s=Nt.add(s,2),this.x2=o+a*Nt.uX(s),this.y2=l+h*Nt.uY(s),s=Nt.add(s,2),this.x3=o+a*Nt.uX(s),this.y3=l+h*Nt.uY(s)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,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}}Wh.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Rp=new Wh;function wa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class q extends Xs{constructor(t,e,s,i,n,a,h){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new it(0,0,1,1)),t instanceof q&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this.destroyed=!1,this._uvs=Rp,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 st(a.x,a.y):new st(0,0),this.defaultBorders=h,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&&zs[e.url]&&q.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,q.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var i;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),s=new q(this.baseTexture,!this.noFrame&&t,e,(i=this.trim)==null?void 0:i.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=t),s}updateUvs(){this._uvs===Rp&&(this._uvs=new Wh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=z.STRICT_TEXTURE_CACHE){const i=typeof t=="string";let n=null;if(i)n=t;else if(t instanceof et){if(!t.cacheId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${h}-${gr()}`,et.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gr()}`}n=t._pixiId}let a=zs[n];if(i&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof et)?(e.resolution||(e.resolution=_i(t)),a=new q(new et(t,e)),a.baseTexture.cacheId=n,et.addToCache(a.baseTexture,n),q.addToCache(a,n)):!a&&t instanceof et&&(a=new q(t),q.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),i=q.from(t,Object.assign({resourceOptions:s},e),!1),n=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):n.load().then(()=>Promise.resolve(i))}static fromBuffer(t,e,s,i){return new q(et.fromBuffer(t,e,s,i))}static fromLoader(t,e,s,i){const n=new et(t,Object.assign({scaleMode:et.defaultOptions.scaleMode,resolution:_i(e)},i)),{resource:a}=n;a instanceof Pp&&(a.url=e);const h=new q(n);return s||(s=e),et.addToCache(h.baseTexture,s),q.addToCache(h,s),s!==e&&(et.addToCache(h.baseTexture,e),q.addToCache(h,e)),h.baseTexture.valid?Promise.resolve(h):new Promise(o=>{h.baseTexture.once("loaded",()=>o(h))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),zs[e]&&zs[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),zs[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=zs[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete zs[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)zs[t.textureCacheIds[e]]===t&&delete zs[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:s,width:i,height:n}=t,a=e+i>this.baseTexture.width,h=s+n>this.baseTexture.height;if(a||h){const o=a&&h?"and":"or",l=`X: ${e} + ${i} = ${e+i} > ${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} ${o} ${u}`)}this.valid=i&&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 q._EMPTY||(q._EMPTY=new q(new et),wa(q._EMPTY),wa(q._EMPTY.baseTexture)),q._EMPTY}static get WHITE(){if(!q._WHITE){const t=z.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),q._WHITE=new q(et.from(t)),wa(q._WHITE),wa(q._WHITE.baseTexture)}return q._WHITE}}class wr extends q{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const i=this.baseTexture.resolution,n=Math.round(t*i)/i,a=Math.round(e*i)/i;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 wr(new Ip(t))}}class Mp{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=ie.NONE){const i=new Ip(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new wr(i)}getOptimalTexture(t,e,s=1,i=ie.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=oa(t),e=oa(e),n=((t&65535)<<16|e&65535)>>>0,i>1&&(n+=i*4294967296)):n=i>1?-i:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,i)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||ie.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let i=0;i<s.length;i++)s[i].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let i=0;i<s.length;i++)s[i].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}Mp.SCREEN_KEY=-1;class F1 extends Li{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Fp extends Li{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Jt(this.vertices),this.uvBuffer=new Jt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let s=0,i=0;return this.uvs[0]=s,this.uvs[1]=i,this.uvs[2]=s+e.width/t.width,this.uvs[3]=i,this.uvs[4]=s+e.width/t.width,this.uvs[5]=i+e.height/t.height,this.uvs[6]=s,this.uvs[7]=i+e.height/t.height,s=e.x,i=e.y,this.vertices[0]=s,this.vertices[1]=i,this.vertices[2]=s+e.width,this.vertices[3]=i,this.vertices[4]=s+e.width,this.vertices[5]=i+e.height,this.vertices[6]=s,this.vertices[7]=i+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class k1{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ie.NONE,this.sourceFrame=new it,this.destinationFrame=new it,this.bindingSourceFrame=new it,this.bindingDestinationFrame=new it,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ea=[new st,new st,new st,new st],zh=new Mt;class kp{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Mp,this.statePool=[],this.quad=new F1,this.quadUv=new Fp,this.tempRect=new it,this.activeState={},this.globalUniforms=new Es({outputFrame:new it,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const s=this.renderer,i=this.defaultFilterStack,n=this.statePool.pop()||new k1,a=s.renderTexture;let h,o;if(a.current){const g=a.current;h=g.resolution,o=g.multisample}else h=s.resolution,o=s.multisample;let l=e[0].resolution||h,u=e[0].multisample??o,c=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){const _=e[g];l=Math.min(l,_.resolution||h),u=Math.min(u,_.multisample??o),c=this.useMaxPadding?Math.max(c,_.padding):c+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}i.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),i.push(n),n.resolution=l,n.multisample=u,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(c);const p=this.tempRect.copyFrom(a.sourceFrame);s.projection.transform&&this.transformAABB(zh.copyFrom(s.projection.transform).invert(),p),d?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,a.current?a.current.resolution:s.resolution,a.sourceFrame,a.destinationFrame,s.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,u),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=n.sourceFrame.width,m.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(a.sourceFrame),n.bindingDestinationFrame.copyFrom(a.destinationFrame),n.transform=s.projection.transform,s.projection.transform=null,a.bind(n.renderTexture,n.sourceFrame,m),s.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),s=e.filters;this.activeState=e;const i=this.globalUniforms.uniforms;i.outputFrame=e.sourceFrame,i.resolution=e.resolution;const n=i.inputSize,a=i.inputPixel,h=i.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],a[0]=Math.round(n[0]*e.resolution),a[1]=Math.round(n[1]*e.resolution),a[2]=1/a[0],a[3]=1/a[1],h[0]=.5*a[2],h[1]=.5*a[3],h[2]=e.sourceFrame.width*n[2]-.5*a[2],h[3]=e.sourceFrame.height*n[3]-.5*a[3],e.legacy){const l=i.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,i.filterClamp=i.inputClamp}this.globalUniforms.update();const o=t[t.length-1];if(this.renderer.framebuffer.blit(),s.length===1)s[0].apply(this,e.renderTexture,o.renderTexture,Vs.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let c=0;for(c=0;c<s.length-1;++c){c===1&&e.multisample>1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),s[c].apply(this,l,u,Vs.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,o.renderTexture,Vs.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=Vs.CLEAR){const{renderTexture:s,state:i}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0: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=i.stateId&1||this.forceClear;(e===Vs.CLEAR||e===Vs.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,i){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,i),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(xs.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(xs.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:i}=this.activeState,{orig:n}=e._texture,a=t.set(i.width,0,0,i.height,s.x,s.y),h=e.worldTransform.copyTo(Mt.TEMP_MATRIX);return h.invert(),a.prepend(h),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,i=ie.NONE){return this.texturePool.getOptimalTexture(t,e,s,i)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||ie.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Ea[0],i=Ea[1],n=Ea[2],a=Ea[3];s.set(e.left,e.top),i.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(i,i),t.apply(n,n),t.apply(a,a);const h=Math.min(s.x,i.x,n.x,a.x),o=Math.min(s.y,i.y,n.y,a.y),l=Math.max(s.x,i.x,n.x,a.x),u=Math.max(s.y,i.y,n.y,a.y);e.x=h,e.y=o,e.width=l-h,e.height=u-o}roundFrame(t,e,s,i,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:h,c:o,d:l}=n;if((Math.abs(h)>1e-4||Math.abs(o)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?zh.copyFrom(n):zh.identity(),n.translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}kp.extension={type:H.RendererSystem,name:"filter"},K.add(kp);class B1{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ie.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const D1=new it;class Bp{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Yh(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 it,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;z.PREFER_ENV===Ns.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=i=>e.drawBuffersWEBGL(i):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:i}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.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<t.colorTextures.length;a++){const h=t.colorTextures[a];this.renderer.texture.unbind(h.parentTextureArray||h)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const a=e.width>>s,h=e.height>>s,o=a/e.width;this.setViewport(e.x*o,e.y*o,a,h)}else{const a=t.width>>s,h=t.height>>s;this.setViewport(0,0,a,h)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,i){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),(n.width!==s||n.height!==i||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=i,this.gl.viewport(t,e,s,i))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,i,n=Pl.COLOR|Pl.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,i),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new B1(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 i=t.colorTextures;let n=i.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){const h=i[a],o=h.parentTextureArray||h;this.renderer.texture.bind(o,0),a===0&&s.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,s.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,o._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:s}=this,i=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let a=n.length;s.drawBuffers||(a=Math.min(a,1)),i.multisample>1&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||s.createRenderbuffer():i.msaaBuffer&&(s.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const h=[];for(let o=0;o<a;o++){const l=n[o],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),o===0&&i.msaaBuffer?(s.bindRenderbuffer(s.RENDERBUFFER,i.msaaBuffer),s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,i.msaaBuffer)):(s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+o,l.target,u._glTextures[this.CONTEXT_UID].texture,e),h.push(s.COLOR_ATTACHMENT0+o))}if(h.length>1&&s.drawBuffers(h),t.depthTexture&&this.writeDepthTexture){const o=t.depthTexture;this.renderer.texture.bind(o,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,o._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){i.stencil=i.stencil||s.createRenderbuffer();let o,l;this.renderer.context.webGLVersion===1?(o=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(o=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(o=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(o=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,i.stencil),i.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,o,s.RENDERBUFFER,i.stencil)}else i.stencil&&(s.deleteRenderbuffer(i.stencil),i.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=ie.NONE;if(t<=1||e===null)return s;for(let i=0;i<e.length;i++)if(e[i]<=t){s=e[i];break}return s===1&&(s=ie.NONE),s}blit(t,e,s){const{current:i,renderer:n,gl:a,CONTEXT_UID:h}=this;if(n.context.webGLVersion!==2||!i)return;const o=i.glFramebuffers[h];if(!o)return;if(!t){if(!o.msaaBuffer)return;const u=i.colorTextures[0];if(!u)return;o.blitFramebuffer||(o.blitFramebuffer=new Yh(i.width,i.height),o.blitFramebuffer.addColorTexture(0,u)),t=o.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==i.width||t.height!==i.height)&&(t.width=i.width,t.height=i.height,t.dirtyId++,t.dirtySize++)}e||(e=D1,e.width=i.width,e.height=i.height),s||(s=e);const l=e.width===s.width&&e.height===s.height;this.bind(t),a.bindFramebuffer(a.READ_FRAMEBUFFER,o.framebuffer),a.blitFramebuffer(e.left,e.top,e.right,e.bottom,s.left,s.top,s.right,s.bottom,a.COLOR_BUFFER_BIT,l?a.NEAREST:a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const s=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(!s)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&i.deleteRenderbuffer(s.msaaBuffer),s.stencil&&i.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;s<e.length;s++)this.disposeFramebuffer(e[s],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const s=t.width,i=t.height,n=this.gl,a=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,a);let h,o;this.renderer.context.webGLVersion===1?(h=n.DEPTH_STENCIL_ATTACHMENT,o=n.DEPTH_STENCIL):t.depth?(h=n.DEPTH_STENCIL_ATTACHMENT,o=n.DEPTH24_STENCIL8):(h=n.STENCIL_ATTACHMENT,o=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,o,s,i):n.renderbufferStorage(n.RENDERBUFFER,o,s,i),n.framebufferRenderbuffer(n.FRAMEBUFFER,h,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new it}destroy(){this.renderer=null}}Bp.extension={type:H.RendererSystem,name:"framebuffer"},K.add(Bp);const jh={5126:4,5123:2,5121:1};class Dp{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let s=this.renderer.context.extensions.vertexArrayObject;z.PREFER_ENV===Ns.WEBGL_LEGACY&&(s=null),s?(t.createVertexArray=()=>s.createVertexArrayOES(),t.bindVertexArray=i=>s.bindVertexArrayOES(i),t.deleteVertexArray=i=>s.deleteVertexArrayOES(i)):(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=(i,n)=>s.vertexAttribDivisorANGLE(i,n),t.drawElementsInstanced=(i,n,a,h,o)=>s.drawElementsInstancedANGLE(i,n,a,h,o),t.drawArraysInstanced=(i,n,a,h)=>s.drawArraysInstancedANGLE(i,n,a,h)):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 i=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},n=!0);const a=i[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s<t.buffers.length;s++){const i=t.buffers[s];e.update(i)}}checkCompatibility(t,e){const s=t.attributes,i=e.attributeData;for(const n in i)if(!s[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const s=t.attributes,i=e.attributeData,n=["g",t.id];for(const a in s)i[a]&&n.push(a,i[a].location);return n.join("-")}initGeometryVao(t,e,s=!0){const i=this.gl,n=this.CONTEXT_UID,a=this.renderer.buffer,h=e.program;h.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,h);const o=this.getSignature(t,h),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[o];if(u)return l[h.id]=u,u;const c=t.buffers,d=t.attributes,f={},p={};for(const m in c)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&h.attributeData[m]?d[m].size=h.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*jh[d[m].type];for(const m in d){const g=d[m],_=g.size;g.stride===void 0&&(f[g.buffer]===_*jh[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=_*jh[g.type])}u=i.createVertexArray(),i.bindVertexArray(u);for(let m=0;m<c.length;m++){const g=c[m];a.bind(g),s&&g._glBuffers[n].refCount++}return this.activateVao(t,h),l[h.id]=u,l[o]=u,i.bindVertexArray(null),a.unbind(Us.ARRAY_BUFFER),u}disposeGeometry(t,e){var h;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const s=t.glVertexArrayObjects[this.CONTEXT_UID],i=this.gl,n=t.buffers,a=(h=this.renderer)==null?void 0:h.buffer;if(t.disposeRunner.remove(this),!!s){if(a)for(let o=0;o<n.length;o++){const l=n[o]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&a.dispose(n[o],e))}if(!e){for(const o in s)if(o[0]==="g"){const l=s[o];this._activeVao===l&&this.unbind(),i.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let s=0;s<e.length;s++)this.disposeGeometry(this.managedGeometries[e[s]],t)}activateVao(t,e){const s=this.gl,i=this.CONTEXT_UID,n=this.renderer.buffer,a=t.buffers,h=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let o=null;for(const l in h){const u=h[l],c=a[u.buffer],d=c._glBuffers[i];if(e.attributeData[l]){o!==d&&(n.bind(c),o=d);const f=e.attributeData[l].location;if(s.enableVertexAttribArray(f),s.vertexAttribPointer(f,u.size,u.type||s.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)s.vertexAttribDivisor(f,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,s,i){const{gl:n}=this,a=this._activeGeometry;if(a.indexBuffer){const h=a.indexBuffer.data.BYTES_PER_ELEMENT,o=h===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;h===2||h===4&&this.canUseUInt32ElementIndex?a.instanced?n.drawElementsInstanced(t,e||a.indexBuffer.data.length,o,(s||0)*h,i||1):n.drawElements(t,e||a.indexBuffer.data.length,o,(s||0)*h):console.warn("unsupported index buffer type: uint32")}else a.instanced?n.drawArraysInstanced(t,s,e||a.getSize(),i||1):n.drawArrays(t,s,e||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Dp.extension={type:H.RendererSystem,name:"geometry"},K.add(Dp);const Op=new Mt;class Lp{constructor(t,e){this._texture=t,this.mapCoord=new Mt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let i=0;i<t.length;i+=2){const n=t[i],a=t[i+1];e[i]=n*s.a+a*s.c+s.tx,e[i+1]=n*s.b+a*s.d+s.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const s=e._uvs;this.mapCoord.set(s.x1-s.x0,s.y1-s.y0,s.x3-s.x0,s.y3-s.y0,s.x0,s.y0);const i=e.orig,n=e.trim;n&&(Op.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Op));const a=e.baseTexture,h=this.uClampFrame,o=this.clampMargin/a.resolution,l=this.clampOffset;return h[0]=(e._frame.x+o+l)/a.width,h[1]=(e._frame.y+o+l)/a.height,h[2]=(e._frame.x+e._frame.width-o+l)/a.width,h[3]=(e._frame.y+e._frame.height-o+l)/a.height,this.uClampOffset[0]=l/a.realWidth,this.uClampOffset[1]=l/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0}}var O1=`varying vec2 vMaskCoord;
378
+ `;const Gh=class Do extends Zs{constructor(t,e,s){const i=yi.from(t||Do.defaultVertexSrc,e||Do.defaultFragmentSrc);super(i,s),this.padding=0,this.resolution=Do.defaultResolution,this.multisample=Do.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new js}apply(t,e,s,i,n){t.applyFilter(this,e,s,i)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return k1}static get defaultFragmentSrc(){return F1}};Gh.defaultResolution=1,Gh.defaultMultisample=ie.NONE;let pe=Gh;class va{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ct(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:i}=t,n=s??e;n!==void 0&&(this.color=n),this.alpha=i}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}va.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},va.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"background"},K.add(va);class bp{constructor(t){this.renderer=t,this.emptyRenderer=new xa(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:s}=this.renderer.texture;for(let i=e-1;i>=0;--i)t[i]=s[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,s,i){const{elements:n,ids:a,count:h}=t;let o=0;for(let l=0;l<h;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<i&&e[c]===u){a[l]=c;continue}for(;o<i;){const d=e[o];if(d&&d._batchEnabled===s&&d._batchLocation===o){o++;continue}a[l]=o,u._batchLocation=o,e[o]=u;break}}}destroy(){this.renderer=null}}bp.extension={type:H.RendererSystem,name:"batch"},K.add(bp);let wp=0;class ba{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=wp++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,s=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:s,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=wp++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let s;if(z.PREFER_ENV>=Ns.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 i=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ba.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ba.extension={type:H.RendererSystem,name:"context"},K.add(ba);class Xh{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 ws("disposeFramebuffer"),this.multisample=ie.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new et(null,{scaleMode:je.NEAREST,resolution:1,mipmap:vs.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new et(null,{scaleMode:je.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:vs.OFF,format:G.DEPTH_COMPONENT,type:tt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s<this.colorTextures.length;s++){const i=this.colorTextures[s],n=i.resolution;i.setSize(t/n,e/n)}if(this.depthTexture){const s=this.depthTexture.resolution;this.depthTexture.setSize(t/s,e/s)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class Ep extends et{constructor(t={}){if(typeof t=="number"){const e=arguments[0],s=arguments[1],i=arguments[2],n=arguments[3];t={width:e,height:s,scaleMode:i,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=ie.NONE),super(null,t),this.mipmap=vs.OFF,this.valid=!0,this._clear=new Ct([0,0,0,0]),this.framebuffer=new Xh(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class xi extends so{constructor(t){const e=t,s=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,i=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(s,i),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){s===void 0&&!e.startsWith("data:")?t.crossOrigin=i1(e):s!==!1&&(t.crossOrigin=typeof s=="string"?s:"anonymous")}upload(t,e,s,i){const n=t.gl,a=e.realWidth,h=e.realHeight;if(i=i||this.source,typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement){if(!i.complete||i.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&i instanceof HTMLVideoElement&&i.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&s.width===a&&s.height===h?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,s.type,i):(s.width=a,s.height=h,n.texImage2D(e.target,0,s.internalFormat,e.format,s.type,i)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,s=t.naturalHeight||t.videoHeight||t.height;this.resize(e,s),super.update()}dispose(){this.source=null}}class Tp extends xi{constructor(t,e){if(e=e||{},typeof t=="string"){const s=new Image;xi.crossOrigin(s,t,e.crossorigin),s.src=t,t=s}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??z.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,s)=>{const i=this.source;this.url=i.src;const n=()=>{this.destroyed||(i.onload=null,i.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};i.complete&&i.src?n():(i.onload=n,i.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(i=>i.blob()).then(i=>e(i,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Re.UNPACK?"premultiply":"none"})).then(i=>this.destroyed?Promise.reject():(this.bitmap=i,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 i=!0;const n=e._glTextures;for(const a in n){const h=n[a];if(h!==s&&h.dirtyId!==e.dirtyId){i=!1;break}}i&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class $h{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const i=e.width,n=e.height;if(s){const a=t.width/2/i,h=t.height/2/n,o=t.x/i+a,l=t.y/n+h;s=Nt.add(s,Nt.NW),this.x0=o+a*Nt.uX(s),this.y0=l+h*Nt.uY(s),s=Nt.add(s,2),this.x1=o+a*Nt.uX(s),this.y1=l+h*Nt.uY(s),s=Nt.add(s,2),this.x2=o+a*Nt.uX(s),this.y2=l+h*Nt.uY(s),s=Nt.add(s,2),this.x3=o+a*Nt.uX(s),this.y3=l+h*Nt.uY(s)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,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}}$h.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Ap=new $h;function wa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class q extends Xs{constructor(t,e,s,i,n,a,h){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new it(0,0,1,1)),t instanceof q&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this.destroyed=!1,this._uvs=Ap,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 st(a.x,a.y):new st(0,0),this.defaultBorders=h,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&&zs[e.url]&&q.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,q.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var i;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),s=new q(this.baseTexture,!this.noFrame&&t,e,(i=this.trim)==null?void 0:i.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=t),s}updateUvs(){this._uvs===Ap&&(this._uvs=new $h),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=z.STRICT_TEXTURE_CACHE){const i=typeof t=="string";let n=null;if(i)n=t;else if(t instanceof et){if(!t.cacheId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${h}-${gr()}`,et.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gr()}`}n=t._pixiId}let a=zs[n];if(i&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof et)?(e.resolution||(e.resolution=_i(t)),a=new q(new et(t,e)),a.baseTexture.cacheId=n,et.addToCache(a.baseTexture,n),q.addToCache(a,n)):!a&&t instanceof et&&(a=new q(t),q.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),i=q.from(t,Object.assign({resourceOptions:s},e),!1),n=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):n.load().then(()=>Promise.resolve(i))}static fromBuffer(t,e,s,i){return new q(et.fromBuffer(t,e,s,i))}static fromLoader(t,e,s,i){const n=new et(t,Object.assign({scaleMode:et.defaultOptions.scaleMode,resolution:_i(e)},i)),{resource:a}=n;a instanceof Tp&&(a.url=e);const h=new q(n);return s||(s=e),et.addToCache(h.baseTexture,s),q.addToCache(h,s),s!==e&&(et.addToCache(h.baseTexture,e),q.addToCache(h,e)),h.baseTexture.valid?Promise.resolve(h):new Promise(o=>{h.baseTexture.once("loaded",()=>o(h))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),zs[e]&&zs[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),zs[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=zs[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete zs[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)zs[t.textureCacheIds[e]]===t&&delete zs[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:s,width:i,height:n}=t,a=e+i>this.baseTexture.width,h=s+n>this.baseTexture.height;if(a||h){const o=a&&h?"and":"or",l=`X: ${e} + ${i} = ${e+i} > ${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} ${o} ${u}`)}this.valid=i&&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 q._EMPTY||(q._EMPTY=new q(new et),wa(q._EMPTY),wa(q._EMPTY.baseTexture)),q._EMPTY}static get WHITE(){if(!q._WHITE){const t=z.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),q._WHITE=new q(et.from(t)),wa(q._WHITE),wa(q._WHITE.baseTexture)}return q._WHITE}}class wr extends q{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const i=this.baseTexture.resolution,n=Math.round(t*i)/i,a=Math.round(e*i)/i;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 wr(new Ep(t))}}class Sp{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=ie.NONE){const i=new Ep(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new wr(i)}getOptimalTexture(t,e,s=1,i=ie.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=oa(t),e=oa(e),n=((t&65535)<<16|e&65535)>>>0,i>1&&(n+=i*4294967296)):n=i>1?-i:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,i)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||ie.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let i=0;i<s.length;i++)s[i].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let i=0;i<s.length;i++)s[i].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}Sp.SCREEN_KEY=-1;class B1 extends Li{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Cp extends Li{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Jt(this.vertices),this.uvBuffer=new Jt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let s=0,i=0;return this.uvs[0]=s,this.uvs[1]=i,this.uvs[2]=s+e.width/t.width,this.uvs[3]=i,this.uvs[4]=s+e.width/t.width,this.uvs[5]=i+e.height/t.height,this.uvs[6]=s,this.uvs[7]=i+e.height/t.height,s=e.x,i=e.y,this.vertices[0]=s,this.vertices[1]=i,this.vertices[2]=s+e.width,this.vertices[3]=i,this.vertices[4]=s+e.width,this.vertices[5]=i+e.height,this.vertices[6]=s,this.vertices[7]=i+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class D1{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ie.NONE,this.sourceFrame=new it,this.destinationFrame=new it,this.bindingSourceFrame=new it,this.bindingDestinationFrame=new it,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ea=[new st,new st,new st,new st],Hh=new Mt;class Ip{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Sp,this.statePool=[],this.quad=new B1,this.quadUv=new Cp,this.tempRect=new it,this.activeState={},this.globalUniforms=new Es({outputFrame:new it,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const s=this.renderer,i=this.defaultFilterStack,n=this.statePool.pop()||new D1,a=s.renderTexture;let h,o;if(a.current){const g=a.current;h=g.resolution,o=g.multisample}else h=s.resolution,o=s.multisample;let l=e[0].resolution||h,u=e[0].multisample??o,c=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){const _=e[g];l=Math.min(l,_.resolution||h),u=Math.min(u,_.multisample??o),c=this.useMaxPadding?Math.max(c,_.padding):c+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}i.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),i.push(n),n.resolution=l,n.multisample=u,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(c);const p=this.tempRect.copyFrom(a.sourceFrame);s.projection.transform&&this.transformAABB(Hh.copyFrom(s.projection.transform).invert(),p),d?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,a.current?a.current.resolution:s.resolution,a.sourceFrame,a.destinationFrame,s.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,u),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=n.sourceFrame.width,m.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(a.sourceFrame),n.bindingDestinationFrame.copyFrom(a.destinationFrame),n.transform=s.projection.transform,s.projection.transform=null,a.bind(n.renderTexture,n.sourceFrame,m),s.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),s=e.filters;this.activeState=e;const i=this.globalUniforms.uniforms;i.outputFrame=e.sourceFrame,i.resolution=e.resolution;const n=i.inputSize,a=i.inputPixel,h=i.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],a[0]=Math.round(n[0]*e.resolution),a[1]=Math.round(n[1]*e.resolution),a[2]=1/a[0],a[3]=1/a[1],h[0]=.5*a[2],h[1]=.5*a[3],h[2]=e.sourceFrame.width*n[2]-.5*a[2],h[3]=e.sourceFrame.height*n[3]-.5*a[3],e.legacy){const l=i.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,i.filterClamp=i.inputClamp}this.globalUniforms.update();const o=t[t.length-1];if(this.renderer.framebuffer.blit(),s.length===1)s[0].apply(this,e.renderTexture,o.renderTexture,Vs.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let c=0;for(c=0;c<s.length-1;++c){c===1&&e.multisample>1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),s[c].apply(this,l,u,Vs.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,o.renderTexture,Vs.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=Vs.CLEAR){const{renderTexture:s,state:i}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0: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=i.stateId&1||this.forceClear;(e===Vs.CLEAR||e===Vs.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,i){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,i),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(xs.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(xs.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:i}=this.activeState,{orig:n}=e._texture,a=t.set(i.width,0,0,i.height,s.x,s.y),h=e.worldTransform.copyTo(Mt.TEMP_MATRIX);return h.invert(),a.prepend(h),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,i=ie.NONE){return this.texturePool.getOptimalTexture(t,e,s,i)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||ie.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Ea[0],i=Ea[1],n=Ea[2],a=Ea[3];s.set(e.left,e.top),i.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(i,i),t.apply(n,n),t.apply(a,a);const h=Math.min(s.x,i.x,n.x,a.x),o=Math.min(s.y,i.y,n.y,a.y),l=Math.max(s.x,i.x,n.x,a.x),u=Math.max(s.y,i.y,n.y,a.y);e.x=h,e.y=o,e.width=l-h,e.height=u-o}roundFrame(t,e,s,i,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:h,c:o,d:l}=n;if((Math.abs(h)>1e-4||Math.abs(o)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?Hh.copyFrom(n):Hh.identity(),n.translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Ip.extension={type:H.RendererSystem,name:"filter"},K.add(Ip);class O1{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ie.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const L1=new it;class Pp{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Xh(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 it,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;z.PREFER_ENV===Ns.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=i=>e.drawBuffersWEBGL(i):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:i}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.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<t.colorTextures.length;a++){const h=t.colorTextures[a];this.renderer.texture.unbind(h.parentTextureArray||h)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const a=e.width>>s,h=e.height>>s,o=a/e.width;this.setViewport(e.x*o,e.y*o,a,h)}else{const a=t.width>>s,h=t.height>>s;this.setViewport(0,0,a,h)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,i){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),(n.width!==s||n.height!==i||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=i,this.gl.viewport(t,e,s,i))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,i,n=Pl.COLOR|Pl.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,i),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new O1(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 i=t.colorTextures;let n=i.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){const h=i[a],o=h.parentTextureArray||h;this.renderer.texture.bind(o,0),a===0&&s.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,s.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,o._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:s}=this,i=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let a=n.length;s.drawBuffers||(a=Math.min(a,1)),i.multisample>1&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||s.createRenderbuffer():i.msaaBuffer&&(s.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const h=[];for(let o=0;o<a;o++){const l=n[o],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),o===0&&i.msaaBuffer?(s.bindRenderbuffer(s.RENDERBUFFER,i.msaaBuffer),s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,i.msaaBuffer)):(s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+o,l.target,u._glTextures[this.CONTEXT_UID].texture,e),h.push(s.COLOR_ATTACHMENT0+o))}if(h.length>1&&s.drawBuffers(h),t.depthTexture&&this.writeDepthTexture){const o=t.depthTexture;this.renderer.texture.bind(o,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,o._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){i.stencil=i.stencil||s.createRenderbuffer();let o,l;this.renderer.context.webGLVersion===1?(o=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(o=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(o=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(o=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,i.stencil),i.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,o,s.RENDERBUFFER,i.stencil)}else i.stencil&&(s.deleteRenderbuffer(i.stencil),i.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=ie.NONE;if(t<=1||e===null)return s;for(let i=0;i<e.length;i++)if(e[i]<=t){s=e[i];break}return s===1&&(s=ie.NONE),s}blit(t,e,s){const{current:i,renderer:n,gl:a,CONTEXT_UID:h}=this;if(n.context.webGLVersion!==2||!i)return;const o=i.glFramebuffers[h];if(!o)return;if(!t){if(!o.msaaBuffer)return;const u=i.colorTextures[0];if(!u)return;o.blitFramebuffer||(o.blitFramebuffer=new Xh(i.width,i.height),o.blitFramebuffer.addColorTexture(0,u)),t=o.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==i.width||t.height!==i.height)&&(t.width=i.width,t.height=i.height,t.dirtyId++,t.dirtySize++)}e||(e=L1,e.width=i.width,e.height=i.height),s||(s=e);const l=e.width===s.width&&e.height===s.height;this.bind(t),a.bindFramebuffer(a.READ_FRAMEBUFFER,o.framebuffer),a.blitFramebuffer(e.left,e.top,e.right,e.bottom,s.left,s.top,s.right,s.bottom,a.COLOR_BUFFER_BIT,l?a.NEAREST:a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const s=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(!s)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&i.deleteRenderbuffer(s.msaaBuffer),s.stencil&&i.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;s<e.length;s++)this.disposeFramebuffer(e[s],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const s=t.width,i=t.height,n=this.gl,a=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,a);let h,o;this.renderer.context.webGLVersion===1?(h=n.DEPTH_STENCIL_ATTACHMENT,o=n.DEPTH_STENCIL):t.depth?(h=n.DEPTH_STENCIL_ATTACHMENT,o=n.DEPTH24_STENCIL8):(h=n.STENCIL_ATTACHMENT,o=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,o,s,i):n.renderbufferStorage(n.RENDERBUFFER,o,s,i),n.framebufferRenderbuffer(n.FRAMEBUFFER,h,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new it}destroy(){this.renderer=null}}Pp.extension={type:H.RendererSystem,name:"framebuffer"},K.add(Pp);const Yh={5126:4,5123:2,5121:1};class Rp{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let s=this.renderer.context.extensions.vertexArrayObject;z.PREFER_ENV===Ns.WEBGL_LEGACY&&(s=null),s?(t.createVertexArray=()=>s.createVertexArrayOES(),t.bindVertexArray=i=>s.bindVertexArrayOES(i),t.deleteVertexArray=i=>s.deleteVertexArrayOES(i)):(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=(i,n)=>s.vertexAttribDivisorANGLE(i,n),t.drawElementsInstanced=(i,n,a,h,o)=>s.drawElementsInstancedANGLE(i,n,a,h,o),t.drawArraysInstanced=(i,n,a,h)=>s.drawArraysInstancedANGLE(i,n,a,h)):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 i=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},n=!0);const a=i[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s<t.buffers.length;s++){const i=t.buffers[s];e.update(i)}}checkCompatibility(t,e){const s=t.attributes,i=e.attributeData;for(const n in i)if(!s[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const s=t.attributes,i=e.attributeData,n=["g",t.id];for(const a in s)i[a]&&n.push(a,i[a].location);return n.join("-")}initGeometryVao(t,e,s=!0){const i=this.gl,n=this.CONTEXT_UID,a=this.renderer.buffer,h=e.program;h.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,h);const o=this.getSignature(t,h),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[o];if(u)return l[h.id]=u,u;const c=t.buffers,d=t.attributes,f={},p={};for(const m in c)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&h.attributeData[m]?d[m].size=h.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Yh[d[m].type];for(const m in d){const g=d[m],_=g.size;g.stride===void 0&&(f[g.buffer]===_*Yh[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=_*Yh[g.type])}u=i.createVertexArray(),i.bindVertexArray(u);for(let m=0;m<c.length;m++){const g=c[m];a.bind(g),s&&g._glBuffers[n].refCount++}return this.activateVao(t,h),l[h.id]=u,l[o]=u,i.bindVertexArray(null),a.unbind(Us.ARRAY_BUFFER),u}disposeGeometry(t,e){var h;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const s=t.glVertexArrayObjects[this.CONTEXT_UID],i=this.gl,n=t.buffers,a=(h=this.renderer)==null?void 0:h.buffer;if(t.disposeRunner.remove(this),!!s){if(a)for(let o=0;o<n.length;o++){const l=n[o]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&a.dispose(n[o],e))}if(!e){for(const o in s)if(o[0]==="g"){const l=s[o];this._activeVao===l&&this.unbind(),i.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let s=0;s<e.length;s++)this.disposeGeometry(this.managedGeometries[e[s]],t)}activateVao(t,e){const s=this.gl,i=this.CONTEXT_UID,n=this.renderer.buffer,a=t.buffers,h=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let o=null;for(const l in h){const u=h[l],c=a[u.buffer],d=c._glBuffers[i];if(e.attributeData[l]){o!==d&&(n.bind(c),o=d);const f=e.attributeData[l].location;if(s.enableVertexAttribArray(f),s.vertexAttribPointer(f,u.size,u.type||s.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)s.vertexAttribDivisor(f,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,s,i){const{gl:n}=this,a=this._activeGeometry;if(a.indexBuffer){const h=a.indexBuffer.data.BYTES_PER_ELEMENT,o=h===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;h===2||h===4&&this.canUseUInt32ElementIndex?a.instanced?n.drawElementsInstanced(t,e||a.indexBuffer.data.length,o,(s||0)*h,i||1):n.drawElements(t,e||a.indexBuffer.data.length,o,(s||0)*h):console.warn("unsupported index buffer type: uint32")}else a.instanced?n.drawArraysInstanced(t,s,e||a.getSize(),i||1):n.drawArrays(t,s,e||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Rp.extension={type:H.RendererSystem,name:"geometry"},K.add(Rp);const Mp=new Mt;class Fp{constructor(t,e){this._texture=t,this.mapCoord=new Mt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let i=0;i<t.length;i+=2){const n=t[i],a=t[i+1];e[i]=n*s.a+a*s.c+s.tx,e[i+1]=n*s.b+a*s.d+s.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const s=e._uvs;this.mapCoord.set(s.x1-s.x0,s.y1-s.y0,s.x3-s.x0,s.y3-s.y0,s.x0,s.y0);const i=e.orig,n=e.trim;n&&(Mp.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Mp));const a=e.baseTexture,h=this.uClampFrame,o=this.clampMargin/a.resolution,l=this.clampOffset;return h[0]=(e._frame.x+o+l)/a.width,h[1]=(e._frame.y+o+l)/a.height,h[2]=(e._frame.x+e._frame.width-o+l)/a.width,h[3]=(e._frame.y+e._frame.height-o+l)/a.height,this.uClampOffset[0]=l/a.realWidth,this.uClampOffset[1]=l/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0}}var N1=`varying vec2 vMaskCoord;
379
379
  varying vec2 vTextureCoord;
380
380
 
381
381
  uniform sampler2D uSampler;
@@ -400,7 +400,7 @@ void main(void)
400
400
 
401
401
  gl_FragColor = original;
402
402
  }
403
- `,L1=`attribute vec2 aVertexPosition;
403
+ `,V1=`attribute vec2 aVertexPosition;
404
404
  attribute vec2 aTextureCoord;
405
405
 
406
406
  uniform mat3 projectionMatrix;
@@ -416,7 +416,7 @@ void main(void)
416
416
  vTextureCoord = aTextureCoord;
417
417
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
418
418
  }
419
- `;class N1 extends pe{constructor(t,e,s){let i=null;typeof t!="string"&&e===void 0&&s===void 0&&(i=t,t=void 0,e=void 0,s=void 0),super(t||L1,e||O1,s),this.maskSprite=i,this.maskMatrix=new Mt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,s,i){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new Lp(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=a,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,t.applyFilter(this,e,s,i))}}class V1{constructor(t=null){this.type=ce.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=pe.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ce.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class Np{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let s=e;if(!s.isMaskData){const n=this.maskDataPool.pop()||new V1;n.pooled=!0,n.maskObject=e,s=n}const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(s.copyCountersOrReset(i),s._colorMask=i?i._colorMask:15,s.autoDetect&&this.detect(s),s._target=t,s.type!==ce.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case ce.SCISSOR:this.renderer.scissor.push(s);break;case ce.STENCIL:this.renderer.stencil.push(s);break;case ce.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case ce.COLOR:this.pushColorMask(s);break}s.type===ce.SPRITE&&this.maskStack.push(s)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ce.SCISSOR:this.renderer.scissor.pop(e);break;case ce.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ce.SPRITE:this.popSpriteMask(e);break;case ce.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const s=this.maskStack[this.maskStack.length-1];s.type===ce.SPRITE&&s._filters&&(s._filters[0].maskSprite=s.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ce.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ce.SCISSOR:t.type=ce.STENCIL:t.type=ce.COLOR}pushSpriteMask(t){const{maskObject:e}=t,s=t._target;let i=t._filters;i||(i=this.alphaMaskPool[this.alphaMaskIndex],i||(i=this.alphaMaskPool[this.alphaMaskIndex]=[new N1])),i[0].resolution=t.resolution,i[0].multisample=t.multisample,i[0].maskSprite=e;const n=s.filterArea;s.filterArea=e.getBounds(!0),this.renderer.filter.push(s,i),s.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,s=t._colorMask=e&t.colorMask;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}popColorMask(t){const e=t._colorMask,s=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}Np.extension={type:H.RendererSystem,name:"mask"},K.add(Np);class Vp{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const i=this.getStackLength();i!==s&&(i===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Up=new Mt,Gp=[],Xp=class Al extends Vp{constructor(t){super(t),this.glConst=z.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:s}=t,{renderer:i}=this,n=i.renderTexture,a=s.getBounds(!0,Gp.pop()??new it);this.roundFrameToPixels(a,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),e&&a.fit(e),t._scissorRectLocal=a}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:i,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Al.isMatrixRotated(e.worldTransform)||Al.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,i,n){Al.isMatrixRotated(n)||(n=n?Up.copyFrom(n):Up.identity(),n.translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.renderer.filter.transformAABB(n,t),t.fit(i),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&&Gp.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)}};Xp.extension={type:H.RendererSystem,name:"scissor"};let U1=Xp;K.add(U1);class $p extends Vp{constructor(t){super(t),this.glConst=z.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,i=t._stencilCounter;i===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,i,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,i=s?s._colorMask:15;i!==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,i!==0&&(s._colorMask=i,e.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&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)}}$p.extension={type:H.RendererSystem,name:"stencil"},K.add($p);class Hp{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}Hp.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"_plugin"},K.add(Hp);class Yp{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Mt,this.transform=null}update(t,e,s,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,i),this.transform&&this.projectionMatrix.append(this.transform);const 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,i){const n=this.projectionMatrix,a=i?-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}}Yp.extension={type:H.RendererSystem,name:"projection"},K.add(Yp);const G1=new ma,Wp=new it;class zp{constructor(t){this.renderer=t,this._tempMatrix=new Mt}generateTexture(t,e){const{region:s,...i}=e||{},n=(s==null?void 0:s.copyTo(Wp))||t.getLocalBounds(Wp,!0),a=i.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a),i.width=n.width,i.height=n.height,i.resolution=a,i.multisample??(i.multisample=this.renderer.multisample);const h=wr.create(i);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=t.transform;return t.transform=G1,this.renderer.render(t,{renderTexture:h,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,h}destroy(){}}zp.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"textureGenerator"},K.add(zp);const Er=new it,no=new it;class jp{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new it,this.destinationFrame=new it,this.viewportFrame=new it}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,s){const i=this.renderer;this.current=t;let n,a,h;t?(n=t.baseTexture,h=n.resolution,e||(Er.width=t.frame.width,Er.height=t.frame.height,e=Er),s||(no.x=t.frame.x,no.y=t.frame.y,no.width=e.width,no.height=e.height,s=no),a=n.framebuffer):(h=i.resolution,e||(Er.width=i._view.screen.width,Er.height=i._view.screen.height,e=Er),s||(s=Er,s.width=e.width,s.height=e.height));const o=this.viewportFrame;o.x=s.x*h,o.y=s.y*h,o.width=s.width*h,o.height=s.height*h,t||(o.y=i.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(a,o),this.renderer.projection.update(s,e,h,!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,i=Ct.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,h=n.width!==a.width||n.height!==a.height;if(h){let{x:o,y:l,width:u,height:c}=this.viewportFrame;o=Math.round(o),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(o,l,u,c)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.alpha,e),h&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}jp.extension={type:H.RendererSystem,name:"renderTexture"},K.add(jp);class X1{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 $1(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let i=0;i<s;i++){const n=t.getActiveAttrib(r,i);if(n.name.startsWith("gl_"))continue;const a=Tp(t,n.type),h={type:a,name:n.name,size:wp(a),location:t.getAttribLocation(r,n.name)};e[n.name]=h}return e}function H1(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let i=0;i<s;i++){const n=t.getActiveUniform(r,i),a=n.name.replace(/\[.*?\]$/,""),h=!!n.name.match(/\[.*?\]$/),o=Tp(t,n.type);e[a]={name:a,index:i,type:o,size:n.size,isArray:h,value:xp(o,n.size)}}return e}function Y1(r,t){var h;const e=yp(r,r.VERTEX_SHADER,t.vertexSrc),s=yp(r,r.FRAGMENT_SHADER,t.fragmentSrc),i=r.createProgram();r.attachShader(i,e),r.attachShader(i,s);const n=(h=t.extra)==null?void 0:h.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(i,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(i),r.getProgramParameter(i,r.LINK_STATUS)||v1(r,i,e,s),t.attributeData=$1(i,r),t.uniformData=H1(i,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const o=Object.keys(t.attributeData);o.sort((l,u)=>l>u?1:-1);for(let l=0;l<o.length;l++)t.attributeData[o[l]].location=l,r.bindAttribLocation(i,l,o[l]);r.linkProgram(i)}r.deleteShader(e),r.deleteShader(s);const a={};for(const o in t.uniformData){const l=t.uniformData[o];a[o]={location:r.getUniformLocation(i,o),value:xp(l.type,l.size)}}return new X1(i,a)}function W1(r,t,e,s,i){e.buffer.update(i)}const z1={float:`
419
+ `;class U1 extends pe{constructor(t,e,s){let i=null;typeof t!="string"&&e===void 0&&s===void 0&&(i=t,t=void 0,e=void 0,s=void 0),super(t||V1,e||N1,s),this.maskSprite=i,this.maskMatrix=new Mt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,s,i){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new Fp(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=a,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,t.applyFilter(this,e,s,i))}}class G1{constructor(t=null){this.type=ce.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=pe.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ce.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class kp{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let s=e;if(!s.isMaskData){const n=this.maskDataPool.pop()||new G1;n.pooled=!0,n.maskObject=e,s=n}const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(s.copyCountersOrReset(i),s._colorMask=i?i._colorMask:15,s.autoDetect&&this.detect(s),s._target=t,s.type!==ce.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case ce.SCISSOR:this.renderer.scissor.push(s);break;case ce.STENCIL:this.renderer.stencil.push(s);break;case ce.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case ce.COLOR:this.pushColorMask(s);break}s.type===ce.SPRITE&&this.maskStack.push(s)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ce.SCISSOR:this.renderer.scissor.pop(e);break;case ce.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ce.SPRITE:this.popSpriteMask(e);break;case ce.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const s=this.maskStack[this.maskStack.length-1];s.type===ce.SPRITE&&s._filters&&(s._filters[0].maskSprite=s.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ce.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ce.SCISSOR:t.type=ce.STENCIL:t.type=ce.COLOR}pushSpriteMask(t){const{maskObject:e}=t,s=t._target;let i=t._filters;i||(i=this.alphaMaskPool[this.alphaMaskIndex],i||(i=this.alphaMaskPool[this.alphaMaskIndex]=[new U1])),i[0].resolution=t.resolution,i[0].multisample=t.multisample,i[0].maskSprite=e;const n=s.filterArea;s.filterArea=e.getBounds(!0),this.renderer.filter.push(s,i),s.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,s=t._colorMask=e&t.colorMask;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}popColorMask(t){const e=t._colorMask,s=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}kp.extension={type:H.RendererSystem,name:"mask"},K.add(kp);class Bp{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const i=this.getStackLength();i!==s&&(i===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Dp=new Mt,Op=[],Lp=class Al extends Bp{constructor(t){super(t),this.glConst=z.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:s}=t,{renderer:i}=this,n=i.renderTexture,a=s.getBounds(!0,Op.pop()??new it);this.roundFrameToPixels(a,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),e&&a.fit(e),t._scissorRectLocal=a}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:i,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Al.isMatrixRotated(e.worldTransform)||Al.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,i,n){Al.isMatrixRotated(n)||(n=n?Dp.copyFrom(n):Dp.identity(),n.translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.renderer.filter.transformAABB(n,t),t.fit(i),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&&Op.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)}};Lp.extension={type:H.RendererSystem,name:"scissor"};let X1=Lp;K.add(X1);class Np extends Bp{constructor(t){super(t),this.glConst=z.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,i=t._stencilCounter;i===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,i,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,i=s?s._colorMask:15;i!==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,i!==0&&(s._colorMask=i,e.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&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)}}Np.extension={type:H.RendererSystem,name:"stencil"},K.add(Np);class Vp{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}Vp.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"_plugin"},K.add(Vp);class Up{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Mt,this.transform=null}update(t,e,s,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,i),this.transform&&this.projectionMatrix.append(this.transform);const 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,i){const n=this.projectionMatrix,a=i?-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}}Up.extension={type:H.RendererSystem,name:"projection"},K.add(Up);const $1=new ma,Gp=new it;class Xp{constructor(t){this.renderer=t,this._tempMatrix=new Mt}generateTexture(t,e){const{region:s,...i}=e||{},n=(s==null?void 0:s.copyTo(Gp))||t.getLocalBounds(Gp,!0),a=i.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a),i.width=n.width,i.height=n.height,i.resolution=a,i.multisample??(i.multisample=this.renderer.multisample);const h=wr.create(i);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=t.transform;return t.transform=$1,this.renderer.render(t,{renderTexture:h,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,h}destroy(){}}Xp.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"textureGenerator"},K.add(Xp);const Er=new it,no=new it;class $p{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new it,this.destinationFrame=new it,this.viewportFrame=new it}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,s){const i=this.renderer;this.current=t;let n,a,h;t?(n=t.baseTexture,h=n.resolution,e||(Er.width=t.frame.width,Er.height=t.frame.height,e=Er),s||(no.x=t.frame.x,no.y=t.frame.y,no.width=e.width,no.height=e.height,s=no),a=n.framebuffer):(h=i.resolution,e||(Er.width=i._view.screen.width,Er.height=i._view.screen.height,e=Er),s||(s=Er,s.width=e.width,s.height=e.height));const o=this.viewportFrame;o.x=s.x*h,o.y=s.y*h,o.width=s.width*h,o.height=s.height*h,t||(o.y=i.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(a,o),this.renderer.projection.update(s,e,h,!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,i=Ct.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,h=n.width!==a.width||n.height!==a.height;if(h){let{x:o,y:l,width:u,height:c}=this.viewportFrame;o=Math.round(o),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(o,l,u,c)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.alpha,e),h&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}$p.extension={type:H.RendererSystem,name:"renderTexture"},K.add($p);class H1{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 Y1(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let i=0;i<s;i++){const n=t.getActiveAttrib(r,i);if(n.name.startsWith("gl_"))continue;const a=xp(t,n.type),h={type:a,name:n.name,size:_p(a),location:t.getAttribLocation(r,n.name)};e[n.name]=h}return e}function W1(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let i=0;i<s;i++){const n=t.getActiveUniform(r,i),a=n.name.replace(/\[.*?\]$/,""),h=!!n.name.match(/\[.*?\]$/),o=xp(t,n.type);e[a]={name:a,index:i,type:o,size:n.size,isArray:h,value:pp(o,n.size)}}return e}function z1(r,t){var h;const e=fp(r,r.VERTEX_SHADER,t.vertexSrc),s=fp(r,r.FRAGMENT_SHADER,t.fragmentSrc),i=r.createProgram();r.attachShader(i,e),r.attachShader(i,s);const n=(h=t.extra)==null?void 0:h.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(i,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(i),r.getProgramParameter(i,r.LINK_STATUS)||w1(r,i,e,s),t.attributeData=Y1(i,r),t.uniformData=W1(i,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const o=Object.keys(t.attributeData);o.sort((l,u)=>l>u?1:-1);for(let l=0;l<o.length;l++)t.attributeData[o[l]].location=l,r.bindAttribLocation(i,l,o[l]);r.linkProgram(i)}r.deleteShader(e),r.deleteShader(s);const a={};for(const o in t.uniformData){const l=t.uniformData[o];a[o]={location:r.getUniformLocation(i,o),value:pp(l.type,l.size)}}return new H1(i,a)}function j1(r,t,e,s,i){e.buffer.update(i)}const q1={float:`
420
420
  data[offset] = v;
421
421
  `,vec2:`
422
422
  data[offset] = v[0];
@@ -454,7 +454,7 @@ void main(void)
454
454
  {
455
455
  data[offset + i] = v[i];
456
456
  }
457
- `},qp={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function j1(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,i=0;for(let n=0;n<t.length;n++){const a=t[n];if(e=qp[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const h=s%e%16;s+=h,i+=h}s+e>16?(i=Math.ceil(i/16)*16,a.offset=i,i+=e,s=e):(a.offset=i,s+=e,i+=e)}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}function q1(r,t){const e=[];for(const s in r)t[s]&&e.push(t[s]);return e.sort((s,i)=>s.index-i.index),e}function Z1(r,t){if(!r.autoManage)return{size:0,syncFunc:W1};const e=q1(r.uniforms,t),{uboElements:s,size:i}=j1(e),n=[`
457
+ `},Hp={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function Z1(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,i=0;for(let n=0;n<t.length;n++){const a=t[n];if(e=Hp[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const h=s%e%16;s+=h,i+=h}s+e>16?(i=Math.ceil(i/16)*16,a.offset=i,i+=e,s=e):(a.offset=i,s+=e,i+=e)}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}function K1(r,t){const e=[];for(const s in r)t[s]&&e.push(t[s]);return e.sort((s,i)=>s.index-i.index),e}function Q1(r,t){if(!r.autoManage)return{size:0,syncFunc:j1};const e=K1(r.uniforms,t),{uboElements:s,size:i}=Z1(e),n=[`
458
458
  var v = null;
459
459
  var v2 = null;
460
460
  var cv = null;
@@ -462,7 +462,7 @@ void main(void)
462
462
  var gl = renderer.gl
463
463
  var index = 0;
464
464
  var data = buffer.data;
465
- `];for(let a=0;a<s.length;a++){const h=s[a],o=r.uniforms[h.data.name],l=h.data.name;let u=!1;for(let c=0;c<on.length;c++){const d=on[c];if(d.codeUbo&&d.test(h.data,o)){n.push(`offset = ${h.offset/4};`,on[c].codeUbo(h.data.name,o)),u=!0;break}}if(!u)if(h.data.size>1){const c=wp(h.data.type),d=Math.max(qp[h.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(`
465
+ `];for(let a=0;a<s.length;a++){const h=s[a],o=r.uniforms[h.data.name],l=h.data.name;let u=!1;for(let c=0;c<on.length;c++){const d=on[c];if(d.codeUbo&&d.test(h.data,o)){n.push(`offset = ${h.offset/4};`,on[c].codeUbo(h.data.name,o)),u=!0;break}}if(!u)if(h.data.size>1){const c=_p(h.data.type),d=Math.max(Hp[h.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(`
466
466
  cv = ud.${l}.value;
467
467
  v = uv.${l};
468
468
  offset = ${h.offset/4};
@@ -478,7 +478,7 @@ void main(void)
478
478
  offset += ${p};
479
479
  }
480
480
 
481
- `)}else{const c=z1[h.data.type];n.push(`
481
+ `)}else{const c=q1[h.data.type];n.push(`
482
482
  cv = ud.${l}.value;
483
483
  v = uv.${l};
484
484
  offset = ${h.offset/4};
@@ -486,7 +486,7 @@ void main(void)
486
486
  `)}}return n.push(`
487
487
  renderer.buffer.update(buffer);
488
488
  `),{size:i,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
489
- `))}}let K1=0;const Ta={textureCount:0,uboCount:0};class Zp{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=K1++}systemCheck(){if(!w1())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,i=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(i.program)),e||(Ta.textureCount=0,Ta.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ta)),i}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=_1(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const i=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),i(s.uniformData,t.uniforms,this.renderer,Ta,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:i}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let h=this._uboCache[a];if(h||(h=this._uboCache[a]=Z1(t,this.shader.program.uniformData)),t.autoManage){const o=new Float32Array(h.size/4);t.buffer.update(o)}return e.uniformGroups[t.id]=h.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const a in i)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,i=Y1(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=i,i}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Zp.extension={type:H.RendererSystem,name:"shader"},K.add(Zp);class Aa{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(){}}Aa.defaultOptions={hello:!1},Aa.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"startup"},K.add(Aa);function Q1(r,t=[]){return t[W.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.ADD]=[r.ONE,r.ONE],t[W.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.NONE]=[0,0],t[W.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[W.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[W.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[W.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[W.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[W.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[W.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[W.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[W.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[W.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const J1=0,tw=1,ew=2,sw=3,iw=4,rw=5,Kp=class gd{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=W.NONE,this._blendEq=!1,this.map=[],this.map[J1]=this.setBlend,this.map[tw]=this.setOffset,this.map[ew]=this.setCullFace,this.map[sw]=this.setDepthTest,this.map[iw]=this.setFrontFace,this.map[rw]=this.setDepthMask,this.checks=[],this.defaultState=new js,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Q1(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<<s)),e=e>>1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(gd.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(gd.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Kp.extension={type:H.RendererSystem,name:"state"};let nw=Kp;K.add(nw);class ow extends Xs{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(i=>t.systems[i]),s=[...e,...Object.keys(t.systems).filter(i=>!e.includes(i))];for(const i of s)this.addSystem(t.systems[i],i)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ws(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 i in this.runners)this.runners[i].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(i=>{const n=s.find(a=>this._systemsHash[a]===i);i[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const oo=class Sl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Sl.defaultMaxIdle,this.checkCountMax=Sl.defaultCheckCountMax,this.mode=Sl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Rl.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let i=0;i<e.length;i++){const n=e[i];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,s=!0)}if(s){let i=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[i++]=e[n]);e.length=i}}unload(t){const e=this.renderer.texture,s=t._texture;s&&!s.framebuffer&&e.destroyTexture(s);for(let i=t.children.length-1;i>=0;i--)this.unload(t.children[i])}destroy(){this.renderer=null}};oo.defaultMode=Rl.AUTO,oo.defaultMaxIdle=60*60,oo.defaultCheckCountMax=60*10,oo.extension={type:H.RendererSystem,name:"textureGC"};let Tr=oo;K.add(Tr);class qh{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=tt.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}}function aw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.R8]:j.FLOAT,[r.R8_SNORM]:j.FLOAT,[r.RG8]:j.FLOAT,[r.RG8_SNORM]:j.FLOAT,[r.RGB8]:j.FLOAT,[r.RGB8_SNORM]:j.FLOAT,[r.RGB565]:j.FLOAT,[r.RGBA4]:j.FLOAT,[r.RGB5_A1]:j.FLOAT,[r.RGBA8]:j.FLOAT,[r.RGBA8_SNORM]:j.FLOAT,[r.RGB10_A2]:j.FLOAT,[r.RGB10_A2UI]:j.FLOAT,[r.SRGB8]:j.FLOAT,[r.SRGB8_ALPHA8]:j.FLOAT,[r.R16F]:j.FLOAT,[r.RG16F]:j.FLOAT,[r.RGB16F]:j.FLOAT,[r.RGBA16F]:j.FLOAT,[r.R32F]:j.FLOAT,[r.RG32F]:j.FLOAT,[r.RGB32F]:j.FLOAT,[r.RGBA32F]:j.FLOAT,[r.R11F_G11F_B10F]:j.FLOAT,[r.RGB9_E5]:j.FLOAT,[r.R8I]:j.INT,[r.R8UI]:j.UINT,[r.R16I]:j.INT,[r.R16UI]:j.UINT,[r.R32I]:j.INT,[r.R32UI]:j.UINT,[r.RG8I]:j.INT,[r.RG8UI]:j.UINT,[r.RG16I]:j.INT,[r.RG16UI]:j.UINT,[r.RG32I]:j.INT,[r.RG32UI]:j.UINT,[r.RGB8I]:j.INT,[r.RGB8UI]:j.UINT,[r.RGB16I]:j.INT,[r.RGB16UI]:j.UINT,[r.RGB32I]:j.INT,[r.RGB32UI]:j.UINT,[r.RGBA8I]:j.INT,[r.RGBA8UI]:j.UINT,[r.RGBA16I]:j.INT,[r.RGBA16UI]:j.UINT,[r.RGBA32I]:j.INT,[r.RGBA32UI]:j.UINT,[r.DEPTH_COMPONENT16]:j.FLOAT,[r.DEPTH_COMPONENT24]:j.FLOAT,[r.DEPTH_COMPONENT32F]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT,[r.DEPTH24_STENCIL8]:j.FLOAT,[r.DEPTH32F_STENCIL8]:j.FLOAT}:t={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT},t}function lw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA8,[G.RGB]:r.RGB8,[G.RG]:r.RG8,[G.RED]:r.R8,[G.RGBA_INTEGER]:r.RGBA8UI,[G.RGB_INTEGER]:r.RGB8UI,[G.RG_INTEGER]:r.RG8UI,[G.RED_INTEGER]:r.R8UI,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[tt.BYTE]:{[G.RGBA]:r.RGBA8_SNORM,[G.RGB]:r.RGB8_SNORM,[G.RG]:r.RG8_SNORM,[G.RED]:r.R8_SNORM,[G.RGBA_INTEGER]:r.RGBA8I,[G.RGB_INTEGER]:r.RGB8I,[G.RG_INTEGER]:r.RG8I,[G.RED_INTEGER]:r.R8I},[tt.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:r.RGBA16UI,[G.RGB_INTEGER]:r.RGB16UI,[G.RG_INTEGER]:r.RG16UI,[G.RED_INTEGER]:r.R16UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[tt.SHORT]:{[G.RGBA_INTEGER]:r.RGBA16I,[G.RGB_INTEGER]:r.RGB16I,[G.RG_INTEGER]:r.RG16I,[G.RED_INTEGER]:r.R16I},[tt.UNSIGNED_INT]:{[G.RGBA_INTEGER]:r.RGBA32UI,[G.RGB_INTEGER]:r.RGB32UI,[G.RG_INTEGER]:r.RG32UI,[G.RED_INTEGER]:r.R32UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[tt.INT]:{[G.RGBA_INTEGER]:r.RGBA32I,[G.RGB_INTEGER]:r.RGB32I,[G.RG_INTEGER]:r.RG32I,[G.RED_INTEGER]:r.R32I},[tt.FLOAT]:{[G.RGBA]:r.RGBA32F,[G.RGB]:r.RGB32F,[G.RG]:r.RG32F,[G.RED]:r.R32F,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[tt.HALF_FLOAT]:{[G.RGBA]:r.RGBA16F,[G.RGB]:r.RGB16F,[G.RG]:r.RG16F,[G.RED]:r.R16F},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB565},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA4},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGB5_A1},[tt.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:r.RGB10_A2,[G.RGBA_INTEGER]:r.RGB10_A2UI},[tt.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:r.R11F_G11F_B10F},[tt.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:r.RGB9_E5},[tt.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[tt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA,[G.RGB]:r.RGB,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGBA}},t}class Qp{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new et,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=lw(t),this.samplerTypes=aw(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let i=0;i<e;i++)this.boundTextures[i]=null;this.emptyTextures={};const s=new qh(t.createTexture());t.bindTexture(t.TEXTURE_2D,s.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=s,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new qh(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let i=0;i<this.boundTextures.length;i++)this.bind(null,i)}bind(t,e=0){const{gl:s}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const i=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(t.target,i.texture)),i.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),this.updateTexture(t)):i.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(s.TEXTURE_2D,this.emptyTextures[s.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:s}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let i=0;i<s.length;i++)s[i]===this.unknownTexture&&this.bind(null,i)}for(let i=0;i<s.length;i++)s[i]===t&&(this.currentLocation!==i&&(e.activeTexture(e.TEXTURE0+i),this.currentLocation=i),e.bindTexture(t.target,this.emptyTextures[t.target].texture),s[i]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:s,CONTEXT_UID:i}=this;if(s)for(let n=t-1;n>=0;--n){const a=e[n];a&&a._glTextures[i].samplerType!==j.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new qh(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;e.internalFormat=((s=this.internalFormats[t.type])==null?void 0:s[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??j.FLOAT,this.webGLVersion===2&&t.type===tt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var i;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const s=this.renderer;if(this.initTextureType(t,e),(i=t.resource)==null?void 0:i.upload(s,t,e))e.samplerType!==j.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,h=s.gl;(e.width!==n||e.height!==a||e.dirtyId<0)&&(e.width=n,e.height=a,h.texImage2D(t.target,0,e.internalFormat,n,a,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if(t=t.castToBaseTexture(),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 i=this.managedTextures.indexOf(t);i!==-1&&nn(this.managedTextures,i,1)}}updateTextureStyle(t){var s;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===vs.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Fi.CLAMP:e.wrapMode=t.wrapMode,(s=t.resource)!=null&&s.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==vs.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===je.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const i=this.renderer.context.extensions.anisotropicFiltering;if(i&&t.anisotropicLevel>0&&t.scaleMode===je.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,i.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===je.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===je.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Qp.extension={type:H.RendererSystem,name:"texture"},K.add(Qp);class Jp{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:i}=this;e&&i.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:i}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[i]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;a<t.buffers.length;a++){const h=t.buffers[a];h&&(s.buffer.update(h),h._glBuffers[i].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,h._glBuffers[i].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const s=t._glTransformFeedbacks[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let a=0;a<t.buffers.length;a++){const h=t.buffers[a];if(!h)continue;const o=h._glBuffers[this.CONTEXT_UID];o&&(o.refCount--,o.refCount===0&&!e&&n.dispose(h,e))}s&&(e||i.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Jp.extension={type:H.RendererSystem,name:"transformFeedback"},K.add(Jp);class Sa{constructor(t){this.renderer=t}init(t){this.screen=new it(0,0,t.width,t.height),this.element=t.view||z.ADAPTER.createCanvas(),this.resolution=t.resolution||z.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const s=this.element.width/this.resolution,i=this.element.height/this.resolution;this.screen.width=s,this.screen.height=i,this.autoDensity&&(this.element.style.width=`${s}px`,this.element.style.height=`${i}px`),this.renderer.emit("resize",s,i),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Sa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Sa.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"_view"},K.add(Sa),z.PREFER_ENV=Ns.WEBGL2,z.STRICT_TEXTURE_CACHE=!1,z.RENDER_OPTIONS={...ba.defaultOptions,...va.defaultOptions,...Sa.defaultOptions,...Aa.defaultOptions},Object.defineProperties(z,{WRAP_MODE:{get(){return et.defaultOptions.wrapMode},set(r){ot("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),et.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return et.defaultOptions.scaleMode},set(r){ot("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),et.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return et.defaultOptions.mipmap},set(r){ot("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),et.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return et.defaultOptions.anisotropicLevel},set(r){ot("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),et.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return ot("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),pe.defaultResolution},set(r){pe.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return ot("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),pe.defaultMultisample},set(r){pe.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return br.defaultMaxTextures},set(r){ot("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),br.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return br.defaultBatchSize},set(r){ot("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),br.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return br.canUploadSameBuffer},set(r){ot("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),br.canUploadSameBuffer=r}},GC_MODE:{get(){return Tr.defaultMode},set(r){ot("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Tr.defaultMode=r}},GC_MAX_IDLE:{get(){return Tr.defaultMaxIdle},set(r){ot("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Tr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Tr.defaultCheckCountMax},set(r){ot("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Tr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return yi.defaultVertexPrecision},set(r){ot("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),yi.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return yi.defaultFragmentPrecision},set(r){ot("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),yi.defaultFragmentPrecision=r}}});var Vi=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Vi||{});class Zh{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=i}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const tm=class ns{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 Zh(null,null,1/0),this.deltaMS=1/ns.targetFPMS,this.elapsedMS=1/ns.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=Vi.NORMAL){return this._addListener(new Zh(t,e,s))}addOnce(t,e,s=Vi.NORMAL){return this._addListener(new Zh(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._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ns.targetFPMS;const s=this._head;let i=s.next;for(;i;)i=i.emit(this.deltaTime);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),s=Math.min(Math.max(0,e)/1e3,ns.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!ns._shared){const t=ns._shared=new ns;t.autoStart=!0,t._protected=!0}return ns._shared}static get system(){if(!ns._system){const t=ns._system=new ns;t.autoStart=!0,t._protected=!0}return ns._system}};tm.targetFPMS=.06;let wt=tm;Object.defineProperties(z,{TARGET_FPMS:{get(){return wt.targetFPMS},set(r){ot("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),wt.targetFPMS=r}}});class em{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Vi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?wt.shared:new wt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}em.extension=H.Application,K.add(em);const sm=[];K.handleByList(H.Renderer,sm);function hw(r){for(const t of sm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var cw=`attribute vec2 aVertexPosition;
489
+ `))}}let J1=0;const Ta={textureCount:0,uboCount:0};class Yp{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=J1++}systemCheck(){if(!T1())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,i=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(i.program)),e||(Ta.textureCount=0,Ta.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ta)),i}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=x1(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const i=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),i(s.uniformData,t.uniforms,this.renderer,Ta,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:i}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let h=this._uboCache[a];if(h||(h=this._uboCache[a]=Q1(t,this.shader.program.uniformData)),t.autoManage){const o=new Float32Array(h.size/4);t.buffer.update(o)}return e.uniformGroups[t.id]=h.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const a in i)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,i=z1(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=i,i}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Yp.extension={type:H.RendererSystem,name:"shader"},K.add(Yp);class Aa{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(){}}Aa.defaultOptions={hello:!1},Aa.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"startup"},K.add(Aa);function tw(r,t=[]){return t[W.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.ADD]=[r.ONE,r.ONE],t[W.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.NONE]=[0,0],t[W.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[W.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[W.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[W.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[W.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[W.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[W.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[W.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[W.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[W.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const ew=0,sw=1,iw=2,rw=3,nw=4,ow=5,Wp=class fd{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=W.NONE,this._blendEq=!1,this.map=[],this.map[ew]=this.setBlend,this.map[sw]=this.setOffset,this.map[iw]=this.setCullFace,this.map[rw]=this.setDepthTest,this.map[nw]=this.setFrontFace,this.map[ow]=this.setDepthMask,this.checks=[],this.defaultState=new js,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=tw(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<<s)),e=e>>1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(fd.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(fd.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Wp.extension={type:H.RendererSystem,name:"state"};let aw=Wp;K.add(aw);class lw extends Xs{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(i=>t.systems[i]),s=[...e,...Object.keys(t.systems).filter(i=>!e.includes(i))];for(const i of s)this.addSystem(t.systems[i],i)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ws(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 i in this.runners)this.runners[i].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(i=>{const n=s.find(a=>this._systemsHash[a]===i);i[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const oo=class Sl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Sl.defaultMaxIdle,this.checkCountMax=Sl.defaultCheckCountMax,this.mode=Sl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Rl.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let i=0;i<e.length;i++){const n=e[i];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,s=!0)}if(s){let i=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[i++]=e[n]);e.length=i}}unload(t){const e=this.renderer.texture,s=t._texture;s&&!s.framebuffer&&e.destroyTexture(s);for(let i=t.children.length-1;i>=0;i--)this.unload(t.children[i])}destroy(){this.renderer=null}};oo.defaultMode=Rl.AUTO,oo.defaultMaxIdle=60*60,oo.defaultCheckCountMax=60*10,oo.extension={type:H.RendererSystem,name:"textureGC"};let Tr=oo;K.add(Tr);class Wh{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=tt.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}}function hw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.R8]:j.FLOAT,[r.R8_SNORM]:j.FLOAT,[r.RG8]:j.FLOAT,[r.RG8_SNORM]:j.FLOAT,[r.RGB8]:j.FLOAT,[r.RGB8_SNORM]:j.FLOAT,[r.RGB565]:j.FLOAT,[r.RGBA4]:j.FLOAT,[r.RGB5_A1]:j.FLOAT,[r.RGBA8]:j.FLOAT,[r.RGBA8_SNORM]:j.FLOAT,[r.RGB10_A2]:j.FLOAT,[r.RGB10_A2UI]:j.FLOAT,[r.SRGB8]:j.FLOAT,[r.SRGB8_ALPHA8]:j.FLOAT,[r.R16F]:j.FLOAT,[r.RG16F]:j.FLOAT,[r.RGB16F]:j.FLOAT,[r.RGBA16F]:j.FLOAT,[r.R32F]:j.FLOAT,[r.RG32F]:j.FLOAT,[r.RGB32F]:j.FLOAT,[r.RGBA32F]:j.FLOAT,[r.R11F_G11F_B10F]:j.FLOAT,[r.RGB9_E5]:j.FLOAT,[r.R8I]:j.INT,[r.R8UI]:j.UINT,[r.R16I]:j.INT,[r.R16UI]:j.UINT,[r.R32I]:j.INT,[r.R32UI]:j.UINT,[r.RG8I]:j.INT,[r.RG8UI]:j.UINT,[r.RG16I]:j.INT,[r.RG16UI]:j.UINT,[r.RG32I]:j.INT,[r.RG32UI]:j.UINT,[r.RGB8I]:j.INT,[r.RGB8UI]:j.UINT,[r.RGB16I]:j.INT,[r.RGB16UI]:j.UINT,[r.RGB32I]:j.INT,[r.RGB32UI]:j.UINT,[r.RGBA8I]:j.INT,[r.RGBA8UI]:j.UINT,[r.RGBA16I]:j.INT,[r.RGBA16UI]:j.UINT,[r.RGBA32I]:j.INT,[r.RGBA32UI]:j.UINT,[r.DEPTH_COMPONENT16]:j.FLOAT,[r.DEPTH_COMPONENT24]:j.FLOAT,[r.DEPTH_COMPONENT32F]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT,[r.DEPTH24_STENCIL8]:j.FLOAT,[r.DEPTH32F_STENCIL8]:j.FLOAT}:t={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT},t}function cw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA8,[G.RGB]:r.RGB8,[G.RG]:r.RG8,[G.RED]:r.R8,[G.RGBA_INTEGER]:r.RGBA8UI,[G.RGB_INTEGER]:r.RGB8UI,[G.RG_INTEGER]:r.RG8UI,[G.RED_INTEGER]:r.R8UI,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[tt.BYTE]:{[G.RGBA]:r.RGBA8_SNORM,[G.RGB]:r.RGB8_SNORM,[G.RG]:r.RG8_SNORM,[G.RED]:r.R8_SNORM,[G.RGBA_INTEGER]:r.RGBA8I,[G.RGB_INTEGER]:r.RGB8I,[G.RG_INTEGER]:r.RG8I,[G.RED_INTEGER]:r.R8I},[tt.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:r.RGBA16UI,[G.RGB_INTEGER]:r.RGB16UI,[G.RG_INTEGER]:r.RG16UI,[G.RED_INTEGER]:r.R16UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[tt.SHORT]:{[G.RGBA_INTEGER]:r.RGBA16I,[G.RGB_INTEGER]:r.RGB16I,[G.RG_INTEGER]:r.RG16I,[G.RED_INTEGER]:r.R16I},[tt.UNSIGNED_INT]:{[G.RGBA_INTEGER]:r.RGBA32UI,[G.RGB_INTEGER]:r.RGB32UI,[G.RG_INTEGER]:r.RG32UI,[G.RED_INTEGER]:r.R32UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[tt.INT]:{[G.RGBA_INTEGER]:r.RGBA32I,[G.RGB_INTEGER]:r.RGB32I,[G.RG_INTEGER]:r.RG32I,[G.RED_INTEGER]:r.R32I},[tt.FLOAT]:{[G.RGBA]:r.RGBA32F,[G.RGB]:r.RGB32F,[G.RG]:r.RG32F,[G.RED]:r.R32F,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[tt.HALF_FLOAT]:{[G.RGBA]:r.RGBA16F,[G.RGB]:r.RGB16F,[G.RG]:r.RG16F,[G.RED]:r.R16F},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB565},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA4},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGB5_A1},[tt.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:r.RGB10_A2,[G.RGBA_INTEGER]:r.RGB10_A2UI},[tt.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:r.R11F_G11F_B10F},[tt.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:r.RGB9_E5},[tt.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[tt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA,[G.RGB]:r.RGB,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGBA}},t}class zp{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new et,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=cw(t),this.samplerTypes=hw(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let i=0;i<e;i++)this.boundTextures[i]=null;this.emptyTextures={};const s=new Wh(t.createTexture());t.bindTexture(t.TEXTURE_2D,s.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=s,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Wh(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let i=0;i<this.boundTextures.length;i++)this.bind(null,i)}bind(t,e=0){const{gl:s}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const i=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(t.target,i.texture)),i.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),this.updateTexture(t)):i.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(s.TEXTURE_2D,this.emptyTextures[s.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:s}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let i=0;i<s.length;i++)s[i]===this.unknownTexture&&this.bind(null,i)}for(let i=0;i<s.length;i++)s[i]===t&&(this.currentLocation!==i&&(e.activeTexture(e.TEXTURE0+i),this.currentLocation=i),e.bindTexture(t.target,this.emptyTextures[t.target].texture),s[i]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:s,CONTEXT_UID:i}=this;if(s)for(let n=t-1;n>=0;--n){const a=e[n];a&&a._glTextures[i].samplerType!==j.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Wh(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;e.internalFormat=((s=this.internalFormats[t.type])==null?void 0:s[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??j.FLOAT,this.webGLVersion===2&&t.type===tt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var i;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const s=this.renderer;if(this.initTextureType(t,e),(i=t.resource)==null?void 0:i.upload(s,t,e))e.samplerType!==j.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,h=s.gl;(e.width!==n||e.height!==a||e.dirtyId<0)&&(e.width=n,e.height=a,h.texImage2D(t.target,0,e.internalFormat,n,a,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if(t=t.castToBaseTexture(),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 i=this.managedTextures.indexOf(t);i!==-1&&nn(this.managedTextures,i,1)}}updateTextureStyle(t){var s;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===vs.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Fi.CLAMP:e.wrapMode=t.wrapMode,(s=t.resource)!=null&&s.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==vs.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===je.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const i=this.renderer.context.extensions.anisotropicFiltering;if(i&&t.anisotropicLevel>0&&t.scaleMode===je.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,i.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===je.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===je.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}zp.extension={type:H.RendererSystem,name:"texture"},K.add(zp);class jp{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:i}=this;e&&i.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:i}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[i]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;a<t.buffers.length;a++){const h=t.buffers[a];h&&(s.buffer.update(h),h._glBuffers[i].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,h._glBuffers[i].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const s=t._glTransformFeedbacks[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let a=0;a<t.buffers.length;a++){const h=t.buffers[a];if(!h)continue;const o=h._glBuffers[this.CONTEXT_UID];o&&(o.refCount--,o.refCount===0&&!e&&n.dispose(h,e))}s&&(e||i.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}jp.extension={type:H.RendererSystem,name:"transformFeedback"},K.add(jp);class Sa{constructor(t){this.renderer=t}init(t){this.screen=new it(0,0,t.width,t.height),this.element=t.view||z.ADAPTER.createCanvas(),this.resolution=t.resolution||z.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const s=this.element.width/this.resolution,i=this.element.height/this.resolution;this.screen.width=s,this.screen.height=i,this.autoDensity&&(this.element.style.width=`${s}px`,this.element.style.height=`${i}px`),this.renderer.emit("resize",s,i),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Sa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Sa.extension={type:[H.RendererSystem,H.CanvasRendererSystem],name:"_view"},K.add(Sa),z.PREFER_ENV=Ns.WEBGL2,z.STRICT_TEXTURE_CACHE=!1,z.RENDER_OPTIONS={...ba.defaultOptions,...va.defaultOptions,...Sa.defaultOptions,...Aa.defaultOptions},Object.defineProperties(z,{WRAP_MODE:{get(){return et.defaultOptions.wrapMode},set(r){ot("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),et.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return et.defaultOptions.scaleMode},set(r){ot("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),et.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return et.defaultOptions.mipmap},set(r){ot("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),et.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return et.defaultOptions.anisotropicLevel},set(r){ot("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),et.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return ot("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),pe.defaultResolution},set(r){pe.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return ot("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),pe.defaultMultisample},set(r){pe.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return br.defaultMaxTextures},set(r){ot("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),br.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return br.defaultBatchSize},set(r){ot("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),br.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return br.canUploadSameBuffer},set(r){ot("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),br.canUploadSameBuffer=r}},GC_MODE:{get(){return Tr.defaultMode},set(r){ot("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Tr.defaultMode=r}},GC_MAX_IDLE:{get(){return Tr.defaultMaxIdle},set(r){ot("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Tr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Tr.defaultCheckCountMax},set(r){ot("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Tr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return yi.defaultVertexPrecision},set(r){ot("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),yi.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return yi.defaultFragmentPrecision},set(r){ot("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),yi.defaultFragmentPrecision=r}}});var Vi=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Vi||{});class zh{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=i}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const qp=class ns{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 zh(null,null,1/0),this.deltaMS=1/ns.targetFPMS,this.elapsedMS=1/ns.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=Vi.NORMAL){return this._addListener(new zh(t,e,s))}addOnce(t,e,s=Vi.NORMAL){return this._addListener(new zh(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._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ns.targetFPMS;const s=this._head;let i=s.next;for(;i;)i=i.emit(this.deltaTime);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),s=Math.min(Math.max(0,e)/1e3,ns.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!ns._shared){const t=ns._shared=new ns;t.autoStart=!0,t._protected=!0}return ns._shared}static get system(){if(!ns._system){const t=ns._system=new ns;t.autoStart=!0,t._protected=!0}return ns._system}};qp.targetFPMS=.06;let wt=qp;Object.defineProperties(z,{TARGET_FPMS:{get(){return wt.targetFPMS},set(r){ot("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),wt.targetFPMS=r}}});class Zp{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Vi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?wt.shared:new wt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Zp.extension=H.Application,K.add(Zp);const Kp=[];K.handleByList(H.Renderer,Kp);function uw(r){for(const t of Kp)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var dw=`attribute vec2 aVertexPosition;
490
490
  attribute vec2 aTextureCoord;
491
491
 
492
492
  uniform mat3 projectionMatrix;
@@ -497,7 +497,7 @@ void main(void)
497
497
  {
498
498
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
499
499
  vTextureCoord = aTextureCoord;
500
- }`,uw=`attribute vec2 aVertexPosition;
500
+ }`,fw=`attribute vec2 aVertexPosition;
501
501
 
502
502
  uniform mat3 projectionMatrix;
503
503
 
@@ -523,7 +523,7 @@ void main(void)
523
523
  gl_Position = filterVertexPosition();
524
524
  vTextureCoord = filterTextureCoord();
525
525
  }
526
- `;const dw=cw,im=uw;class rm{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>=ie.HIGH?this.multisample=ie.HIGH:e>=ie.MEDIUM?this.multisample=ie.MEDIUM:e>=ie.LOW?this.multisample=ie.LOW:this.multisample=ie.NONE}destroy(){}}rm.extension={type:H.RendererSystem,name:"_multisample"},K.add(rm);class fw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class nm{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:i,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==i.updateID)if(i.updateID=t._updateID,e.bindBuffer(t.type,i.buffer),i.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),s&&(e||i.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;s<e.length;s++)this.dispose(this.managedBuffers[e[s]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:s}=this;return t._glBuffers[e]=new fw(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}nm.extension={type:H.RendererSystem,name:"buffer"},K.add(nm);class om{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let i,n,a,h;if(e&&(i=e.renderTexture,n=e.clear,a=e.transform,h=e.skipUpdateTransform),this.renderingToScreen=!i,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=a,!s.context.isLost){if(i||(this.lastObjectRendered=t),!h){const o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}s.renderTexture.bind(i),s.batch.currentRenderer.start(),(n??s.background.clearBeforeRender)&&s.renderTexture.clear(),t.render(s),s.batch.currentRenderer.flush(),i&&(e.blit&&s.framebuffer.blit(),i.baseTexture.update()),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}om.extension={type:H.RendererSystem,name:"objectRenderer"},K.add(om);const Ca=class _d extends ow{constructor(t){super(),this.type=Td.WEBGL,t=Object.assign({},z.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Es({projectionMatrix:new Mt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:_d.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ot("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=_d.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:Nb()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ot("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ot("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ot("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ot("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Ca.extension={type:H.Renderer,priority:1},Ca.__plugins={},Ca.__systems={};let Kh=Ca;K.handleByMap(H.RendererPlugin,Kh.__plugins),K.handleByMap(H.RendererSystem,Kh.__systems),K.add(Kh);class am extends so{constructor(t,e){const{width:s,height:i}=e||{};super(s,i),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const a=new et;this.items.push(a),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let s=0;s<this.length;s++)t[s]&&(t[s].castToBaseTexture?this.addBaseTextureAt(t[s].castToBaseTexture(),s):t[s]instanceof so?this.addResourceAt(t[s],s):this.addResourceAt(pp(t[s],e),s))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}class pw extends am{constructor(t,e){const{width:s,height:i}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:i}),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=Wr.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:i,itemDirtyIds:n,items:a}=this,{gl:h}=t;s.dirtyId<0&&h.texImage3D(h.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,i,0,e.format,s.type,null);for(let o=0;o<i;o++){const l=a[o];n[o]<l.dirtyId&&(n[o]=l.dirtyId,l.valid&&h.texSubImage3D(h.TEXTURE_2D_ARRAY,0,0,0,o,l.resource.width,l.resource.height,1,e.format,s.type,l.resource.source))}return!0}}class mw extends xi{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const lm=class Oo extends am{constructor(t,e){const{width:s,height:i,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==Oo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:i});for(let h=0;h<Oo.SIDES;h++)this.items[h].target=Wr.TEXTURE_CUBE_MAP_POSITIVE_X+h;this.linkBaseTexture=a!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Wr.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,s){if(s===void 0&&(s=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Wr.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 i=this.itemDirtyIds;for(let n=0;n<Oo.SIDES;n++){const a=this.items[n];(i[n]<a.dirtyId||s.dirtyId<e.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,s),i[n]=a.dirtyId):i[n]<-1&&(t.gl.texImage2D(a.target,0,s.internalFormat,e.realWidth,e.realHeight,0,e.format,s.type,null),i[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Oo.SIDES}};lm.SIDES=6;let gw=lm;class ln extends xi{constructor(t,e){e=e||{};let s,i,n;typeof t=="string"?(s=ln.EMPTY,i=t,n=!0):(s=t,i=null,n=!1),super(s),this.url=i,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const s=await z.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const i=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(i,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Re.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<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return ln._EMPTY=ln._EMPTY??z.ADAPTER.createCanvas(0,0),ln._EMPTY}}const Qh=class Cl extends xi{constructor(t,e){e=e||{},super(z.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)},Cl.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;xi.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 i=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),i=Math.round(i),n=Math.round(n);const a=this.source;a.width=i,a.height=n,a._pixiId=`canvas_${gr()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,i,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Cl.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"&&Cl.SVG_XML.test(t)}};Qh.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Qh.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Jh=Qh;class _w extends xi{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const tc=class yd extends xi{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 i=t[0].src||t[0];xi.crossOrigin(s,i,e.crossorigin);for(let n=0;n<t.length;++n){const a=document.createElement("source");let{src:h,mime:o}=t[n];if(h=h||t[n],h.startsWith("data:"))o=h.slice(5,h.indexOf(";"));else if(!h.startsWith("blob:")){const l=h.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);o=o||yd.MIME_TYPES[u]||`video/${u}`}a.src=h,o&&(a.type=o),s.appendChild(a)}t=s}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=wt.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,s)=>{this.valid?e(this):(this._resolve=e,this._reject=s,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(wt.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||(wt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(wt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||yd.TYPES.includes(e)}};tc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],tc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let hm=tc;Dh.push(ln,Pp,mw,hm,_w,Jh,aa,gw,pw);class Ia{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?it.EMPTY:(t=t||new it(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:i,c:n,d:a,tx:h,ty:o}=t,l=s*e.x+n*e.y+h,u=i*e.x+a*e.y+o;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,i=this.maxX,n=this.maxY,a=t[0],h=t[1];e=a<e?a:e,s=h<s?h:s,i=a>i?a:i,n=h>n?h:n,a=t[2],h=t[3],e=a<e?a:e,s=h<s?h:s,i=a>i?a:i,n=h>n?h:n,a=t[4],h=t[5],e=a<e?a:e,s=h<s?h:s,i=a>i?a:i,n=h>n?h:n,a=t[6],h=t[7],e=a<e?a:e,s=h<s?h:s,i=a>i?a:i,n=h>n?h:n,this.minX=e,this.minY=s,this.maxX=i,this.maxY=n}addFrame(t,e,s,i,n){this.addFrameMatrix(t.worldTransform,e,s,i,n)}addFrameMatrix(t,e,s,i,n){const a=t.a,h=t.b,o=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+o*s+u,_=h*e+l*s+c;d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*i+o*s+u,_=h*i+l*s+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*e+o*n+u,_=h*e+l*n+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*i+o*n+u,_=h*i+l*n+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let i=this.minX,n=this.minY,a=this.maxX,h=this.maxY;for(let o=e;o<s;o+=2){const l=t[o],u=t[o+1];i=l<i?l:i,n=u<n?u:n,a=l>a?l:a,h=u>h?u:h}this.minX=i,this.minY=n,this.maxX=a,this.maxY=h}addVertices(t,e,s,i){this.addVerticesMatrix(t.worldTransform,e,s,i)}addVerticesMatrix(t,e,s,i,n=0,a=n){const h=t.a,o=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 _=s;_<i;_+=2){const x=e[_],y=e[_+1],v=h*x+l*y+c,b=u*y+o*x+d;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,b-a),g=Math.max(g,b+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,s=this.minY,i=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<s?t.minY:s,this.maxX=t.maxX>i?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,a=t.maxY<e.maxY?t.maxY:e.maxY;if(s<=n&&i<=a){const h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=i<o?i:o,this.maxX=n>l?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,i=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,a=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(s<=n&&i<=a){const h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=i<o?i:o,this.maxX=n>l?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,i,n,a){t-=n,e-=a,s+=n,i+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>s?this.maxX:s,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>i?this.maxY:i}}class Vt extends Xs{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ma,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 Ia,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s<e.length;++s){const i=e[s];Object.defineProperty(Vt.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new it),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new it),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Ia);const e=this.transform,s=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(s==null?void 0:s.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const i=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,t);return this.parent=s,this.transform=e,this._bounds=i,this._bounds.updateID+=this._boundsID-n,a}toGlobal(t,e,s=!1){return s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,s,i){return e&&(t=e.toGlobal(t,s,i)),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,s)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,s=1,i=1,n=0,a=0,h=0,o=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=s||1,this.scale.y=i||1,this.rotation=n,this.skew.x=a,this.skew.y=h,this.pivot.x=o,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new yw),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*u1}set angle(t){this.transform.rotation=t*Nh}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class yw extends Vt{constructor(){super(...arguments),this.sortDirty=null}}Vt.prototype.displayObjectUpdateTransform=Vt.prototype.updateTransform;const xw=new Mt;function vw(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const cm=class xd extends Vt{constructor(){super(),this.children=[],this.sortableChildren=xd.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),i=this.getChildIndex(e);this.children[s]=e,this.children[i]=t,this.onChildrenChange(s<i?s:i)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);nn(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],s=this.children.indexOf(e);if(s===-1)return null;e.parent=null,e.transform._parentID=-1,nn(this.children,s,1),this._boundsID++,this.onChildrenChange(s),e.emit("removed",this),this.emit("childRemoved",e,this,s)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,nn(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const s=t,i=e,n=i-s;let a;if(n>0&&n<=i){a=this.children.splice(s,n);for(let h=0;h<a.length;++h)a[h].parent=null,a[h].transform&&(a[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let h=0;h<a.length;++h)a[h].emit("removed",this),this.emit("childRemoved",a[h],this,h);return a}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,s=this.children.length;e<s;++e){const i=this.children[e];i._lastSortedIndex=e,!t&&i.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(vw),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const s=this.children[t];s.visible&&s.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const s=e._mask.isMaskData?e._mask.maskObject:e._mask;s?(s.calculateBounds(),this._bounds.addBoundsMask(e._bounds,s._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const s=super.getLocalBounds(t);if(!e)for(let i=0,n=this.children.length;i<n;++i){const a=this.children[i];a.visible&&a.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let s,i;this.cullArea?(s=this.cullArea,i=this.worldTransform):this._render!==xd.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(i?(i=xw.copyFrom(i),i.prepend(n)):i=n),s&&e.intersects(s,i))this._render(t);else if(this.cullArea)return;for(let a=0,h=this.children.length;a<h;++a){const o=this.children[a],l=o.cullable;o.cullable=l||!this.cullArea,o.render(t),o.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let s=0,i=this.children.length;s<i;++s)this.children[s].render(t)}}renderAdvanced(t){var n,a,h;const e=this.filters,s=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let o=0;o<e.length;o++)e[o].enabled&&this._enabledFilters.push(e[o])}const i=e&&((n=this._enabledFilters)==null?void 0:n.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==ce.NONE));if(i&&t.batch.flush(),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.push(this,this._enabledFilters),s&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let o=0,l=this.children.length;o<l;++o)this.children[o].render(t)}i&&t.batch.flush(),s&&t.mask.pop(this),e&&((h=this._enabledFilters)!=null&&h.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,s=this.removeChildren(0,this.children.length);if(e)for(let i=0;i<s.length;++i)s[i].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};cm.defaultSortableChildren=!1;let It=cm;It.prototype.containerUpdateTransform=It.prototype.updateTransform,Object.defineProperties(z,{SORTABLE_CHILDREN:{get(){return It.defaultSortableChildren},set(r){ot("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),It.defaultSortableChildren=r}}});const ao=new st,bw=new Uint16Array([0,1,2,0,2,3]);class qe extends It{constructor(t){super(),this._anchor=new qs(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Ct(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=W.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||q.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=bw,this.pluginName="batch",this.isSprite=!0,this._roundPixels=z.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Di(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Di(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,s=e.a,i=e.b,n=e.c,a=e.d,h=e.tx,o=e.ty,l=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let f=0,p=0,m=0,g=0;if(u?(p=u.x-d._x*c.width,f=p+u.width,g=u.y-d._y*c.height,m=g+u.height):(p=-d._x*c.width,f=p+c.width,g=-d._y*c.height,m=g+c.height),l[0]=s*p+n*g+h,l[1]=a*g+i*p+o,l[2]=s*f+n*g+h,l[3]=a*g+i*f+o,l[4]=s*f+n*m+h,l[5]=a*m+i*f+o,l[6]=s*p+n*m+h,l[7]=a*m+i*p+o,this._roundPixels){const _=z.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*_)/_}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,s=t.orig,i=this._anchor,n=this.transform.worldTransform,a=n.a,h=n.b,o=n.c,l=n.d,u=n.tx,c=n.ty,d=-i._x*s.width,f=d+s.width,p=-i._y*s.height,m=p+s.height;if(e[0]=a*d+o*p+u,e[1]=l*p+h*d+c,e[2]=a*f+o*p+u,e[3]=l*p+h*f+c,e[4]=a*f+o*m+u,e[5]=l*m+h*f+c,e[6]=a*d+o*m+u,e[7]=l*m+h*d+c,this._roundPixels){const g=z.RESOLUTION;for(let _=0;_<e.length;++_)e[_]=Math.round(e[_]*g)/g}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Ia),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new it),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ao);const e=this._texture.orig.width,s=this._texture.orig.height,i=-e*this.anchor.x;let n=0;return ao.x>=i&&ao.x<i+e&&(n=-s*this.anchor.y,ao.y>=n&&ao.y<n+s)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const s=t instanceof q?t:q.from(t,e);return new qe(s)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=Di(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=Di(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||q.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const um=new Mt;Vt.prototype._cacheAsBitmap=!1,Vt.prototype._cacheData=null,Vt.prototype._cacheAsBitmapResolution=null,Vt.prototype._cacheAsBitmapMultisample=null;class ww{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Vt.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new ww),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Vt.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Vt.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new it,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const s=this.cacheAsBitmapResolution||r.resolution;e.ceil(s),e.width=Math.max(e.width,1/s),e.height=Math.max(e.height,1/s);const i=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),a=r.renderTexture.destinationFrame.clone(),h=r.projection.transform,o=wr.create({width:e.width,height:e.height,resolution:s,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${gr()}`;this._cacheData.textureCacheId=l,et.addToCache(o.baseTexture,l),q.addToCache(o,l);const u=this.transform.localTransform.copyTo(um).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:o,clear:!0,transform:u,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=h,r.renderTexture.bind(i,n,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new qe(o);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Vt.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Vt.prototype._initCachedDisplayObjectCanvas=function(r){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new it,!0),e=this.alpha;this.alpha=1;const s=r.canvasContext.activeContext,i=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const a=wr.create({width:t.width,height:t.height,resolution:n}),h=`cacheAsBitmap_${gr()}`;this._cacheData.textureCacheId=h,et.addToCache(a.baseTexture,h),q.addToCache(a,h);const o=um;this.transform.localTransform.copyTo(o),o.invert(),o.tx-=t.x,o.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:a,clear:!0,transform:o,skipUpdateTransform:!1}),r.canvasContext.activeContext=s,r._projTransform=i,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new qe(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Vt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Vt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Vt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,et.removeFromCache(this._cacheData.textureCacheId),q.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Vt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Vt.prototype.name=null,It.prototype.getChildByName=function(r,t){for(let e=0,s=this.children.length;e<s;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,s=this.children.length;e<s;e++){const i=this.children[e];if(!i.getChildByName)continue;const n=i.getChildByName(r,!0);if(n)return n}return null},Vt.prototype.getGlobalPosition=function(r=new st,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Ew=`varying vec2 vTextureCoord;
526
+ `;const pw=dw,Qp=fw;class Jp{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>=ie.HIGH?this.multisample=ie.HIGH:e>=ie.MEDIUM?this.multisample=ie.MEDIUM:e>=ie.LOW?this.multisample=ie.LOW:this.multisample=ie.NONE}destroy(){}}Jp.extension={type:H.RendererSystem,name:"_multisample"},K.add(Jp);class mw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class tm{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:i,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==i.updateID)if(i.updateID=t._updateID,e.bindBuffer(t.type,i.buffer),i.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),s&&(e||i.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;s<e.length;s++)this.dispose(this.managedBuffers[e[s]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:s}=this;return t._glBuffers[e]=new mw(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}tm.extension={type:H.RendererSystem,name:"buffer"},K.add(tm);class em{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let i,n,a,h;if(e&&(i=e.renderTexture,n=e.clear,a=e.transform,h=e.skipUpdateTransform),this.renderingToScreen=!i,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=a,!s.context.isLost){if(i||(this.lastObjectRendered=t),!h){const o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}s.renderTexture.bind(i),s.batch.currentRenderer.start(),(n??s.background.clearBeforeRender)&&s.renderTexture.clear(),t.render(s),s.batch.currentRenderer.flush(),i&&(e.blit&&s.framebuffer.blit(),i.baseTexture.update()),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}em.extension={type:H.RendererSystem,name:"objectRenderer"},K.add(em);const Ca=class pd extends lw{constructor(t){super(),this.type=bd.WEBGL,t=Object.assign({},z.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Es({projectionMatrix:new Mt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:pd.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ot("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=pd.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:Ub()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ot("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ot("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ot("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ot("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Ca.extension={type:H.Renderer,priority:1},Ca.__plugins={},Ca.__systems={};let jh=Ca;K.handleByMap(H.RendererPlugin,jh.__plugins),K.handleByMap(H.RendererSystem,jh.__systems),K.add(jh);class sm extends so{constructor(t,e){const{width:s,height:i}=e||{};super(s,i),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const a=new et;this.items.push(a),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let s=0;s<this.length;s++)t[s]&&(t[s].castToBaseTexture?this.addBaseTextureAt(t[s].castToBaseTexture(),s):t[s]instanceof so?this.addResourceAt(t[s],s):this.addResourceAt(hp(t[s],e),s))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}class gw extends sm{constructor(t,e){const{width:s,height:i}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:i}),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=Wr.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:i,itemDirtyIds:n,items:a}=this,{gl:h}=t;s.dirtyId<0&&h.texImage3D(h.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,i,0,e.format,s.type,null);for(let o=0;o<i;o++){const l=a[o];n[o]<l.dirtyId&&(n[o]=l.dirtyId,l.valid&&h.texSubImage3D(h.TEXTURE_2D_ARRAY,0,0,0,o,l.resource.width,l.resource.height,1,e.format,s.type,l.resource.source))}return!0}}class _w extends xi{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const im=class Oo extends sm{constructor(t,e){const{width:s,height:i,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==Oo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:i});for(let h=0;h<Oo.SIDES;h++)this.items[h].target=Wr.TEXTURE_CUBE_MAP_POSITIVE_X+h;this.linkBaseTexture=a!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Wr.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,s){if(s===void 0&&(s=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Wr.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 i=this.itemDirtyIds;for(let n=0;n<Oo.SIDES;n++){const a=this.items[n];(i[n]<a.dirtyId||s.dirtyId<e.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,s),i[n]=a.dirtyId):i[n]<-1&&(t.gl.texImage2D(a.target,0,s.internalFormat,e.realWidth,e.realHeight,0,e.format,s.type,null),i[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Oo.SIDES}};im.SIDES=6;let yw=im;class ln extends xi{constructor(t,e){e=e||{};let s,i,n;typeof t=="string"?(s=ln.EMPTY,i=t,n=!0):(s=t,i=null,n=!1),super(s),this.url=i,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const s=await z.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const i=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(i,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Re.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<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return ln._EMPTY=ln._EMPTY??z.ADAPTER.createCanvas(0,0),ln._EMPTY}}const qh=class Cl extends xi{constructor(t,e){e=e||{},super(z.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)},Cl.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;xi.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 i=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),i=Math.round(i),n=Math.round(n);const a=this.source;a.width=i,a.height=n,a._pixiId=`canvas_${gr()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,i,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Cl.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"&&Cl.SVG_XML.test(t)}};qh.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,qh.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Zh=qh;class xw extends xi{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Kh=class md extends xi{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 i=t[0].src||t[0];xi.crossOrigin(s,i,e.crossorigin);for(let n=0;n<t.length;++n){const a=document.createElement("source");let{src:h,mime:o}=t[n];if(h=h||t[n],h.startsWith("data:"))o=h.slice(5,h.indexOf(";"));else if(!h.startsWith("blob:")){const l=h.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);o=o||md.MIME_TYPES[u]||`video/${u}`}a.src=h,o&&(a.type=o),s.appendChild(a)}t=s}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=wt.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,s)=>{this.valid?e(this):(this._resolve=e,this._reject=s,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(wt.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||(wt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(wt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||md.TYPES.includes(e)}};Kh.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Kh.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let rm=Kh;Fh.push(ln,Tp,_w,rm,xw,Zh,aa,yw,gw);class Ia{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?it.EMPTY:(t=t||new it(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:i,c:n,d:a,tx:h,ty:o}=t,l=s*e.x+n*e.y+h,u=i*e.x+a*e.y+o;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,i=this.maxX,n=this.maxY,a=t[0],h=t[1];e=a<e?a:e,s=h<s?h:s,i=a>i?a:i,n=h>n?h:n,a=t[2],h=t[3],e=a<e?a:e,s=h<s?h:s,i=a>i?a:i,n=h>n?h:n,a=t[4],h=t[5],e=a<e?a:e,s=h<s?h:s,i=a>i?a:i,n=h>n?h:n,a=t[6],h=t[7],e=a<e?a:e,s=h<s?h:s,i=a>i?a:i,n=h>n?h:n,this.minX=e,this.minY=s,this.maxX=i,this.maxY=n}addFrame(t,e,s,i,n){this.addFrameMatrix(t.worldTransform,e,s,i,n)}addFrameMatrix(t,e,s,i,n){const a=t.a,h=t.b,o=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+o*s+u,_=h*e+l*s+c;d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*i+o*s+u,_=h*i+l*s+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*e+o*n+u,_=h*e+l*n+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*i+o*n+u,_=h*i+l*n+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let i=this.minX,n=this.minY,a=this.maxX,h=this.maxY;for(let o=e;o<s;o+=2){const l=t[o],u=t[o+1];i=l<i?l:i,n=u<n?u:n,a=l>a?l:a,h=u>h?u:h}this.minX=i,this.minY=n,this.maxX=a,this.maxY=h}addVertices(t,e,s,i){this.addVerticesMatrix(t.worldTransform,e,s,i)}addVerticesMatrix(t,e,s,i,n=0,a=n){const h=t.a,o=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 _=s;_<i;_+=2){const x=e[_],y=e[_+1],v=h*x+l*y+c,b=u*y+o*x+d;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,b-a),g=Math.max(g,b+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,s=this.minY,i=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<s?t.minY:s,this.maxX=t.maxX>i?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,a=t.maxY<e.maxY?t.maxY:e.maxY;if(s<=n&&i<=a){const h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=i<o?i:o,this.maxX=n>l?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,i=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,a=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(s<=n&&i<=a){const h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=i<o?i:o,this.maxX=n>l?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,i,n,a){t-=n,e-=a,s+=n,i+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>s?this.maxX:s,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>i?this.maxY:i}}class Vt extends Xs{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ma,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 Ia,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s<e.length;++s){const i=e[s];Object.defineProperty(Vt.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new it),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new it),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Ia);const e=this.transform,s=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(s==null?void 0:s.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const i=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,t);return this.parent=s,this.transform=e,this._bounds=i,this._bounds.updateID+=this._boundsID-n,a}toGlobal(t,e,s=!1){return s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,s,i){return e&&(t=e.toGlobal(t,s,i)),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,s)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,s=1,i=1,n=0,a=0,h=0,o=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=s||1,this.scale.y=i||1,this.rotation=n,this.skew.x=a,this.skew.y=h,this.pivot.x=o,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new vw),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*f1}set angle(t){this.transform.rotation=t*Dh}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class vw extends Vt{constructor(){super(...arguments),this.sortDirty=null}}Vt.prototype.displayObjectUpdateTransform=Vt.prototype.updateTransform;const bw=new Mt;function ww(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const nm=class gd extends Vt{constructor(){super(),this.children=[],this.sortableChildren=gd.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),i=this.getChildIndex(e);this.children[s]=e,this.children[i]=t,this.onChildrenChange(s<i?s:i)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);nn(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],s=this.children.indexOf(e);if(s===-1)return null;e.parent=null,e.transform._parentID=-1,nn(this.children,s,1),this._boundsID++,this.onChildrenChange(s),e.emit("removed",this),this.emit("childRemoved",e,this,s)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,nn(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const s=t,i=e,n=i-s;let a;if(n>0&&n<=i){a=this.children.splice(s,n);for(let h=0;h<a.length;++h)a[h].parent=null,a[h].transform&&(a[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let h=0;h<a.length;++h)a[h].emit("removed",this),this.emit("childRemoved",a[h],this,h);return a}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,s=this.children.length;e<s;++e){const i=this.children[e];i._lastSortedIndex=e,!t&&i.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(ww),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const s=this.children[t];s.visible&&s.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const s=e._mask.isMaskData?e._mask.maskObject:e._mask;s?(s.calculateBounds(),this._bounds.addBoundsMask(e._bounds,s._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const s=super.getLocalBounds(t);if(!e)for(let i=0,n=this.children.length;i<n;++i){const a=this.children[i];a.visible&&a.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let s,i;this.cullArea?(s=this.cullArea,i=this.worldTransform):this._render!==gd.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(i?(i=bw.copyFrom(i),i.prepend(n)):i=n),s&&e.intersects(s,i))this._render(t);else if(this.cullArea)return;for(let a=0,h=this.children.length;a<h;++a){const o=this.children[a],l=o.cullable;o.cullable=l||!this.cullArea,o.render(t),o.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let s=0,i=this.children.length;s<i;++s)this.children[s].render(t)}}renderAdvanced(t){var n,a,h;const e=this.filters,s=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let o=0;o<e.length;o++)e[o].enabled&&this._enabledFilters.push(e[o])}const i=e&&((n=this._enabledFilters)==null?void 0:n.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==ce.NONE));if(i&&t.batch.flush(),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.push(this,this._enabledFilters),s&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let o=0,l=this.children.length;o<l;++o)this.children[o].render(t)}i&&t.batch.flush(),s&&t.mask.pop(this),e&&((h=this._enabledFilters)!=null&&h.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,s=this.removeChildren(0,this.children.length);if(e)for(let i=0;i<s.length;++i)s[i].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};nm.defaultSortableChildren=!1;let It=nm;It.prototype.containerUpdateTransform=It.prototype.updateTransform,Object.defineProperties(z,{SORTABLE_CHILDREN:{get(){return It.defaultSortableChildren},set(r){ot("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),It.defaultSortableChildren=r}}});const ao=new st,Ew=new Uint16Array([0,1,2,0,2,3]);class qe extends It{constructor(t){super(),this._anchor=new qs(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Ct(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=W.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||q.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Ew,this.pluginName="batch",this.isSprite=!0,this._roundPixels=z.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Di(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Di(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,s=e.a,i=e.b,n=e.c,a=e.d,h=e.tx,o=e.ty,l=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let f=0,p=0,m=0,g=0;if(u?(p=u.x-d._x*c.width,f=p+u.width,g=u.y-d._y*c.height,m=g+u.height):(p=-d._x*c.width,f=p+c.width,g=-d._y*c.height,m=g+c.height),l[0]=s*p+n*g+h,l[1]=a*g+i*p+o,l[2]=s*f+n*g+h,l[3]=a*g+i*f+o,l[4]=s*f+n*m+h,l[5]=a*m+i*f+o,l[6]=s*p+n*m+h,l[7]=a*m+i*p+o,this._roundPixels){const _=z.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*_)/_}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,s=t.orig,i=this._anchor,n=this.transform.worldTransform,a=n.a,h=n.b,o=n.c,l=n.d,u=n.tx,c=n.ty,d=-i._x*s.width,f=d+s.width,p=-i._y*s.height,m=p+s.height;if(e[0]=a*d+o*p+u,e[1]=l*p+h*d+c,e[2]=a*f+o*p+u,e[3]=l*p+h*f+c,e[4]=a*f+o*m+u,e[5]=l*m+h*f+c,e[6]=a*d+o*m+u,e[7]=l*m+h*d+c,this._roundPixels){const g=z.RESOLUTION;for(let _=0;_<e.length;++_)e[_]=Math.round(e[_]*g)/g}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Ia),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new it),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ao);const e=this._texture.orig.width,s=this._texture.orig.height,i=-e*this.anchor.x;let n=0;return ao.x>=i&&ao.x<i+e&&(n=-s*this.anchor.y,ao.y>=n&&ao.y<n+s)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const s=t instanceof q?t:q.from(t,e);return new qe(s)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=Di(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=Di(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||q.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const om=new Mt;Vt.prototype._cacheAsBitmap=!1,Vt.prototype._cacheData=null,Vt.prototype._cacheAsBitmapResolution=null,Vt.prototype._cacheAsBitmapMultisample=null;class Tw{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Vt.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new Tw),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Vt.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Vt.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new it,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const s=this.cacheAsBitmapResolution||r.resolution;e.ceil(s),e.width=Math.max(e.width,1/s),e.height=Math.max(e.height,1/s);const i=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),a=r.renderTexture.destinationFrame.clone(),h=r.projection.transform,o=wr.create({width:e.width,height:e.height,resolution:s,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${gr()}`;this._cacheData.textureCacheId=l,et.addToCache(o.baseTexture,l),q.addToCache(o,l);const u=this.transform.localTransform.copyTo(om).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:o,clear:!0,transform:u,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=h,r.renderTexture.bind(i,n,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new qe(o);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Vt.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Vt.prototype._initCachedDisplayObjectCanvas=function(r){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new it,!0),e=this.alpha;this.alpha=1;const s=r.canvasContext.activeContext,i=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const a=wr.create({width:t.width,height:t.height,resolution:n}),h=`cacheAsBitmap_${gr()}`;this._cacheData.textureCacheId=h,et.addToCache(a.baseTexture,h),q.addToCache(a,h);const o=om;this.transform.localTransform.copyTo(o),o.invert(),o.tx-=t.x,o.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:a,clear:!0,transform:o,skipUpdateTransform:!1}),r.canvasContext.activeContext=s,r._projTransform=i,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new qe(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Vt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Vt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Vt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,et.removeFromCache(this._cacheData.textureCacheId),q.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Vt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Vt.prototype.name=null,It.prototype.getChildByName=function(r,t){for(let e=0,s=this.children.length;e<s;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,s=this.children.length;e<s;e++){const i=this.children[e];if(!i.getChildByName)continue;const n=i.getChildByName(r,!0);if(n)return n}return null},Vt.prototype.getGlobalPosition=function(r=new st,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Aw=`varying vec2 vTextureCoord;
527
527
 
528
528
  uniform sampler2D uSampler;
529
529
  uniform float uAlpha;
@@ -532,9 +532,9 @@ void main(void)
532
532
  {
533
533
  gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
534
534
  }
535
- `;class Tw extends pe{constructor(t=1){super(dw,Ew,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Aw={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Sw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
536
- `);function Cw(r){const t=Aw[r],e=t.length;let s=Sw,i="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let h=0;h<r;h++){let o=n.replace("%index%",h.toString());a=h,h>=e&&(a=r-h-1),o=o.replace("%value%",t[a].toString()),i+=o,i+=`
537
- `}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}const Iw=`
535
+ `;class Sw extends pe{constructor(t=1){super(pw,Aw,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Cw={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Iw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
536
+ `);function Pw(r){const t=Cw[r],e=t.length;let s=Iw,i="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let h=0;h<r;h++){let o=n.replace("%index%",h.toString());a=h,h>=e&&(a=r-h-1),o=o.replace("%value%",t[a].toString()),i+=o,i+=`
537
+ `}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}const Rw=`
538
538
  attribute vec2 aVertexPosition;
539
539
 
540
540
  uniform mat3 projectionMatrix;
@@ -564,8 +564,8 @@ void main(void)
564
564
 
565
565
  vec2 textureCoord = filterTextureCoord();
566
566
  %blur%
567
- }`;function Pw(r,t){const e=Math.ceil(r/2);let s=Iw,i="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a<r;a++){let h=n.replace("%index%",a.toString());h=h.replace("%sampleIndex%",`${a-(e-1)}.0`),i+=h,i+=`
568
- `}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}class ec extends pe{constructor(t,e=8,s=4,i=pe.defaultResolution,n=5){const a=Pw(n,t),h=Cw(n);super(a,h),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=s,this.blur=e}apply(t,e,s,i){if(s?this.horizontal?this.uniforms.strength=1/s.width*(s.width/e.width):this.uniforms.strength=1/s.height*(s.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,e,s,i);else{const n=t.getFilterTexture(),a=t.renderer;let h=e,o=n;this.state.blend=!1,t.applyFilter(this,h,o,Vs.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(h,Vs.BLIT),this.uniforms.uSampler=o;const u=o;o=h,h=u,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,o,s,i),t.returnFilterTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class dm extends pe{constructor(t=8,e=4,s=pe.defaultResolution,i=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new ec(!0,t,e,s,i),this.blurYFilter=new ec(!1,t,e,s,i),this.resolution=s,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,s,i){const n=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(n&&a){const h=t.getFilterTexture();this.blurXFilter.apply(t,e,h,Vs.CLEAR),this.blurYFilter.apply(t,h,s,i),t.returnFilterTexture(h)}else a?this.blurYFilter.apply(t,e,s,i):this.blurXFilter.apply(t,e,s,i)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}var Rw=`varying vec2 vTextureCoord;
567
+ }`;function Mw(r,t){const e=Math.ceil(r/2);let s=Rw,i="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a<r;a++){let h=n.replace("%index%",a.toString());h=h.replace("%sampleIndex%",`${a-(e-1)}.0`),i+=h,i+=`
568
+ `}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}class Qh extends pe{constructor(t,e=8,s=4,i=pe.defaultResolution,n=5){const a=Mw(n,t),h=Pw(n);super(a,h),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=s,this.blur=e}apply(t,e,s,i){if(s?this.horizontal?this.uniforms.strength=1/s.width*(s.width/e.width):this.uniforms.strength=1/s.height*(s.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,e,s,i);else{const n=t.getFilterTexture(),a=t.renderer;let h=e,o=n;this.state.blend=!1,t.applyFilter(this,h,o,Vs.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(h,Vs.BLIT),this.uniforms.uSampler=o;const u=o;o=h,h=u,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,o,s,i),t.returnFilterTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class am extends pe{constructor(t=8,e=4,s=pe.defaultResolution,i=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Qh(!0,t,e,s,i),this.blurYFilter=new Qh(!1,t,e,s,i),this.resolution=s,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,s,i){const n=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(n&&a){const h=t.getFilterTexture();this.blurXFilter.apply(t,e,h,Vs.CLEAR),this.blurYFilter.apply(t,h,s,i),t.returnFilterTexture(h)}else a?this.blurYFilter.apply(t,e,s,i):this.blurXFilter.apply(t,e,s,i)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}var Fw=`varying vec2 vTextureCoord;
569
569
  uniform sampler2D uSampler;
570
570
  uniform float m[20];
571
571
  uniform float uAlpha;
@@ -617,7 +617,7 @@ void main(void)
617
617
 
618
618
  gl_FragColor = vec4(rgb, result.a);
619
619
  }
620
- `;class hn extends pe{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(im,Rw,t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,i,n]=Ct.shared.setValue(t).toArray(),a=[s,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),n=Math.sqrt,a=1/3,h=n(a),o=s+(1-s)*a,l=a*(1-s)-h*i,u=a*(1-s)+h*i,c=a*(1-s)+h*i,d=s+a*(1-s),f=a*(1-s)-h*i,p=a*(1-s)-h*i,m=a*(1-s)+h*i,g=s+a*(1-s),_=[o,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(_,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),n=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,i=(s-1)*-.5,n=[s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,i,n){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const a=Ct.shared,[h,o,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(i).toArray(),f=[.3,.59,.11,0,0,h,o,l,t,0,u,c,d,e,0,h-u,o-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}}hn.prototype.grayscale=hn.prototype.greyscale;var Mw=`varying vec2 vFilterCoord;
620
+ `;class hn extends pe{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(Qp,Fw,t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,i,n]=Ct.shared.setValue(t).toArray(),a=[s,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),n=Math.sqrt,a=1/3,h=n(a),o=s+(1-s)*a,l=a*(1-s)-h*i,u=a*(1-s)+h*i,c=a*(1-s)+h*i,d=s+a*(1-s),f=a*(1-s)-h*i,p=a*(1-s)-h*i,m=a*(1-s)+h*i,g=s+a*(1-s),_=[o,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(_,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),n=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,i=(s-1)*-.5,n=[s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,i,n){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const a=Ct.shared,[h,o,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(i).toArray(),f=[.3,.59,.11,0,0,h,o,l,t,0,u,c,d,e,0,h-u,o-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}}hn.prototype.grayscale=hn.prototype.greyscale;var kw=`varying vec2 vFilterCoord;
621
621
  varying vec2 vTextureCoord;
622
622
 
623
623
  uniform vec2 scale;
@@ -637,7 +637,7 @@ void main(void)
637
637
 
638
638
  gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
639
639
  }
640
- `,Fw=`attribute vec2 aVertexPosition;
640
+ `,Bw=`attribute vec2 aVertexPosition;
641
641
 
642
642
  uniform mat3 projectionMatrix;
643
643
  uniform mat3 filterMatrix;
@@ -666,7 +666,7 @@ void main(void)
666
666
  vTextureCoord = filterTextureCoord();
667
667
  vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
668
668
  }
669
- `;class kw extends pe{constructor(t,e){const s=new Mt;t.renderable=!1,super(Fw,Mw,{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 st(e,e)}apply(t,e,s,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),h=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&h!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/h,this.uniforms.rotation[3]=n.d/h),t.applyFilter(this,e,s,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Bw=`varying vec2 v_rgbNW;
669
+ `;class Dw extends pe{constructor(t,e){const s=new Mt;t.renderable=!1,super(Bw,kw,{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 st(e,e)}apply(t,e,s,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),h=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&h!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/h,this.uniforms.rotation[3]=n.d/h),t.applyFilter(this,e,s,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Ow=`varying vec2 v_rgbNW;
670
670
  varying vec2 v_rgbNE;
671
671
  varying vec2 v_rgbSW;
672
672
  varying vec2 v_rgbSE;
@@ -787,7 +787,7 @@ void main() {
787
787
 
788
788
  gl_FragColor = color;
789
789
  }
790
- `,Dw=`
790
+ `,Lw=`
791
791
  attribute vec2 aVertexPosition;
792
792
 
793
793
  uniform mat3 projectionMatrix;
@@ -829,7 +829,7 @@ void main(void) {
829
829
 
830
830
  texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
831
831
  }
832
- `;class Ow extends pe{constructor(){super(Dw,Bw)}}var Lw=`precision highp float;
832
+ `;class Nw extends pe{constructor(){super(Lw,Ow)}}var Vw=`precision highp float;
833
833
 
834
834
  varying vec2 vTextureCoord;
835
835
  varying vec4 vColor;
@@ -863,8 +863,8 @@ void main()
863
863
 
864
864
  gl_FragColor = color;
865
865
  }
866
- `;class Nw extends pe{constructor(t=.5,e=Math.random()){super(im,Lw,{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 fm={AlphaFilter:Tw,BlurFilter:dm,BlurFilterPass:ec,ColorMatrixFilter:hn,DisplacementFilter:kw,FXAAFilter:Ow,NoiseFilter:Nw};Object.entries(fm).forEach(([r,t])=>{Object.defineProperty(fm,r,{get(){return ot("7.1.0",`filters.${r} has moved to ${r}`),t}})});class Vw{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||(wt.system.add(this.tickerUpdate,this,Vi.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(wt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const Ui=new Vw;class lo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=lo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new st,this.page=new st,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,s,i,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Pa extends lo{constructor(){super(...arguments),this.client=new st,this.movement=new st,this.offset=new st,this.global=new st,this.screen=new st}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,s){return t.worldTransform.applyInverse(s||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,s,i,n,a,h,o,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Ts extends Pa{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class cn extends Pa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}cn.DOM_DELTA_PIXEL=0,cn.DOM_DELTA_LINE=1,cn.DOM_DELTA_PAGE=2;const Uw=2048,Gw=new st,sc=new st;class Xw{constructor(t){this.dispatch=new Xs,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((s,i)=>s.priority-i.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,i=e.length;s<i;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ui.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",i=this[s](this.rootTarget,this.rootTarget.eventMode,Gw.set(t,e),this.hitTestFn,this.hitPruneFn);return i&&i[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,n=s.length-1;i<n;i++)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let i=s.length-2;i>=0;i--)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const i=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)i.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s<Uw&&t!==this.rootTarget;s++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,s,i,n,a=!1){let h=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ui.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,i,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),h=!0}}}const o=this._isInteractive(e),l=t.isInteractive();return o&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:h?this._hitElements:o&&!n(t,s)&&i(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,i,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ui.pauseUpdate=!1),t.interactiveChildren&&t.children){const o=t.children;for(let l=o.length-1;l>=0;l--){const u=o[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,i,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),h=t.isInteractive();return a&&i(t,s)?h?[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,sc),!t.hitArea.contains(sc.x,sc.y)))return!0;if(t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&!((s=i.containsPoint)!=null&&s.call(i,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 n,a;e=e??t.type;const s=`on${e}`;(a=(n=t.currentTarget)[s])==null||a.call(n,t);const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ts)){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 i=e.button===2;this.dispatchEvent(e,i?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var o,l;if(!(t instanceof Ts)){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 e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const s=e.pointerType==="mouse"||e.pointerType==="pen",i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.overTargets);if(((o=i.overTargets)==null?void 0:o.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),s&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),s&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),s&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),s&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}const a=[],h=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),h&&a.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),h&&a.push("globaltouchmove")),s&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),h&&a.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),a.length>0&&this.all(e,a),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Ts)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),i=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),i&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(a=s.target)==null?void 0:a.cursor);const n=this.clonePointerEvent(s,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ts)){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",i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",i);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 Ts)){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 h=s.button===2;this.dispatchEvent(s,h?"rightup":"mouseup")}const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let h=n;for(;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.notifyTarget(s,o?"rightupoutside":"mouseupoutside")}h=h.parent}delete i.pressTargetsByButton[t.button],a=h}if(a){const h=this.clonePointerEvent(s,"click");h.target=a,h.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});const o=i.clicksByButton[t.button];if(o.target===h.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=h.target,o.timeStamp=e,h.detail=o.clickCount,h.pointerType==="mouse"){const l=h.button===2;this.dispatchEvent(h,l?"rightclick":"click")}else h.pointerType==="touch"&&this.dispatchEvent(h,"tap");this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Ts)){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]),i=this.createPointerEvent(t);if(s){let n=s;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch"?this.notifyTarget(i,"touchendoutside"):(i.pointerType==="mouse"||i.pointerType==="pen")&&this.notifyTarget(i,i.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof cn)){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;s<t.length&&t[s].parent===e;s++)e=t[s];return e}createPointerEvent(t,e,s){const i=this.allocateEvent(Ts);return this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=s??this.hitTest(i.global.x,i.global.y)??this._hitElements[0],typeof e=="string"&&(i.type=e),i}createWheelEvent(t){const e=this.allocateEvent(cn);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const s=this.allocateEvent(Ts);return s.nativeEvent=t.nativeEvent,s.originalEvent=t.originalEvent,this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.target=t.target,s.path=t.composedPath().slice(),s.type=e??s.type,s}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ts&&e instanceof Ts&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Pa&&e instanceof Pa&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const s=t.currentTarget._events[e];if(s&&t.currentTarget.isInteractive())if("fn"in s)s.once&&t.currentTarget.removeListener(e,s.fn,void 0,!0),s.fn.call(s.context,t);else for(let i=0,n=s.length;i<n&&!t.propagationImmediatelyStopped;i++)s[i].once&&t.currentTarget.removeListener(e,s[i].fn,void 0,!0),s[i].fn.call(s[i].context,t)}}const $w=1,Hw={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},ic=class vd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Xw(null),Ui.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ts(null),this.rootWheelEvent=new cn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...vd.defaultEventFeatures},{set:(e,s,i)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=i),e[s]=i,!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){const{view:e,resolution:s}=this.renderer;this.setTargetElement(e),this.resolution=s,vd._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s);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,i=e.length;s<i;s++){const n=e[s],a=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ui.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,i=e.length;s<i;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let n=0,a=i.length;n<a;n++){const h=this.bootstrapEvent(this.rootPointerEvent,i[n]);h.type+=s,this.rootBoundary.mapEvent(h)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let s=0,i=e.length;s<i;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,Ui.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ui.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;Ui.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,s){const i=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-i.left)*(this.domElement.width/i.width)*n,t.y=(s-i.top)*(this.domElement.height/i.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,i=t.changedTouches.length;s<i;s++){const n=t.changedTouches[s];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const s=t;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=$w),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Hw[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};ic.extension={name:"events",type:[H.RendererSystem,H.CanvasRendererSystem]},ic.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let rc=ic;K.add(rc);function pm(r){return r==="dynamic"||r==="static"}const Yw={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??pm(rc.defaultEventMode)},set interactive(r){ot("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??rc.defaultEventMode},set eventMode(r){this._internalInteractive=pm(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,i=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;r=s?`${r}capture`:r;const h=typeof t=="function"?t:t.handleEvent,o=this;i&&i.addEventListener("abort",()=>{o.off(r,h,a)}),n?o.once(r,h,a):o.on(r,h,a)},removeEventListener(r,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,i=typeof t=="function"?void 0:t;r=s?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,i)},dispatchEvent(r){if(!(r instanceof lo))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Vt.mixin(Yw);const Ww={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Vt.mixin(Ww);const zw=9,Ra=100,jw=0,qw=0,mm=2,gm=1,Zw=-1e3,Kw=-1e3,Qw=2;class _m{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,(fi.tablet||fi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.position="absolute",e.style.top=`${jw}px`,e.style.left=`${qw}px`,e.style.zIndex=mm.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=`${gm}px`,t.style.height=`${gm}px`,t.style.position="absolute",t.style.top=`${Zw}px`,t.style.left=`${Kw}px`,t.style.zIndex=Qw.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<e.length;s++)this.updateAccessibleObjects(e[s])}update(){const t=performance.now();if(fi.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:s,width:i,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:h,resolution:o}=this.renderer,l=i/a*o,u=n/h*o;let c=this.div;c.style.left=`${e}px`,c.style.top=`${s}px`,c.style.width=`${a}px`,c.style.height=`${h}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,nn(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{c=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(c.style.left=`${(m.tx+p.x*m.a)*l}px`,c.style.top=`${(m.ty+p.y*m.d)*u}px`,c.style.width=`${p.width*m.a*l}px`,c.style.height=`${p.height*m.d*u}px`):(p=f.getBounds(),this.capHitArea(p),c.style.left=`${p.x*l}px`,c.style.top=`${p.y*u}px`,c.style.width=`${p.width*l}px`,c.style.height=`${p.height*u}px`,c.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(c.title=f.accessibleTitle),c.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&c.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==c.title||f.tabIndex!==c.tabIndex)&&(c.title=f.accessibleTitle,c.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(c))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=mm.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,i=this.renderer.events.rootBoundary,n=Object.assign(new lo(i),{target:s});i.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>i.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===zw&&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}}_m.extension={name:"accessibility",type:[H.RendererPlugin,H.CanvasRendererPlugin]},K.add(_m);const ym=class bd{constructor(t){this.stage=new It,t=Object.assign({forceCanvas:!1},t),this.renderer=hw(t),bd._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=bd._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};ym._plugins=[];let Jw=ym;K.handleByList(H.Application,Jw._plugins);class xm{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:i,clientHeight:n}=this._resizeTo;e=i,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}}xm.extension=H.Application,K.add(xm);const vm={loader:H.LoadParser,resolver:H.ResolveParser,cache:H.CacheParser,detection:H.DetectionParser};K.handle(H.Asset,r=>{const t=r.ref;Object.entries(vm).filter(([e])=>!!t[e]).forEach(([e,s])=>K.add(Object.assign(t[e],{extension:t[e].extension??s})))},r=>{const t=r.ref;Object.keys(vm).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});class tE{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<e;s++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function un(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Le(r,t){const e=r.split("?")[0],s=bt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const As=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(s=>typeof s=="string"||e?t(s):s):r),nc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function bm(r,t,e,s,i){const n=t[e];for(let a=0;a<n.length;a++){const h=n[a];e<t.length-1?bm(r.replace(s[e],h),t,e+1,s,i):i.push(r.replace(s[e],h))}}function eE(r){const t=/\{(.*?)\}/g,e=r.match(t),s=[];if(e){const i=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");i.push(a)}),bm(r,i,0,e,s)}else s.push(r);return s}const Ma=r=>!Array.isArray(r);class sE{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=As(t);let i;for(let h=0;h<this.parsers.length;h++){const o=this.parsers[h];if(o.test(e)){i=o.getCacheableAssets(s,e);break}}i||(i={},s.forEach(h=>{i[h]=e}));const n=Object.keys(i),a={cacheKeys:n,keys:s};if(s.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{this._cache.has(h)&&this._cache.get(h)!==e&&console.warn("[Cache] already has key:",h),this._cache.set(h,i[h])}),e instanceof q){const h=e;s.forEach(o=>{h.baseTexture!==q.EMPTY.baseTexture&&et.addToCache(h.baseTexture,o),q.addToCache(h,o)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);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 Ar=new sE;class iE{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 a,h;let i=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];if(l.load&&((a=l.test)!=null&&a.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}i=await n.load(t,e,this),s.parser=n;for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];l.parse&&l.parse&&await((h=l.testParse)==null?void 0:h.call(l,i,e,this))&&(i=await l.parse(i,e,this)||i,s.parser=l)}return i})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const i={},n=Ma(t),a=As(t,l=>({alias:[l],src:l})),h=a.length,o=a.map(async l=>{const u=bt.toAbsolute(l.src);if(!i[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),i[l.src]=await this.promiseCache[u].promise,e&&e(++s/h)}catch(c){throw delete this.promiseCache[u],delete i[l.src],new Error(`[Loader.load] Failed to load ${u}.
867
- ${c}`)}});return await Promise.all(o),n?i[a[0].src]:i}async unload(t){const e=As(t,s=>({alias:[s],src:s})).map(async s=>{var a,h;const i=bt.toAbsolute(s.src),n=this.promiseCache[i];if(n){const o=await n.promise;delete this.promiseCache[i],(h=(a=n.parser)==null?void 0:a.unload)==null||h.call(a,o,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var Ne=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(Ne||{});const rE=".json",nE="application/json",oE={extension:{type:H.LoadParser,priority:Ne.Low},name:"loadJson",test(r){return un(r,nE)||Le(r,rE)},async load(r){return await(await z.ADAPTER.fetch(r)).json()}};K.add(oE);const aE=".txt",lE="text/plain",hE={name:"loadTxt",extension:{type:H.LoadParser,priority:Ne.Low},test(r){return un(r,lE)||Le(r,aE)},async load(r){return await(await z.ADAPTER.fetch(r)).text()}};K.add(hE);const cE=["normal","bold","100","200","300","400","500","600","700","800","900"],uE=[".ttf",".otf",".woff",".woff2"],dE=["font/ttf","font/otf","font/woff","font/woff2"],fE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function pE(r){const t=bt.extname(r),e=bt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(fE)){s=!1;break}let i=e.join(" ");return s||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}const mE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function gE(r){return mE.test(r)?r:encodeURI(r)}const _E={extension:{type:H.LoadParser,priority:Ne.Low},name:"loadWebFont",test(r){return un(r,dE)||Le(r,uE)},async load(r,t){var s,i,n;const e=z.ADAPTER.getFontFaceSet();if(e){const a=[],h=((s=t.data)==null?void 0:s.family)??pE(r),o=((n=(i=t.data)==null?void 0:i.weights)==null?void 0:n.filter(u=>cE.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<o.length;u++){const c=o[u],d=new FontFace(h,`url(${gE(r)})`,{...l,weight:c});await d.load(),e.add(d),a.push(d)}return a.length===1?a[0]:a}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};K.add(_E);const yE=`(function() {
866
+ `;class Uw extends pe{constructor(t=.5,e=Math.random()){super(Qp,Vw,{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 lm={AlphaFilter:Sw,BlurFilter:am,BlurFilterPass:Qh,ColorMatrixFilter:hn,DisplacementFilter:Dw,FXAAFilter:Nw,NoiseFilter:Uw};Object.entries(lm).forEach(([r,t])=>{Object.defineProperty(lm,r,{get(){return ot("7.1.0",`filters.${r} has moved to ${r}`),t}})});class Gw{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||(wt.system.add(this.tickerUpdate,this,Vi.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(wt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const Ui=new Gw;class lo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=lo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new st,this.page=new st,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,s,i,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Pa extends lo{constructor(){super(...arguments),this.client=new st,this.movement=new st,this.offset=new st,this.global=new st,this.screen=new st}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,s){return t.worldTransform.applyInverse(s||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,s,i,n,a,h,o,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Ts extends Pa{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class cn extends Pa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}cn.DOM_DELTA_PIXEL=0,cn.DOM_DELTA_LINE=1,cn.DOM_DELTA_PAGE=2;const Xw=2048,$w=new st,Jh=new st;class Hw{constructor(t){this.dispatch=new Xs,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((s,i)=>s.priority-i.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,i=e.length;s<i;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ui.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",i=this[s](this.rootTarget,this.rootTarget.eventMode,$w.set(t,e),this.hitTestFn,this.hitPruneFn);return i&&i[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,n=s.length-1;i<n;i++)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let i=s.length-2;i>=0;i--)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const i=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)i.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s<Xw&&t!==this.rootTarget;s++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,s,i,n,a=!1){let h=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ui.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,i,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),h=!0}}}const o=this._isInteractive(e),l=t.isInteractive();return o&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:h?this._hitElements:o&&!n(t,s)&&i(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,i,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ui.pauseUpdate=!1),t.interactiveChildren&&t.children){const o=t.children;for(let l=o.length-1;l>=0;l--){const u=o[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,i,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),h=t.isInteractive();return a&&i(t,s)?h?[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,Jh),!t.hitArea.contains(Jh.x,Jh.y)))return!0;if(t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&!((s=i.containsPoint)!=null&&s.call(i,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 n,a;e=e??t.type;const s=`on${e}`;(a=(n=t.currentTarget)[s])==null||a.call(n,t);const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ts)){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 i=e.button===2;this.dispatchEvent(e,i?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var o,l;if(!(t instanceof Ts)){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 e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const s=e.pointerType==="mouse"||e.pointerType==="pen",i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.overTargets);if(((o=i.overTargets)==null?void 0:o.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),s&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),s&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),s&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),s&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}const a=[],h=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),h&&a.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),h&&a.push("globaltouchmove")),s&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),h&&a.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),a.length>0&&this.all(e,a),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Ts)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),i=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),i&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(a=s.target)==null?void 0:a.cursor);const n=this.clonePointerEvent(s,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ts)){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",i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",i);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 Ts)){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 h=s.button===2;this.dispatchEvent(s,h?"rightup":"mouseup")}const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let h=n;for(;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.notifyTarget(s,o?"rightupoutside":"mouseupoutside")}h=h.parent}delete i.pressTargetsByButton[t.button],a=h}if(a){const h=this.clonePointerEvent(s,"click");h.target=a,h.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});const o=i.clicksByButton[t.button];if(o.target===h.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=h.target,o.timeStamp=e,h.detail=o.clickCount,h.pointerType==="mouse"){const l=h.button===2;this.dispatchEvent(h,l?"rightclick":"click")}else h.pointerType==="touch"&&this.dispatchEvent(h,"tap");this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Ts)){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]),i=this.createPointerEvent(t);if(s){let n=s;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch"?this.notifyTarget(i,"touchendoutside"):(i.pointerType==="mouse"||i.pointerType==="pen")&&this.notifyTarget(i,i.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof cn)){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;s<t.length&&t[s].parent===e;s++)e=t[s];return e}createPointerEvent(t,e,s){const i=this.allocateEvent(Ts);return this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=s??this.hitTest(i.global.x,i.global.y)??this._hitElements[0],typeof e=="string"&&(i.type=e),i}createWheelEvent(t){const e=this.allocateEvent(cn);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const s=this.allocateEvent(Ts);return s.nativeEvent=t.nativeEvent,s.originalEvent=t.originalEvent,this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.target=t.target,s.path=t.composedPath().slice(),s.type=e??s.type,s}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ts&&e instanceof Ts&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Pa&&e instanceof Pa&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const s=t.currentTarget._events[e];if(s&&t.currentTarget.isInteractive())if("fn"in s)s.once&&t.currentTarget.removeListener(e,s.fn,void 0,!0),s.fn.call(s.context,t);else for(let i=0,n=s.length;i<n&&!t.propagationImmediatelyStopped;i++)s[i].once&&t.currentTarget.removeListener(e,s[i].fn,void 0,!0),s[i].fn.call(s[i].context,t)}}const Yw=1,Ww={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},tc=class _d{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Hw(null),Ui.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ts(null),this.rootWheelEvent=new cn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({..._d.defaultEventFeatures},{set:(e,s,i)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=i),e[s]=i,!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){const{view:e,resolution:s}=this.renderer;this.setTargetElement(e),this.resolution=s,_d._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s);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,i=e.length;s<i;s++){const n=e[s],a=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ui.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,i=e.length;s<i;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let n=0,a=i.length;n<a;n++){const h=this.bootstrapEvent(this.rootPointerEvent,i[n]);h.type+=s,this.rootBoundary.mapEvent(h)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let s=0,i=e.length;s<i;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,Ui.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ui.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;Ui.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,s){const i=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-i.left)*(this.domElement.width/i.width)*n,t.y=(s-i.top)*(this.domElement.height/i.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,i=t.changedTouches.length;s<i;s++){const n=t.changedTouches[s];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const s=t;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=Yw),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Ww[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};tc.extension={name:"events",type:[H.RendererSystem,H.CanvasRendererSystem]},tc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let ec=tc;K.add(ec);function hm(r){return r==="dynamic"||r==="static"}const zw={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??hm(ec.defaultEventMode)},set interactive(r){ot("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??ec.defaultEventMode},set eventMode(r){this._internalInteractive=hm(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,i=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;r=s?`${r}capture`:r;const h=typeof t=="function"?t:t.handleEvent,o=this;i&&i.addEventListener("abort",()=>{o.off(r,h,a)}),n?o.once(r,h,a):o.on(r,h,a)},removeEventListener(r,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,i=typeof t=="function"?void 0:t;r=s?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,i)},dispatchEvent(r){if(!(r instanceof lo))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Vt.mixin(zw);const jw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Vt.mixin(jw);const qw=9,Ra=100,Zw=0,Kw=0,cm=2,um=1,Qw=-1e3,Jw=-1e3,tE=2;class dm{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,(fi.tablet||fi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.position="absolute",e.style.top=`${Zw}px`,e.style.left=`${Kw}px`,e.style.zIndex=cm.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=`${um}px`,t.style.height=`${um}px`,t.style.position="absolute",t.style.top=`${Qw}px`,t.style.left=`${Jw}px`,t.style.zIndex=tE.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<e.length;s++)this.updateAccessibleObjects(e[s])}update(){const t=performance.now();if(fi.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:s,width:i,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:h,resolution:o}=this.renderer,l=i/a*o,u=n/h*o;let c=this.div;c.style.left=`${e}px`,c.style.top=`${s}px`,c.style.width=`${a}px`,c.style.height=`${h}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,nn(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{c=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(c.style.left=`${(m.tx+p.x*m.a)*l}px`,c.style.top=`${(m.ty+p.y*m.d)*u}px`,c.style.width=`${p.width*m.a*l}px`,c.style.height=`${p.height*m.d*u}px`):(p=f.getBounds(),this.capHitArea(p),c.style.left=`${p.x*l}px`,c.style.top=`${p.y*u}px`,c.style.width=`${p.width*l}px`,c.style.height=`${p.height*u}px`,c.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(c.title=f.accessibleTitle),c.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&c.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==c.title||f.tabIndex!==c.tabIndex)&&(c.title=f.accessibleTitle,c.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(c))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=cm.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,i=this.renderer.events.rootBoundary,n=Object.assign(new lo(i),{target:s});i.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>i.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===qw&&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}}dm.extension={name:"accessibility",type:[H.RendererPlugin,H.CanvasRendererPlugin]},K.add(dm);const fm=class yd{constructor(t){this.stage=new It,t=Object.assign({forceCanvas:!1},t),this.renderer=uw(t),yd._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=yd._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};fm._plugins=[];let eE=fm;K.handleByList(H.Application,eE._plugins);class pm{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:i,clientHeight:n}=this._resizeTo;e=i,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}}pm.extension=H.Application,K.add(pm);const mm={loader:H.LoadParser,resolver:H.ResolveParser,cache:H.CacheParser,detection:H.DetectionParser};K.handle(H.Asset,r=>{const t=r.ref;Object.entries(mm).filter(([e])=>!!t[e]).forEach(([e,s])=>K.add(Object.assign(t[e],{extension:t[e].extension??s})))},r=>{const t=r.ref;Object.keys(mm).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});class sE{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<e;s++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function un(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Le(r,t){const e=r.split("?")[0],s=bt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const As=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(s=>typeof s=="string"||e?t(s):s):r),sc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function gm(r,t,e,s,i){const n=t[e];for(let a=0;a<n.length;a++){const h=n[a];e<t.length-1?gm(r.replace(s[e],h),t,e+1,s,i):i.push(r.replace(s[e],h))}}function iE(r){const t=/\{(.*?)\}/g,e=r.match(t),s=[];if(e){const i=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");i.push(a)}),gm(r,i,0,e,s)}else s.push(r);return s}const Ma=r=>!Array.isArray(r);class rE{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=As(t);let i;for(let h=0;h<this.parsers.length;h++){const o=this.parsers[h];if(o.test(e)){i=o.getCacheableAssets(s,e);break}}i||(i={},s.forEach(h=>{i[h]=e}));const n=Object.keys(i),a={cacheKeys:n,keys:s};if(s.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{this._cache.has(h)&&this._cache.get(h)!==e&&console.warn("[Cache] already has key:",h),this._cache.set(h,i[h])}),e instanceof q){const h=e;s.forEach(o=>{h.baseTexture!==q.EMPTY.baseTexture&&et.addToCache(h.baseTexture,o),q.addToCache(h,o)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);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 Ar=new rE;class nE{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 a,h;let i=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];if(l.load&&((a=l.test)!=null&&a.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}i=await n.load(t,e,this),s.parser=n;for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];l.parse&&l.parse&&await((h=l.testParse)==null?void 0:h.call(l,i,e,this))&&(i=await l.parse(i,e,this)||i,s.parser=l)}return i})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const i={},n=Ma(t),a=As(t,l=>({alias:[l],src:l})),h=a.length,o=a.map(async l=>{const u=bt.toAbsolute(l.src);if(!i[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),i[l.src]=await this.promiseCache[u].promise,e&&e(++s/h)}catch(c){throw delete this.promiseCache[u],delete i[l.src],new Error(`[Loader.load] Failed to load ${u}.
867
+ ${c}`)}});return await Promise.all(o),n?i[a[0].src]:i}async unload(t){const e=As(t,s=>({alias:[s],src:s})).map(async s=>{var a,h;const i=bt.toAbsolute(s.src),n=this.promiseCache[i];if(n){const o=await n.promise;delete this.promiseCache[i],(h=(a=n.parser)==null?void 0:a.unload)==null||h.call(a,o,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var Ne=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(Ne||{});const oE=".json",aE="application/json",lE={extension:{type:H.LoadParser,priority:Ne.Low},name:"loadJson",test(r){return un(r,aE)||Le(r,oE)},async load(r){return await(await z.ADAPTER.fetch(r)).json()}};K.add(lE);const hE=".txt",cE="text/plain",uE={name:"loadTxt",extension:{type:H.LoadParser,priority:Ne.Low},test(r){return un(r,cE)||Le(r,hE)},async load(r){return await(await z.ADAPTER.fetch(r)).text()}};K.add(uE);const dE=["normal","bold","100","200","300","400","500","600","700","800","900"],fE=[".ttf",".otf",".woff",".woff2"],pE=["font/ttf","font/otf","font/woff","font/woff2"],mE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function gE(r){const t=bt.extname(r),e=bt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(mE)){s=!1;break}let i=e.join(" ");return s||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}const _E=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function yE(r){return _E.test(r)?r:encodeURI(r)}const xE={extension:{type:H.LoadParser,priority:Ne.Low},name:"loadWebFont",test(r){return un(r,pE)||Le(r,fE)},async load(r,t){var s,i,n;const e=z.ADAPTER.getFontFaceSet();if(e){const a=[],h=((s=t.data)==null?void 0:s.family)??gE(r),o=((n=(i=t.data)==null?void 0:i.weights)==null?void 0:n.filter(u=>dE.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<o.length;u++){const c=o[u],d=new FontFace(h,`url(${yE(r)})`,{...l,weight:c});await d.load(),e.add(d),a.push(d)}return a.length===1?a[0]:a}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};K.add(xE);const vE=`(function() {
868
868
  "use strict";
869
869
  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
870
870
  async function checkImageBitmap() {
@@ -881,7 +881,7 @@ ${c}`)}});return await Promise.all(o),n?i[a[0].src]:i}async unload(t){const e=As
881
881
  self.postMessage(result);
882
882
  });
883
883
  })();
884
- `;let dn=null,oc=class{constructor(){dn||(dn=URL.createObjectURL(new Blob([yE],{type:"application/javascript"}))),this.worker=new Worker(dn)}};oc.revokeObjectURL=function(){dn&&(URL.revokeObjectURL(dn),dn=null)};const xE=`(function() {
884
+ `;let dn=null,ic=class{constructor(){dn||(dn=URL.createObjectURL(new Blob([vE],{type:"application/javascript"}))),this.worker=new Worker(dn)}};ic.revokeObjectURL=function(){dn&&(URL.revokeObjectURL(dn),dn=null)};const bE=`(function() {
885
885
  "use strict";
886
886
  async function loadImageBitmap(url) {
887
887
  const response = await fetch(url);
@@ -907,8 +907,8 @@ ${c}`)}});return await Promise.all(o),n?i[a[0].src]:i}async unload(t){const e=As
907
907
  }
908
908
  };
909
909
  })();
910
- `;let fn=null;class wm{constructor(){fn||(fn=URL.createObjectURL(new Blob([xE],{type:"application/javascript"}))),this.worker=new Worker(fn)}}wm.revokeObjectURL=function(){fn&&(URL.revokeObjectURL(fn),fn=null)};let Em=0,ac;class vE{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 oc;e.addEventListener("message",s=>{e.terminate(),oc.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){ac===void 0&&(ac=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<ac&&(this._createdWorkers++,t=new wm().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise((i,n)=>{this.queue.push({id:t,arguments:e,resolve:i,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[Em]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Em++,id:s})}}const Tm=new vE;function ho(r,t,e){r.resource.internal=!0;const s=new q(r),i=()=>{delete t.promiseCache[e],Ar.has(e)&&Ar.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),i())}),s.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),i())}),s}const bE=[".jpeg",".jpg",".png",".webp",".avif"],wE=["image/jpeg","image/png","image/webp","image/avif"];async function EE(r){const t=await z.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Fa={name:"loadTextures",extension:{type:H.LoadParser,priority:Ne.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return un(r,wE)||Le(r,bE)},async load(r,t,e){var h;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let i;s?this.config.preferWorkers&&await Tm.isImageBitmapSupported()?i=await Tm.loadImageBitmap(r):i=await EE(r):i=await new Promise((o,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=r,u.complete?o(u):(u.onload=()=>o(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=_i(r)),s&&((h=n.resourceOptions)==null?void 0:h.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const a=new et(i,n);return a.resource.src=r,ho(a,e,r)},unload(r){r.destroy(!0)}};K.add(Fa);const TE=".svg",AE="image/svg+xml",SE={extension:{type:H.LoadParser,priority:Ne.High},name:"loadSVG",test(r){return un(r,AE)||Le(r,TE)},async testParse(r){return Jh.test(r)},async parse(r,t,e){var n;const s=new Jh(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await s.load();const i=new et(s,{resolution:_i(r),...t==null?void 0:t.data});return i.resource.src=t.src,ho(i,e,t.src)},async load(r,t){return(await z.ADAPTER.fetch(r)).text()},unload:Fa.unload};K.add(SE);const CE=[".mp4",".m4v",".webm",".ogv"],IE=["video/mp4","video/webm","video/ogg"],PE={name:"loadVideo",extension:{type:H.LoadParser,priority:Ne.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return un(r,IE)||Le(r,CE)},async load(r,t,e){var a;let s;const i=await(await z.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(i);try{const h={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(a=t==null?void 0:t.data)==null?void 0:a.resourceOptions,autoLoad:!0},o=new hm(n,h);await o.load();const l=new et(o,{alphaMode:await Lb(),resolution:_i(r),...t==null?void 0:t.data});l.resource.src=r,s=ho(l,e,r),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(h){throw URL.revokeObjectURL(n),h}return s},unload(r){r.destroy(!0)}};K.add(PE);class RE{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,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:i,srcs:n}=t;return As(e||s||i||n,a=>typeof a=="string"?a:Array.isArray(a)?a.map(h=>(h==null?void 0:h.src)??(h==null?void 0:h.srcs)??h):a!=null&&a.src||a!=null&&a.srcs?a.src??a.srcs:a,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(i=>{const n=i.src??i.srcs,a=i.alias??i.name;let h;if(typeof a=="string"){const o=this._createBundleAssetId(t,a);s.push(o),h=[a,o]}else{const o=a.map(l=>this._createBundleAssetId(t,l));s.push(...o),h=[...a,...o]}this.add({...i,alias:h,src:n})}):Object.keys(e).forEach(i=>{const n=[i,this._createBundleAssetId(t,i)];if(typeof e[i]=="string")this.add({alias:n,src:e[i]});else if(Array.isArray(e[i]))this.add({alias:n,src:e[i]});else{const a=e[i],h=a.src??a.srcs;this.add({...a,alias:n,src:Array.isArray(h)?h:[h]})}s.push(...n)}),this._bundles[t]=s}add(t,e,s,i,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(ot("7.2.0",`Assets.add now uses an object instead of individual parameters.
911
- Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:s,format:i,loadParser:n})):Array.isArray(t)?a.push(...t):a.push(t);let h;h=o=>{this.hasKey(o)&&console.warn(`[Resolver] already has key: ${o} overwriting`)},As(a).forEach(o=>{const{src:l,srcs:u}=o;let{data:c,format:d,loadParser:f}=o;const p=As(l||u).map(_=>typeof _=="string"?eE(_):Array.isArray(_)?_:[_]),m=this.getAlias(o);Array.isArray(m)?m.forEach(h):h(m);const g=[];p.forEach(_=>{_.forEach(x=>{let y={};if(typeof x!="object"){y.src=x;for(let v=0;v<this._parsers.length;v++){const b=this._parsers[v];if(b.test(x)){y=b.parse(x);break}}}else c=x.data??c,d=x.format??d,f=x.loadParser??f,y={...y,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:m,data:c,format:d,loadParser:f}),g.push(y)})}),m.forEach(_=>{this._assetMap[_]=g})})}resolveBundle(t){const e=Ma(t);t=As(t);const s={};return t.forEach(i=>{const n=this._bundles[i];if(n){const a=this.resolve(n),h={};for(const o in a){const l=a[o];h[this._extractAssetIdFromBundle(i,o)]=l}s[i]=h}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=Ma(t);t=As(t);const s={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i];const a=n[0],h=this._getPreferredOrder(n);h==null||h.priority.forEach(o=>{h.params[o].forEach(l=>{const u=n.filter(c=>c[o]?c[o]===l:!1);u.length&&(n=u)})}),this._resolverHash[i]=n[0]??a}else this._resolverHash[i]=this.buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],i=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:s,data:i,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=bt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??bt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class ME{constructor(){this._detections=[],this._initialized=!1,this.resolver=new RE,this.loader=new iE,this.cache=Ar,this._backgroundLoader=new tE(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,a;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,s=typeof e=="number"?[e]:e,i=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:i,resolution:s}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,i,n){this.resolver.add(t,e,s,i,n)}async load(t,e){this._initialized||await this.init();const s=Ma(t),i=As(t).map(h=>{if(typeof h!="string"){const o=this.resolver.getAlias(h);return o.some(l=>!this.resolver.hasKey(l))&&this.add(h),Array.isArray(o)?o[0]:o}return this.resolver.hasKey(h)||this.add({alias:h,src:h}),h}),n=this.resolver.resolve(i),a=await this._mapLoadToResolve(n,e);return s?a[i[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 i=this.resolver.resolveBundle(t),n={},a=Object.keys(i);let h=0,o=0;const l=()=>{e==null||e(++h/o)},u=a.map(c=>{const d=i[c];return o+=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 Ar.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ar.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),i=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(s,e);this._backgroundLoader.active=!0;const a={};return s.forEach((h,o)=>{const l=n[h.src],u=[h.src];h.alias&&u.push(...h.alias),a[i[o]]=l,Ar.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=As(t).map(i=>typeof i!="string"?i.src:i),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=As(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(i=>this._unloadFromResolved(e[i]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Ar.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,i)=>e.indexOf(s)===i),e}get detections(){return this._detections}get preferWorkers(){return Fa.config.preferWorkers}set preferWorkers(t){ot("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Gi=new ME;K.handleByList(H.LoadParser,Gi.loader.parsers).handleByList(H.ResolveParser,Gi.resolver.parsers).handleByList(H.CacheParser,Gi.cache.parsers).handleByList(H.DetectionParser,Gi.detections);const FE={extension:H.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof q),getCacheableAssets:(r,t)=>{const e={};return r.forEach(s=>{t.forEach((i,n)=>{e[s+(n===0?"":n+1)]=i})}),e}};K.add(FE);async function Am(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const kE={extension:{type:H.DetectionParser,priority:1},test:async()=>Am("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};K.add(kE);const BE={extension:{type:H.DetectionParser,priority:0},test:async()=>Am("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};K.add(BE);const Sm=["png","jpg","jpeg"],DE={extension:{type:H.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Sm],remove:async r=>r.filter(t=>!Sm.includes(t))};K.add(DE);const OE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function lc(r){return OE?!1:document.createElement("video").canPlayType(r)!==""}const LE={extension:{type:H.DetectionParser,priority:0},test:async()=>lc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};K.add(LE);const NE={extension:{type:H.DetectionParser,priority:0},test:async()=>lc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};K.add(NE);const VE={extension:{type:H.DetectionParser,priority:0},test:async()=>lc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};K.add(VE);const UE={extension:H.ResolveParser,test:Fa.test,parse:r=>{var t;return{resolution:parseFloat(((t=z.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:bt.extname(r).slice(1),src:r}}};K.add(UE);var ve=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(ve||{});const ka={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 Ks,pn;function Cm(){pn={bptc:Ks.getExtension("EXT_texture_compression_bptc"),astc:Ks.getExtension("WEBGL_compressed_texture_astc"),etc:Ks.getExtension("WEBGL_compressed_texture_etc"),s3tc:Ks.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ks.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Ks.getExtension("WEBGL_compressed_texture_pvrtc")||Ks.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Ks.getExtension("WEBGL_compressed_texture_etc1"),atc:Ks.getExtension("WEBGL_compressed_texture_atc")}}const GE={extension:{type:H.DetectionParser,priority:2},test:async()=>{const r=z.ADAPTER.createCanvas().getContext("webgl");return r?(Ks=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{pn||Cm();const t=[];for(const e in pn)pn[e]&&t.push(e);return[...t,...r]},remove:async r=>(pn||Cm(),r.filter(t=>!(t in pn)))};K.add(GE);class XE extends aa{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,i;typeof t=="string"?(s=t,i=new Uint8Array):(s=null,i=t),super(i,e),this.origin=s,this.buffer=i?new Ih(i):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 Ih(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Sr extends XE{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=Sr._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Sr._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const i=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;i.pixelStorei(i.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n<a;n++){const{levelID:h,levelWidth:o,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];i.compressedTexImage2D(i.TEXTURE_2D,h,this.format,o,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Sr._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(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,i,n,a,h){const o=new Array(s);let l=t.byteOffset,u=a,c=h,d=u+i-1&~(i-1),f=c+n-1&~(n-1),p=d*f*ka[e];for(let m=0;m<s;m++)o[m]={levelID:m,levelWidth:s>1?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+i-1&~(i-1),f=c+n-1&~(n-1),p=d*f*ka[e];return o}}const hc=4,Ba=124,$E=32,Im=20,HE=542327876,Da={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},YE={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},Oa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},WE=1,zE=2,jE=4,qE=64,ZE=512,KE=131072,QE=827611204,JE=861165636,tT=894720068,eT=808540228,sT=4,iT={[QE]:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,[JE]:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,[tT]:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT},rT={70:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:ve.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:ve.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:ve.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:ve.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function nT(r){const t=new Uint32Array(r);if(t[0]!==HE)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Ba/Uint32Array.BYTES_PER_ELEMENT),s=e[Da.HEIGHT],i=e[Da.WIDTH],n=e[Da.MIPMAP_COUNT],a=new Uint32Array(r,Da.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,$E/Uint32Array.BYTES_PER_ELEMENT),h=a[WE];if(h&jE){const o=a[YE.FOURCC];if(o!==eT){const x=iT[o],y=hc+Ba,v=new Uint8Array(r,y);return[new Sr(v,{format:x,width:i,height:s,levels:n})]}const l=hc+Ba,u=new Uint32Array(t.buffer,l,Im/Uint32Array.BYTES_PER_ELEMENT),c=u[Oa.DXGI_FORMAT],d=u[Oa.RESOURCE_DIMENSION],f=u[Oa.MISC_FLAG],p=u[Oa.ARRAY_SIZE],m=rT[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===sT)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,_=hc+Ba+Im;if(p===1)g.push(new Uint8Array(r,_));else{const x=ka[m];let y=0,v=i,b=s;for(let E=0;E<n;E++){const T=Math.max(1,v+3&-4),A=Math.max(1,b+3&-4),I=T*A*x;y+=I,v=v>>>1,b=b>>>1}let w=_;for(let E=0;E<p;E++)g.push(new Uint8Array(r,w,y)),w+=y}return g.map(x=>new Sr(x,{format:m,width:i,height:s,levels:n}))}throw h&qE?new Error("DDSParser does not support uncompressed texture data."):h&ZE?new Error("DDSParser does not supported YUV uncompressed texture data."):h&KE?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&zE?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 Pm=[171,75,84,88,32,49,49,187,13,10,26,10],oT=67305985,Ss={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},cc=64,Rm={[tt.UNSIGNED_BYTE]:1,[tt.UNSIGNED_SHORT]:2,[tt.INT]:4,[tt.UNSIGNED_INT]:4,[tt.FLOAT]:4,[tt.HALF_FLOAT]:8},aT={[G.RGBA]:4,[G.RGB]:3,[G.RG]:2,[G.RED]:1,[G.LUMINANCE]:1,[G.LUMINANCE_ALPHA]:2,[G.ALPHA]:1},lT={[tt.UNSIGNED_SHORT_4_4_4_4]:2,[tt.UNSIGNED_SHORT_5_5_5_1]:2,[tt.UNSIGNED_SHORT_5_6_5]:2};function hT(r,t,e=!1){const s=new DataView(t);if(!cT(r,s))return null;const i=s.getUint32(Ss.ENDIANNESS,!0)===oT,n=s.getUint32(Ss.GL_TYPE,i),a=s.getUint32(Ss.GL_FORMAT,i),h=s.getUint32(Ss.GL_INTERNAL_FORMAT,i),o=s.getUint32(Ss.PIXEL_WIDTH,i),l=s.getUint32(Ss.PIXEL_HEIGHT,i)||1,u=s.getUint32(Ss.PIXEL_DEPTH,i)||1,c=s.getUint32(Ss.NUMBER_OF_ARRAY_ELEMENTS,i)||1,d=s.getUint32(Ss.NUMBER_OF_FACES,i),f=s.getUint32(Ss.NUMBER_OF_MIPMAP_LEVELS,i),p=s.getUint32(Ss.BYTES_OF_KEY_VALUE_DATA,i);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,_=o+3&-4,x=l+3&-4,y=new Array(c);let v=o*l;n===0&&(v=_*x);let b;if(n!==0?Rm[n]?b=Rm[n]*aT[a]:b=lT[n]:b=ka[h],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?dT(s,p,i):null;let E=v*b,T=o,A=l,I=_,M=x,R=cc+p;for(let C=0;C<f;C++){const P=s.getUint32(R,i);let k=R+4;for(let U=0;U<c;U++){let V=y[U];V||(V=y[U]=new Array(f)),V[C]={levelID:C,levelWidth:f>1||n!==0?T:I,levelHeight:f>1||n!==0?A:M,levelBuffer:new Uint8Array(t,k,E)},k+=E}R+=P+4,R=R%4!==0?R+4-R%4:R,T=T>>1||1,A=A>>1||1,I=T+m-1&~(m-1),M=A+g-1&~(g-1),E=I*M*b}return n!==0?{uncompressed:y.map(C=>{let P=C[0].levelBuffer,k=!1;return n===tt.FLOAT?P=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===tt.UNSIGNED_INT?(k=!0,P=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===tt.INT&&(k=!0,P=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new aa(P,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:k?uT(a):a}}),kvData:w}:{compressed:y.map(C=>new Sr(null,{format:h,width:o,height:l,levels:f,levelBuffers:C})),kvData:w}}function cT(r,t){for(let e=0;e<Pm.length;e++)if(t.getUint8(e)!==Pm[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function uT(r){switch(r){case G.RGBA:return G.RGBA_INTEGER;case G.RGB:return G.RGB_INTEGER;case G.RG:return G.RG_INTEGER;case G.RED:return G.RED_INTEGER;default:return r}}function dT(r,t,e){const s=new Map;let i=0;for(;i<t;){const n=r.getUint32(cc+i,e),a=cc+i+4,h=3-(n+3)%4;if(n===0||n>t-i){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let o=0;for(;o<n&&r.getUint8(a+o)!==0;o++);if(o===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(r.buffer,a,o)),u=new DataView(r.buffer,a+o+1,n-o-1);s.set(l,u),i+=4+n+h}return s}const fT={extension:{type:H.LoadParser,priority:Ne.High},name:"loadDDS",test(r){return Le(r,".dds")},async load(r,t,e){const s=await(await z.ADAPTER.fetch(r)).arrayBuffer(),i=nT(s).map(n=>{const a=new et(n,{mipmap:vs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_i(r),...t.data});return ho(a,e,r)});return i.length===1?i[0]:i},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};K.add(fT);const pT={extension:{type:H.LoadParser,priority:Ne.High},name:"loadKTX",test(r){return Le(r,".ktx")},async load(r,t,e){const s=await(await z.ADAPTER.fetch(r)).arrayBuffer(),{compressed:i,uncompressed:n,kvData:a}=hT(r,s),h=i??n,o={mipmap:vs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_i(r),...t.data},l=h.map(u=>{h===n&&Object.assign(o,{type:u.type,format:u.format});const c=u.resource??u,d=new et(c,o);return d.ktxKeyValueData=a,ho(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};K.add(pT);const mT=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],gT={extension:H.ResolveParser,test:r=>{const t=bt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var s,i;const t=r.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(mT.includes(n))return{resolution:parseFloat(((s=z.RETINA_PREFIX.exec(r))==null?void 0:s[1])??"1"),format:n,src:r}}return{resolution:parseFloat(((i=z.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:e,src:r}}};K.add(gT);const La=new it,_T=4,Mm=class Lo{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,s,i){const n=new Image;return n.src=await this.base64(t,e,s,i),n}async base64(t,e,s,i){const n=this.canvas(t,i);if(n.toBlob!==void 0)return new Promise((a,h)=>{n.toBlob(o=>{if(!o){h(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)},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((h,o)=>{const l=new FileReader;l.onload=()=>h(l.result),l.onerror=o,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:i,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);a&&Lo._flipY(s,i,n),h&&Lo._unpremultiplyAlpha(s);const o=new Qb(i,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),i,n);return o.context.putImageData(l,0,0),o.canvas}pixels(t,e){const{pixels:s,width:i,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);return a&&Lo._flipY(s,i,n),h&&Lo._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let i,n=!1,a=!1,h,o=!1;t&&(t instanceof wr?h=t:(h=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),o=!0,e&&(La.width=e.width,La.height=e.height,e=La)));const l=s.gl;if(h){if(i=h.baseTexture.resolution,e=e??h.frame,n=!1,a=h.baseTexture.alphaMode>0&&h.baseTexture.format===G.RGBA,!o){s.renderTexture.bind(h);const f=h.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else i=s.resolution,e||(e=La,e.width=s.width/i,e.height=s.height/i),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*i),1),c=Math.max(Math.round(e.height*i),1),d=new Uint8Array(_T*u*c);return l.readPixels(Math.round(e.x*i),Math.round(e.y*i),u,c,l.RGBA,l.UNSIGNED_BYTE,d),o&&(h==null||h.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const i=e<<2,n=s>>1,a=new Uint8Array(i);for(let h=0;h<n;h++){const o=h*i,l=(s-h-1)*i;a.set(t.subarray(o,o+i)),t.copyWithin(o,l,l+i),t.set(a,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let s=0;s<e;s+=4){const i=t[s+3];if(i!==0){const n=255.001/i;t[s]=t[s]*n+.5,t[s+1]=t[s+1]*n+.5,t[s+2]=t[s+2]*n+.5}}}};Mm.extension={name:"extract",type:H.RendererSystem};let yT=Mm;K.add(yT);const Na={build(r){const t=r.points;let e,s,i,n,a,h;if(r.type===xe.CIRC){const p=r.shape;e=p.x,s=p.y,a=h=p.radius,i=n=0}else if(r.type===xe.ELIP){const p=r.shape;e=p.x,s=p.y,a=p.width,h=p.height,i=n=0}else{const p=r.shape,m=p.width/2,g=p.height/2;e=p.x+m,s=p.y+g,a=h=Math.max(0,Math.min(p.radius,Math.min(m,g))),i=m-a,n=g-h}if(!(a>=0&&h>=0&&i>=0&&n>=0)){t.length=0;return}const o=Math.ceil(2.3*Math.sqrt(a+h)),l=o*8+(i?4:0)+(n?4:0);if(t.length=l,l===0)return;if(o===0){t.length=8,t[0]=t[6]=e+i,t[1]=t[3]=s+n,t[2]=t[4]=e-i,t[5]=t[7]=s-n;return}let u=0,c=o*4+(i?2:0)+2,d=c,f=l;{const p=i+a,m=n,g=e+p,_=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=_,n){const y=s-m;t[d++]=_,t[d++]=y,t[--f]=y,t[--f]=g}}for(let p=1;p<o;p++){const m=Math.PI/2*(p/o),g=i+Math.cos(m)*a,_=n+Math.sin(m)*h,x=e+g,y=e-g,v=s+_,b=s-_;t[u++]=x,t[u++]=v,t[--c]=v,t[--c]=y,t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=x}{const p=i,m=n+h,g=e+p,_=e-p,x=s+m,y=s-m;t[u++]=g,t[u++]=x,t[--f]=y,t[--f]=g,i&&(t[u++]=_,t[u++]=x,t[--f]=y,t[--f]=_)}},triangulate(r,t){const e=r.points,s=t.points,i=t.indices;if(e.length===0)return;let n=s.length/2;const a=n;let h,o;if(r.type!==xe.RREC){const u=r.shape;h=u.x,o=u.y}else{const u=r.shape;h=u.x+u.width/2,o=u.y+u.height/2}const l=r.matrix;s.push(r.matrix?l.a*h+l.c*o+l.tx:h,r.matrix?l.b*h+l.d*o+l.ty:o),n++,s.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)s.push(e[u],e[u+1]),i.push(n++,a,n);i.push(a+1,a,n)}};function Fm(r,t=!1){const e=r.length;if(e<6)return;let s=0;for(let i=0,n=r[e-2],a=r[e-1];i<e;i+=2){const h=r[i],o=r[i+1];s+=(h-n)*(o+a),n=h,a=o}if(!t&&s>0||t&&s<=0){const i=e/2;for(let n=i+i%2;n<e;n+=2){const a=e-n-2,h=e-n-1,o=n,l=n+1;[r[a],r[o]]=[r[o],r[a]],[r[h],r[l]]=[r[l],r[h]]}}}const km={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const s=r.holes,i=t.points,n=t.indices;if(e.length>=6){Fm(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];Fm(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const h=Fy(e,a,2);if(!h)return;const o=i.length/2;for(let l=0;l<h.length;l+=3)n.push(h[l]+o),n.push(h[l+1]+o),n.push(h[l+2]+o);for(let l=0;l<e.length;l++)i.push(e[l])}}},xT={build(r){const t=r.shape,e=t.x,s=t.y,i=t.width,n=t.height,a=r.points;a.length=0,i>=0&&n>=0&&a.push(e,s,e+i,s,e+i,s+n,e,s+n)},triangulate(r,t){const e=r.points,s=t.points;if(e.length===0)return;const i=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(i,i+1,i+2,i+1,i+2,i+3)}},vT={build(r){Na.build(r)},triangulate(r,t){Na.triangulate(r,t)}};var ls=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(ls||{}),Xi=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Xi||{});const mn={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class Bm{static curveTo(t,e,s,i,n,a){const h=a[a.length-2],o=a[a.length-1]-e,l=h-t,u=i-e,c=s-t,d=Math.abs(o*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=o*o+l*l,p=u*u+c*c,m=o*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(p)/d,x=g*m/f,y=_*m/p,v=g*c+_*l,b=g*u+_*o,w=l*(_+x),E=o*(_+x),T=c*(g+y),A=u*(g+y),I=Math.atan2(E-b,w-v),M=Math.atan2(A-b,T-v);return{cx:v+t,cy:b+e,radius:n,startAngle:I,endAngle:M,anticlockwise:l*u>c*o}}static arc(t,e,s,i,n,a,h,o,l){const u=h-a,c=mn._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/ha)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,_=g%1/g;for(let x=0;x<=g;++x){const y=x+_*x,v=d+a+f*y,b=Math.cos(v),w=-Math.sin(v);l.push((p*b+m*w)*n+s,(p*-w+m*b)*n+i)}}}class bT{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 uc{static curveLength(t,e,s,i,n,a,h,o){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,y=0,v=t,b=e;for(let w=1;w<=10;++w)u=w/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*h,_=m*e+3*p*u*i+3*f*c*a+d*o,x=v-g,y=b-_,v=g,b=_,l+=Math.sqrt(x*x+y*y);return l}static curveTo(t,e,s,i,n,a,h){const o=h[h.length-2],l=h[h.length-1];h.length-=2;const u=mn._segmentsCount(uc.curveLength(o,l,t,e,s,i,n,a));let c=0,d=0,f=0,p=0,m=0;h.push(o,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,p=_*_,m=p*_,h.push(f*o+3*d*_*t+3*c*p*s+m*n,f*l+3*d*_*e+3*c*p*i+m*a)}}function Dm(r,t,e,s,i,n,a,h){const o=r-e*i,l=t-s*i,u=r+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=o+d,m=l+f,g=u+d,_=c+f;return h.push(p,m,g,_),2}function Cr(r,t,e,s,i,n,a,h){const o=e-r,l=s-t;let u=Math.atan2(o,l),c=Math.atan2(i-r,n-t);h&&u<c?u+=Math.PI*2:!h&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(o*o+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,h){a.push(r,t,e,s);for(let x=1,y=d;x<g;x++,y+=_)a.push(r,t,r+Math.sin(y)*m,t+Math.cos(y)*m);a.push(r,t,i,n)}else{a.push(e,s,r,t);for(let x=1,y=d;x<g;x++,y+=_)a.push(r+Math.sin(y)*m,t+Math.cos(y)*m,r,t);a.push(i,n,r,t)}return g*2}function wT(r,t){const e=r.shape;let s=r.points||e.points.slice();const i=t.closePointEps;if(s.length===0)return;const n=r.lineStyle,a=new st(s[0],s[1]),h=new st(s[s.length-2],s[s.length-1]),o=e.type!==xe.POLY||e.closeStroke,l=Math.abs(a.x-h.x)<i&&Math.abs(a.y-h.y)<i;if(o){s=s.slice(),l&&(s.pop(),s.pop(),h.set(s[s.length-2],s[s.length-1]));const V=(a.x+h.x)*.5,L=(h.y+a.y)*.5;s.unshift(V,L),s.push(V,L)}const u=t.points,c=s.length/2;let d=s.length;const f=u.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let _=s[0],x=s[1],y=s[2],v=s[3],b=0,w=0,E=-(x-v),T=_-y,A=0,I=0,M=Math.sqrt(E*E+T*T);E/=M,T/=M,E*=p,T*=p;const R=n.alignment,C=(1-R)*2,P=R*2;o||(n.cap===Xi.ROUND?d+=Cr(_-E*(C-P)*.5,x-T*(C-P)*.5,_-E*C,x-T*C,_+E*P,x+T*P,u,!0)+2:n.cap===Xi.SQUARE&&(d+=Dm(_,x,E,T,C,P,!0,u))),u.push(_-E*C,x-T*C,_+E*P,x+T*P);for(let V=1;V<c-1;++V){_=s[(V-1)*2],x=s[(V-1)*2+1],y=s[V*2],v=s[V*2+1],b=s[(V+1)*2],w=s[(V+1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,A=-(v-w),I=y-b,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=p,I*=p;const L=y-_,$=x-v,O=y-b,N=w-v,Z=L*O+$*N,Q=$*O-N*L,Y=Q<0;if(Math.abs(Q)<.001*Math.abs(Z)){u.push(y-E*C,v-T*C,y+E*P,v+T*P),Z>=0&&(n.join===ls.ROUND?d+=Cr(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4:d+=2,u.push(y-A*P,v-I*P,y+A*C,v+I*C));continue}const lt=(-E+_)*(-T+v)-(-E+y)*(-T+x),Tt=(-A+b)*(-I+v)-(-A+y)*(-I+w),_t=(L*Tt-O*lt)/Q,Bt=(N*lt-$*Tt)/Q,zt=(_t-y)*(_t-y)+(Bt-v)*(Bt-v),Qt=y+(_t-y)*C,Rt=v+(Bt-v)*C,jt=y-(_t-y)*P,Ot=v-(Bt-v)*P,ze=Math.min(L*L+$*$,O*O+N*N),rs=Y?C:P,lr=ze+rs*rs*m,kn=zt<=lr;let hr=n.join;if(hr===ls.MITER&&zt/m>g&&(hr=ls.BEVEL),kn)switch(hr){case ls.MITER:{u.push(Qt,Rt,jt,Ot);break}case ls.BEVEL:{Y?u.push(Qt,Rt,y+E*P,v+T*P,Qt,Rt,y+A*P,v+I*P):u.push(y-E*C,v-T*C,jt,Ot,y-A*C,v-I*C,jt,Ot),d+=2;break}case ls.ROUND:{Y?(u.push(Qt,Rt,y+E*P,v+T*P),d+=Cr(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+4,u.push(Qt,Rt,y+A*P,v+I*P)):(u.push(y-E*C,v-T*C,jt,Ot),d+=Cr(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4,u.push(y-A*C,v-I*C,jt,Ot));break}}else{switch(u.push(y-E*C,v-T*C,y+E*P,v+T*P),hr){case ls.MITER:{Y?u.push(jt,Ot,jt,Ot):u.push(Qt,Rt,Qt,Rt),d+=2;break}case ls.ROUND:{Y?d+=Cr(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+2:d+=Cr(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+2;break}}u.push(y-A*C,v-I*C,y+A*P,v+I*P),d+=2}}_=s[(c-2)*2],x=s[(c-2)*2+1],y=s[(c-1)*2],v=s[(c-1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,u.push(y-E*C,v-T*C,y+E*P,v+T*P),o||(n.cap===Xi.ROUND?d+=Cr(y-E*(C-P)*.5,v-T*(C-P)*.5,y-E*C,v-T*C,y+E*P,v+T*P,u,!1)+2:n.cap===Xi.SQUARE&&(d+=Dm(y,v,E,T,C,P,!1,u)));const k=t.indices,U=mn.epsilon*mn.epsilon;for(let V=f;V<d+f-2;++V)_=u[V*2],x=u[V*2+1],y=u[(V+1)*2],v=u[(V+1)*2+1],b=u[(V+2)*2],w=u[(V+2)*2+1],!(Math.abs(_*(v-w)+y*(w-x)+b*(x-v))<U)&&k.push(V,V+1,V+2)}function ET(r,t){let e=0;const s=r.shape,i=r.points||s.points,n=s.type!==xe.POLY||s.closeStroke;if(i.length===0)return;const a=t.points,h=t.indices,o=i.length/2,l=a.length/2;let u=l;for(a.push(i[0],i[1]),e=1;e<o;e++)a.push(i[e*2],i[e*2+1]),h.push(u,u+1),u++;n&&h.push(u,l)}function Om(r,t){r.lineStyle.native?ET(r,t):wT(r,t)}class dc{static curveLength(t,e,s,i,n,a){const h=t-2*s+n,o=e-2*i+a,l=2*s-2*t,u=2*i-2*e,c=4*(h*h+o*o),d=4*(h*l+o*u),f=l*l+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),g=2*c*m,_=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-_)+(4*f*c-d*d)*Math.log((2*m+x+p)/(x+_)))/(4*g)}static curveTo(t,e,s,i,n){const a=n[n.length-2],h=n[n.length-1],o=mn._segmentsCount(dc.curveLength(a,h,t,e,s,i));let l=0,u=0;for(let c=1;c<=o;++c){const d=c/o;l=a+(t-a)*d,u=h+(e-h)*d,n.push(l+(t+(s-t)*d-l)*d,u+(e+(i-e)*d-u)*d)}}}const fc={[xe.POLY]:km,[xe.CIRC]:Na,[xe.ELIP]:Na,[xe.RECT]:xT,[xe.RREC]:vT},Lm=[],Va=[];class Ua{constructor(t,e=null,s=null,i=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=i,this.type=t.type}clone(){return new Ua(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const gn=new st,Nm=class ry extends gp{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Ia,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Va.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Lm.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,i=null){const n=new Ua(t,e,s,i);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Ua(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=i.lineStyle,i.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let s=0;s<e.length;++s){const i=e[s];if(i.fillStyle.visible&&i.shape&&(i.matrix?i.matrix.applyInverse(t,gn):gn.copyFrom(t),i.shape.contains(gn.x,gn.y))){let n=!1;if(i.holes){for(let a=0;a<i.holes.length;a++)if(i.holes[a].shape.contains(gn.x,gn.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let s=null,i=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],i=s.style);for(let o=this.shapeIndex;o<e.length;o++){this.shapeIndex++;const l=e[o],u=l.fillStyle,c=l.lineStyle;fc[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?u:c;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=Fi.REPEAT,d===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-g;_!==0&&(s&&!this._compareStyles(i,f)&&(s.end(m,g),s=null),s||(s=Lm.pop()||new bT,s.begin(f,m,g),this.batches.push(s),i=f),this.addUvs(this.points,t,f.texture,g,_,f.matrix))}}const n=this.indices.length,a=this.points.length/2;if(s&&s.end(n,a),this.batches.length===0){this.batchable=!0;return}const h=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&h===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=h?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const s=this.graphicsData[t],i=s.fillStyle,n=s.lineStyle;if(i&&!i.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,s=t.length;e<s;e++){const i=t[e];for(let n=0;n<i.size;n++){const a=i.start+n;this.indicesUint16[a]=this.indicesUint16[a]-i.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<ry.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++et._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Va.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let i=Va.pop();i||(i=new Lh,i.texArray=new $h),i.texArray.count=0,i.start=0,i.size=0,i.type=xs.TRIANGLES;let n=0,a=null,h=0,o=!1,l=xs.TRIANGLES,u=0;this.drawCalls.push(i);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],f=8,p=d.style,m=p.texture.baseTexture;o!==!!p.native&&(o=!!p.native,l=o?xs.LINES:xs.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,i.size>0&&(i=Va.pop(),i||(i=new Lh,i.texArray=new $h),this.drawCalls.push(i)),i.start=u,i.size=0,i.texArray.count=0,i.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Fi.REPEAT,i.texArray.elements[i.texArray.count++]=m,n++)),i.size+=d.size,u+=d.size,h=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,h,d.attribSize,d.attribStart)}et._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,i=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),h=new Uint32Array(n);let o=0;for(let l=0;l<t.length/2;l++)a[o++]=t[l*2],a[o++]=t[l*2+1],a[o++]=e[l*2],a[o++]=e[l*2+1],h[o++]=s[l],a[o++]=i[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?km.triangulate(t,this):fc[t.type].triangulate(t,this)}processLine(t){Om(t,this);for(let e=0;e<t.holes.length;e++)Om(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];fc[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let s=0;s<t.length/2;s++){const i=t[s*2],n=t[s*2+1];t[s*2]=e.a*i+e.c*n+e.tx,t[s*2+1]=e.b*i+e.d*n+e.ty}}addColors(t,e,s,i,n=0){const a=Ct.shared.setValue(e).toLittleEndianNumber(),h=Ct.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+i);for(let o=0;o<i;o++)t[n+o]=h}addTextureIds(t,e,s,i=0){t.length=Math.max(t.length,i+s);for(let n=0;n<s;n++)t[i+n]=e}addUvs(t,e,s,i,n,a=null){let h=0;const o=e.length,l=s.frame;for(;h<n;){let c=t[(i+h)*2],d=t[(i+h)*2+1];if(a){const f=a.a*c+a.c*d+a.tx;d=a.b*c+a.d*d+a.ty,c=f}h++,e.push(c/l.width,d/l.height)}const u=s.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,s,o,n)}adjustUvs(t,e,s,i){const n=e.baseTexture,a=1e-6,h=s+i*2,o=e.frame,l=o.width/n.width,u=o.height/n.height;let c=o.x/o.width,d=o.y/o.height,f=Math.floor(t[s]+a),p=Math.floor(t[s+1]+a);for(let m=s+2;m<h;m+=2)f=Math.min(f,Math.floor(t[m]+a)),p=Math.min(p,Math.floor(t[m+1]+a));c-=f,d-=p;for(let m=s;m<h;m+=2)t[m]=(t[m]+c)*l,t[m+1]=(t[m+1]+d)*u}};Nm.BATCHABLE_SIZE=100;let TT=Nm;class Ga{constructor(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ga;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class pc extends Ga{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Xi.BUTT,this.join=ls.MITER,this.miterLimit=10}clone(){const t=new pc;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=Xi.BUTT,this.join=ls.MITER,this.miterLimit=10}}const mc={},gc=class Il extends It{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Ga,this._lineStyle=new pc,this._matrix=null,this._holeMode=!1,this.state=js.for2d(),this._geometry=t||new TT,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ct(16777215),this.blendMode=W.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Il(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,s,i=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:s,alignment:i,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:q.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Xi.BUTT,join:ls.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.width>0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Ni,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ni,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,i=s[s.length-2],n=s[s.length-1];return(i!==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,i){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),dc.curveTo(t,e,s,i,n),this}bezierCurveTo(t,e,s,i,n,a){return this._initCurve(),uc.curveTo(t,e,s,i,n,a,this.currentPath.points),this}arcTo(t,e,s,i,n){this._initCurve(t,e);const a=this.currentPath.points,h=Bm.curveTo(t,e,s,i,n,a);if(h){const{cx:o,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=h;this.arc(o,l,u,c,d,f)}return this}arc(t,e,s,i,n,a=!1){if(i===n)return this;if(!a&&n<=i?n+=ha:a&&i<=n&&(i+=ha),n-i===0)return this;const h=t+Math.cos(i)*s,o=e+Math.sin(i)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-h),d=Math.abs(u[u.length-1]-o);c<l&&d<l||u.push(h,o)}else this.moveTo(h,o),u=this.currentPath.points;return Bm.arc(h,o,t,e,s,i,n,a,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:q.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ct.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:q.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,i){return this.drawShape(new it(t,e,s,i))}drawRoundedRect(t,e,s,i,n){return this.drawShape(new fa(t,e,s,i,n))}drawCircle(t,e,s){return this.drawShape(new ua(t,e,s))}drawEllipse(t,e,s,i){return this.drawShape(new da(t,e,s,i))}drawPolygon(...t){let e,s=!0;const i=t[0];i.points?(s=i.closeStroke,e=i.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Ni(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===xe.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let i=0;i<s;i++){const n=t.batches[i],a=n.style.color,h=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),o=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:h,blendMode:e,indices:l,uvs:o,_batchRGB:Ct.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[i]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,s=this.batches.length;e<s;e++){const i=this.batches[e];i.worldAlpha=this.worldAlpha*i.alpha,t.plugins[this.pluginName].render(i)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,i=this.worldAlpha,n=e.uniforms,a=s.drawCalls;n.translationMatrix=this.transform.worldTransform,Ct.shared.setValue(this._tintColor).premultiply(i).toArray(n.tint),t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,s.drawCalls[h])}_renderDrawCallDirect(t,e){const{texArray:s,type:i,size:n,start:a}=e,h=s.count;for(let o=0;o<h;o++)t.texture.bind(s.elements[o],o);t.geometry.draw(i,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!mc[s]){const{maxTextures:i}=t.plugins[s],n=new Int32Array(i);for(let o=0;o<i;o++)n[o]=o;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new Mt,default:Es.from({uSamplers:n},!0)},h=t.plugins[s]._shader.program;mc[s]=new Zs(h,a)}e=mc[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:i,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,s,i,n)}containsPoint(t){return this.worldTransform.applyInverse(t,Il._TEMP_POINT),this._geometry.containsPoint(Il._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=Ct.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,s=e.a,i=e.b,n=e.c,a=e.d,h=e.tx,o=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const f=l[d],p=l[d+1];u[c++]=s*f+n*p+h,u[c++]=a*p+i*f+o}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};gc.curves=mn,gc._TEMP_POINT=new st;let hs=gc;class AT{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const _c=new st,Vm=new Ni,Um=class ny extends It{constructor(t,e,s,i=xs.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||js.for2d(),this.drawMode=i,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=z.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===xs.TRIANGLES&&e.length<ny.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=s._tintRGB,this._texture=s.texture;const i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,s=t._updateID;if(s===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const i=this.transform.worldTransform,n=i.a,a=i.b,h=i.c,o=i.d,l=i.tx,u=i.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const f=e[d*2],p=e[d*2+1];c[d*2]=n*f+h*p+l,c[d*2+1]=a*f+o*p+u}if(this._roundPixels){const d=z.RESOLUTION;for(let f=0;f<c.length;++f)c[f]=Math.round(c[f]*d)/d}this.vertexDirty=s}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new AT(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,_c);const e=this.geometry.getBuffer("aVertexPosition").data,s=Vm.points,i=this.geometry.getIndex().data,n=i.length,a=this.drawMode===4?3:1;for(let h=0;h+2<n;h+=a){const o=i[h]*2,l=i[h+1]*2,u=i[h+2]*2;if(s[0]=e[o],s[1]=e[o+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[u],s[5]=e[u+1],Vm.contains(_c.x,_c.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Um.BATCHABLE_SIZE=100;let Xa=Um;class yc extends Li{constructor(t,e,s){super();const i=new Jt(t),n=new Jt(e,!0),a=new Jt(s,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,tt.FLOAT).addAttribute("aTextureCoord",n,2,!1,tt.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var ST=`varying vec2 vTextureCoord;
910
+ `;let fn=null;class _m{constructor(){fn||(fn=URL.createObjectURL(new Blob([bE],{type:"application/javascript"}))),this.worker=new Worker(fn)}}_m.revokeObjectURL=function(){fn&&(URL.revokeObjectURL(fn),fn=null)};let ym=0,rc;class wE{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 ic;e.addEventListener("message",s=>{e.terminate(),ic.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){rc===void 0&&(rc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<rc&&(this._createdWorkers++,t=new _m().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise((i,n)=>{this.queue.push({id:t,arguments:e,resolve:i,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[ym]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:ym++,id:s})}}const xm=new wE;function ho(r,t,e){r.resource.internal=!0;const s=new q(r),i=()=>{delete t.promiseCache[e],Ar.has(e)&&Ar.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),i())}),s.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),i())}),s}const EE=[".jpeg",".jpg",".png",".webp",".avif"],TE=["image/jpeg","image/png","image/webp","image/avif"];async function AE(r){const t=await z.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Fa={name:"loadTextures",extension:{type:H.LoadParser,priority:Ne.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return un(r,TE)||Le(r,EE)},async load(r,t,e){var h;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let i;s?this.config.preferWorkers&&await xm.isImageBitmapSupported()?i=await xm.loadImageBitmap(r):i=await AE(r):i=await new Promise((o,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=r,u.complete?o(u):(u.onload=()=>o(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=_i(r)),s&&((h=n.resourceOptions)==null?void 0:h.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const a=new et(i,n);return a.resource.src=r,ho(a,e,r)},unload(r){r.destroy(!0)}};K.add(Fa);const SE=".svg",CE="image/svg+xml",IE={extension:{type:H.LoadParser,priority:Ne.High},name:"loadSVG",test(r){return un(r,CE)||Le(r,SE)},async testParse(r){return Zh.test(r)},async parse(r,t,e){var n;const s=new Zh(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await s.load();const i=new et(s,{resolution:_i(r),...t==null?void 0:t.data});return i.resource.src=t.src,ho(i,e,t.src)},async load(r,t){return(await z.ADAPTER.fetch(r)).text()},unload:Fa.unload};K.add(IE);const PE=[".mp4",".m4v",".webm",".ogv"],RE=["video/mp4","video/webm","video/ogg"],ME={name:"loadVideo",extension:{type:H.LoadParser,priority:Ne.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return un(r,RE)||Le(r,PE)},async load(r,t,e){var a;let s;const i=await(await z.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(i);try{const h={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(a=t==null?void 0:t.data)==null?void 0:a.resourceOptions,autoLoad:!0},o=new rm(n,h);await o.load();const l=new et(o,{alphaMode:await Vb(),resolution:_i(r),...t==null?void 0:t.data});l.resource.src=r,s=ho(l,e,r),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(h){throw URL.revokeObjectURL(n),h}return s},unload(r){r.destroy(!0)}};K.add(ME);class FE{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,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:i,srcs:n}=t;return As(e||s||i||n,a=>typeof a=="string"?a:Array.isArray(a)?a.map(h=>(h==null?void 0:h.src)??(h==null?void 0:h.srcs)??h):a!=null&&a.src||a!=null&&a.srcs?a.src??a.srcs:a,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(i=>{const n=i.src??i.srcs,a=i.alias??i.name;let h;if(typeof a=="string"){const o=this._createBundleAssetId(t,a);s.push(o),h=[a,o]}else{const o=a.map(l=>this._createBundleAssetId(t,l));s.push(...o),h=[...a,...o]}this.add({...i,alias:h,src:n})}):Object.keys(e).forEach(i=>{const n=[i,this._createBundleAssetId(t,i)];if(typeof e[i]=="string")this.add({alias:n,src:e[i]});else if(Array.isArray(e[i]))this.add({alias:n,src:e[i]});else{const a=e[i],h=a.src??a.srcs;this.add({...a,alias:n,src:Array.isArray(h)?h:[h]})}s.push(...n)}),this._bundles[t]=s}add(t,e,s,i,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(ot("7.2.0",`Assets.add now uses an object instead of individual parameters.
911
+ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:s,format:i,loadParser:n})):Array.isArray(t)?a.push(...t):a.push(t);let h;h=o=>{this.hasKey(o)&&console.warn(`[Resolver] already has key: ${o} overwriting`)},As(a).forEach(o=>{const{src:l,srcs:u}=o;let{data:c,format:d,loadParser:f}=o;const p=As(l||u).map(_=>typeof _=="string"?iE(_):Array.isArray(_)?_:[_]),m=this.getAlias(o);Array.isArray(m)?m.forEach(h):h(m);const g=[];p.forEach(_=>{_.forEach(x=>{let y={};if(typeof x!="object"){y.src=x;for(let v=0;v<this._parsers.length;v++){const b=this._parsers[v];if(b.test(x)){y=b.parse(x);break}}}else c=x.data??c,d=x.format??d,f=x.loadParser??f,y={...y,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:m,data:c,format:d,loadParser:f}),g.push(y)})}),m.forEach(_=>{this._assetMap[_]=g})})}resolveBundle(t){const e=Ma(t);t=As(t);const s={};return t.forEach(i=>{const n=this._bundles[i];if(n){const a=this.resolve(n),h={};for(const o in a){const l=a[o];h[this._extractAssetIdFromBundle(i,o)]=l}s[i]=h}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=Ma(t);t=As(t);const s={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i];const a=n[0],h=this._getPreferredOrder(n);h==null||h.priority.forEach(o=>{h.params[o].forEach(l=>{const u=n.filter(c=>c[o]?c[o]===l:!1);u.length&&(n=u)})}),this._resolverHash[i]=n[0]??a}else this._resolverHash[i]=this.buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],i=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:s,data:i,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=bt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??bt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class kE{constructor(){this._detections=[],this._initialized=!1,this.resolver=new FE,this.loader=new nE,this.cache=Ar,this._backgroundLoader=new sE(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,a;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,s=typeof e=="number"?[e]:e,i=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:i,resolution:s}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,i,n){this.resolver.add(t,e,s,i,n)}async load(t,e){this._initialized||await this.init();const s=Ma(t),i=As(t).map(h=>{if(typeof h!="string"){const o=this.resolver.getAlias(h);return o.some(l=>!this.resolver.hasKey(l))&&this.add(h),Array.isArray(o)?o[0]:o}return this.resolver.hasKey(h)||this.add({alias:h,src:h}),h}),n=this.resolver.resolve(i),a=await this._mapLoadToResolve(n,e);return s?a[i[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 i=this.resolver.resolveBundle(t),n={},a=Object.keys(i);let h=0,o=0;const l=()=>{e==null||e(++h/o)},u=a.map(c=>{const d=i[c];return o+=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 Ar.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ar.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),i=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(s,e);this._backgroundLoader.active=!0;const a={};return s.forEach((h,o)=>{const l=n[h.src],u=[h.src];h.alias&&u.push(...h.alias),a[i[o]]=l,Ar.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=As(t).map(i=>typeof i!="string"?i.src:i),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=As(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(i=>this._unloadFromResolved(e[i]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Ar.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,i)=>e.indexOf(s)===i),e}get detections(){return this._detections}get preferWorkers(){return Fa.config.preferWorkers}set preferWorkers(t){ot("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Gi=new kE;K.handleByList(H.LoadParser,Gi.loader.parsers).handleByList(H.ResolveParser,Gi.resolver.parsers).handleByList(H.CacheParser,Gi.cache.parsers).handleByList(H.DetectionParser,Gi.detections);const BE={extension:H.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof q),getCacheableAssets:(r,t)=>{const e={};return r.forEach(s=>{t.forEach((i,n)=>{e[s+(n===0?"":n+1)]=i})}),e}};K.add(BE);async function vm(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const DE={extension:{type:H.DetectionParser,priority:1},test:async()=>vm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};K.add(DE);const OE={extension:{type:H.DetectionParser,priority:0},test:async()=>vm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};K.add(OE);const bm=["png","jpg","jpeg"],LE={extension:{type:H.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...bm],remove:async r=>r.filter(t=>!bm.includes(t))};K.add(LE);const NE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function nc(r){return NE?!1:document.createElement("video").canPlayType(r)!==""}const VE={extension:{type:H.DetectionParser,priority:0},test:async()=>nc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};K.add(VE);const UE={extension:{type:H.DetectionParser,priority:0},test:async()=>nc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};K.add(UE);const GE={extension:{type:H.DetectionParser,priority:0},test:async()=>nc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};K.add(GE);const XE={extension:H.ResolveParser,test:Fa.test,parse:r=>{var t;return{resolution:parseFloat(((t=z.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:bt.extname(r).slice(1),src:r}}};K.add(XE);var ve=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(ve||{});const ka={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 Ks,pn;function wm(){pn={bptc:Ks.getExtension("EXT_texture_compression_bptc"),astc:Ks.getExtension("WEBGL_compressed_texture_astc"),etc:Ks.getExtension("WEBGL_compressed_texture_etc"),s3tc:Ks.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ks.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Ks.getExtension("WEBGL_compressed_texture_pvrtc")||Ks.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Ks.getExtension("WEBGL_compressed_texture_etc1"),atc:Ks.getExtension("WEBGL_compressed_texture_atc")}}const $E={extension:{type:H.DetectionParser,priority:2},test:async()=>{const r=z.ADAPTER.createCanvas().getContext("webgl");return r?(Ks=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{pn||wm();const t=[];for(const e in pn)pn[e]&&t.push(e);return[...t,...r]},remove:async r=>(pn||wm(),r.filter(t=>!(t in pn)))};K.add($E);class HE extends aa{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,i;typeof t=="string"?(s=t,i=new Uint8Array):(s=null,i=t),super(i,e),this.origin=s,this.buffer=i?new Ah(i):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 Ah(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Sr extends HE{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=Sr._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Sr._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const i=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;i.pixelStorei(i.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n<a;n++){const{levelID:h,levelWidth:o,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];i.compressedTexImage2D(i.TEXTURE_2D,h,this.format,o,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Sr._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(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,i,n,a,h){const o=new Array(s);let l=t.byteOffset,u=a,c=h,d=u+i-1&~(i-1),f=c+n-1&~(n-1),p=d*f*ka[e];for(let m=0;m<s;m++)o[m]={levelID:m,levelWidth:s>1?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+i-1&~(i-1),f=c+n-1&~(n-1),p=d*f*ka[e];return o}}const oc=4,Ba=124,YE=32,Em=20,WE=542327876,Da={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},zE={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},Oa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},jE=1,qE=2,ZE=4,KE=64,QE=512,JE=131072,tT=827611204,eT=861165636,sT=894720068,iT=808540228,rT=4,nT={[tT]:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,[eT]:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,[sT]:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT},oT={70:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:ve.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:ve.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:ve.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:ve.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function aT(r){const t=new Uint32Array(r);if(t[0]!==WE)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Ba/Uint32Array.BYTES_PER_ELEMENT),s=e[Da.HEIGHT],i=e[Da.WIDTH],n=e[Da.MIPMAP_COUNT],a=new Uint32Array(r,Da.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,YE/Uint32Array.BYTES_PER_ELEMENT),h=a[jE];if(h&ZE){const o=a[zE.FOURCC];if(o!==iT){const x=nT[o],y=oc+Ba,v=new Uint8Array(r,y);return[new Sr(v,{format:x,width:i,height:s,levels:n})]}const l=oc+Ba,u=new Uint32Array(t.buffer,l,Em/Uint32Array.BYTES_PER_ELEMENT),c=u[Oa.DXGI_FORMAT],d=u[Oa.RESOURCE_DIMENSION],f=u[Oa.MISC_FLAG],p=u[Oa.ARRAY_SIZE],m=oT[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===rT)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,_=oc+Ba+Em;if(p===1)g.push(new Uint8Array(r,_));else{const x=ka[m];let y=0,v=i,b=s;for(let E=0;E<n;E++){const T=Math.max(1,v+3&-4),A=Math.max(1,b+3&-4),I=T*A*x;y+=I,v=v>>>1,b=b>>>1}let w=_;for(let E=0;E<p;E++)g.push(new Uint8Array(r,w,y)),w+=y}return g.map(x=>new Sr(x,{format:m,width:i,height:s,levels:n}))}throw h&KE?new Error("DDSParser does not support uncompressed texture data."):h&QE?new Error("DDSParser does not supported YUV uncompressed texture data."):h&JE?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&qE?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 Tm=[171,75,84,88,32,49,49,187,13,10,26,10],lT=67305985,Ss={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},ac=64,Am={[tt.UNSIGNED_BYTE]:1,[tt.UNSIGNED_SHORT]:2,[tt.INT]:4,[tt.UNSIGNED_INT]:4,[tt.FLOAT]:4,[tt.HALF_FLOAT]:8},hT={[G.RGBA]:4,[G.RGB]:3,[G.RG]:2,[G.RED]:1,[G.LUMINANCE]:1,[G.LUMINANCE_ALPHA]:2,[G.ALPHA]:1},cT={[tt.UNSIGNED_SHORT_4_4_4_4]:2,[tt.UNSIGNED_SHORT_5_5_5_1]:2,[tt.UNSIGNED_SHORT_5_6_5]:2};function uT(r,t,e=!1){const s=new DataView(t);if(!dT(r,s))return null;const i=s.getUint32(Ss.ENDIANNESS,!0)===lT,n=s.getUint32(Ss.GL_TYPE,i),a=s.getUint32(Ss.GL_FORMAT,i),h=s.getUint32(Ss.GL_INTERNAL_FORMAT,i),o=s.getUint32(Ss.PIXEL_WIDTH,i),l=s.getUint32(Ss.PIXEL_HEIGHT,i)||1,u=s.getUint32(Ss.PIXEL_DEPTH,i)||1,c=s.getUint32(Ss.NUMBER_OF_ARRAY_ELEMENTS,i)||1,d=s.getUint32(Ss.NUMBER_OF_FACES,i),f=s.getUint32(Ss.NUMBER_OF_MIPMAP_LEVELS,i),p=s.getUint32(Ss.BYTES_OF_KEY_VALUE_DATA,i);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,_=o+3&-4,x=l+3&-4,y=new Array(c);let v=o*l;n===0&&(v=_*x);let b;if(n!==0?Am[n]?b=Am[n]*hT[a]:b=cT[n]:b=ka[h],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?pT(s,p,i):null;let E=v*b,T=o,A=l,I=_,M=x,R=ac+p;for(let C=0;C<f;C++){const P=s.getUint32(R,i);let k=R+4;for(let U=0;U<c;U++){let V=y[U];V||(V=y[U]=new Array(f)),V[C]={levelID:C,levelWidth:f>1||n!==0?T:I,levelHeight:f>1||n!==0?A:M,levelBuffer:new Uint8Array(t,k,E)},k+=E}R+=P+4,R=R%4!==0?R+4-R%4:R,T=T>>1||1,A=A>>1||1,I=T+m-1&~(m-1),M=A+g-1&~(g-1),E=I*M*b}return n!==0?{uncompressed:y.map(C=>{let P=C[0].levelBuffer,k=!1;return n===tt.FLOAT?P=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===tt.UNSIGNED_INT?(k=!0,P=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===tt.INT&&(k=!0,P=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new aa(P,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:k?fT(a):a}}),kvData:w}:{compressed:y.map(C=>new Sr(null,{format:h,width:o,height:l,levels:f,levelBuffers:C})),kvData:w}}function dT(r,t){for(let e=0;e<Tm.length;e++)if(t.getUint8(e)!==Tm[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function fT(r){switch(r){case G.RGBA:return G.RGBA_INTEGER;case G.RGB:return G.RGB_INTEGER;case G.RG:return G.RG_INTEGER;case G.RED:return G.RED_INTEGER;default:return r}}function pT(r,t,e){const s=new Map;let i=0;for(;i<t;){const n=r.getUint32(ac+i,e),a=ac+i+4,h=3-(n+3)%4;if(n===0||n>t-i){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let o=0;for(;o<n&&r.getUint8(a+o)!==0;o++);if(o===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(r.buffer,a,o)),u=new DataView(r.buffer,a+o+1,n-o-1);s.set(l,u),i+=4+n+h}return s}const mT={extension:{type:H.LoadParser,priority:Ne.High},name:"loadDDS",test(r){return Le(r,".dds")},async load(r,t,e){const s=await(await z.ADAPTER.fetch(r)).arrayBuffer(),i=aT(s).map(n=>{const a=new et(n,{mipmap:vs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_i(r),...t.data});return ho(a,e,r)});return i.length===1?i[0]:i},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};K.add(mT);const gT={extension:{type:H.LoadParser,priority:Ne.High},name:"loadKTX",test(r){return Le(r,".ktx")},async load(r,t,e){const s=await(await z.ADAPTER.fetch(r)).arrayBuffer(),{compressed:i,uncompressed:n,kvData:a}=uT(r,s),h=i??n,o={mipmap:vs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_i(r),...t.data},l=h.map(u=>{h===n&&Object.assign(o,{type:u.type,format:u.format});const c=u.resource??u,d=new et(c,o);return d.ktxKeyValueData=a,ho(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};K.add(gT);const _T=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],yT={extension:H.ResolveParser,test:r=>{const t=bt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var s,i;const t=r.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(_T.includes(n))return{resolution:parseFloat(((s=z.RETINA_PREFIX.exec(r))==null?void 0:s[1])??"1"),format:n,src:r}}return{resolution:parseFloat(((i=z.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:e,src:r}}};K.add(yT);const La=new it,xT=4,Sm=class Lo{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,s,i){const n=new Image;return n.src=await this.base64(t,e,s,i),n}async base64(t,e,s,i){const n=this.canvas(t,i);if(n.toBlob!==void 0)return new Promise((a,h)=>{n.toBlob(o=>{if(!o){h(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)},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((h,o)=>{const l=new FileReader;l.onload=()=>h(l.result),l.onerror=o,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:i,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);a&&Lo._flipY(s,i,n),h&&Lo._unpremultiplyAlpha(s);const o=new t1(i,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),i,n);return o.context.putImageData(l,0,0),o.canvas}pixels(t,e){const{pixels:s,width:i,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);return a&&Lo._flipY(s,i,n),h&&Lo._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let i,n=!1,a=!1,h,o=!1;t&&(t instanceof wr?h=t:(h=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),o=!0,e&&(La.width=e.width,La.height=e.height,e=La)));const l=s.gl;if(h){if(i=h.baseTexture.resolution,e=e??h.frame,n=!1,a=h.baseTexture.alphaMode>0&&h.baseTexture.format===G.RGBA,!o){s.renderTexture.bind(h);const f=h.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else i=s.resolution,e||(e=La,e.width=s.width/i,e.height=s.height/i),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*i),1),c=Math.max(Math.round(e.height*i),1),d=new Uint8Array(xT*u*c);return l.readPixels(Math.round(e.x*i),Math.round(e.y*i),u,c,l.RGBA,l.UNSIGNED_BYTE,d),o&&(h==null||h.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const i=e<<2,n=s>>1,a=new Uint8Array(i);for(let h=0;h<n;h++){const o=h*i,l=(s-h-1)*i;a.set(t.subarray(o,o+i)),t.copyWithin(o,l,l+i),t.set(a,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let s=0;s<e;s+=4){const i=t[s+3];if(i!==0){const n=255.001/i;t[s]=t[s]*n+.5,t[s+1]=t[s+1]*n+.5,t[s+2]=t[s+2]*n+.5}}}};Sm.extension={name:"extract",type:H.RendererSystem};let vT=Sm;K.add(vT);const Na={build(r){const t=r.points;let e,s,i,n,a,h;if(r.type===xe.CIRC){const p=r.shape;e=p.x,s=p.y,a=h=p.radius,i=n=0}else if(r.type===xe.ELIP){const p=r.shape;e=p.x,s=p.y,a=p.width,h=p.height,i=n=0}else{const p=r.shape,m=p.width/2,g=p.height/2;e=p.x+m,s=p.y+g,a=h=Math.max(0,Math.min(p.radius,Math.min(m,g))),i=m-a,n=g-h}if(!(a>=0&&h>=0&&i>=0&&n>=0)){t.length=0;return}const o=Math.ceil(2.3*Math.sqrt(a+h)),l=o*8+(i?4:0)+(n?4:0);if(t.length=l,l===0)return;if(o===0){t.length=8,t[0]=t[6]=e+i,t[1]=t[3]=s+n,t[2]=t[4]=e-i,t[5]=t[7]=s-n;return}let u=0,c=o*4+(i?2:0)+2,d=c,f=l;{const p=i+a,m=n,g=e+p,_=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=_,n){const y=s-m;t[d++]=_,t[d++]=y,t[--f]=y,t[--f]=g}}for(let p=1;p<o;p++){const m=Math.PI/2*(p/o),g=i+Math.cos(m)*a,_=n+Math.sin(m)*h,x=e+g,y=e-g,v=s+_,b=s-_;t[u++]=x,t[u++]=v,t[--c]=v,t[--c]=y,t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=x}{const p=i,m=n+h,g=e+p,_=e-p,x=s+m,y=s-m;t[u++]=g,t[u++]=x,t[--f]=y,t[--f]=g,i&&(t[u++]=_,t[u++]=x,t[--f]=y,t[--f]=_)}},triangulate(r,t){const e=r.points,s=t.points,i=t.indices;if(e.length===0)return;let n=s.length/2;const a=n;let h,o;if(r.type!==xe.RREC){const u=r.shape;h=u.x,o=u.y}else{const u=r.shape;h=u.x+u.width/2,o=u.y+u.height/2}const l=r.matrix;s.push(r.matrix?l.a*h+l.c*o+l.tx:h,r.matrix?l.b*h+l.d*o+l.ty:o),n++,s.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)s.push(e[u],e[u+1]),i.push(n++,a,n);i.push(a+1,a,n)}};function Cm(r,t=!1){const e=r.length;if(e<6)return;let s=0;for(let i=0,n=r[e-2],a=r[e-1];i<e;i+=2){const h=r[i],o=r[i+1];s+=(h-n)*(o+a),n=h,a=o}if(!t&&s>0||t&&s<=0){const i=e/2;for(let n=i+i%2;n<e;n+=2){const a=e-n-2,h=e-n-1,o=n,l=n+1;[r[a],r[o]]=[r[o],r[a]],[r[h],r[l]]=[r[l],r[h]]}}}const Im={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const s=r.holes,i=t.points,n=t.indices;if(e.length>=6){Cm(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];Cm(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const h=Cy(e,a,2);if(!h)return;const o=i.length/2;for(let l=0;l<h.length;l+=3)n.push(h[l]+o),n.push(h[l+1]+o),n.push(h[l+2]+o);for(let l=0;l<e.length;l++)i.push(e[l])}}},bT={build(r){const t=r.shape,e=t.x,s=t.y,i=t.width,n=t.height,a=r.points;a.length=0,i>=0&&n>=0&&a.push(e,s,e+i,s,e+i,s+n,e,s+n)},triangulate(r,t){const e=r.points,s=t.points;if(e.length===0)return;const i=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(i,i+1,i+2,i+1,i+2,i+3)}},wT={build(r){Na.build(r)},triangulate(r,t){Na.triangulate(r,t)}};var ls=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(ls||{}),Xi=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Xi||{});const mn={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class Pm{static curveTo(t,e,s,i,n,a){const h=a[a.length-2],o=a[a.length-1]-e,l=h-t,u=i-e,c=s-t,d=Math.abs(o*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=o*o+l*l,p=u*u+c*c,m=o*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(p)/d,x=g*m/f,y=_*m/p,v=g*c+_*l,b=g*u+_*o,w=l*(_+x),E=o*(_+x),T=c*(g+y),A=u*(g+y),I=Math.atan2(E-b,w-v),M=Math.atan2(A-b,T-v);return{cx:v+t,cy:b+e,radius:n,startAngle:I,endAngle:M,anticlockwise:l*u>c*o}}static arc(t,e,s,i,n,a,h,o,l){const u=h-a,c=mn._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/ha)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,_=g%1/g;for(let x=0;x<=g;++x){const y=x+_*x,v=d+a+f*y,b=Math.cos(v),w=-Math.sin(v);l.push((p*b+m*w)*n+s,(p*-w+m*b)*n+i)}}}class ET{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 lc{static curveLength(t,e,s,i,n,a,h,o){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,y=0,v=t,b=e;for(let w=1;w<=10;++w)u=w/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*h,_=m*e+3*p*u*i+3*f*c*a+d*o,x=v-g,y=b-_,v=g,b=_,l+=Math.sqrt(x*x+y*y);return l}static curveTo(t,e,s,i,n,a,h){const o=h[h.length-2],l=h[h.length-1];h.length-=2;const u=mn._segmentsCount(lc.curveLength(o,l,t,e,s,i,n,a));let c=0,d=0,f=0,p=0,m=0;h.push(o,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,p=_*_,m=p*_,h.push(f*o+3*d*_*t+3*c*p*s+m*n,f*l+3*d*_*e+3*c*p*i+m*a)}}function Rm(r,t,e,s,i,n,a,h){const o=r-e*i,l=t-s*i,u=r+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=o+d,m=l+f,g=u+d,_=c+f;return h.push(p,m,g,_),2}function Cr(r,t,e,s,i,n,a,h){const o=e-r,l=s-t;let u=Math.atan2(o,l),c=Math.atan2(i-r,n-t);h&&u<c?u+=Math.PI*2:!h&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(o*o+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,h){a.push(r,t,e,s);for(let x=1,y=d;x<g;x++,y+=_)a.push(r,t,r+Math.sin(y)*m,t+Math.cos(y)*m);a.push(r,t,i,n)}else{a.push(e,s,r,t);for(let x=1,y=d;x<g;x++,y+=_)a.push(r+Math.sin(y)*m,t+Math.cos(y)*m,r,t);a.push(i,n,r,t)}return g*2}function TT(r,t){const e=r.shape;let s=r.points||e.points.slice();const i=t.closePointEps;if(s.length===0)return;const n=r.lineStyle,a=new st(s[0],s[1]),h=new st(s[s.length-2],s[s.length-1]),o=e.type!==xe.POLY||e.closeStroke,l=Math.abs(a.x-h.x)<i&&Math.abs(a.y-h.y)<i;if(o){s=s.slice(),l&&(s.pop(),s.pop(),h.set(s[s.length-2],s[s.length-1]));const V=(a.x+h.x)*.5,L=(h.y+a.y)*.5;s.unshift(V,L),s.push(V,L)}const u=t.points,c=s.length/2;let d=s.length;const f=u.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let _=s[0],x=s[1],y=s[2],v=s[3],b=0,w=0,E=-(x-v),T=_-y,A=0,I=0,M=Math.sqrt(E*E+T*T);E/=M,T/=M,E*=p,T*=p;const R=n.alignment,C=(1-R)*2,P=R*2;o||(n.cap===Xi.ROUND?d+=Cr(_-E*(C-P)*.5,x-T*(C-P)*.5,_-E*C,x-T*C,_+E*P,x+T*P,u,!0)+2:n.cap===Xi.SQUARE&&(d+=Rm(_,x,E,T,C,P,!0,u))),u.push(_-E*C,x-T*C,_+E*P,x+T*P);for(let V=1;V<c-1;++V){_=s[(V-1)*2],x=s[(V-1)*2+1],y=s[V*2],v=s[V*2+1],b=s[(V+1)*2],w=s[(V+1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,A=-(v-w),I=y-b,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=p,I*=p;const L=y-_,$=x-v,O=y-b,N=w-v,Z=L*O+$*N,Q=$*O-N*L,Y=Q<0;if(Math.abs(Q)<.001*Math.abs(Z)){u.push(y-E*C,v-T*C,y+E*P,v+T*P),Z>=0&&(n.join===ls.ROUND?d+=Cr(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4:d+=2,u.push(y-A*P,v-I*P,y+A*C,v+I*C));continue}const lt=(-E+_)*(-T+v)-(-E+y)*(-T+x),Tt=(-A+b)*(-I+v)-(-A+y)*(-I+w),_t=(L*Tt-O*lt)/Q,Bt=(N*lt-$*Tt)/Q,zt=(_t-y)*(_t-y)+(Bt-v)*(Bt-v),Qt=y+(_t-y)*C,Rt=v+(Bt-v)*C,jt=y-(_t-y)*P,Ot=v-(Bt-v)*P,ze=Math.min(L*L+$*$,O*O+N*N),rs=Y?C:P,lr=ze+rs*rs*m,kn=zt<=lr;let hr=n.join;if(hr===ls.MITER&&zt/m>g&&(hr=ls.BEVEL),kn)switch(hr){case ls.MITER:{u.push(Qt,Rt,jt,Ot);break}case ls.BEVEL:{Y?u.push(Qt,Rt,y+E*P,v+T*P,Qt,Rt,y+A*P,v+I*P):u.push(y-E*C,v-T*C,jt,Ot,y-A*C,v-I*C,jt,Ot),d+=2;break}case ls.ROUND:{Y?(u.push(Qt,Rt,y+E*P,v+T*P),d+=Cr(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+4,u.push(Qt,Rt,y+A*P,v+I*P)):(u.push(y-E*C,v-T*C,jt,Ot),d+=Cr(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4,u.push(y-A*C,v-I*C,jt,Ot));break}}else{switch(u.push(y-E*C,v-T*C,y+E*P,v+T*P),hr){case ls.MITER:{Y?u.push(jt,Ot,jt,Ot):u.push(Qt,Rt,Qt,Rt),d+=2;break}case ls.ROUND:{Y?d+=Cr(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+2:d+=Cr(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+2;break}}u.push(y-A*C,v-I*C,y+A*P,v+I*P),d+=2}}_=s[(c-2)*2],x=s[(c-2)*2+1],y=s[(c-1)*2],v=s[(c-1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,u.push(y-E*C,v-T*C,y+E*P,v+T*P),o||(n.cap===Xi.ROUND?d+=Cr(y-E*(C-P)*.5,v-T*(C-P)*.5,y-E*C,v-T*C,y+E*P,v+T*P,u,!1)+2:n.cap===Xi.SQUARE&&(d+=Rm(y,v,E,T,C,P,!1,u)));const k=t.indices,U=mn.epsilon*mn.epsilon;for(let V=f;V<d+f-2;++V)_=u[V*2],x=u[V*2+1],y=u[(V+1)*2],v=u[(V+1)*2+1],b=u[(V+2)*2],w=u[(V+2)*2+1],!(Math.abs(_*(v-w)+y*(w-x)+b*(x-v))<U)&&k.push(V,V+1,V+2)}function AT(r,t){let e=0;const s=r.shape,i=r.points||s.points,n=s.type!==xe.POLY||s.closeStroke;if(i.length===0)return;const a=t.points,h=t.indices,o=i.length/2,l=a.length/2;let u=l;for(a.push(i[0],i[1]),e=1;e<o;e++)a.push(i[e*2],i[e*2+1]),h.push(u,u+1),u++;n&&h.push(u,l)}function Mm(r,t){r.lineStyle.native?AT(r,t):TT(r,t)}class hc{static curveLength(t,e,s,i,n,a){const h=t-2*s+n,o=e-2*i+a,l=2*s-2*t,u=2*i-2*e,c=4*(h*h+o*o),d=4*(h*l+o*u),f=l*l+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),g=2*c*m,_=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-_)+(4*f*c-d*d)*Math.log((2*m+x+p)/(x+_)))/(4*g)}static curveTo(t,e,s,i,n){const a=n[n.length-2],h=n[n.length-1],o=mn._segmentsCount(hc.curveLength(a,h,t,e,s,i));let l=0,u=0;for(let c=1;c<=o;++c){const d=c/o;l=a+(t-a)*d,u=h+(e-h)*d,n.push(l+(t+(s-t)*d-l)*d,u+(e+(i-e)*d-u)*d)}}}const cc={[xe.POLY]:Im,[xe.CIRC]:Na,[xe.ELIP]:Na,[xe.RECT]:bT,[xe.RREC]:wT},Fm=[],Va=[];class Ua{constructor(t,e=null,s=null,i=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=i,this.type=t.type}clone(){return new Ua(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const gn=new st,km=class J0 extends up{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Ia,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Va.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Fm.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,i=null){const n=new Ua(t,e,s,i);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Ua(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=i.lineStyle,i.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let s=0;s<e.length;++s){const i=e[s];if(i.fillStyle.visible&&i.shape&&(i.matrix?i.matrix.applyInverse(t,gn):gn.copyFrom(t),i.shape.contains(gn.x,gn.y))){let n=!1;if(i.holes){for(let a=0;a<i.holes.length;a++)if(i.holes[a].shape.contains(gn.x,gn.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let s=null,i=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],i=s.style);for(let o=this.shapeIndex;o<e.length;o++){this.shapeIndex++;const l=e[o],u=l.fillStyle,c=l.lineStyle;cc[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?u:c;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=Fi.REPEAT,d===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-g;_!==0&&(s&&!this._compareStyles(i,f)&&(s.end(m,g),s=null),s||(s=Fm.pop()||new ET,s.begin(f,m,g),this.batches.push(s),i=f),this.addUvs(this.points,t,f.texture,g,_,f.matrix))}}const n=this.indices.length,a=this.points.length/2;if(s&&s.end(n,a),this.batches.length===0){this.batchable=!0;return}const h=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&h===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=h?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const s=this.graphicsData[t],i=s.fillStyle,n=s.lineStyle;if(i&&!i.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,s=t.length;e<s;e++){const i=t[e];for(let n=0;n<i.size;n++){const a=i.start+n;this.indicesUint16[a]=this.indicesUint16[a]-i.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<J0.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++et._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Va.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let i=Va.pop();i||(i=new Bh,i.texArray=new Uh),i.texArray.count=0,i.start=0,i.size=0,i.type=xs.TRIANGLES;let n=0,a=null,h=0,o=!1,l=xs.TRIANGLES,u=0;this.drawCalls.push(i);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],f=8,p=d.style,m=p.texture.baseTexture;o!==!!p.native&&(o=!!p.native,l=o?xs.LINES:xs.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,i.size>0&&(i=Va.pop(),i||(i=new Bh,i.texArray=new Uh),this.drawCalls.push(i)),i.start=u,i.size=0,i.texArray.count=0,i.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Fi.REPEAT,i.texArray.elements[i.texArray.count++]=m,n++)),i.size+=d.size,u+=d.size,h=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,h,d.attribSize,d.attribStart)}et._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,i=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),h=new Uint32Array(n);let o=0;for(let l=0;l<t.length/2;l++)a[o++]=t[l*2],a[o++]=t[l*2+1],a[o++]=e[l*2],a[o++]=e[l*2+1],h[o++]=s[l],a[o++]=i[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?Im.triangulate(t,this):cc[t.type].triangulate(t,this)}processLine(t){Mm(t,this);for(let e=0;e<t.holes.length;e++)Mm(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];cc[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let s=0;s<t.length/2;s++){const i=t[s*2],n=t[s*2+1];t[s*2]=e.a*i+e.c*n+e.tx,t[s*2+1]=e.b*i+e.d*n+e.ty}}addColors(t,e,s,i,n=0){const a=Ct.shared.setValue(e).toLittleEndianNumber(),h=Ct.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+i);for(let o=0;o<i;o++)t[n+o]=h}addTextureIds(t,e,s,i=0){t.length=Math.max(t.length,i+s);for(let n=0;n<s;n++)t[i+n]=e}addUvs(t,e,s,i,n,a=null){let h=0;const o=e.length,l=s.frame;for(;h<n;){let c=t[(i+h)*2],d=t[(i+h)*2+1];if(a){const f=a.a*c+a.c*d+a.tx;d=a.b*c+a.d*d+a.ty,c=f}h++,e.push(c/l.width,d/l.height)}const u=s.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,s,o,n)}adjustUvs(t,e,s,i){const n=e.baseTexture,a=1e-6,h=s+i*2,o=e.frame,l=o.width/n.width,u=o.height/n.height;let c=o.x/o.width,d=o.y/o.height,f=Math.floor(t[s]+a),p=Math.floor(t[s+1]+a);for(let m=s+2;m<h;m+=2)f=Math.min(f,Math.floor(t[m]+a)),p=Math.min(p,Math.floor(t[m+1]+a));c-=f,d-=p;for(let m=s;m<h;m+=2)t[m]=(t[m]+c)*l,t[m+1]=(t[m+1]+d)*u}};km.BATCHABLE_SIZE=100;let ST=km;class Ga{constructor(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ga;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class uc extends Ga{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Xi.BUTT,this.join=ls.MITER,this.miterLimit=10}clone(){const t=new uc;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=Xi.BUTT,this.join=ls.MITER,this.miterLimit=10}}const dc={},fc=class Il extends It{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Ga,this._lineStyle=new uc,this._matrix=null,this._holeMode=!1,this.state=js.for2d(),this._geometry=t||new ST,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ct(16777215),this.blendMode=W.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Il(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,s,i=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:s,alignment:i,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:q.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Xi.BUTT,join:ls.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.width>0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Ni,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ni,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,i=s[s.length-2],n=s[s.length-1];return(i!==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,i){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),hc.curveTo(t,e,s,i,n),this}bezierCurveTo(t,e,s,i,n,a){return this._initCurve(),lc.curveTo(t,e,s,i,n,a,this.currentPath.points),this}arcTo(t,e,s,i,n){this._initCurve(t,e);const a=this.currentPath.points,h=Pm.curveTo(t,e,s,i,n,a);if(h){const{cx:o,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=h;this.arc(o,l,u,c,d,f)}return this}arc(t,e,s,i,n,a=!1){if(i===n)return this;if(!a&&n<=i?n+=ha:a&&i<=n&&(i+=ha),n-i===0)return this;const h=t+Math.cos(i)*s,o=e+Math.sin(i)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-h),d=Math.abs(u[u.length-1]-o);c<l&&d<l||u.push(h,o)}else this.moveTo(h,o),u=this.currentPath.points;return Pm.arc(h,o,t,e,s,i,n,a,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:q.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ct.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:q.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,i){return this.drawShape(new it(t,e,s,i))}drawRoundedRect(t,e,s,i,n){return this.drawShape(new fa(t,e,s,i,n))}drawCircle(t,e,s){return this.drawShape(new ua(t,e,s))}drawEllipse(t,e,s,i){return this.drawShape(new da(t,e,s,i))}drawPolygon(...t){let e,s=!0;const i=t[0];i.points?(s=i.closeStroke,e=i.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Ni(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===xe.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let i=0;i<s;i++){const n=t.batches[i],a=n.style.color,h=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),o=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:h,blendMode:e,indices:l,uvs:o,_batchRGB:Ct.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[i]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,s=this.batches.length;e<s;e++){const i=this.batches[e];i.worldAlpha=this.worldAlpha*i.alpha,t.plugins[this.pluginName].render(i)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,i=this.worldAlpha,n=e.uniforms,a=s.drawCalls;n.translationMatrix=this.transform.worldTransform,Ct.shared.setValue(this._tintColor).premultiply(i).toArray(n.tint),t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,s.drawCalls[h])}_renderDrawCallDirect(t,e){const{texArray:s,type:i,size:n,start:a}=e,h=s.count;for(let o=0;o<h;o++)t.texture.bind(s.elements[o],o);t.geometry.draw(i,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!dc[s]){const{maxTextures:i}=t.plugins[s],n=new Int32Array(i);for(let o=0;o<i;o++)n[o]=o;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new Mt,default:Es.from({uSamplers:n},!0)},h=t.plugins[s]._shader.program;dc[s]=new Zs(h,a)}e=dc[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:i,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,s,i,n)}containsPoint(t){return this.worldTransform.applyInverse(t,Il._TEMP_POINT),this._geometry.containsPoint(Il._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=Ct.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,s=e.a,i=e.b,n=e.c,a=e.d,h=e.tx,o=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const f=l[d],p=l[d+1];u[c++]=s*f+n*p+h,u[c++]=a*p+i*f+o}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};fc.curves=mn,fc._TEMP_POINT=new st;let hs=fc;class CT{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const pc=new st,Bm=new Ni,Dm=class ty extends It{constructor(t,e,s,i=xs.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||js.for2d(),this.drawMode=i,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=z.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===xs.TRIANGLES&&e.length<ty.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=s._tintRGB,this._texture=s.texture;const i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,s=t._updateID;if(s===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const i=this.transform.worldTransform,n=i.a,a=i.b,h=i.c,o=i.d,l=i.tx,u=i.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const f=e[d*2],p=e[d*2+1];c[d*2]=n*f+h*p+l,c[d*2+1]=a*f+o*p+u}if(this._roundPixels){const d=z.RESOLUTION;for(let f=0;f<c.length;++f)c[f]=Math.round(c[f]*d)/d}this.vertexDirty=s}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new CT(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,pc);const e=this.geometry.getBuffer("aVertexPosition").data,s=Bm.points,i=this.geometry.getIndex().data,n=i.length,a=this.drawMode===4?3:1;for(let h=0;h+2<n;h+=a){const o=i[h]*2,l=i[h+1]*2,u=i[h+2]*2;if(s[0]=e[o],s[1]=e[o+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[u],s[5]=e[u+1],Bm.contains(pc.x,pc.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Dm.BATCHABLE_SIZE=100;let Xa=Dm;class mc extends Li{constructor(t,e,s){super();const i=new Jt(t),n=new Jt(e,!0),a=new Jt(s,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,tt.FLOAT).addAttribute("aTextureCoord",n,2,!1,tt.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var IT=`varying vec2 vTextureCoord;
912
912
  uniform vec4 uColor;
913
913
 
914
914
  uniform sampler2D uSampler;
@@ -917,7 +917,7 @@ void main(void)
917
917
  {
918
918
  gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
919
919
  }
920
- `,CT=`attribute vec2 aVertexPosition;
920
+ `,PT=`attribute vec2 aVertexPosition;
921
921
  attribute vec2 aTextureCoord;
922
922
 
923
923
  uniform mat3 projectionMatrix;
@@ -932,7 +932,7 @@ void main(void)
932
932
 
933
933
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
934
934
  }
935
- `;class $a extends Zs{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:Mt.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(s,e.uniforms),super(e.program||yi.from(CT,ST),s),this._colorDirty=!1,this.uvMatrix=new Lp(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Ct(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;Ct.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class IT extends yc{constructor(t=100,e=100,s=10,i=10){super(),this.segWidth=s,this.segHeight=i,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],s=[],i=[],n=this.segWidth-1,a=this.segHeight-1,h=this.width/n,o=this.height/a;for(let u=0;u<t;u++){const c=u%this.segWidth,d=u/this.segWidth|0;e.push(c*h,d*o),s.push(c/n,d/a)}const l=n*a;for(let u=0;u<l;u++){const c=u%n,d=u/n|0,f=d*this.segWidth+c,p=d*this.segWidth+c+1,m=(d+1)*this.segWidth+c,g=(d+1)*this.segWidth+c+1;i.push(f,p,m,p,g,m)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint16Array(i),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class PT extends Xa{constructor(t,e,s){const i=new IT(t.width,t.height,e,s),n=new $a(q.WHITE);super(i,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){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 Ha=10;class RT extends PT{constructor(t,e,s,i,n){var a,h,o,l;super(q.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=e??((a=t.defaultBorders)==null?void 0:a.left)??Ha,this._rightWidth=i??((h=t.defaultBorders)==null?void 0:h.right)??Ha,this._topHeight=s??((o=t.defaultBorders)==null?void 0:o.top)??Ha,this._bottomHeight=n??((l=t.defaultBorders)==null?void 0:l.bottom)??Ha,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,i=this._height>s?1:this._height/s;return Math.min(e,i)}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,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class MT extends Xa{constructor(t=q.EMPTY,e,s,i,n){const a=new yc(e,s,i);a.getBuffer("aVertexPosition").static=!1;const h=new $a(t);super(a,h,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 FT extends It{constructor(t=1500,e,s=16384,i=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=W.NORMAL,this.autoResize=i,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new Ct(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.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID}dispose(){if(this._buffers){for(let t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}}destroy(t){super.destroy(t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}class Gm{constructor(t,e,s){this.geometry=new Li,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let i=0;i<t.length;++i){let n=t[i];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||tt.FLOAT,offset:n.offset},e[i]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new Jt(Zb(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let a=0;a<this.dynamicProperties.length;++a){const h=this.dynamicProperties[a];h.offset=e,e+=h.size,this.dynamicStride+=h.size}const s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new Jt(this.dynamicData,!1,!1);let i=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];h.offset=i,i+=h.size,this.staticStride+=h.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Jt(this.staticData,!0,!1);for(let a=0;a<this.dynamicProperties.length;++a){const h=this.dynamicProperties[a];t.addAttribute(h.attributeName,this.dynamicBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.dynamicStride*4,h.offset*4)}for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];t.addAttribute(h.attributeName,this.staticBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.staticStride*4,h.offset*4)}}uploadDynamic(t,e,s){for(let i=0;i<this.dynamicProperties.length;i++){const n=this.dynamicProperties[i];n.uploadFunction(t,e,s,n.type===tt.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,s){for(let i=0;i<this.staticProperties.length;i++){const n=this.staticProperties[i];n.uploadFunction(t,e,s,n.type===tt.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var kT=`varying vec2 vTextureCoord;
935
+ `;class $a extends Zs{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:Mt.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(s,e.uniforms),super(e.program||yi.from(PT,IT),s),this._colorDirty=!1,this.uvMatrix=new Fp(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Ct(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;Ct.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class RT extends mc{constructor(t=100,e=100,s=10,i=10){super(),this.segWidth=s,this.segHeight=i,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],s=[],i=[],n=this.segWidth-1,a=this.segHeight-1,h=this.width/n,o=this.height/a;for(let u=0;u<t;u++){const c=u%this.segWidth,d=u/this.segWidth|0;e.push(c*h,d*o),s.push(c/n,d/a)}const l=n*a;for(let u=0;u<l;u++){const c=u%n,d=u/n|0,f=d*this.segWidth+c,p=d*this.segWidth+c+1,m=(d+1)*this.segWidth+c,g=(d+1)*this.segWidth+c+1;i.push(f,p,m,p,g,m)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint16Array(i),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class MT extends Xa{constructor(t,e,s){const i=new RT(t.width,t.height,e,s),n=new $a(q.WHITE);super(i,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){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 Ha=10;class FT extends MT{constructor(t,e,s,i,n){var a,h,o,l;super(q.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=e??((a=t.defaultBorders)==null?void 0:a.left)??Ha,this._rightWidth=i??((h=t.defaultBorders)==null?void 0:h.right)??Ha,this._topHeight=s??((o=t.defaultBorders)==null?void 0:o.top)??Ha,this._bottomHeight=n??((l=t.defaultBorders)==null?void 0:l.bottom)??Ha,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,i=this._height>s?1:this._height/s;return Math.min(e,i)}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,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class kT extends Xa{constructor(t=q.EMPTY,e,s,i,n){const a=new mc(e,s,i);a.getBuffer("aVertexPosition").static=!1;const h=new $a(t);super(a,h,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 BT extends It{constructor(t=1500,e,s=16384,i=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=W.NORMAL,this.autoResize=i,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new Ct(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.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID}dispose(){if(this._buffers){for(let t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}}destroy(t){super.destroy(t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}class Om{constructor(t,e,s){this.geometry=new Li,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let i=0;i<t.length;++i){let n=t[i];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||tt.FLOAT,offset:n.offset},e[i]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new Jt(Qb(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let a=0;a<this.dynamicProperties.length;++a){const h=this.dynamicProperties[a];h.offset=e,e+=h.size,this.dynamicStride+=h.size}const s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new Jt(this.dynamicData,!1,!1);let i=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];h.offset=i,i+=h.size,this.staticStride+=h.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Jt(this.staticData,!0,!1);for(let a=0;a<this.dynamicProperties.length;++a){const h=this.dynamicProperties[a];t.addAttribute(h.attributeName,this.dynamicBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.dynamicStride*4,h.offset*4)}for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];t.addAttribute(h.attributeName,this.staticBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.staticStride*4,h.offset*4)}}uploadDynamic(t,e,s){for(let i=0;i<this.dynamicProperties.length;i++){const n=this.dynamicProperties[i];n.uploadFunction(t,e,s,n.type===tt.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,s){for(let i=0;i<this.staticProperties.length;i++){const n=this.staticProperties[i];n.uploadFunction(t,e,s,n.type===tt.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var DT=`varying vec2 vTextureCoord;
936
936
  varying vec4 vColor;
937
937
 
938
938
  uniform sampler2D uSampler;
@@ -940,7 +940,7 @@ uniform sampler2D uSampler;
940
940
  void main(void){
941
941
  vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
942
942
  gl_FragColor = color;
943
- }`,BT=`attribute vec2 aVertexPosition;
943
+ }`,OT=`attribute vec2 aVertexPosition;
944
944
  attribute vec2 aTextureCoord;
945
945
  attribute vec4 aColor;
946
946
 
@@ -965,8 +965,8 @@ void main(void){
965
965
  vTextureCoord = aTextureCoord;
966
966
  vColor = aColor * uColor;
967
967
  }
968
- `;class Xm extends xa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Mt,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:tt.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Zs.from(BT,kT,{}),this.state=js.for2d()}render(t){const e=t.children,s=t._maxSize,i=t._batchSize,n=this.renderer;let a=e.length;if(a===0)return;a>s&&!t.autoResize&&(a=s);let h=t._buffers;h||(h=t._buffers=this.generateBuffers(t));const o=e[0]._texture.baseTexture,l=o.alphaMode>0;this.state.blendMode=np(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=Ct.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=o,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;f<a;f+=i,p+=1){let m=a-f;m>i&&(m=i),p>=h.length&&h.push(this._generateOneMoreBuffer(t));const g=h[p];g.uploadDynamic(e,f,m);const _=t._bufferUpdateIDs[p]||0;d=d||g._updateID<_,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,m*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,i=t._batchSize,n=t._properties;for(let a=0;a<s;a+=i)e.push(new Gm(this.properties,n,i));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new Gm(this.properties,s,e)}uploadVertices(t,e,s,i,n,a){let h=0,o=0,l=0,u=0;for(let c=0;c<s;++c){const d=t[e+c],f=d._texture,p=d.scale.x,m=d.scale.y,g=f.trim,_=f.orig;g?(o=g.x-d.anchor.x*_.width,h=o+g.width,u=g.y-d.anchor.y*_.height,l=u+g.height):(h=_.width*(1-d.anchor.x),o=_.width*-d.anchor.x,l=_.height*(1-d.anchor.y),u=_.height*-d.anchor.y),i[a]=o*p,i[a+1]=u*m,i[a+n]=h*p,i[a+n+1]=u*m,i[a+n*2]=h*p,i[a+n*2+1]=l*m,i[a+n*3]=o*p,i[a+n*3+1]=l*m,a+=n*4}}uploadPosition(t,e,s,i,n,a){for(let h=0;h<s;h++){const o=t[e+h].position;i[a]=o.x,i[a+1]=o.y,i[a+n]=o.x,i[a+n+1]=o.y,i[a+n*2]=o.x,i[a+n*2+1]=o.y,i[a+n*3]=o.x,i[a+n*3+1]=o.y,a+=n*4}}uploadRotation(t,e,s,i,n,a){for(let h=0;h<s;h++){const o=t[e+h].rotation;i[a]=o,i[a+n]=o,i[a+n*2]=o,i[a+n*3]=o,a+=n*4}}uploadUvs(t,e,s,i,n,a){for(let h=0;h<s;++h){const o=t[e+h]._texture._uvs;o?(i[a]=o.x0,i[a+1]=o.y0,i[a+n]=o.x1,i[a+n+1]=o.y1,i[a+n*2]=o.x2,i[a+n*2+1]=o.y2,i[a+n*3]=o.x3,i[a+n*3+1]=o.y3,a+=n*4):(i[a]=0,i[a+1]=0,i[a+n]=0,i[a+n+1]=0,i[a+n*2]=0,i[a+n*2+1]=0,i[a+n*3]=0,i[a+n*3+1]=0,a+=n*4)}}uploadTint(t,e,s,i,n,a){for(let h=0;h<s;++h){const o=t[e+h],l=Ct.shared.setValue(o._tintRGB).toPremultiplied(o.alpha,o.texture.baseTexture.alphaMode>0);i[a]=l,i[a+n]=l,i[a+n*2]=l,i[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Xm.extension={name:"particle",type:H.RendererPlugin},K.add(Xm);var Ya=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ya||{});const Wa={willReadFrequently:!0},Qs=class J{static get experimentalLetterSpacingSupported(){let t=J._experimentalLetterSpacingSupported;if(t!==void 0){const e=z.ADAPTER.getCanvasRenderingContext2D().prototype;t=J._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,i,n,a,h,o,l){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=n,this.lineWidths=a,this.lineHeight=h,this.maxLineWidth=o,this.fontProperties=l}static measureText(t,e,s,i=J._canvas){s=s??e.wordWrap;const n=e.toFontString(),a=J.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const h=i.getContext("2d",Wa);h.font=n;const o=(s?J.wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),l=new Array(o.length);let u=0;for(let p=0;p<o.length;p++){const m=J._measureText(o[p],e.letterSpacing,h);l[p]=m,u=Math.max(u,m)}let c=u+e.strokeThickness;e.dropShadow&&(c+=e.dropShadowDistance);const d=e.lineHeight||a.fontSize+e.strokeThickness;let f=Math.max(d,a.fontSize+e.strokeThickness*2)+e.leading+(o.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new J(t,e,c,f,o,l,d+e.leading,u,a)}static _measureText(t,e,s){let i=!1;J.experimentalLetterSpacingSupported&&(J.experimentalLetterSpacing?(s.letterSpacing=`${e}px`,s.textLetterSpacing=`${e}px`,i=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));let n=s.measureText(t).width;return n>0&&(i?n-=e:n+=(J.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=J._canvas){const i=s.getContext("2d",Wa);let n=0,a="",h="";const o=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=J.collapseSpaces(u),d=J.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+l,m=J.tokenize(t);for(let g=0;g<m.length;g++){let _=m[g];if(J.isNewline(_)){if(!d){h+=J.addLine(a),f=!c,a="",n=0;continue}_=" "}if(c){const y=J.isBreakingSpace(_),v=J.isBreakingSpace(a[a.length-1]);if(y&&v)continue}const x=J.getFromCache(_,l,o,i);if(x>p)if(a!==""&&(h+=J.addLine(a),a="",n=0),J.canBreakWords(_,e.breakWords)){const y=J.wordWrapSplit(_);for(let v=0;v<y.length;v++){let b=y[v],w=b,E=1;for(;y[v+E];){const A=y[v+E];if(!J.canBreakChars(w,A,_,v,e.breakWords))b+=A;else break;w=A,E++}v+=E-1;const T=J.getFromCache(b,l,o,i);T+n>p&&(h+=J.addLine(a),f=!1,a="",n=0),a+=b,n+=T}}else{a.length>0&&(h+=J.addLine(a),a="",n=0);const y=g===m.length-1;h+=J.addLine(_,!y),f=!1,a="",n=0}else x+n>p&&(f=!1,h+=J.addLine(a),a="",n=0),(a.length>0||!J.isBreakingSpace(_)||f)&&(a+=_,n+=x)}return h+=J.addLine(a,!1),h}static addLine(t,e=!0){return t=J.trimRight(t),t=e?`${t}
969
- `:t,t}static getFromCache(t,e,s,i){let n=s[t];return typeof n!="number"&&(n=J._measureText(t,e,i)+e,s[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!J.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:J._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:J._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let i=0;i<t.length;i++){const n=t[i],a=t[i+1];if(J.isBreakingSpace(n,a)||J.isNewline(n)){s!==""&&(e.push(s),s=""),e.push(n);continue}s+=n}return s!==""&&e.push(s),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,i,n){return!0}static wordWrapSplit(t){return J.graphemeSegmenter(t)}static measureFont(t){if(J._fonts[t])return J._fonts[t];const e={ascent:0,descent:0,fontSize:0},s=J._canvas,i=J._context;i.font=t;const n=J.METRICS_STRING+J.BASELINE_SYMBOL,a=Math.ceil(i.measureText(n).width);let h=Math.ceil(i.measureText(J.BASELINE_SYMBOL).width);const o=Math.ceil(J.HEIGHT_MULTIPLIER*h);if(h=h*J.BASELINE_MULTIPLIER|0,a===0||o===0)return J._fonts[t]=e,e;s.width=a,s.height=o,i.fillStyle="#f00",i.fillRect(0,0,a,o),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(n,0,h);const l=i.getImageData(0,0,a,o).data,u=l.length,c=a*4;let d=0,f=0,p=!1;for(d=0;d<h;++d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=c;else break}for(e.ascent=h-d,f=u-c,p=!1,d=o;d>h;--d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=c;else break}return e.descent=d-h,e.fontSize=e.ascent+e.descent,J._fonts[t]=e,e}static clearMetrics(t=""){t?delete J._fonts[t]:J._fonts={}}static get _canvas(){var t;if(!J.__canvas){let e;try{const s=new OffscreenCanvas(0,0);if((t=s.getContext("2d",Wa))!=null&&t.measureText)return J.__canvas=s,s;e=z.ADAPTER.createCanvas()}catch{e=z.ADAPTER.createCanvas()}e.width=e.height=10,J.__canvas=e}return J.__canvas}static get _context(){return J.__context||(J.__context=J._canvas.getContext("2d",Wa)),J.__context}};Qs.METRICS_STRING="|ÉqÅ",Qs.BASELINE_SYMBOL="M",Qs.BASELINE_MULTIPLIER=1.4,Qs.HEIGHT_MULTIPLIER=2,Qs.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Qs.experimentalLetterSpacing=!1,Qs._fonts={},Qs._newlines=[10,13],Qs._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let $i=Qs;const DT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],$m=class No{constructor(t){this.styleID=0,this.reset(),vc(this,t,t)}clone(){const t={};return vc(t,this,No.defaultStyle),new No(t)}reset(){vc(this,No.defaultStyle,No.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=xc(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=xc(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){OT(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=xc(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 i=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!DT.includes(i)&&(i=`"${i}"`),e[s]=i}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};$m.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ya.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 vi=$m;function xc(r){const t=Ct.shared,e=s=>{const i=t.setValue(s);return i.alpha===1?i.toHex():i.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function OT(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function vc(r,t,e){for(const s in e)Array.isArray(t[s])?r[s]=t[s].slice():r[s]=t[s]}const LT={texture:!0,children:!1,baseTexture:!0},Hm=class wd extends qe{constructor(t,e,s){let i=!1;s||(s=z.ADAPTER.createCanvas(),i=!0),s.width=3,s.height=3;const n=q.from(s);n.orig=new it,n.trim=new it,super(n),this._ownCanvas=i,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=wd.defaultResolution??z.RESOLUTION,this._autoResolution=wd.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return $i.experimentalLetterSpacing}static set experimentalLetterSpacing(t){ot("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),$i.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const s=this.context,i=$i.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=i.width,a=i.height,h=i.lines,o=i.lineHeight,l=i.lineWidths,u=i.maxLineWidth,c=i.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,a)+e.padding*2)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=e.strokeThickness,s.textBaseline=e.textBaseline,s.lineJoin=e.lineJoin,s.miterLimit=e.miterLimit;let d,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const g=e.dropShadow&&m===0,_=g?Math.ceil(Math.max(1,a)+e.padding*2):0,x=_*this._resolution;if(g){s.fillStyle="black",s.strokeStyle="black";const v=e.dropShadowColor,b=e.dropShadowBlur*this._resolution,w=e.dropShadowDistance*this._resolution;s.shadowColor=Ct.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),s.shadowBlur=b,s.shadowOffsetX=Math.cos(e.dropShadowAngle)*w,s.shadowOffsetY=Math.sin(e.dropShadowAngle)*w+x}else s.fillStyle=this._generateFillStyle(e,h,i),s.strokeStyle=e.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let y=(o-c.fontSize)/2;o-c.fontSize<0&&(y=0);for(let v=0;v<h.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*o+c.ascent+y,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(h[v],d+e.padding,f+e.padding-_,!0),e.fill&&this.drawLetterSpacing(h[v],d+e.padding,f+e.padding-_)}this.updateTexture()}drawLetterSpacing(t,e,s,i=!1){const n=this._style.letterSpacing;let a=!1;if($i.experimentalLetterSpacingSupported&&($i.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||a){i?this.context.strokeText(t,e,s):this.context.fillText(t,e,s);return}let h=e;const o=$i.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<o.length;++c){const d=o[c];i?this.context.strokeText(d,h,s):this.context.fillText(d,h,s);let f="";for(let p=c+1;p<o.length;++p)f+=o[p];u=this.context.measureText(f).width,h+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const a=t1(t);a.data&&(t.width=a.width,t.height=a.height,this.context.putImageData(a.data,0,0))}const e=this._texture,s=this._style,i=s.trim?0:s.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-i,e.trim.y=-i,e.orig.width=e._frame.width-i*2,e.orig.height=e._frame.height-i*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,s){const i=t.fill;if(Array.isArray(i)){if(i.length===1)return i[0]}else return i;let n;const a=t.dropShadow?t.dropShadowDistance:0,h=t.padding||0,o=this.canvas.width/this._resolution-a-h*2,l=this.canvas.height/this._resolution-a-h*2,u=i.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let f=1;f<d;++f)c.push(f/d)}if(u.unshift(i[0]),c.unshift(0),u.push(i[i.length-1]),c.push(1),t.fillGradientType===Ya.LINEAR_VERTICAL){n=this.context.createLinearGradient(o/2,h,o/2,l+h);const d=s.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=s.lineHeight*(f-1)+d,m=s.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const _=m+d,x=s.lineHeight*(f+1);let y=_;f+1<e.length&&x<_&&(y=(_+x)/2);const v=(y-g)/l;for(let b=0;b<u.length;b++){let w=0;typeof c[b]=="number"?w=c[b]:w=b/u.length;let E=Math.min(1,Math.max(0,g/l+w*v));E=Number(E.toFixed(5)),n.addColorStop(E,u[b])}}}else{n=this.context.createLinearGradient(h,l/2,o+h,l/2);const d=u.length+1;let f=1;for(let p=0;p<u.length;p++){let m;typeof c[p]=="number"?m=c[p]:m=f/d,n.addColorStop(m,u[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},LT,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=Di(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=Di(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof vi?this._style=t:this._style=new vi(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Hm.defaultAutoResolution=!0;let za=Hm;class NT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function VT(r,t){var s;let e=!1;if((s=r==null?void 0:r._textures)!=null&&s.length){for(let i=0;i<r._textures.length;i++)if(r._textures[i]instanceof q){const n=r._textures[i].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function UT(r,t){if(r.baseTexture instanceof et){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function GT(r,t){if(r._texture&&r._texture instanceof q){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function XT(r,t){return t instanceof za?(t.updateText(!0),!0):!1}function $T(r,t){if(t instanceof vi){const e=t.toFontString();return $i.measureFont(e),!0}return!1}function HT(r,t){if(r instanceof za){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function YT(r,t){return r instanceof vi?(t.includes(r)||t.push(r),!0):!1}const Ym=class oy{constructor(t){this.limiter=new NT(oy.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(HT),this.registerFindHook(YT),this.registerFindHook(VT),this.registerFindHook(UT),this.registerFindHook(GT),this.registerUploadHook(XT),this.registerUploadHook($T)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,wt.system.addOnce(this.tick,this,Vi.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let s=0,i=this.uploadHooks.length;s<i;s++)if(this.uploadHooks[s](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)wt.system.addOnce(this.tick,this,Vi.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,s=t.length;e<s;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,s=this.addHooks.length;e<s&&!this.addHooks[e](t,this.queue);e++);if(t instanceof It)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&wt.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}};Ym.uploadsPerFrame=4;let bc=Ym;Object.defineProperties(z,{UPLOADS_PER_FRAME:{get(){return bc.uploadsPerFrame},set(r){ot("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),bc.uploadsPerFrame=r}}});function Wm(r,t){return t instanceof et?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function WT(r,t){if(!(t instanceof hs))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let i=0;i<s.length;i++){const{texture:n}=s[i].style;n&&Wm(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function zT(r,t){return r instanceof hs?(t.push(r),!0):!1}class zm extends bc{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(zT),this.registerUploadHook(Wm),this.registerUploadHook(WT)}}zm.extension={name:"prepare",type:H.RendererSystem},K.add(zm);var jT=`#version 300 es
968
+ `;class Lm extends xa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Mt,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:tt.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Zs.from(OT,DT,{}),this.state=js.for2d()}render(t){const e=t.children,s=t._maxSize,i=t._batchSize,n=this.renderer;let a=e.length;if(a===0)return;a>s&&!t.autoResize&&(a=s);let h=t._buffers;h||(h=t._buffers=this.generateBuffers(t));const o=e[0]._texture.baseTexture,l=o.alphaMode>0;this.state.blendMode=tp(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=Ct.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=o,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;f<a;f+=i,p+=1){let m=a-f;m>i&&(m=i),p>=h.length&&h.push(this._generateOneMoreBuffer(t));const g=h[p];g.uploadDynamic(e,f,m);const _=t._bufferUpdateIDs[p]||0;d=d||g._updateID<_,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,m*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,i=t._batchSize,n=t._properties;for(let a=0;a<s;a+=i)e.push(new Om(this.properties,n,i));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new Om(this.properties,s,e)}uploadVertices(t,e,s,i,n,a){let h=0,o=0,l=0,u=0;for(let c=0;c<s;++c){const d=t[e+c],f=d._texture,p=d.scale.x,m=d.scale.y,g=f.trim,_=f.orig;g?(o=g.x-d.anchor.x*_.width,h=o+g.width,u=g.y-d.anchor.y*_.height,l=u+g.height):(h=_.width*(1-d.anchor.x),o=_.width*-d.anchor.x,l=_.height*(1-d.anchor.y),u=_.height*-d.anchor.y),i[a]=o*p,i[a+1]=u*m,i[a+n]=h*p,i[a+n+1]=u*m,i[a+n*2]=h*p,i[a+n*2+1]=l*m,i[a+n*3]=o*p,i[a+n*3+1]=l*m,a+=n*4}}uploadPosition(t,e,s,i,n,a){for(let h=0;h<s;h++){const o=t[e+h].position;i[a]=o.x,i[a+1]=o.y,i[a+n]=o.x,i[a+n+1]=o.y,i[a+n*2]=o.x,i[a+n*2+1]=o.y,i[a+n*3]=o.x,i[a+n*3+1]=o.y,a+=n*4}}uploadRotation(t,e,s,i,n,a){for(let h=0;h<s;h++){const o=t[e+h].rotation;i[a]=o,i[a+n]=o,i[a+n*2]=o,i[a+n*3]=o,a+=n*4}}uploadUvs(t,e,s,i,n,a){for(let h=0;h<s;++h){const o=t[e+h]._texture._uvs;o?(i[a]=o.x0,i[a+1]=o.y0,i[a+n]=o.x1,i[a+n+1]=o.y1,i[a+n*2]=o.x2,i[a+n*2+1]=o.y2,i[a+n*3]=o.x3,i[a+n*3+1]=o.y3,a+=n*4):(i[a]=0,i[a+1]=0,i[a+n]=0,i[a+n+1]=0,i[a+n*2]=0,i[a+n*2+1]=0,i[a+n*3]=0,i[a+n*3+1]=0,a+=n*4)}}uploadTint(t,e,s,i,n,a){for(let h=0;h<s;++h){const o=t[e+h],l=Ct.shared.setValue(o._tintRGB).toPremultiplied(o.alpha,o.texture.baseTexture.alphaMode>0);i[a]=l,i[a+n]=l,i[a+n*2]=l,i[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Lm.extension={name:"particle",type:H.RendererPlugin},K.add(Lm);var Ya=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ya||{});const Wa={willReadFrequently:!0},Qs=class J{static get experimentalLetterSpacingSupported(){let t=J._experimentalLetterSpacingSupported;if(t!==void 0){const e=z.ADAPTER.getCanvasRenderingContext2D().prototype;t=J._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,i,n,a,h,o,l){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=n,this.lineWidths=a,this.lineHeight=h,this.maxLineWidth=o,this.fontProperties=l}static measureText(t,e,s,i=J._canvas){s=s??e.wordWrap;const n=e.toFontString(),a=J.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const h=i.getContext("2d",Wa);h.font=n;const o=(s?J.wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),l=new Array(o.length);let u=0;for(let p=0;p<o.length;p++){const m=J._measureText(o[p],e.letterSpacing,h);l[p]=m,u=Math.max(u,m)}let c=u+e.strokeThickness;e.dropShadow&&(c+=e.dropShadowDistance);const d=e.lineHeight||a.fontSize+e.strokeThickness;let f=Math.max(d,a.fontSize+e.strokeThickness*2)+e.leading+(o.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new J(t,e,c,f,o,l,d+e.leading,u,a)}static _measureText(t,e,s){let i=!1;J.experimentalLetterSpacingSupported&&(J.experimentalLetterSpacing?(s.letterSpacing=`${e}px`,s.textLetterSpacing=`${e}px`,i=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));let n=s.measureText(t).width;return n>0&&(i?n-=e:n+=(J.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=J._canvas){const i=s.getContext("2d",Wa);let n=0,a="",h="";const o=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=J.collapseSpaces(u),d=J.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+l,m=J.tokenize(t);for(let g=0;g<m.length;g++){let _=m[g];if(J.isNewline(_)){if(!d){h+=J.addLine(a),f=!c,a="",n=0;continue}_=" "}if(c){const y=J.isBreakingSpace(_),v=J.isBreakingSpace(a[a.length-1]);if(y&&v)continue}const x=J.getFromCache(_,l,o,i);if(x>p)if(a!==""&&(h+=J.addLine(a),a="",n=0),J.canBreakWords(_,e.breakWords)){const y=J.wordWrapSplit(_);for(let v=0;v<y.length;v++){let b=y[v],w=b,E=1;for(;y[v+E];){const A=y[v+E];if(!J.canBreakChars(w,A,_,v,e.breakWords))b+=A;else break;w=A,E++}v+=E-1;const T=J.getFromCache(b,l,o,i);T+n>p&&(h+=J.addLine(a),f=!1,a="",n=0),a+=b,n+=T}}else{a.length>0&&(h+=J.addLine(a),a="",n=0);const y=g===m.length-1;h+=J.addLine(_,!y),f=!1,a="",n=0}else x+n>p&&(f=!1,h+=J.addLine(a),a="",n=0),(a.length>0||!J.isBreakingSpace(_)||f)&&(a+=_,n+=x)}return h+=J.addLine(a,!1),h}static addLine(t,e=!0){return t=J.trimRight(t),t=e?`${t}
969
+ `:t,t}static getFromCache(t,e,s,i){let n=s[t];return typeof n!="number"&&(n=J._measureText(t,e,i)+e,s[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!J.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:J._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:J._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let i=0;i<t.length;i++){const n=t[i],a=t[i+1];if(J.isBreakingSpace(n,a)||J.isNewline(n)){s!==""&&(e.push(s),s=""),e.push(n);continue}s+=n}return s!==""&&e.push(s),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,i,n){return!0}static wordWrapSplit(t){return J.graphemeSegmenter(t)}static measureFont(t){if(J._fonts[t])return J._fonts[t];const e={ascent:0,descent:0,fontSize:0},s=J._canvas,i=J._context;i.font=t;const n=J.METRICS_STRING+J.BASELINE_SYMBOL,a=Math.ceil(i.measureText(n).width);let h=Math.ceil(i.measureText(J.BASELINE_SYMBOL).width);const o=Math.ceil(J.HEIGHT_MULTIPLIER*h);if(h=h*J.BASELINE_MULTIPLIER|0,a===0||o===0)return J._fonts[t]=e,e;s.width=a,s.height=o,i.fillStyle="#f00",i.fillRect(0,0,a,o),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(n,0,h);const l=i.getImageData(0,0,a,o).data,u=l.length,c=a*4;let d=0,f=0,p=!1;for(d=0;d<h;++d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=c;else break}for(e.ascent=h-d,f=u-c,p=!1,d=o;d>h;--d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=c;else break}return e.descent=d-h,e.fontSize=e.ascent+e.descent,J._fonts[t]=e,e}static clearMetrics(t=""){t?delete J._fonts[t]:J._fonts={}}static get _canvas(){var t;if(!J.__canvas){let e;try{const s=new OffscreenCanvas(0,0);if((t=s.getContext("2d",Wa))!=null&&t.measureText)return J.__canvas=s,s;e=z.ADAPTER.createCanvas()}catch{e=z.ADAPTER.createCanvas()}e.width=e.height=10,J.__canvas=e}return J.__canvas}static get _context(){return J.__context||(J.__context=J._canvas.getContext("2d",Wa)),J.__context}};Qs.METRICS_STRING="|ÉqÅ",Qs.BASELINE_SYMBOL="M",Qs.BASELINE_MULTIPLIER=1.4,Qs.HEIGHT_MULTIPLIER=2,Qs.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Qs.experimentalLetterSpacing=!1,Qs._fonts={},Qs._newlines=[10,13],Qs._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let $i=Qs;const LT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Nm=class No{constructor(t){this.styleID=0,this.reset(),_c(this,t,t)}clone(){const t={};return _c(t,this,No.defaultStyle),new No(t)}reset(){_c(this,No.defaultStyle,No.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=gc(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=gc(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){NT(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=gc(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 i=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!LT.includes(i)&&(i=`"${i}"`),e[s]=i}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Nm.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ya.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 vi=Nm;function gc(r){const t=Ct.shared,e=s=>{const i=t.setValue(s);return i.alpha===1?i.toHex():i.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function NT(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function _c(r,t,e){for(const s in e)Array.isArray(t[s])?r[s]=t[s].slice():r[s]=t[s]}const VT={texture:!0,children:!1,baseTexture:!0},Vm=class xd extends qe{constructor(t,e,s){let i=!1;s||(s=z.ADAPTER.createCanvas(),i=!0),s.width=3,s.height=3;const n=q.from(s);n.orig=new it,n.trim=new it,super(n),this._ownCanvas=i,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=xd.defaultResolution??z.RESOLUTION,this._autoResolution=xd.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return $i.experimentalLetterSpacing}static set experimentalLetterSpacing(t){ot("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),$i.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const s=this.context,i=$i.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=i.width,a=i.height,h=i.lines,o=i.lineHeight,l=i.lineWidths,u=i.maxLineWidth,c=i.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,a)+e.padding*2)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=e.strokeThickness,s.textBaseline=e.textBaseline,s.lineJoin=e.lineJoin,s.miterLimit=e.miterLimit;let d,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const g=e.dropShadow&&m===0,_=g?Math.ceil(Math.max(1,a)+e.padding*2):0,x=_*this._resolution;if(g){s.fillStyle="black",s.strokeStyle="black";const v=e.dropShadowColor,b=e.dropShadowBlur*this._resolution,w=e.dropShadowDistance*this._resolution;s.shadowColor=Ct.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),s.shadowBlur=b,s.shadowOffsetX=Math.cos(e.dropShadowAngle)*w,s.shadowOffsetY=Math.sin(e.dropShadowAngle)*w+x}else s.fillStyle=this._generateFillStyle(e,h,i),s.strokeStyle=e.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let y=(o-c.fontSize)/2;o-c.fontSize<0&&(y=0);for(let v=0;v<h.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*o+c.ascent+y,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(h[v],d+e.padding,f+e.padding-_,!0),e.fill&&this.drawLetterSpacing(h[v],d+e.padding,f+e.padding-_)}this.updateTexture()}drawLetterSpacing(t,e,s,i=!1){const n=this._style.letterSpacing;let a=!1;if($i.experimentalLetterSpacingSupported&&($i.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||a){i?this.context.strokeText(t,e,s):this.context.fillText(t,e,s);return}let h=e;const o=$i.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<o.length;++c){const d=o[c];i?this.context.strokeText(d,h,s):this.context.fillText(d,h,s);let f="";for(let p=c+1;p<o.length;++p)f+=o[p];u=this.context.measureText(f).width,h+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const a=s1(t);a.data&&(t.width=a.width,t.height=a.height,this.context.putImageData(a.data,0,0))}const e=this._texture,s=this._style,i=s.trim?0:s.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-i,e.trim.y=-i,e.orig.width=e._frame.width-i*2,e.orig.height=e._frame.height-i*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,s){const i=t.fill;if(Array.isArray(i)){if(i.length===1)return i[0]}else return i;let n;const a=t.dropShadow?t.dropShadowDistance:0,h=t.padding||0,o=this.canvas.width/this._resolution-a-h*2,l=this.canvas.height/this._resolution-a-h*2,u=i.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let f=1;f<d;++f)c.push(f/d)}if(u.unshift(i[0]),c.unshift(0),u.push(i[i.length-1]),c.push(1),t.fillGradientType===Ya.LINEAR_VERTICAL){n=this.context.createLinearGradient(o/2,h,o/2,l+h);const d=s.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=s.lineHeight*(f-1)+d,m=s.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const _=m+d,x=s.lineHeight*(f+1);let y=_;f+1<e.length&&x<_&&(y=(_+x)/2);const v=(y-g)/l;for(let b=0;b<u.length;b++){let w=0;typeof c[b]=="number"?w=c[b]:w=b/u.length;let E=Math.min(1,Math.max(0,g/l+w*v));E=Number(E.toFixed(5)),n.addColorStop(E,u[b])}}}else{n=this.context.createLinearGradient(h,l/2,o+h,l/2);const d=u.length+1;let f=1;for(let p=0;p<u.length;p++){let m;typeof c[p]=="number"?m=c[p]:m=f/d,n.addColorStop(m,u[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},VT,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=Di(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=Di(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof vi?this._style=t:this._style=new vi(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Vm.defaultAutoResolution=!0;let za=Vm;class UT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function GT(r,t){var s;let e=!1;if((s=r==null?void 0:r._textures)!=null&&s.length){for(let i=0;i<r._textures.length;i++)if(r._textures[i]instanceof q){const n=r._textures[i].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function XT(r,t){if(r.baseTexture instanceof et){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function $T(r,t){if(r._texture&&r._texture instanceof q){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function HT(r,t){return t instanceof za?(t.updateText(!0),!0):!1}function YT(r,t){if(t instanceof vi){const e=t.toFontString();return $i.measureFont(e),!0}return!1}function WT(r,t){if(r instanceof za){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function zT(r,t){return r instanceof vi?(t.includes(r)||t.push(r),!0):!1}const Um=class ey{constructor(t){this.limiter=new UT(ey.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(WT),this.registerFindHook(zT),this.registerFindHook(GT),this.registerFindHook(XT),this.registerFindHook($T),this.registerUploadHook(HT),this.registerUploadHook(YT)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,wt.system.addOnce(this.tick,this,Vi.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let s=0,i=this.uploadHooks.length;s<i;s++)if(this.uploadHooks[s](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)wt.system.addOnce(this.tick,this,Vi.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,s=t.length;e<s;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,s=this.addHooks.length;e<s&&!this.addHooks[e](t,this.queue);e++);if(t instanceof It)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&wt.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}};Um.uploadsPerFrame=4;let yc=Um;Object.defineProperties(z,{UPLOADS_PER_FRAME:{get(){return yc.uploadsPerFrame},set(r){ot("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),yc.uploadsPerFrame=r}}});function Gm(r,t){return t instanceof et?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function jT(r,t){if(!(t instanceof hs))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let i=0;i<s.length;i++){const{texture:n}=s[i].style;n&&Gm(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function qT(r,t){return r instanceof hs?(t.push(r),!0):!1}class Xm extends yc{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(qT),this.registerUploadHook(Gm),this.registerUploadHook(jT)}}Xm.extension={name:"prepare",type:H.RendererSystem},K.add(Xm);var ZT=`#version 300 es
970
970
  #define SHADER_NAME Tiling-Sprite-100
971
971
 
972
972
  precision lowp float;
@@ -992,7 +992,7 @@ void main(void)
992
992
 
993
993
  fragmentColor = texSample * uColor;
994
994
  }
995
- `,qT=`#version 300 es
995
+ `,KT=`#version 300 es
996
996
  #define SHADER_NAME Tiling-Sprite-300
997
997
 
998
998
  precision lowp float;
@@ -1012,7 +1012,7 @@ void main(void)
1012
1012
 
1013
1013
  vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
1014
1014
  }
1015
- `,ZT=`#version 100
1015
+ `,QT=`#version 100
1016
1016
  #ifdef GL_EXT_shader_texture_lod
1017
1017
  #extension GL_EXT_shader_texture_lod : enable
1018
1018
  #endif
@@ -1045,7 +1045,7 @@ void main(void)
1045
1045
 
1046
1046
  gl_FragColor = texSample * uColor;
1047
1047
  }
1048
- `,jm=`#version 100
1048
+ `,$m=`#version 100
1049
1049
  #define SHADER_NAME Tiling-Sprite-100
1050
1050
 
1051
1051
  precision lowp float;
@@ -1065,7 +1065,7 @@ void main(void)
1065
1065
 
1066
1066
  vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
1067
1067
  }
1068
- `,KT=`#version 100
1068
+ `,JT=`#version 100
1069
1069
  #define SHADER_NAME Tiling-Sprite-Simple-100
1070
1070
 
1071
1071
  precision lowp float;
@@ -1080,7 +1080,7 @@ void main(void)
1080
1080
  vec4 texSample = texture2D(uSampler, vTextureCoord);
1081
1081
  gl_FragColor = texSample * uColor;
1082
1082
  }
1083
- `;const ja=new Mt;class qm extends xa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Fp,this.state=js.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Zs.from(jm,KT,e),this.shader=t.context.webGLVersion>1?Zs.from(qT,jT,e):Zs.from(jm,ZT,e)}render(t){const e=this.renderer,s=this.quad;let i=s.vertices;i[0]=i[6]=t._width*-t.anchor.x,i[1]=i[3]=t._height*-t.anchor.y,i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;i=s.uvs,i[0]=i[6]=-n,i[1]=i[3]=-a,i[2]=i[4]=1-n,i[5]=i[7]=1-a,s.invalidate();const h=t._texture,o=h.baseTexture,l=o.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=o.isPowerOfTwo&&h.frame.width===o.width&&h.frame.height===o.height;d&&(o._glTextures[e.CONTEXT_UID]?d=o.wrapMode!==Fi.CLAMP:o.wrapMode===Fi.CLAMP&&(o.wrapMode=Fi.REPEAT));const f=d?this.simpleShader:this.shader,p=h.width,m=h.height,g=t._width,_=t._height;ja.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),ja.invert(),d?ja.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=ja.toArray(!0),f.uniforms.uColor=Ct.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=h,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=np(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}qm.extension={name:"tilingSprite",type:H.RendererPlugin},K.add(qm);const Zm=class Vo{constructor(t,e,s){this.linkedSheets=[],(t instanceof et||t instanceof q)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:i,data:n,resolutionFilename:a=null,cachePrefix:h=""}=t;this.cachePrefix=h,this._texture=i instanceof q?i:null,this.baseTexture=i instanceof et?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const o=this.baseTexture.resource;this.resolution=this._updateResolution(a||(o?o.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=_i(t,null);return s===null&&(s=typeof e=="number"?e:parseFloat(e??"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Vo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Vo.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const i=this._frameKeys[e],n=this._frames[i],a=n.frame;if(a){let h=null,o=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new it(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?h=new it(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new it(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(o=new it(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[i]=new q(this.baseTexture,h,u,o,n.rotated?2:0,n.anchor,n.borders),q.addToCache(this.textures[i],this.cachePrefix+i.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const i=t[e][s];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Vo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Vo.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Zm.BATCH_SIZE=1e3;let Km=Zm;const QT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Qm(r,t,e){const s={};if(r.forEach(i=>{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[`${t.cachePrefix}${i}`]=t.textures[i]}),!e){const i=bt.dirname(r[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,Qm([`${i}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const JT={extension:H.Asset,cache:{test:r=>r instanceof Km,getCacheableAssets:(r,t)=>Qm(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&QT.includes(s)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=z.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:H.LoadParser,priority:Ne.Normal},async testParse(r,t){return bt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var u,c;const{texture:s,imageFilename:i,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=bt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(s&&s.baseTexture)h=s;else{const d=nc(a+(i??r.meta.image),t.src);h=(await e.load([d]))[d]}const o=new Km({texture:h.baseTexture,data:r,resolutionFilename:t.src,cachePrefix:n});await o.parse();const l=(u=r==null?void 0:r.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(l)){const d=[];for(const p of l){if(typeof p!="string")continue;let m=a+p;(c=t.data)!=null&&c.ignoreMultiPack||(m=nc(m,t.src),d.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);o.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[o].concat(o.linkedSheets.filter(m=>m!==p))})}return o},unload(r){r.destroy(!0)}}};K.add(JT);class qa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Za{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],h=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(const l in h){const u=h[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;o[c]=p}s[a].push(o)}const i=new qa;return s.info.forEach(n=>i.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>i.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>i.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>i.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=>i.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>i.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),i}}class wc{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 qa,s=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),h=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let l=0;l<s.length;l++)e.info.push({face:s[l].getAttribute("face"),size:parseInt(s[l].getAttribute("size"),10)});for(let l=0;l<i.length;l++)e.common.push({lineHeight:parseInt(i[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<a.length;l++){const u=a[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<h.length;l++)e.kerning.push({first:parseInt(h[l].getAttribute("first"),10),second:parseInt(h[l].getAttribute("second"),10),amount:parseInt(h[l].getAttribute("amount"),10)});for(let l=0;l<o.length;l++)e.distanceField.push({fieldType:o[l].getAttribute("fieldType"),distanceRange:parseInt(o[l].getAttribute("distanceRange"),10)});return e}}class Ec{static test(t){return typeof t=="string"&&t.includes("<font>")?wc.test(z.ADAPTER.parseXML(t)):!1}static parse(t){return wc.parse(z.ADAPTER.parseXML(t))}}const Tc=[Za,wc,Ec];function tA(r){for(let t=0;t<Tc.length;t++)if(Tc[t].test(r))return Tc[t];return null}function eA(r,t,e,s,i,n){const a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let h;const o=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=r.width/s-o-l*2,c=r.height/s-o-l*2,d=a.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(a[0]),f.unshift(0),d.push(a[a.length-1]),f.push(1),e.fillGradientType===Ya.LINEAR_VERTICAL){h=t.createLinearGradient(u/2,l,u/2,c+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<i.length;g++){const _=n.lineHeight*g;for(let x=0;x<d.length;x++){let y=0;typeof f[x]=="number"?y=f[x]:y=x/d.length;const v=_/c+y*m;let b=Math.max(p,v);b=Math.min(b,1),h.addColorStop(b,d[x]),p=b}}}else{h=t.createLinearGradient(l,c/2,u+l,c/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let _;typeof f[g]=="number"?_=f[g]:_=m/p,h.addColorStop(_,d[g]),m++}}return h}function sA(r,t,e,s,i,n,a){const h=e.text,o=e.fontProperties;t.translate(s,i),t.scale(n,n);const l=a.strokeThickness/2,u=-(a.strokeThickness/2);if(t.font=a.toFontString(),t.lineWidth=a.strokeThickness,t.textBaseline=a.textBaseline,t.lineJoin=a.lineJoin,t.miterLimit=a.miterLimit,t.fillStyle=eA(r,t,a,n,[h],e),t.strokeStyle=a.stroke,a.dropShadow){const c=a.dropShadowColor,d=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=Ct.shared.setValue(c).setAlpha(a.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(h,l,u+e.lineHeight-o.descent),a.fill&&t.fillText(h,l,u+e.lineHeight-o.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ka(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Jm(r){return Array.from?Array.from(r):r.split("")}function iA(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,s=r.length;e<s;e++){const i=r[e];if(Array.isArray(i)){if(i.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);const n=i[0].charCodeAt(0),a=i[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let h=n,o=a;h<=o;h++)t.push(String.fromCharCode(h))}else t.push(...Jm(i))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Hi=class ui{constructor(t,e,s){var u;const[i]=t.info,[n]=t.common,[a]=t.page,[h]=t.distanceField,o=_i(a.file),l={};this._ownsTextures=s,this.font=i.face,this.size=i.size,this.lineHeight=n.lineHeight/o,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:f}=t.page[c];l[d]=e instanceof Array?e[c]:e[f],h!=null&&h.fieldType&&h.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Re.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=vs.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:f}=t.char[c];let{x:p,y:m,width:g,height:_,xoffset:x,yoffset:y,xadvance:v}=t.char[c];p/=o,m/=o,g/=o,_/=o,x/=o,y/=o,v/=o;const b=new it(p+l[f].frame.x/o,m+l[f].frame.y/o,g,_);this.chars[d]={xOffset:x,yOffset:y,xAdvance:v,kerning:{},texture:new q(l[f].baseTexture,b),page:f}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:f,amount:p}=t.kerning[c];d/=o,f/=o,p/=o,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=h==null?void 0:h.distanceRange,this.distanceFieldType=((u=h==null?void 0:h.fieldType)==null?void 0:u.toLowerCase())??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,s){let i;if(t instanceof qa)i=t;else{const a=tA(t);if(!a)throw new Error("Unrecognized data format for font.");i=a.parse(t)}e instanceof q&&(e=[e]);const n=new ui(i,e,s);return ui.available[n.font]=n,n}static uninstall(t){const e=ui.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ui.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:i,padding:n,resolution:a,textureWidth:h,textureHeight:o,...l}=Object.assign({},ui.defaultOptions,s),u=iA(i),c=e instanceof vi?e:new vi(e),d=h,f=new qa;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p=0,m=0,g,_,x,y=0;const v=[];for(let w=0;w<u.length;w++){g||(g=z.ADAPTER.createCanvas(),g.width=h,g.height=o,_=g.getContext("2d"),x=new et(g,{resolution:a,...l}),v.push(new q(x)),f.page.push({id:v.length-1,file:""}));const E=u[w],T=$i.measureText(E,c,!1,g),A=T.width,I=Math.ceil(T.height),M=Math.ceil((c.fontStyle==="italic"?2:1)*A);if(m>=o-I*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,g=null,_=null,x=null,m=0,p=0,y=0;continue}if(y=Math.max(I+T.fontProperties.descent,y),M*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,m+=y*a,m=Math.ceil(m),p=0,y=0;continue}sA(g,_,T,p,m,a,c);const R=Ka(T.text);f.char.push({id:R,page:v.length-1,x:p/a,y:m/a,width:M,height:I,xoffset:0,yoffset:0,xadvance:A-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),p+=(M+2*n)*a,p=Math.ceil(p)}if(!(s!=null&&s.skipKerning))for(let w=0,E=u.length;w<E;w++){const T=u[w];for(let A=0;A<E;A++){const I=u[A],M=_.measureText(T).width,R=_.measureText(I).width,C=_.measureText(T+I).width-(M+R);C&&f.kerning.push({first:Ka(T),second:Ka(I),amount:C})}}const b=new ui(f,v,!0);return ui.available[t]!==void 0&&ui.uninstall(t),ui.available[t]=b,b}};Hi.ALPHA=[["a","z"],["A","Z"]," "],Hi.NUMERIC=[["0","9"]],Hi.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Hi.ASCII=[[" ","~"]],Hi.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Hi.ALPHANUMERIC},Hi.available={};let Yi=Hi;var rA=`// Pixi texture info\r
1083
+ `;const ja=new Mt;class Hm extends xa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Cp,this.state=js.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Zs.from($m,JT,e),this.shader=t.context.webGLVersion>1?Zs.from(KT,ZT,e):Zs.from($m,QT,e)}render(t){const e=this.renderer,s=this.quad;let i=s.vertices;i[0]=i[6]=t._width*-t.anchor.x,i[1]=i[3]=t._height*-t.anchor.y,i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;i=s.uvs,i[0]=i[6]=-n,i[1]=i[3]=-a,i[2]=i[4]=1-n,i[5]=i[7]=1-a,s.invalidate();const h=t._texture,o=h.baseTexture,l=o.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=o.isPowerOfTwo&&h.frame.width===o.width&&h.frame.height===o.height;d&&(o._glTextures[e.CONTEXT_UID]?d=o.wrapMode!==Fi.CLAMP:o.wrapMode===Fi.CLAMP&&(o.wrapMode=Fi.REPEAT));const f=d?this.simpleShader:this.shader,p=h.width,m=h.height,g=t._width,_=t._height;ja.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),ja.invert(),d?ja.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=ja.toArray(!0),f.uniforms.uColor=Ct.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=h,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=tp(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Hm.extension={name:"tilingSprite",type:H.RendererPlugin},K.add(Hm);const Ym=class Vo{constructor(t,e,s){this.linkedSheets=[],(t instanceof et||t instanceof q)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:i,data:n,resolutionFilename:a=null,cachePrefix:h=""}=t;this.cachePrefix=h,this._texture=i instanceof q?i:null,this.baseTexture=i instanceof et?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const o=this.baseTexture.resource;this.resolution=this._updateResolution(a||(o?o.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=_i(t,null);return s===null&&(s=typeof e=="number"?e:parseFloat(e??"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Vo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Vo.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const i=this._frameKeys[e],n=this._frames[i],a=n.frame;if(a){let h=null,o=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new it(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?h=new it(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new it(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(o=new it(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[i]=new q(this.baseTexture,h,u,o,n.rotated?2:0,n.anchor,n.borders),q.addToCache(this.textures[i],this.cachePrefix+i.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const i=t[e][s];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Vo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Vo.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Ym.BATCH_SIZE=1e3;let Wm=Ym;const tA=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function zm(r,t,e){const s={};if(r.forEach(i=>{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[`${t.cachePrefix}${i}`]=t.textures[i]}),!e){const i=bt.dirname(r[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,zm([`${i}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const eA={extension:H.Asset,cache:{test:r=>r instanceof Wm,getCacheableAssets:(r,t)=>zm(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&tA.includes(s)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=z.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:H.LoadParser,priority:Ne.Normal},async testParse(r,t){return bt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var u,c;const{texture:s,imageFilename:i,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=bt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(s&&s.baseTexture)h=s;else{const d=sc(a+(i??r.meta.image),t.src);h=(await e.load([d]))[d]}const o=new Wm({texture:h.baseTexture,data:r,resolutionFilename:t.src,cachePrefix:n});await o.parse();const l=(u=r==null?void 0:r.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(l)){const d=[];for(const p of l){if(typeof p!="string")continue;let m=a+p;(c=t.data)!=null&&c.ignoreMultiPack||(m=sc(m,t.src),d.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);o.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[o].concat(o.linkedSheets.filter(m=>m!==p))})}return o},unload(r){r.destroy(!0)}}};K.add(eA);class qa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Za{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],h=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(const l in h){const u=h[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;o[c]=p}s[a].push(o)}const i=new qa;return s.info.forEach(n=>i.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>i.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>i.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>i.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=>i.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>i.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),i}}class xc{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 qa,s=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),h=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let l=0;l<s.length;l++)e.info.push({face:s[l].getAttribute("face"),size:parseInt(s[l].getAttribute("size"),10)});for(let l=0;l<i.length;l++)e.common.push({lineHeight:parseInt(i[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<a.length;l++){const u=a[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<h.length;l++)e.kerning.push({first:parseInt(h[l].getAttribute("first"),10),second:parseInt(h[l].getAttribute("second"),10),amount:parseInt(h[l].getAttribute("amount"),10)});for(let l=0;l<o.length;l++)e.distanceField.push({fieldType:o[l].getAttribute("fieldType"),distanceRange:parseInt(o[l].getAttribute("distanceRange"),10)});return e}}class vc{static test(t){return typeof t=="string"&&t.includes("<font>")?xc.test(z.ADAPTER.parseXML(t)):!1}static parse(t){return xc.parse(z.ADAPTER.parseXML(t))}}const bc=[Za,xc,vc];function sA(r){for(let t=0;t<bc.length;t++)if(bc[t].test(r))return bc[t];return null}function iA(r,t,e,s,i,n){const a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let h;const o=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=r.width/s-o-l*2,c=r.height/s-o-l*2,d=a.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(a[0]),f.unshift(0),d.push(a[a.length-1]),f.push(1),e.fillGradientType===Ya.LINEAR_VERTICAL){h=t.createLinearGradient(u/2,l,u/2,c+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<i.length;g++){const _=n.lineHeight*g;for(let x=0;x<d.length;x++){let y=0;typeof f[x]=="number"?y=f[x]:y=x/d.length;const v=_/c+y*m;let b=Math.max(p,v);b=Math.min(b,1),h.addColorStop(b,d[x]),p=b}}}else{h=t.createLinearGradient(l,c/2,u+l,c/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let _;typeof f[g]=="number"?_=f[g]:_=m/p,h.addColorStop(_,d[g]),m++}}return h}function rA(r,t,e,s,i,n,a){const h=e.text,o=e.fontProperties;t.translate(s,i),t.scale(n,n);const l=a.strokeThickness/2,u=-(a.strokeThickness/2);if(t.font=a.toFontString(),t.lineWidth=a.strokeThickness,t.textBaseline=a.textBaseline,t.lineJoin=a.lineJoin,t.miterLimit=a.miterLimit,t.fillStyle=iA(r,t,a,n,[h],e),t.strokeStyle=a.stroke,a.dropShadow){const c=a.dropShadowColor,d=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=Ct.shared.setValue(c).setAlpha(a.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(h,l,u+e.lineHeight-o.descent),a.fill&&t.fillText(h,l,u+e.lineHeight-o.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ka(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function jm(r){return Array.from?Array.from(r):r.split("")}function nA(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,s=r.length;e<s;e++){const i=r[e];if(Array.isArray(i)){if(i.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);const n=i[0].charCodeAt(0),a=i[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let h=n,o=a;h<=o;h++)t.push(String.fromCharCode(h))}else t.push(...jm(i))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Hi=class ui{constructor(t,e,s){var u;const[i]=t.info,[n]=t.common,[a]=t.page,[h]=t.distanceField,o=_i(a.file),l={};this._ownsTextures=s,this.font=i.face,this.size=i.size,this.lineHeight=n.lineHeight/o,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:f}=t.page[c];l[d]=e instanceof Array?e[c]:e[f],h!=null&&h.fieldType&&h.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Re.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=vs.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:f}=t.char[c];let{x:p,y:m,width:g,height:_,xoffset:x,yoffset:y,xadvance:v}=t.char[c];p/=o,m/=o,g/=o,_/=o,x/=o,y/=o,v/=o;const b=new it(p+l[f].frame.x/o,m+l[f].frame.y/o,g,_);this.chars[d]={xOffset:x,yOffset:y,xAdvance:v,kerning:{},texture:new q(l[f].baseTexture,b),page:f}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:f,amount:p}=t.kerning[c];d/=o,f/=o,p/=o,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=h==null?void 0:h.distanceRange,this.distanceFieldType=((u=h==null?void 0:h.fieldType)==null?void 0:u.toLowerCase())??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,s){let i;if(t instanceof qa)i=t;else{const a=sA(t);if(!a)throw new Error("Unrecognized data format for font.");i=a.parse(t)}e instanceof q&&(e=[e]);const n=new ui(i,e,s);return ui.available[n.font]=n,n}static uninstall(t){const e=ui.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ui.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:i,padding:n,resolution:a,textureWidth:h,textureHeight:o,...l}=Object.assign({},ui.defaultOptions,s),u=nA(i),c=e instanceof vi?e:new vi(e),d=h,f=new qa;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p=0,m=0,g,_,x,y=0;const v=[];for(let w=0;w<u.length;w++){g||(g=z.ADAPTER.createCanvas(),g.width=h,g.height=o,_=g.getContext("2d"),x=new et(g,{resolution:a,...l}),v.push(new q(x)),f.page.push({id:v.length-1,file:""}));const E=u[w],T=$i.measureText(E,c,!1,g),A=T.width,I=Math.ceil(T.height),M=Math.ceil((c.fontStyle==="italic"?2:1)*A);if(m>=o-I*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,g=null,_=null,x=null,m=0,p=0,y=0;continue}if(y=Math.max(I+T.fontProperties.descent,y),M*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,m+=y*a,m=Math.ceil(m),p=0,y=0;continue}rA(g,_,T,p,m,a,c);const R=Ka(T.text);f.char.push({id:R,page:v.length-1,x:p/a,y:m/a,width:M,height:I,xoffset:0,yoffset:0,xadvance:A-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),p+=(M+2*n)*a,p=Math.ceil(p)}if(!(s!=null&&s.skipKerning))for(let w=0,E=u.length;w<E;w++){const T=u[w];for(let A=0;A<E;A++){const I=u[A],M=_.measureText(T).width,R=_.measureText(I).width,C=_.measureText(T+I).width-(M+R);C&&f.kerning.push({first:Ka(T),second:Ka(I),amount:C})}}const b=new ui(f,v,!0);return ui.available[t]!==void 0&&ui.uninstall(t),ui.available[t]=b,b}};Hi.ALPHA=[["a","z"],["A","Z"]," "],Hi.NUMERIC=[["0","9"]],Hi.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Hi.ASCII=[[" ","~"]],Hi.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Hi.ALPHANUMERIC},Hi.available={};let Yi=Hi;var oA=`// Pixi texture info\r
1084
1084
  varying vec2 vTextureCoord;\r
1085
1085
  uniform sampler2D uSampler;\r
1086
1086
  \r
@@ -1118,7 +1118,7 @@ void main(void) {\r
1118
1118
  // NPM Textures, NPM outputs\r
1119
1119
  gl_FragColor = vec4(uColor.rgb, coverage);\r
1120
1120
  }\r
1121
- `,nA=`// Mesh material default fragment\r
1121
+ `,aA=`// Mesh material default fragment\r
1122
1122
  attribute vec2 aVertexPosition;\r
1123
1123
  attribute vec2 aTextureCoord;\r
1124
1124
  \r
@@ -1134,17 +1134,17 @@ void main(void)\r
1134
1134
  \r
1135
1135
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
1136
1136
  }\r
1137
- `;const tg=[],eg=[],sg=[],ig=class ay extends It{constructor(t,e={}){super();const{align:s,tint:i,maxWidth:n,letterSpacing:a,fontName:h,fontSize:o}=Object.assign({},ay.styleDefaults,e);if(!Yi.available[h])throw new Error(`Missing BitmapFont "${h}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Ct(i),this._font=void 0,this._fontName=h,this._fontSize=o,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new qs(()=>{this.dirty=!0},this,0,0),this._roundPixels=z.ROUND_PIXELS,this.dirty=!0,this._resolution=z.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var M;const t=Yi.available[this._fontName],e=this.fontSize,s=e/t.size,i=new st,n=[],a=[],h=[],o=this._text.replace(/(?:\r\n|\r)/g,`
1138
- `)||" ",l=Jm(o),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?tg:eg;let d=null,f=0,p=0,m=0,g=-1,_=0,x=0,y=0,v=0;for(let R=0;R<l.length;R++){const C=l[R],P=Ka(C);if(/(?:\s)/.test(C)&&(g=R,_=f,v++),C==="\r"||C===`
1139
- `){a.push(f),h.push(-1),p=Math.max(p,f),++m,++x,i.x=0,i.y+=t.lineHeight,d=null,v=0;continue}const k=t.chars[P];if(!k)continue;d&&k.kerning[d]&&(i.x+=k.kerning[d]);const U=sg.pop()||{texture:q.EMPTY,line:0,charCode:0,prevSpaces:0,position:new st};U.texture=k.texture,U.line=m,U.charCode=P,U.position.x=Math.round(i.x+k.xOffset+this._letterSpacing/2),U.position.y=Math.round(i.y+k.yOffset),U.prevSpaces=v,n.push(U),f=U.position.x+Math.max(k.xAdvance-k.xOffset,k.texture.orig.width),i.x+=k.xAdvance+this._letterSpacing,y=Math.max(y,k.yOffset+k.texture.height),d=P,g!==-1&&u>0&&i.x>u&&(++x,nn(n,1+g-x,1+R-g),R=g,g=-1,a.push(_),h.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,_),m++,i.x=0,i.y+=t.lineHeight,d=null,v=0)}const b=l[l.length-1];b!=="\r"&&b!==`
1140
- `&&(/(?:\s)/.test(b)&&(f=_),a.push(f),p=Math.max(p,f),h.push(-1));const w=[];for(let R=0;R<=m;R++){let C=0;this._align==="right"?C=p-a[R]:this._align==="center"?C=(p-a[R])/2:this._align==="justify"&&(C=h[R]<0?0:(p-a[R])/h[R]),w.push(C)}const E=n.length,T={},A=[],I=this._activePagesMeshData;c.push(...I);for(let R=0;R<E;R++){const C=n[R].texture,P=C.baseTexture.uid;if(!T[P]){let k=c.pop();if(!k){const V=new yc;let L,$;t.distanceFieldType==="none"?(L=new $a(q.EMPTY),$=W.NORMAL):(L=new $a(q.EMPTY,{program:yi.from(nA,rA),uniforms:{uFWidth:0}}),$=W.NORMAL_NPM);const O=new Xa(V,L);O.blendMode=$,k={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:O,vertices:null,uvs:null,indices:null}}k.index=0,k.indexCount=0,k.vertexCount=0,k.uvsCount=0,k.total=0;const{_textureCache:U}=this;U[P]=U[P]||new q(C.baseTexture),k.mesh.texture=U[P],k.mesh.tint=this._tintColor.value,A.push(k),T[P]=k}T[P].total++}for(let R=0;R<I.length;R++)A.includes(I[R])||this.removeChild(I[R].mesh);for(let R=0;R<A.length;R++)A[R].mesh.parent!==this&&this.addChild(A[R].mesh);this._activePagesMeshData=A;for(const R in T){const C=T[R],P=C.total;if(!(((M=C.indices)==null?void 0:M.length)>6*P)||C.vertices.length<Xa.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*P),C.uvs=new Float32Array(4*2*P),C.indices=new Uint16Array(6*P);else{const k=C.total,U=C.vertices;for(let V=k*4*2;V<U.length;V++)U[V]=0}C.mesh.size=6*P}for(let R=0;R<E;R++){const C=n[R];let P=C.position.x+w[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(P=Math.round(P));const k=P*s,U=C.position.y*s,V=C.texture,L=T[V.baseTexture.uid],$=V.frame,O=V._uvs,N=L.index++;L.indices[N*6+0]=0+N*4,L.indices[N*6+1]=1+N*4,L.indices[N*6+2]=2+N*4,L.indices[N*6+3]=0+N*4,L.indices[N*6+4]=2+N*4,L.indices[N*6+5]=3+N*4,L.vertices[N*8+0]=k,L.vertices[N*8+1]=U,L.vertices[N*8+2]=k+$.width*s,L.vertices[N*8+3]=U,L.vertices[N*8+4]=k+$.width*s,L.vertices[N*8+5]=U+$.height*s,L.vertices[N*8+6]=k,L.vertices[N*8+7]=U+$.height*s,L.uvs[N*8+0]=O.x0,L.uvs[N*8+1]=O.y0,L.uvs[N*8+2]=O.x1,L.uvs[N*8+3]=O.y1,L.uvs[N*8+4]=O.x2,L.uvs[N*8+5]=O.y2,L.uvs[N*8+6]=O.x3,L.uvs[N*8+7]=O.y3}this._textWidth=p*s,this._textHeight=(i.y+t.lineHeight)*s;for(const R in T){const C=T[R];if(this.anchor.x!==0||this.anchor.y!==0){let V=0;const L=this._textWidth*this.anchor.x,$=this._textHeight*this.anchor.y;for(let O=0;O<C.total;O++)C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$}this._maxLineHeight=y*s;const P=C.mesh.geometry.getBuffer("aVertexPosition"),k=C.mesh.geometry.getBuffer("aTextureCoord"),U=C.mesh.geometry.getIndex();P.data=C.vertices,k.data=C.uvs,U.data=C.indices,P.update(),k.update(),U.update()}for(let R=0;R<n.length;R++)sg.push(n[R]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:s,size:i}=Yi.available[this._fontName];if(s!=="none"){const{a:n,b:a,c:h,d:o}=this.worldTransform,l=Math.sqrt(n*n+a*a),u=Math.sqrt(h*h+o*o),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/i,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=c*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=Yi.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!Yi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Yi.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,s=Yi.available[this._fontName].distanceFieldType==="none"?tg:eg;s.push(...this._activePagesMeshData);for(const i of this._activePagesMeshData)this.removeChild(i.mesh);this._activePagesMeshData=[],s.filter(i=>e[i.mesh.texture.baseTexture.uid]).forEach(i=>{i.mesh.texture=q.EMPTY});for(const i in e)e[i].destroy(),delete e[i];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};ig.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let oA=ig;const aA=[".xml",".fnt"],lA={extension:{type:H.LoadParser,priority:Ne.Normal},name:"loadBitmapFont",test(r){return aA.includes(bt.extname(r).toLowerCase())},async testParse(r){return Za.test(r)||Ec.test(r)},async parse(r,t,e){const s=Za.test(r)?Za.parse(r):Ec.parse(r),{src:i}=t,{page:n}=s,a=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=bt.join(bt.dirname(i),u);c=nc(c,i),a.push(c)}const h=await e.load(a),o=a.map(l=>h[l]);return Yi.install(s,o,!0)},async load(r,t){return(await z.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};K.add(lA);const Ac=class Nn extends vi{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Nn(Object.keys(Nn.defaultOptions).reduce((e,s)=>({...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 Nn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=Nn;if(s[t]){const i=s[t];return this._fonts.push(i),i.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.ADAPTER.fetch(t).then(i=>i.blob()).then(async i=>new Promise((n,a)=>{const h=URL.createObjectURL(i),o=new FileReader;o.onload=()=>n([h,o.result]),o.onerror=a,o.readAsDataURL(i)})).then(async([i,n])=>{const a=Object.assign({family:bt.basename(t,bt.extname(t)),weight:"normal",style:"normal",display:"auto",src:i,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const h=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=h,await h.load(),document.fonts.add(h),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}
1137
+ `;const qm=[],Zm=[],Km=[],Qm=class sy extends It{constructor(t,e={}){super();const{align:s,tint:i,maxWidth:n,letterSpacing:a,fontName:h,fontSize:o}=Object.assign({},sy.styleDefaults,e);if(!Yi.available[h])throw new Error(`Missing BitmapFont "${h}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Ct(i),this._font=void 0,this._fontName=h,this._fontSize=o,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new qs(()=>{this.dirty=!0},this,0,0),this._roundPixels=z.ROUND_PIXELS,this.dirty=!0,this._resolution=z.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var M;const t=Yi.available[this._fontName],e=this.fontSize,s=e/t.size,i=new st,n=[],a=[],h=[],o=this._text.replace(/(?:\r\n|\r)/g,`
1138
+ `)||" ",l=jm(o),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?qm:Zm;let d=null,f=0,p=0,m=0,g=-1,_=0,x=0,y=0,v=0;for(let R=0;R<l.length;R++){const C=l[R],P=Ka(C);if(/(?:\s)/.test(C)&&(g=R,_=f,v++),C==="\r"||C===`
1139
+ `){a.push(f),h.push(-1),p=Math.max(p,f),++m,++x,i.x=0,i.y+=t.lineHeight,d=null,v=0;continue}const k=t.chars[P];if(!k)continue;d&&k.kerning[d]&&(i.x+=k.kerning[d]);const U=Km.pop()||{texture:q.EMPTY,line:0,charCode:0,prevSpaces:0,position:new st};U.texture=k.texture,U.line=m,U.charCode=P,U.position.x=Math.round(i.x+k.xOffset+this._letterSpacing/2),U.position.y=Math.round(i.y+k.yOffset),U.prevSpaces=v,n.push(U),f=U.position.x+Math.max(k.xAdvance-k.xOffset,k.texture.orig.width),i.x+=k.xAdvance+this._letterSpacing,y=Math.max(y,k.yOffset+k.texture.height),d=P,g!==-1&&u>0&&i.x>u&&(++x,nn(n,1+g-x,1+R-g),R=g,g=-1,a.push(_),h.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,_),m++,i.x=0,i.y+=t.lineHeight,d=null,v=0)}const b=l[l.length-1];b!=="\r"&&b!==`
1140
+ `&&(/(?:\s)/.test(b)&&(f=_),a.push(f),p=Math.max(p,f),h.push(-1));const w=[];for(let R=0;R<=m;R++){let C=0;this._align==="right"?C=p-a[R]:this._align==="center"?C=(p-a[R])/2:this._align==="justify"&&(C=h[R]<0?0:(p-a[R])/h[R]),w.push(C)}const E=n.length,T={},A=[],I=this._activePagesMeshData;c.push(...I);for(let R=0;R<E;R++){const C=n[R].texture,P=C.baseTexture.uid;if(!T[P]){let k=c.pop();if(!k){const V=new mc;let L,$;t.distanceFieldType==="none"?(L=new $a(q.EMPTY),$=W.NORMAL):(L=new $a(q.EMPTY,{program:yi.from(aA,oA),uniforms:{uFWidth:0}}),$=W.NORMAL_NPM);const O=new Xa(V,L);O.blendMode=$,k={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:O,vertices:null,uvs:null,indices:null}}k.index=0,k.indexCount=0,k.vertexCount=0,k.uvsCount=0,k.total=0;const{_textureCache:U}=this;U[P]=U[P]||new q(C.baseTexture),k.mesh.texture=U[P],k.mesh.tint=this._tintColor.value,A.push(k),T[P]=k}T[P].total++}for(let R=0;R<I.length;R++)A.includes(I[R])||this.removeChild(I[R].mesh);for(let R=0;R<A.length;R++)A[R].mesh.parent!==this&&this.addChild(A[R].mesh);this._activePagesMeshData=A;for(const R in T){const C=T[R],P=C.total;if(!(((M=C.indices)==null?void 0:M.length)>6*P)||C.vertices.length<Xa.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*P),C.uvs=new Float32Array(4*2*P),C.indices=new Uint16Array(6*P);else{const k=C.total,U=C.vertices;for(let V=k*4*2;V<U.length;V++)U[V]=0}C.mesh.size=6*P}for(let R=0;R<E;R++){const C=n[R];let P=C.position.x+w[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(P=Math.round(P));const k=P*s,U=C.position.y*s,V=C.texture,L=T[V.baseTexture.uid],$=V.frame,O=V._uvs,N=L.index++;L.indices[N*6+0]=0+N*4,L.indices[N*6+1]=1+N*4,L.indices[N*6+2]=2+N*4,L.indices[N*6+3]=0+N*4,L.indices[N*6+4]=2+N*4,L.indices[N*6+5]=3+N*4,L.vertices[N*8+0]=k,L.vertices[N*8+1]=U,L.vertices[N*8+2]=k+$.width*s,L.vertices[N*8+3]=U,L.vertices[N*8+4]=k+$.width*s,L.vertices[N*8+5]=U+$.height*s,L.vertices[N*8+6]=k,L.vertices[N*8+7]=U+$.height*s,L.uvs[N*8+0]=O.x0,L.uvs[N*8+1]=O.y0,L.uvs[N*8+2]=O.x1,L.uvs[N*8+3]=O.y1,L.uvs[N*8+4]=O.x2,L.uvs[N*8+5]=O.y2,L.uvs[N*8+6]=O.x3,L.uvs[N*8+7]=O.y3}this._textWidth=p*s,this._textHeight=(i.y+t.lineHeight)*s;for(const R in T){const C=T[R];if(this.anchor.x!==0||this.anchor.y!==0){let V=0;const L=this._textWidth*this.anchor.x,$=this._textHeight*this.anchor.y;for(let O=0;O<C.total;O++)C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$}this._maxLineHeight=y*s;const P=C.mesh.geometry.getBuffer("aVertexPosition"),k=C.mesh.geometry.getBuffer("aTextureCoord"),U=C.mesh.geometry.getIndex();P.data=C.vertices,k.data=C.uvs,U.data=C.indices,P.update(),k.update(),U.update()}for(let R=0;R<n.length;R++)Km.push(n[R]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:s,size:i}=Yi.available[this._fontName];if(s!=="none"){const{a:n,b:a,c:h,d:o}=this.worldTransform,l=Math.sqrt(n*n+a*a),u=Math.sqrt(h*h+o*o),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/i,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=c*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=Yi.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!Yi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Yi.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,s=Yi.available[this._fontName].distanceFieldType==="none"?qm:Zm;s.push(...this._activePagesMeshData);for(const i of this._activePagesMeshData)this.removeChild(i.mesh);this._activePagesMeshData=[],s.filter(i=>e[i.mesh.texture.baseTexture.uid]).forEach(i=>{i.mesh.texture=q.EMPTY});for(const i in e)e[i].destroy(),delete e[i];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Qm.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let lA=Qm;const hA=[".xml",".fnt"],cA={extension:{type:H.LoadParser,priority:Ne.Normal},name:"loadBitmapFont",test(r){return hA.includes(bt.extname(r).toLowerCase())},async testParse(r){return Za.test(r)||vc.test(r)},async parse(r,t,e){const s=Za.test(r)?Za.parse(r):vc.parse(r),{src:i}=t,{page:n}=s,a=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=bt.join(bt.dirname(i),u);c=sc(c,i),a.push(c)}const h=await e.load(a),o=a.map(l=>h[l]);return Yi.install(s,o,!0)},async load(r,t){return(await z.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};K.add(cA);const wc=class Nn extends vi{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Nn(Object.keys(Nn.defaultOptions).reduce((e,s)=>({...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 Nn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=Nn;if(s[t]){const i=s[t];return this._fonts.push(i),i.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.ADAPTER.fetch(t).then(i=>i.blob()).then(async i=>new Promise((n,a)=>{const h=URL.createObjectURL(i),o=new FileReader;o.onload=()=>n([h,o.result]),o.onerror=a,o.readAsDataURL(i)})).then(async([i,n])=>{const a=Object.assign({family:bt.basename(t,bt.extname(t)),weight:"normal",style:"normal",display:"auto",src:i,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const h=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=h,await h.load(),document.fonts.add(h),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}
1141
1141
  @font-face {
1142
1142
  font-family: "${e.family}";
1143
1143
  src: url('${e.dataSrc}');
1144
1144
  font-weight: ${e.weight};
1145
1145
  font-style: ${e.style};
1146
1146
  font-display: ${e.display};
1147
- }`,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=eo(t)),typeof t=="number"?jb(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,Nn.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}=z.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}};Ac.availableFonts={},Ac.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 Sc=Ac;const Qa=class Vn extends qe{constructor(t="",e={}){super(q.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const s=new Image,i=q.from(s,{scaleMode:z.SCALE_MODE,resourceOptions:{autoLoad:!1}});i.orig=new it,i.trim=new it,this.texture=i;const n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",h=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),u=document.createElementNS(a,"style");o.setAttribute("width","10000"),o.setAttribute("height","10000"),o.style.overflow="hidden",h.appendChild(o),this.maxWidth=Vn.defaultMaxWidth,this.maxHeight=Vn.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=h,this._foreignObject=o,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=s,this._loadImage=new Image,this._autoResolution=Vn.defaultAutoResolution,this._resolution=Vn.defaultResolution??z.RESOLUTION,this.text=t,this.style=e}measureText(t){var u,c;const{text:e,style:s,resolution:i}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:s.toCSS(i)}),this._styleElement.textContent=s.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:a,height:h}=n;(a>this.maxWidth||h>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const o=Math.min(this.maxWidth,Math.ceil(a)),l=Math.min(this.maxHeight,Math.ceil(h));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),s!==this._style&&(Object.assign(this._domElement,{style:(u=this._style)==null?void 0:u.toCSS(i)}),this._styleElement.textContent=(c=this._style)==null?void 0:c.toGlobalCSS()),{width:o+s.padding*2,height:l+s.padding*2}}async updateText(t=!0){const{style:e,_image:s,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();s.width=i.width=Math.ceil(Math.max(1,n)),s.height=i.height=Math.ceil(Math.max(1,a)),this._updateID++;const h=this._updateID;await new Promise(o=>{i.onload=async()=>{if(h<this._updateID){o();return}await e.onBeforeDraw(),s.src=i.src,i.onload=null,i.src="",this.updateTexture(),o()};const l=new XMLSerializer().serializeToString(this._svgRoot);i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:s,resolution:i}=this,{padding:n}=t,{baseTexture:a}=e;e.trim.width=e._frame.width=s.width/i,e.trim.height=e._frame.height=s.height/i,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),a.setRealSize(s.width,s.height,i),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var s,i,n,a,h;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Vn.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((s=this._style)==null||s.cleanFonts()),this._style=e,(i=this._svgRoot)==null||i.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(a=this._foreignObject)==null||a.remove(),this._foreignObject=e,(h=this._styleElement)==null||h.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=Di(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=Di(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&(t=t||{},t instanceof Sc?(this.ownsStyle=!1,this._style=t):t instanceof vi?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Sc.from(t)):(this.ownsStyle=!0,this._style=new Sc(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};Qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qa.defaultMaxWidth=2024,Qa.defaultMaxHeight=2024,Qa.defaultAutoResolution=!0;class hA{constructor(t,e){this._fontName=t,this._defaultFontSize=e}createText(t,e){return new oA(t.toString(),{fontName:this._fontName,fontSize:this._defaultFontSize||e})}}function bi(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function rg(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
1147
+ }`,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=eo(t)),typeof t=="number"?Zb(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,Nn.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}=z.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}};wc.availableFonts={},wc.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 Ec=wc;const Qa=class Vn extends qe{constructor(t="",e={}){super(q.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const s=new Image,i=q.from(s,{scaleMode:z.SCALE_MODE,resourceOptions:{autoLoad:!1}});i.orig=new it,i.trim=new it,this.texture=i;const n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",h=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),u=document.createElementNS(a,"style");o.setAttribute("width","10000"),o.setAttribute("height","10000"),o.style.overflow="hidden",h.appendChild(o),this.maxWidth=Vn.defaultMaxWidth,this.maxHeight=Vn.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=h,this._foreignObject=o,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=s,this._loadImage=new Image,this._autoResolution=Vn.defaultAutoResolution,this._resolution=Vn.defaultResolution??z.RESOLUTION,this.text=t,this.style=e}measureText(t){var u,c;const{text:e,style:s,resolution:i}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:s.toCSS(i)}),this._styleElement.textContent=s.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:a,height:h}=n;(a>this.maxWidth||h>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const o=Math.min(this.maxWidth,Math.ceil(a)),l=Math.min(this.maxHeight,Math.ceil(h));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),s!==this._style&&(Object.assign(this._domElement,{style:(u=this._style)==null?void 0:u.toCSS(i)}),this._styleElement.textContent=(c=this._style)==null?void 0:c.toGlobalCSS()),{width:o+s.padding*2,height:l+s.padding*2}}async updateText(t=!0){const{style:e,_image:s,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();s.width=i.width=Math.ceil(Math.max(1,n)),s.height=i.height=Math.ceil(Math.max(1,a)),this._updateID++;const h=this._updateID;await new Promise(o=>{i.onload=async()=>{if(h<this._updateID){o();return}await e.onBeforeDraw(),s.src=i.src,i.onload=null,i.src="",this.updateTexture(),o()};const l=new XMLSerializer().serializeToString(this._svgRoot);i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:s,resolution:i}=this,{padding:n}=t,{baseTexture:a}=e;e.trim.width=e._frame.width=s.width/i,e.trim.height=e._frame.height=s.height/i,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),a.setRealSize(s.width,s.height,i),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var s,i,n,a,h;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Vn.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((s=this._style)==null||s.cleanFonts()),this._style=e,(i=this._svgRoot)==null||i.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(a=this._foreignObject)==null||a.remove(),this._foreignObject=e,(h=this._styleElement)==null||h.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=Di(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=Di(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&(t=t||{},t instanceof Ec?(this.ownsStyle=!1,this._style=t):t instanceof vi?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Ec.from(t)):(this.ownsStyle=!0,this._style=new Ec(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};Qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qa.defaultMaxWidth=2024,Qa.defaultMaxHeight=2024,Qa.defaultAutoResolution=!0;class uA{constructor(t,e){this._fontName=t,this._defaultFontSize=e}createText(t,e){return new lA(t.toString(),{fontName:this._fontName,fontSize:this._defaultFontSize||e})}}function bi(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Jm(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
1148
1148
  * GSAP 3.12.5
1149
1149
  * https://gsap.com
1150
1150
  *
@@ -1152,7 +1152,7 @@ void main(void)\r
1152
1152
  * Subject to the terms at https://gsap.com/standard-license or for
1153
1153
  * Club GSAP members, the agreement issued with that membership.
1154
1154
  * @author: Jack Doyle, jack@greensock.com
1155
- */var Ze={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},_n={duration:.5,overwrite:!1,delay:0},Cc,Ae,Dt,cs=1e8,Ft=1/cs,Ic=Math.PI*2,cA=Ic/4,uA=0,ng=Math.sqrt,dA=Math.cos,fA=Math.sin,me=function(t){return typeof t=="string"},Zt=function(t){return typeof t=="function"},wi=function(t){return typeof t=="number"},Pc=function(t){return typeof t>"u"},Js=function(t){return typeof t=="object"},Ve=function(t){return t!==!1},Rc=function(){return typeof window<"u"},Ja=function(t){return Zt(t)||me(t)},og=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Se=Array.isArray,Mc=/(?:-?\.?\d|\.)+/gi,ag=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,yn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Fc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,lg=/[+-]=-?[.\d]+/,hg=/[^,'"\[\]\s]+/gi,pA=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ut,ti,kc,Bc,Ke={},tl={},cg,ug=function(t){return(tl=Pr(t,Ke))&&Xe},Dc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},co=function(t,e){return!e&&console.warn(t)},dg=function(t,e){return t&&(Ke[t]=e)&&tl&&(tl[t]=e)||Ke},uo=function(){return 0},mA={suppressEvents:!0,isStart:!0,kill:!1},el={suppressEvents:!0,kill:!1},gA={suppressEvents:!0},Oc={},Wi=[],Lc={},fg,Qe={},Nc={},pg=30,sl=[],Vc="",Uc=function(t){var e=t[0],s,i;if(Js(e)||Zt(e)||(t=[t]),!(s=(e._gsap||{}).harness)){for(i=sl.length;i--&&!sl[i].targetTest(e););s=sl[i]}for(i=t.length;i--;)t[i]&&(t[i]._gsap||(t[i]._gsap=new $g(t[i],s)))||t.splice(i,1);return t},Ir=function(t){return t._gsap||Uc(fs(t))[0]._gsap},mg=function(t,e,s){return(s=t[e])&&Zt(s)?t[e]():Pc(s)&&t.getAttribute&&t.getAttribute(e)||s},Ue=function(t,e){return(t=t.split(",")).forEach(e)||t},te=function(t){return Math.round(t*1e5)/1e5||0},ge=function(t){return Math.round(t*1e7)/1e7||0},xn=function(t,e){var s=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),s==="+"?t+i:s==="-"?t-i:s==="*"?t*i:t/i},_A=function(t,e){for(var s=e.length,i=0;t.indexOf(e[i])<0&&++i<s;);return i<s},il=function(){var t=Wi.length,e=Wi.slice(0),s,i;for(Lc={},Wi.length=0,s=0;s<t;s++)i=e[s],i&&i._lazy&&(i.render(i._lazy[0],i._lazy[1],!0)._lazy=0)},gg=function(t,e,s,i){Wi.length&&!Ae&&il(),t.render(e,s,i||Ae&&e<0&&(t._initted||t._startAt)),Wi.length&&!Ae&&il()},_g=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(hg).length<2?e:me(t)?t.trim():t},yg=function(t){return t},us=function(t,e){for(var s in e)s in t||(t[s]=e[s]);return t},yA=function(t){return function(e,s){for(var i in s)i in e||i==="duration"&&t||i==="ease"||(e[i]=s[i])}},Pr=function(t,e){for(var s in e)t[s]=e[s];return t},xg=function r(t,e){for(var s in e)s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(t[s]=Js(e[s])?r(t[s]||(t[s]={}),e[s]):e[s]);return t},rl=function(t,e){var s={},i;for(i in t)i in e||(s[i]=t[i]);return s},fo=function(t){var e=t.parent||Ut,s=t.keyframes?yA(Se(t.keyframes)):us;if(Ve(t.inherit))for(;e;)s(t,e.vars.defaults),e=e.parent||e._dp;return t},xA=function(t,e){for(var s=t.length,i=s===e.length;i&&s--&&t[s]===e[s];);return s<0},vg=function(t,e,s,i,n){s===void 0&&(s="_first"),i===void 0&&(i="_last");var a=t[i],h;if(n)for(h=e[n];a&&a[n]>h;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[s],t[s]=e),e._next?e._next._prev=e:t[i]=e,e._prev=a,e.parent=e._dp=t,e},nl=function(t,e,s,i){s===void 0&&(s="_first"),i===void 0&&(i="_last");var n=e._prev,a=e._next;n?n._next=a:t[s]===e&&(t[s]=a),a?a._prev=n:t[i]===e&&(t[i]=n),e._next=e._prev=e.parent=null},zi=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Rr=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var s=t;s;)s._dirty=1,s=s.parent;return t},vA=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Gc=function(t,e,s,i){return t._startAt&&(Ae?t._startAt.revert(el):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},bA=function r(t){return!t||t._ts&&r(t.parent)},bg=function(t){return t._repeat?vn(t._tTime,t=t.duration()+t._rDelay)*t:0},vn=function(t,e){var s=Math.floor(t/=e);return t&&s===t?s-1:s},ol=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},al=function(t){return t._end=ge(t._start+(t._tDur/Math.abs(t._ts||t._rts||Ft)||0))},ll=function(t,e){var s=t._dp;return s&&s.smoothChildTiming&&t._ts&&(t._start=ge(s._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),al(t),s._dirty||Rr(s,t)),t},wg=function(t,e){var s;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(s=ol(t.rawTime(),e),(!e._dur||mo(0,e.totalDuration(),s)-e._tTime>Ft)&&e.render(s,!0)),Rr(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(s=t;s._dp;)s.rawTime()>=0&&s.totalTime(s._tTime),s=s._dp;t._zTime=-Ft}},ei=function(t,e,s,i){return e.parent&&zi(e),e._start=ge((wi(s)?s:s||t!==Ut?ds(t,s,e):t._time)+e._delay),e._end=ge(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),vg(t,e,"_first","_last",t._sort?"_start":0),Xc(e)||(t._recent=e),i||wg(t,e),t._ts<0&&ll(t,t._tTime),t},Eg=function(t,e){return(Ke.ScrollTrigger||Dc("scrollTrigger",e))&&Ke.ScrollTrigger.create(e,t)},Tg=function(t,e,s,i,n){if(Kc(t,e,n),!t._initted)return 1;if(!s&&t._pt&&!Ae&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&fg!==ts.frame)return Wi.push(t),t._lazy=[n,i],1},wA=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Xc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},EA=function(t,e,s,i){var n=t.ratio,a=e<0||!e&&(!t._start&&wA(t)&&!(!t._initted&&Xc(t))||(t._ts<0||t._dp._ts<0)&&!Xc(t))?0:1,h=t._rDelay,o=0,l,u,c;if(h&&t._repeat&&(o=mo(0,t._tDur,e),u=vn(o,h),t._yoyo&&u&1&&(a=1-a),u!==vn(t._tTime,h)&&(n=1-a,t.vars.repeatRefresh&&t._initted&&t.invalidate())),a!==n||Ae||i||t._zTime===Ft||!e&&t._zTime){if(!t._initted&&Tg(t,e,i,s,o))return;for(c=t._zTime,t._zTime=e||(s?Ft:0),s||(s=e&&!c),t.ratio=a,t._from&&(a=1-a),t._time=0,t._tTime=o,l=t._pt;l;)l.r(a,l.d),l=l._next;e<0&&Gc(t,e,s,!0),t._onUpdate&&!s&&Je(t,"onUpdate"),o&&t._repeat&&!s&&t.parent&&Je(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===a&&(a&&zi(t,1),!s&&!Ae&&(Je(t,a?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},TA=function(t,e,s){var i;if(s>e)for(i=t._first;i&&i._start<=s;){if(i.data==="isPause"&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=s;){if(i.data==="isPause"&&i._start<e)return i;i=i._prev}},bn=function(t,e,s,i){var n=t._repeat,a=ge(e)||0,h=t._tTime/t._tDur;return h&&!i&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:ge(a*(n+1)+t._rDelay*n):a,h>0&&!i&&ll(t,t._tTime=t._tDur*h),t.parent&&al(t),s||Rr(t.parent,t),t},Ag=function(t){return t instanceof Me?Rr(t):bn(t,t._dur)},AA={_start:0,endTime:uo,totalDuration:uo},ds=function r(t,e,s){var i=t.labels,n=t._recent||AA,a=t.duration()>=cs?n.endTime(!1):t._dur,h,o,l;return me(e)&&(isNaN(e)||e in i)?(o=e.charAt(0),l=e.substr(-1)==="%",h=e.indexOf("="),o==="<"||o===">"?(h>=0&&(e=e.replace(/=/,"")),(o==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(h<0?n:s).totalDuration()/100:1)):h<0?(e in i||(i[e]=a),i[e]):(o=parseFloat(e.charAt(h-1)+e.substr(h+1)),l&&s&&(o=o/100*(Se(s)?s[0]:s).totalDuration()),h>1?r(t,e.substr(0,h-1),s)+o:a+o)):e==null?a:+e},po=function(t,e,s){var i=wi(e[1]),n=(i?2:1)+(t<2?0:1),a=e[n],h,o;if(i&&(a.duration=e[1]),a.parent=s,t){for(h=a,o=s;o&&!("immediateRender"in h);)h=o.vars.defaults||{},o=Ve(o.vars.inherit)&&o.parent;a.immediateRender=Ve(h.immediateRender),t<2?a.runBackwards=1:a.startAt=e[n-1]}return new re(e[0],a,e[n+1])},ji=function(t,e){return t||t===0?e(t):e},mo=function(t,e,s){return s<t?t:s>e?e:s},Ce=function(t,e){return!me(t)||!(e=pA.exec(t))?"":e[1]},SA=function(t,e,s){return ji(s,function(i){return mo(t,e,i)})},$c=[].slice,Sg=function(t,e){return t&&Js(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Js(t[0]))&&!t.nodeType&&t!==ti},CA=function(t,e,s){return s===void 0&&(s=[]),t.forEach(function(i){var n;return me(i)&&!e||Sg(i,1)?(n=s).push.apply(n,fs(i)):s.push(i)})||s},fs=function(t,e,s){return Dt&&!e&&Dt.selector?Dt.selector(t):me(t)&&!s&&(kc||!En())?$c.call((e||Bc).querySelectorAll(t),0):Se(t)?CA(t,s):Sg(t)?$c.call(t,0):t?[t]:[]},Hc=function(t){return t=fs(t)[0]||co("Invalid scope")||{},function(e){var s=t.current||t.nativeElement||t;return fs(e,s.querySelectorAll?s:s===t?co("Invalid scope")||Bc.createElement("div"):t)}},Cg=function(t){return t.sort(function(){return .5-Math.random()})},Ig=function(t){if(Zt(t))return t;var e=Js(t)?t:{each:t},s=Mr(e.ease),i=e.from||0,n=parseFloat(e.base)||0,a={},h=i>0&&i<1,o=isNaN(i)||h,l=e.axis,u=i,c=i;return me(i)?u=c={center:.5,edges:.5,end:1}[i]||0:!h&&o&&(u=i[0],c=i[1]),function(d,f,p){var m=(p||e).length,g=a[m],_,x,y,v,b,w,E,T,A;if(!g){if(A=e.grid==="auto"?0:(e.grid||[1,cs])[1],!A){for(E=-cs;E<(E=p[A++].getBoundingClientRect().left)&&A<m;);A<m&&A--}for(g=a[m]=[],_=o?Math.min(A,m)*u-.5:i%A,x=A===cs?0:o?m*c/A-.5:i/A|0,E=0,T=cs,w=0;w<m;w++)y=w%A-_,v=x-(w/A|0),g[w]=b=l?Math.abs(l==="y"?v:y):ng(y*y+v*v),b>E&&(E=b),b<T&&(T=b);i==="random"&&Cg(g),g.max=E-T,g.min=T,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(A>m?m-1:l?l==="y"?m/A:A:Math.max(A,m/A))||0)*(i==="edges"?-1:1),g.b=m<0?n-m:n,g.u=Ce(e.amount||e.each)||0,s=s&&m<0?Ug(s):s}return m=(g[d]-g.min)/g.max||0,ge(g.b+(s?s(m):m)*g.v)+g.u}},Yc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(s){var i=ge(Math.round(parseFloat(s)/t)*t*e);return(i-i%1)/e+(wi(s)?0:Ce(s))}},Pg=function(t,e){var s=Se(t),i,n;return!s&&Js(t)&&(i=s=t.radius||cs,t.values?(t=fs(t.values),(n=!wi(t[0]))&&(i*=i)):t=Yc(t.increment)),ji(e,s?Zt(t)?function(a){return n=t(a),Math.abs(n-a)<=i?n:a}:function(a){for(var h=parseFloat(n?a.x:a),o=parseFloat(n?a.y:0),l=cs,u=0,c=t.length,d,f;c--;)n?(d=t[c].x-h,f=t[c].y-o,d=d*d+f*f):d=Math.abs(t[c]-h),d<l&&(l=d,u=c);return u=!i||l<=i?t[u]:a,n||u===a||wi(a)?u:u+Ce(a)}:Yc(t))},Rg=function(t,e,s,i){return ji(Se(t)?!e:s===!0?!!(s=0):!i,function(){return Se(t)?t[~~(Math.random()*t.length)]:(s=s||1e-5)&&(i=s<1?Math.pow(10,(s+"").length-2):1)&&Math.floor(Math.round((t-s/2+Math.random()*(e-t+s*.99))/s)*s*i)/i})},IA=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return function(i){return e.reduce(function(n,a){return a(n)},i)}},PA=function(t,e){return function(s){return t(parseFloat(s))+(e||Ce(s))}},RA=function(t,e,s){return Fg(t,e,0,1,s)},Mg=function(t,e,s){return ji(s,function(i){return t[~~e(i)]})},MA=function r(t,e,s){var i=e-t;return Se(t)?Mg(t,r(0,t.length),e):ji(s,function(n){return(i+(n-t)%i)%i+t})},FA=function r(t,e,s){var i=e-t,n=i*2;return Se(t)?Mg(t,r(0,t.length-1),e):ji(s,function(a){return a=(n+(a-t)%n)%n||0,t+(a>i?n-a:a)})},go=function(t){for(var e=0,s="",i,n,a,h;~(i=t.indexOf("random(",e));)a=t.indexOf(")",i),h=t.charAt(i+7)==="[",n=t.substr(i+7,a-i-7).match(h?hg:Mc),s+=t.substr(e,i-e)+Rg(h?n:+n[0],h?0:+n[1],+n[2]||1e-5),e=a+1;return s+t.substr(e,t.length-e)},Fg=function(t,e,s,i,n){var a=e-t,h=i-s;return ji(n,function(o){return s+((o-t)/a*h||0)})},kA=function r(t,e,s,i){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var a=me(t),h={},o,l,u,c,d;if(s===!0&&(i=1)&&(s=null),a)t={p:t},e={p:e};else if(Se(t)&&!Se(e)){for(u=[],c=t.length,d=c-2,l=1;l<c;l++)u.push(r(t[l-1],t[l]));c--,n=function(p){p*=c;var m=Math.min(d,~~p);return u[m](p-m)},s=e}else i||(t=Pr(Se(t)?[]:{},t));if(!u){for(o in e)qc.call(h,t,o,"get",e[o]);n=function(p){return tu(p,h)||(a?t.p:t)}}}return ji(s,n)},kg=function(t,e,s){var i=t.labels,n=cs,a,h,o;for(a in i)h=i[a]-e,h<0==!!s&&h&&n>(h=Math.abs(h))&&(o=a,n=h);return o},Je=function(t,e,s){var i=t.vars,n=i[e],a=Dt,h=t._ctx,o,l,u;if(n)return o=i[e+"Params"],l=i.callbackScope||t,s&&Wi.length&&il(),h&&(Dt=h),u=o?n.apply(l,o):n.call(l),Dt=a,u},_o=function(t){return zi(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Ae),t.progress()<1&&Je(t,"onInterrupt"),t},wn,Bg=[],Dg=function(t){if(t)if(t=!t.name&&t.default||t,Rc()||t.headless){var e=t.name,s=Zt(t),i=e&&!s&&t.init?function(){this._props=[]}:t,n={init:uo,render:tu,add:qc,kill:qA,modifier:jA,rawVars:0},a={targetTest:0,get:0,getSetter:Jc,aliases:{},register:0};if(En(),t!==i){if(Qe[e])return;us(i,us(rl(t,n),a)),Pr(i.prototype,Pr(n,rl(t,a))),Qe[i.prop=e]=i,t.targetTest&&(sl.push(i),Oc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}dg(e,i),t.register&&t.register(Xe,i,Ge)}else Bg.push(t)},Pt=255,yo={aqua:[0,Pt,Pt],lime:[0,Pt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Pt],navy:[0,0,128],white:[Pt,Pt,Pt],olive:[128,128,0],yellow:[Pt,Pt,0],orange:[Pt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Pt,0,0],pink:[Pt,192,203],cyan:[0,Pt,Pt],transparent:[Pt,Pt,Pt,0]},Wc=function(t,e,s){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(s-e)*t*6:t<.5?s:t*3<2?e+(s-e)*(2/3-t)*6:e)*Pt+.5|0},Og=function(t,e,s){var i=t?wi(t)?[t>>16,t>>8&Pt,t&Pt]:0:yo.black,n,a,h,o,l,u,c,d,f,p;if(!i){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),yo[t])i=yo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),a=t.charAt(2),h=t.charAt(3),t="#"+n+n+a+a+h+h+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return i=parseInt(t.substr(1,6),16),[i>>16,i>>8&Pt,i&Pt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),i=[t>>16,t>>8&Pt,t&Pt]}else if(t.substr(0,3)==="hsl"){if(i=p=t.match(Mc),!e)o=+i[0]%360/360,l=+i[1]/100,u=+i[2]/100,a=u<=.5?u*(l+1):u+l-u*l,n=u*2-a,i.length>3&&(i[3]*=1),i[0]=Wc(o+1/3,n,a),i[1]=Wc(o,n,a),i[2]=Wc(o-1/3,n,a);else if(~t.indexOf("="))return i=t.match(ag),s&&i.length<4&&(i[3]=1),i}else i=t.match(Mc)||yo.transparent;i=i.map(Number)}return e&&!p&&(n=i[0]/Pt,a=i[1]/Pt,h=i[2]/Pt,c=Math.max(n,a,h),d=Math.min(n,a,h),u=(c+d)/2,c===d?o=l=0:(f=c-d,l=u>.5?f/(2-c-d):f/(c+d),o=c===n?(a-h)/f+(a<h?6:0):c===a?(h-n)/f+2:(n-a)/f+4,o*=60),i[0]=~~(o+.5),i[1]=~~(l*100+.5),i[2]=~~(u*100+.5)),s&&i.length<4&&(i[3]=1),i},Lg=function(t){var e=[],s=[],i=-1;return t.split(qi).forEach(function(n){var a=n.match(yn)||[];e.push.apply(e,a),s.push(i+=a.length+1)}),e.c=s,e},Ng=function(t,e,s){var i="",n=(t+i).match(qi),a=e?"hsla(":"rgba(",h=0,o,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=Og(d,e,1))&&a+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),s&&(u=Lg(t),o=s.c,o.join(i)!==u.c.join(i)))for(l=t.replace(qi,"1").split(yn),c=l.length-1;h<c;h++)i+=l[h]+(~o.indexOf(h)?n.shift()||a+"0,0,0,0)":(u.length?u:n.length?n:s).shift());if(!l)for(l=t.split(qi),c=l.length-1;h<c;h++)i+=l[h]+n[h];return i+l[c]},qi=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in yo)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),BA=/hsl[a]?\(/,Vg=function(t){var e=t.join(" "),s;if(qi.lastIndex=0,qi.test(e))return s=BA.test(e),t[1]=Ng(t[1],s),t[0]=Ng(t[0],s,Lg(t[1])),!0},xo,ts=function(){var r=Date.now,t=500,e=33,s=r(),i=s,n=1e3/240,a=n,h=[],o,l,u,c,d,f,p=function m(g){var _=r()-i,x=g===!0,y,v,b,w;if((_>t||_<0)&&(s+=_-e),i+=_,b=i-s,y=b-a,(y>0||x)&&(w=++c.frame,d=b-c.time*1e3,c.time=b=b/1e3,a+=y+(y>=n?4:n-y),v=1),x||(o=l(m)),v)for(f=0;f<h.length;f++)h[f](b,d,w,g)};return c={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){cg&&(!kc&&Rc()&&(ti=kc=window,Bc=ti.document||{},Ke.gsap=Xe,(ti.gsapVersions||(ti.gsapVersions=[])).push(Xe.version),ug(tl||ti.GreenSockGlobals||!ti.gsap&&ti||{}),Bg.forEach(Dg)),u=typeof requestAnimationFrame<"u"&&requestAnimationFrame,o&&c.sleep(),l=u||function(g){return setTimeout(g,a-c.time*1e3+1|0)},xo=1,p(2))},sleep:function(){(u?cancelAnimationFrame:clearTimeout)(o),xo=0,l=uo},lagSmoothing:function(g,_){t=g||1/0,e=Math.min(_||33,t)},fps:function(g){n=1e3/(g||240),a=c.time*1e3+n},add:function(g,_,x){var y=_?function(v,b,w,E){g(v,b,w,E),c.remove(y)}:g;return c.remove(g),h[x?"unshift":"push"](y),En(),y},remove:function(g,_){~(_=h.indexOf(g))&&h.splice(_,1)&&f>=_&&f--},_listeners:h},c}(),En=function(){return!xo&&ts.wake()},ut={},DA=/^[\d.\-M][\d.\-,\s]/,OA=/["']/g,LA=function(t){for(var e={},s=t.substr(1,t.length-3).split(":"),i=s[0],n=1,a=s.length,h,o,l;n<a;n++)o=s[n],h=n!==a-1?o.lastIndexOf(","):o.length,l=o.substr(0,h),e[i]=isNaN(l)?l.replace(OA,"").trim():+l,i=o.substr(h+1).trim();return e},NA=function(t){var e=t.indexOf("(")+1,s=t.indexOf(")"),i=t.indexOf("(",e);return t.substring(e,~i&&i<s?t.indexOf(")",s+1):s)},VA=function(t){var e=(t+"").split("("),s=ut[e[0]];return s&&e.length>1&&s.config?s.config.apply(null,~t.indexOf("{")?[LA(e[1])]:NA(t).split(",").map(_g)):ut._CE&&DA.test(t)?ut._CE("",t):s},Ug=function(t){return function(e){return 1-t(1-e)}},Gg=function r(t,e){for(var s=t._first,i;s;)s instanceof Me?r(s,e):s.vars.yoyoEase&&(!s._yoyo||!s._repeat)&&s._yoyo!==e&&(s.timeline?r(s.timeline,e):(i=s._ease,s._ease=s._yEase,s._yEase=i,s._yoyo=e)),s=s._next},Mr=function(t,e){return t&&(Zt(t)?t:ut[t]||VA(t))||e},Fr=function(t,e,s,i){s===void 0&&(s=function(o){return 1-e(1-o)}),i===void 0&&(i=function(o){return o<.5?e(o*2)/2:1-e((1-o)*2)/2});var n={easeIn:e,easeOut:s,easeInOut:i},a;return Ue(t,function(h){ut[h]=Ke[h]=n,ut[a=h.toLowerCase()]=s;for(var o in n)ut[a+(o==="easeIn"?".in":o==="easeOut"?".out":".inOut")]=ut[h+"."+o]=n[o]}),n},Xg=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},zc=function r(t,e,s){var i=e>=1?e:1,n=(s||(t?.3:.45))/(e<1?e:1),a=n/Ic*(Math.asin(1/i)||0),h=function(u){return u===1?1:i*Math.pow(2,-10*u)*fA((u-a)*n)+1},o=t==="out"?h:t==="in"?function(l){return 1-h(1-l)}:Xg(h);return n=Ic/n,o.config=function(l,u){return r(t,l,u)},o},jc=function r(t,e){e===void 0&&(e=1.70158);var s=function(a){return a?--a*a*((e+1)*a+e)+1:0},i=t==="out"?s:t==="in"?function(n){return 1-s(1-n)}:Xg(s);return i.config=function(n){return r(t,n)},i};Ue("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;Fr(r+",Power"+(e-1),t?function(s){return Math.pow(s,e)}:function(s){return s},function(s){return 1-Math.pow(1-s,e)},function(s){return s<.5?Math.pow(s*2,e)/2:1-Math.pow((1-s)*2,e)/2})}),ut.Linear.easeNone=ut.none=ut.Linear.easeIn,Fr("Elastic",zc("in"),zc("out"),zc()),function(r,t){var e=1/t,s=2*e,i=2.5*e,n=function(h){return h<e?r*h*h:h<s?r*Math.pow(h-1.5/t,2)+.75:h<i?r*(h-=2.25/t)*h+.9375:r*Math.pow(h-2.625/t,2)+.984375};Fr("Bounce",function(a){return 1-n(1-a)},n)}(7.5625,2.75),Fr("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),Fr("Circ",function(r){return-(ng(1-r*r)-1)}),Fr("Sine",function(r){return r===1?1:-dA(r*cA)+1}),Fr("Back",jc("in"),jc("out"),jc()),ut.SteppedEase=ut.steps=Ke.SteppedEase={config:function(t,e){t===void 0&&(t=1);var s=1/t,i=t+(e?0:1),n=e?1:0,a=1-Ft;return function(h){return((i*mo(0,a,h)|0)+n)*s}}},_n.ease=ut["quad.out"],Ue("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return Vc+=r+","+r+"Params,"});var $g=function(t,e){this.id=uA++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:mg,this.set=e?e.getSetter:Jc},vo=function(){function r(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,bn(this,+e.duration,1,1),this.data=e.data,Dt&&(this._ctx=Dt,Dt.data.push(this)),xo||ts.wake()}var t=r.prototype;return t.delay=function(s){return s||s===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+s-this._delay),this._delay=s,this):this._delay},t.duration=function(s){return arguments.length?this.totalDuration(this._repeat>0?s+(s+this._rDelay)*this._repeat:s):this.totalDuration()&&this._dur},t.totalDuration=function(s){return arguments.length?(this._dirty=0,bn(this,this._repeat<0?s:(s-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(s,i){if(En(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(ll(this,s),!n._dp||n.parent||wg(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&s<this._tDur||this._ts<0&&s>0||!this._tDur&&!s)&&ei(this._dp,this,this._start-this._delay)}return(this._tTime!==s||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===Ft||!s&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=s),gg(this,s,i)),this},t.time=function(s,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),s+bg(this))%(this._dur+this._rDelay)||(s?this._dur:0),i):this._time},t.totalProgress=function(s,i){return arguments.length?this.totalTime(this.totalDuration()*s,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(s,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-s:s)+bg(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(s,i){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(s-1)*n,i):this._repeat?vn(this._tTime,n)+1:1},t.timeScale=function(s,i){if(!arguments.length)return this._rts===-Ft?0:this._rts;if(this._rts===s)return this;var n=this.parent&&this._ts?ol(this.parent._time,this):this._tTime;return this._rts=+s||0,this._ts=this._ps||s===-Ft?0:this._rts,this.totalTime(mo(-Math.abs(this._delay),this._tDur,n),i!==!1),al(this),vA(this)},t.paused=function(s){return arguments.length?(this._ps!==s&&(this._ps=s,s?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(En(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Ft&&(this._tTime-=Ft)))),this):this._ps},t.startTime=function(s){if(arguments.length){this._start=s;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&ei(i,this,s-this._delay),this}return this._start},t.endTime=function(s){return this._start+(Ve(s)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(s){var i=this.parent||this._dp;return i?s&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?ol(i.rawTime(s),this):this._tTime:this._tTime},t.revert=function(s){s===void 0&&(s=gA);var i=Ae;return Ae=s,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(s),this.totalTime(-.01,s.suppressEvents)),this.data!=="nested"&&s.kill!==!1&&this.kill(),Ae=i,this},t.globalTime=function(s){for(var i=this,n=arguments.length?s:i.rawTime();i;)n=i._start+n/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(s):n},t.repeat=function(s){return arguments.length?(this._repeat=s===1/0?-2:s,Ag(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(s){if(arguments.length){var i=this._time;return this._rDelay=s,Ag(this),i?this.time(i):this}return this._rDelay},t.yoyo=function(s){return arguments.length?(this._yoyo=s,this):this._yoyo},t.seek=function(s,i){return this.totalTime(ds(this,s),Ve(i))},t.restart=function(s,i){return this.play().totalTime(s?-this._delay:0,Ve(i))},t.play=function(s,i){return s!=null&&this.seek(s,i),this.reversed(!1).paused(!1)},t.reverse=function(s,i){return s!=null&&this.seek(s||this.totalDuration(),i),this.reversed(!0).paused(!1)},t.pause=function(s,i){return s!=null&&this.seek(s,i),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(s){return arguments.length?(!!s!==this.reversed()&&this.timeScale(-this._rts||(s?-Ft:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Ft,this},t.isActive=function(){var s=this.parent||this._dp,i=this._start,n;return!!(!s||this._ts&&this._initted&&s.isActive()&&(n=s.rawTime(!0))>=i&&n<this.endTime(!0)-Ft)},t.eventCallback=function(s,i,n){var a=this.vars;return arguments.length>1?(i?(a[s]=i,n&&(a[s+"Params"]=n),s==="onUpdate"&&(this._onUpdate=i)):delete a[s],this):a[s]},t.then=function(s){var i=this;return new Promise(function(n){var a=Zt(s)?s:yg,h=function(){var l=i.then;i.then=null,Zt(a)&&(a=a(i))&&(a.then||a===i)&&(i.then=l),n(a),i.then=l};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?h():i._prom=h})},t.kill=function(){_o(this)},r}();us(vo.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ft,_prom:0,_ps:!1,_rts:1});var Me=function(r){rg(t,r);function t(s,i){var n;return s===void 0&&(s={}),n=r.call(this,s)||this,n.labels={},n.smoothChildTiming=!!s.smoothChildTiming,n.autoRemoveChildren=!!s.autoRemoveChildren,n._sort=Ve(s.sortChildren),Ut&&ei(s.parent||Ut,bi(n),i),s.reversed&&n.reverse(),s.paused&&n.paused(!0),s.scrollTrigger&&Eg(bi(n),s.scrollTrigger),n}var e=t.prototype;return e.to=function(i,n,a){return po(0,arguments,this),this},e.from=function(i,n,a){return po(1,arguments,this),this},e.fromTo=function(i,n,a,h){return po(2,arguments,this),this},e.set=function(i,n,a){return n.duration=0,n.parent=this,fo(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new re(i,n,ds(this,a),1),this},e.call=function(i,n,a){return ei(this,re.delayedCall(0,i,n),a)},e.staggerTo=function(i,n,a,h,o,l,u){return a.duration=n,a.stagger=a.stagger||h,a.onComplete=l,a.onCompleteParams=u,a.parent=this,new re(i,a,ds(this,o)),this},e.staggerFrom=function(i,n,a,h,o,l,u){return a.runBackwards=1,fo(a).immediateRender=Ve(a.immediateRender),this.staggerTo(i,n,a,h,o,l,u)},e.staggerFromTo=function(i,n,a,h,o,l,u,c){return h.startAt=a,fo(h).immediateRender=Ve(h.immediateRender),this.staggerTo(i,n,h,o,l,u,c)},e.render=function(i,n,a){var h=this._time,o=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=i<=0?0:ge(i),c=this._zTime<0!=i<0&&(this._initted||!l),d,f,p,m,g,_,x,y,v,b,w,E;if(this!==Ut&&u>o&&i>=0&&(u=o),u!==this._tTime||a||c){if(h!==this._time&&l&&(u+=this._time-h,i+=this._time-h),d=u,v=this._start,y=this._ts,_=!y,c&&(l||(h=this._zTime),(i||!n)&&(this._zTime=i)),this._repeat){if(w=this._yoyo,g=l+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,n,a);if(d=ge(u%g),u===o?(m=this._repeat,d=l):(m=~~(u/g),m&&m===u/g&&(d=l,m--),d>l&&(d=l)),b=vn(this._tTime,g),!h&&this._tTime&&b!==m&&this._tTime-b*g-this._dur<=0&&(b=m),w&&m&1&&(d=l-d,E=1),m!==b&&!this._lock){var T=w&&b&1,A=T===(w&&m&1);if(m<b&&(T=!T),h=T?0:u%l?l:u,this._lock=1,this.render(h||(E?0:ge(m*g)),n,!l)._lock=0,this._tTime=u,!n&&this.parent&&Je(this,"onRepeat"),this.vars.repeatRefresh&&!E&&(this.invalidate()._lock=1),h&&h!==this._time||_!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,o=this._tDur,A&&(this._lock=2,h=T?l:-1e-4,this.render(h,!0),this.vars.repeatRefresh&&!E&&this.invalidate()),this._lock=0,!this._ts&&!_)return this;Gg(this,E)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=TA(this,ge(h),ge(d)),x&&(u-=d-(d=x._start))),this._tTime=u,this._time=d,this._act=!y,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,h=0),!h&&d&&!n&&!m&&(Je(this,"onStart"),this._tTime!==u))return this;if(d>=h&&i>=0)for(f=this._first;f;){if(p=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(i,n,a);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,n,a),d!==this._time||!this._ts&&!_){x=0,p&&(u+=this._zTime=-Ft);break}}f=p}else{f=this._last;for(var I=i<0?i:d;f;){if(p=f._prev,(f._act||I<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(i,n,a);if(f.render(f._ts>0?(I-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(I-f._start)*f._ts,n,a||Ae&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!_){x=0,p&&(u+=this._zTime=I?-Ft:Ft);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=h?0:-Ft)._zTime=d>=h?1:-1,this._ts))return this._start=v,al(this),this.render(i,n,a);this._onUpdate&&!n&&Je(this,"onUpdate",!0),(u===o&&this._tTime>=this.totalDuration()||!u&&h)&&(v===this._start||Math.abs(y)!==Math.abs(this._ts))&&(this._lock||((i||!l)&&(u===o&&this._ts>0||!u&&this._ts<0)&&zi(this,1),!n&&!(i<0&&!h)&&(u||h||!o)&&(Je(this,u===o&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<o&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(i,n){var a=this;if(wi(n)||(n=ds(this,n,i)),!(i instanceof vo)){if(Se(i))return i.forEach(function(h){return a.add(h,n)}),this;if(me(i))return this.addLabel(i,n);if(Zt(i))i=re.delayedCall(0,i);else return this}return this!==i?ei(this,i,n):this},e.getChildren=function(i,n,a,h){i===void 0&&(i=!0),n===void 0&&(n=!0),a===void 0&&(a=!0),h===void 0&&(h=-cs);for(var o=[],l=this._first;l;)l._start>=h&&(l instanceof re?n&&o.push(l):(a&&o.push(l),i&&o.push.apply(o,l.getChildren(!0,n,a)))),l=l._next;return o},e.getById=function(i){for(var n=this.getChildren(1,1,1),a=n.length;a--;)if(n[a].vars.id===i)return n[a]},e.remove=function(i){return me(i)?this.removeLabel(i):Zt(i)?this.killTweensOf(i):(nl(this,i),i===this._recent&&(this._recent=this._last),Rr(this))},e.totalTime=function(i,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ge(ts.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),r.prototype.totalTime.call(this,i,n),this._forcing=0,this):this._tTime},e.addLabel=function(i,n){return this.labels[i]=ds(this,n),this},e.removeLabel=function(i){return delete this.labels[i],this},e.addPause=function(i,n,a){var h=re.delayedCall(0,n||uo,a);return h.data="isPause",this._hasPause=1,ei(this,h,ds(this,i))},e.removePause=function(i){var n=this._first;for(i=ds(this,i);n;)n._start===i&&n.data==="isPause"&&zi(n),n=n._next},e.killTweensOf=function(i,n,a){for(var h=this.getTweensOf(i,a),o=h.length;o--;)Zi!==h[o]&&h[o].kill(i,n);return this},e.getTweensOf=function(i,n){for(var a=[],h=fs(i),o=this._first,l=wi(n),u;o;)o instanceof re?_A(o._targets,h)&&(l?(!Zi||o._initted&&o._ts)&&o.globalTime(0)<=n&&o.globalTime(o.totalDuration())>n:!n||o.isActive())&&a.push(o):(u=o.getTweensOf(h,n)).length&&a.push.apply(a,u),o=o._next;return a},e.tweenTo=function(i,n){n=n||{};var a=this,h=ds(a,i),o=n,l=o.startAt,u=o.onStart,c=o.onStartParams,d=o.immediateRender,f,p=re.to(a,us({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:h,overwrite:"auto",duration:n.duration||Math.abs((h-(l&&"time"in l?l.time:a._time))/a.timeScale())||Ft,onStart:function(){if(a.pause(),!f){var g=n.duration||Math.abs((h-(l&&"time"in l?l.time:a._time))/a.timeScale());p._dur!==g&&bn(p,g,0,1).render(p._time,!0,!0),f=1}u&&u.apply(p,c||[])}},n));return d?p.render(0):p},e.tweenFromTo=function(i,n,a){return this.tweenTo(n,us({startAt:{time:ds(this,i)}},a))},e.recent=function(){return this._recent},e.nextLabel=function(i){return i===void 0&&(i=this._time),kg(this,ds(this,i))},e.previousLabel=function(i){return i===void 0&&(i=this._time),kg(this,ds(this,i),1)},e.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+Ft)},e.shiftChildren=function(i,n,a){a===void 0&&(a=0);for(var h=this._first,o=this.labels,l;h;)h._start>=a&&(h._start+=i,h._end+=i),h=h._next;if(n)for(l in o)o[l]>=a&&(o[l]+=i);return Rr(this)},e.invalidate=function(i){var n=this._first;for(this._lock=0;n;)n.invalidate(i),n=n._next;return r.prototype.invalidate.call(this,i)},e.clear=function(i){i===void 0&&(i=!0);for(var n=this._first,a;n;)a=n._next,this.remove(n),n=a;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),Rr(this)},e.totalDuration=function(i){var n=0,a=this,h=a._last,o=cs,l,u,c;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-i:i));if(a._dirty){for(c=a.parent;h;)l=h._prev,h._dirty&&h.totalDuration(),u=h._start,u>o&&a._sort&&h._ts&&!a._lock?(a._lock=1,ei(a,h,u-h._delay,1)._lock=0):o=u,u<0&&h._ts&&(n-=u,(!c&&!a._dp||c&&c.smoothChildTiming)&&(a._start+=u/a._ts,a._time-=u,a._tTime-=u),a.shiftChildren(-u,!1,-1/0),o=0),h._end>n&&h._ts&&(n=h._end),h=l;bn(a,a===Ut&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},t.updateRoot=function(i){if(Ut._ts&&(gg(Ut,ol(i,Ut)),fg=ts.frame),ts.frame>=pg){pg+=Ze.autoSleep||120;var n=Ut._first;if((!n||!n._ts)&&Ze.autoSleep&&ts._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||ts.sleep()}}},t}(vo);us(Me.prototype,{_lock:0,_hasPause:0,_forcing:0});var UA=function(t,e,s,i,n,a,h){var o=new Ge(this._pt,t,e,0,1,qg,null,n),l=0,u=0,c,d,f,p,m,g,_,x;for(o.b=s,o.e=i,s+="",i+="",(_=~i.indexOf("random("))&&(i=go(i)),a&&(x=[s,i],a(x,t,e),s=x[0],i=x[1]),d=s.match(Fc)||[];c=Fc.exec(i);)p=c[0],m=i.substring(l,c.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==d[u++]&&(g=parseFloat(d[u-1])||0,o._pt={_next:o._pt,p:m||u===1?m:",",s:g,c:p.charAt(1)==="="?xn(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=Fc.lastIndex);return o.c=l<i.length?i.substring(l,i.length):"",o.fp=h,(lg.test(i)||_)&&(o.e=0),this._pt=o,o},qc=function(t,e,s,i,n,a,h,o,l,u){Zt(i)&&(i=i(n||0,t,a));var c=t[e],d=s!=="get"?s:Zt(c)?l?t[e.indexOf("set")||!Zt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,f=Zt(c)?l?YA:zg:Qc,p;if(me(i)&&(~i.indexOf("random(")&&(i=go(i)),i.charAt(1)==="="&&(p=xn(d,i)+(Ce(d)||0),(p||p===0)&&(i=p))),!u||d!==i||Zc)return!isNaN(d*i)&&i!==""?(p=new Ge(this._pt,t,e,+d||0,i-(d||0),typeof c=="boolean"?zA:jg,0,f),l&&(p.fp=l),h&&p.modifier(h,this,t),this._pt=p):(!c&&!(e in t)&&Dc(e,i),UA.call(this,t,e,d,i,f,o||Ze.stringFilter,l))},GA=function(t,e,s,i,n){if(Zt(t)&&(t=bo(t,n,e,s,i)),!Js(t)||t.style&&t.nodeType||Se(t)||og(t))return me(t)?bo(t,n,e,s,i):t;var a={},h;for(h in t)a[h]=bo(t[h],n,e,s,i);return a},Hg=function(t,e,s,i,n,a){var h,o,l,u;if(Qe[t]&&(h=new Qe[t]).init(n,h.rawVars?e[t]:GA(e[t],i,n,a,s),s,i,a)!==!1&&(s._pt=o=new Ge(s._pt,n,t,0,1,h.render,h,0,h.priority),s!==wn))for(l=s._ptLookup[s._targets.indexOf(n)],u=h._props.length;u--;)l[h._props[u]]=o;return h},Zi,Zc,Kc=function r(t,e,s){var i=t.vars,n=i.ease,a=i.startAt,h=i.immediateRender,o=i.lazy,l=i.onUpdate,u=i.runBackwards,c=i.yoyoEase,d=i.keyframes,f=i.autoRevert,p=t._dur,m=t._startAt,g=t._targets,_=t.parent,x=_&&_.data==="nested"?_.vars.targets:g,y=t._overwrite==="auto"&&!Cc,v=t.timeline,b,w,E,T,A,I,M,R,C,P,k,U,V;if(v&&(!d||!n)&&(n="none"),t._ease=Mr(n,_n.ease),t._yEase=c?Ug(Mr(c===!0?n:c,_n.ease)):0,c&&t._yoyo&&!t._repeat&&(c=t._yEase,t._yEase=t._ease,t._ease=c),t._from=!v&&!!i.runBackwards,!v||d&&!i.stagger){if(R=g[0]?Ir(g[0]).harness:0,U=R&&i[R.prop],b=rl(i,Oc),m&&(m._zTime<0&&m.progress(1),e<0&&u&&h&&!f?m.render(-1,!0):m.revert(u&&p?el:mA),m._lazy=0),a){if(zi(t._startAt=re.set(g,us({data:"isStart",overwrite:!1,parent:_,immediateRender:!0,lazy:!m&&Ve(o),startAt:null,delay:0,onUpdate:l&&function(){return Je(t,"onUpdate")},stagger:0},a))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae||!h&&!f)&&t._startAt.revert(el),h&&p&&e<=0&&s<=0){e&&(t._zTime=e);return}}else if(u&&p&&!m){if(e&&(h=!1),E=us({overwrite:!1,data:"isFromStart",lazy:h&&!m&&Ve(o),immediateRender:h,stagger:0,parent:_},b),U&&(E[R.prop]=U),zi(t._startAt=re.set(g,E)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae?t._startAt.revert(el):t._startAt.render(-1,!0)),t._zTime=e,!h)r(t._startAt,Ft,Ft);else if(!e)return}for(t._pt=t._ptCache=0,o=p&&Ve(o)||o&&!p,w=0;w<g.length;w++){if(A=g[w],M=A._gsap||Uc(g)[w]._gsap,t._ptLookup[w]=P={},Lc[M.id]&&Wi.length&&il(),k=x===g?w:x.indexOf(A),R&&(C=new R).init(A,U||b,t,k,x)!==!1&&(t._pt=T=new Ge(t._pt,A,C.name,0,1,C.render,C,0,C.priority),C._props.forEach(function(L){P[L]=T}),C.priority&&(I=1)),!R||U)for(E in b)Qe[E]&&(C=Hg(E,b,t,k,A,x))?C.priority&&(I=1):P[E]=T=qc.call(t,A,E,"get",b[E],k,x,0,i.stringFilter);t._op&&t._op[w]&&t.kill(A,t._op[w]),y&&t._pt&&(Zi=t,Ut.killTweensOf(A,P,t.globalTime(e)),V=!t.parent,Zi=0),t._pt&&o&&(Lc[M.id]=1)}I&&Zg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!V,d&&e<=0&&v.render(cs,!0,!0)},XA=function(t,e,s,i,n,a,h,o){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],u,c,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(u=d[f][e],u&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==e&&u.fp!==e;)u=u._next;if(!u)return Zc=1,t.vars[e]="+=0",Kc(t,h),Zc=0,o?co(e+" not eligible for reset"):1;l.push(u)}for(f=l.length;f--;)c=l[f],u=c._pt||c,u.s=(i||i===0)&&!n?i:u.s+(i||0)+a*u.c,u.c=s-u.s,c.e&&(c.e=te(s)+Ce(c.e)),c.b&&(c.b=u.s+Ce(c.b))},$A=function(t,e){var s=t[0]?Ir(t[0]).harness:0,i=s&&s.aliases,n,a,h,o;if(!i)return e;n=Pr({},e);for(a in i)if(a in n)for(o=i[a].split(","),h=o.length;h--;)n[o[h]]=n[a];return n},HA=function(t,e,s,i){var n=e.ease||i||"power1.inOut",a,h;if(Se(e))h=s[t]||(s[t]=[]),e.forEach(function(o,l){return h.push({t:l/(e.length-1)*100,v:o,e:n})});else for(a in e)h=s[a]||(s[a]=[]),a==="ease"||h.push({t:parseFloat(t),v:e[a],e:n})},bo=function(t,e,s,i,n){return Zt(t)?t.call(e,s,i,n):me(t)&&~t.indexOf("random(")?go(t):t},Yg=Vc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Wg={};Ue(Yg+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return Wg[r]=1});var re=function(r){rg(t,r);function t(s,i,n,a){var h;typeof i=="number"&&(n.duration=i,i=n,n=null),h=r.call(this,a?i:fo(i))||this;var o=h.vars,l=o.duration,u=o.delay,c=o.immediateRender,d=o.stagger,f=o.overwrite,p=o.keyframes,m=o.defaults,g=o.scrollTrigger,_=o.yoyoEase,x=i.parent||Ut,y=(Se(s)||og(s)?wi(s[0]):"length"in i)?[s]:fs(s),v,b,w,E,T,A,I,M;if(h._targets=y.length?Uc(y):co("GSAP target "+s+" not found. https://gsap.com",!Ze.nullTargetWarn)||[],h._ptLookup=[],h._overwrite=f,p||d||Ja(l)||Ja(u)){if(i=h.vars,v=h.timeline=new Me({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:y}),v.kill(),v.parent=v._dp=bi(h),v._start=0,d||Ja(l)||Ja(u)){if(E=y.length,I=d&&Ig(d),Js(d))for(T in d)~Yg.indexOf(T)&&(M||(M={}),M[T]=d[T]);for(b=0;b<E;b++)w=rl(i,Wg),w.stagger=0,_&&(w.yoyoEase=_),M&&Pr(w,M),A=y[b],w.duration=+bo(l,bi(h),b,A,y),w.delay=(+bo(u,bi(h),b,A,y)||0)-h._delay,!d&&E===1&&w.delay&&(h._delay=u=w.delay,h._start+=u,w.delay=0),v.to(A,w,I?I(b,A,y):0),v._ease=ut.none;v.duration()?l=u=0:h.timeline=0}else if(p){fo(us(v.vars.defaults,{ease:"none"})),v._ease=Mr(p.ease||i.ease||"none");var R=0,C,P,k;if(Se(p))p.forEach(function(U){return v.to(y,U,">")}),v.duration();else{w={};for(T in p)T==="ease"||T==="easeEach"||HA(T,p[T],w,p.easeEach);for(T in w)for(C=w[T].sort(function(U,V){return U.t-V.t}),R=0,b=0;b<C.length;b++)P=C[b],k={ease:P.e,duration:(P.t-(b?C[b-1].t:0))/100*l},k[T]=P.v,v.to(y,k,R),R+=k.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||h.duration(l=v.duration())}else h.timeline=0;return f===!0&&!Cc&&(Zi=bi(h),Ut.killTweensOf(y),Zi=0),ei(x,bi(h),n),i.reversed&&h.reverse(),i.paused&&h.paused(!0),(c||!l&&!p&&h._start===ge(x._time)&&Ve(c)&&bA(bi(h))&&x.data!=="nested")&&(h._tTime=-Ft,h.render(Math.max(0,-u)||0)),g&&Eg(bi(h),g),h}var e=t.prototype;return e.render=function(i,n,a){var h=this._time,o=this._tDur,l=this._dur,u=i<0,c=i>o-Ft&&!u?o:i<Ft?0:i,d,f,p,m,g,_,x,y,v;if(!l)EA(this,i,n,a);else if(c!==this._tTime||!i||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u){if(d=c,y=this.timeline,this._repeat){if(m=l+this._rDelay,this._repeat<-1&&u)return this.totalTime(m*100+i,n,a);if(d=ge(c%m),c===o?(p=this._repeat,d=l):(p=~~(c/m),p&&p===ge(c/m)&&(d=l,p--),d>l&&(d=l)),_=this._yoyo&&p&1,_&&(v=this._yEase,d=l-d),g=vn(this._tTime,m),d===h&&!a&&this._initted&&p===g)return this._tTime=c,this;p!==g&&(y&&this._yEase&&Gg(y,_),this.vars.repeatRefresh&&!_&&!this._lock&&this._time!==m&&this._initted&&(this._lock=a=1,this.render(ge(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(Tg(this,u?i:d,a,n,c))return this._tTime=0,this;if(h!==this._time&&!(a&&this.vars.repeatRefresh&&p!==g))return this;if(l!==this._dur)return this.render(i,n,a)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!h&&!n&&!p&&(Je(this,"onStart"),this._tTime!==c))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;y&&y.render(i<0?i:y._dur*y._ease(d/this._dur),n,a)||this._startAt&&(this._zTime=i),this._onUpdate&&!n&&(u&&Gc(this,i,n,a),Je(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&Je(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&Gc(this,i,!0,!0),(i||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&zi(this,1),!n&&!(u&&!h)&&(c||h||_)&&(Je(this,c===o?"onComplete":"onReverseComplete",!0),this._prom&&!(c<o&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),r.prototype.invalidate.call(this,i)},e.resetTo=function(i,n,a,h,o){xo||ts.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),u;return this._initted||Kc(this,l),u=this._ease(l/this._dur),XA(this,i,n,a,h,u,l,o)?this.resetTo(i,n,a,h,1):(ll(this,0),this.parent||vg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(i,n){if(n===void 0&&(n="all"),!i&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?_o(this):this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(i,n,Zi&&Zi.vars.overwrite!==!0)._first||_o(this),this.parent&&a!==this.timeline.totalDuration()&&bn(this,this._dur*this.timeline._tDur/a,0,1),this}var h=this._targets,o=i?fs(i):h,l=this._ptLookup,u=this._pt,c,d,f,p,m,g,_;if((!n||n==="all")&&xA(h,o))return n==="all"&&(this._pt=0),_o(this);for(c=this._op=this._op||[],n!=="all"&&(me(n)&&(m={},Ue(n,function(x){return m[x]=1}),n=m),n=$A(h,n)),_=h.length;_--;)if(~o.indexOf(h[_])){d=l[_],n==="all"?(c[_]=n,p=d,f={}):(f=c[_]=c[_]||{},p=n);for(m in p)g=d&&d[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&nl(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&u&&_o(this),this},t.to=function(i,n){return new t(i,n,arguments[2])},t.from=function(i,n){return po(1,arguments)},t.delayedCall=function(i,n,a,h){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:n,onReverseComplete:n,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:h})},t.fromTo=function(i,n,a){return po(2,arguments)},t.set=function(i,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(i,n)},t.killTweensOf=function(i,n,a){return Ut.killTweensOf(i,n,a)},t}(vo);us(re.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ue("staggerTo,staggerFrom,staggerFromTo",function(r){re[r]=function(){var t=new Me,e=$c.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Qc=function(t,e,s){return t[e]=s},zg=function(t,e,s){return t[e](s)},YA=function(t,e,s,i){return t[e](i.fp,s)},WA=function(t,e,s){return t.setAttribute(e,s)},Jc=function(t,e){return Zt(t[e])?zg:Pc(t[e])&&t.setAttribute?WA:Qc},jg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},zA=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},qg=function(t,e){var s=e._pt,i="";if(!t&&e.b)i=e.b;else if(t===1&&e.e)i=e.e;else{for(;s;)i=s.p+(s.m?s.m(s.s+s.c*t):Math.round((s.s+s.c*t)*1e4)/1e4)+i,s=s._next;i+=e.c}e.set(e.t,e.p,i,e)},tu=function(t,e){for(var s=e._pt;s;)s.r(t,s.d),s=s._next},jA=function(t,e,s,i){for(var n=this._pt,a;n;)a=n._next,n.p===i&&n.modifier(t,e,s),n=a},qA=function(t){for(var e=this._pt,s,i;e;)i=e._next,e.p===t&&!e.op||e.op===t?nl(this,e,"_pt"):e.dep||(s=1),e=i;return!s},ZA=function(t,e,s,i){i.mSet(t,e,i.m.call(i.tween,s,i.mt),i)},Zg=function(t){for(var e=t._pt,s,i,n,a;e;){for(s=e._next,i=n;i&&i.pr>e.pr;)i=i._next;(e._prev=i?i._prev:a)?e._prev._next=e:n=e,(e._next=i)?i._prev=e:a=e,e=s}t._pt=n},Ge=function(){function r(e,s,i,n,a,h,o,l,u){this.t=s,this.s=n,this.c=a,this.p=i,this.r=h||jg,this.d=o||this,this.set=l||Qc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(s,i,n){this.mSet=this.mSet||this.set,this.set=ZA,this.m=s,this.mt=n,this.tween=i},r}();Ue(Vc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(r){return Oc[r]=1}),Ke.TweenMax=Ke.TweenLite=re,Ke.TimelineLite=Ke.TimelineMax=Me,Ut=new Me({sortChildren:!1,defaults:_n,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ze.stringFilter=Vg;var kr=[],hl={},KA=[],Kg=0,QA=0,eu=function(t){return(hl[t]||KA).map(function(e){return e()})},su=function(){var t=Date.now(),e=[];t-Kg>2&&(eu("matchMediaInit"),kr.forEach(function(s){var i=s.queries,n=s.conditions,a,h,o,l;for(h in i)a=ti.matchMedia(i[h]).matches,a&&(o=1),a!==n[h]&&(n[h]=a,l=1);l&&(s.revert(),o&&e.push(s))}),eu("matchMediaRevert"),e.forEach(function(s){return s.onMatch(s,function(i){return s.add(null,i)})}),Kg=t,eu("matchMedia"))},Qg=function(){function r(e,s){this.selector=s&&Hc(s),this.data=[],this._r=[],this.isReverted=!1,this.id=QA++,e&&this.add(e)}var t=r.prototype;return t.add=function(s,i,n){Zt(s)&&(n=i,i=s,s=Zt);var a=this,h=function(){var l=Dt,u=a.selector,c;return l&&l!==a&&l.data.push(a),n&&(a.selector=Hc(n)),Dt=a,c=i.apply(a,arguments),Zt(c)&&a._r.push(c),Dt=l,a.selector=u,a.isReverted=!1,c};return a.last=h,s===Zt?h(a,function(o){return a.add(null,o)}):s?a[s]=h:h},t.ignore=function(s){var i=Dt;Dt=null,s(this),Dt=i},t.getTweens=function(){var s=[];return this.data.forEach(function(i){return i instanceof r?s.push.apply(s,i.getTweens()):i instanceof re&&!(i.parent&&i.parent.data==="nested")&&s.push(i)}),s},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(s,i){var n=this;if(s?function(){for(var h=n.getTweens(),o=n.data.length,l;o--;)l=n.data[o],l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(u){return h.splice(h.indexOf(u),1)}));for(h.map(function(u){return{g:u._dur||u._delay||u._sat&&!u._sat.vars.immediateRender?u.globalTime(0):-1/0,t:u}}).sort(function(u,c){return c.g-u.g||-1/0}).forEach(function(u){return u.t.revert(s)}),o=n.data.length;o--;)l=n.data[o],l instanceof Me?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof re)&&l.revert&&l.revert(s);n._r.forEach(function(u){return u(s,n)}),n.isReverted=!0}():this.data.forEach(function(h){return h.kill&&h.kill()}),this.clear(),i)for(var a=kr.length;a--;)kr[a].id===this.id&&kr.splice(a,1)},t.revert=function(s){this.kill(s||{})},r}(),JA=function(){function r(e){this.contexts=[],this.scope=e,Dt&&Dt.data.push(this)}var t=r.prototype;return t.add=function(s,i,n){Js(s)||(s={matches:s});var a=new Qg(0,n||this.scope),h=a.conditions={},o,l,u;Dt&&!a.selector&&(a.selector=Dt.selector),this.contexts.push(a),i=a.add("onMatch",i),a.queries=s;for(l in s)l==="all"?u=1:(o=ti.matchMedia(s[l]),o&&(kr.indexOf(a)<0&&kr.push(a),(h[l]=o.matches)&&(u=1),o.addListener?o.addListener(su):o.addEventListener("change",su)));return u&&i(a,function(c){return a.add(null,c)}),this},t.revert=function(s){this.kill(s||{})},t.kill=function(s){this.contexts.forEach(function(i){return i.kill(s,!0)})},r}(),cl={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e.forEach(function(i){return Dg(i)})},timeline:function(t){return new Me(t)},getTweensOf:function(t,e){return Ut.getTweensOf(t,e)},getProperty:function(t,e,s,i){me(t)&&(t=fs(t)[0]);var n=Ir(t||{}).get,a=s?yg:_g;return s==="native"&&(s=""),t&&(e?a((Qe[e]&&Qe[e].get||n)(t,e,s,i)):function(h,o,l){return a((Qe[h]&&Qe[h].get||n)(t,h,o,l))})},quickSetter:function(t,e,s){if(t=fs(t),t.length>1){var i=t.map(function(u){return Xe.quickSetter(u,e,s)}),n=i.length;return function(u){for(var c=n;c--;)i[c](u)}}t=t[0]||{};var a=Qe[e],h=Ir(t),o=h.harness&&(h.harness.aliases||{})[e]||e,l=a?function(u){var c=new a;wn._pt=0,c.init(t,s?u+s:u,wn,0,[t]),c.render(1,c),wn._pt&&tu(1,wn)}:h.set(t,o);return a?l:function(u){return l(t,o,s?u+s:u,h,1)}},quickTo:function(t,e,s){var i,n=Xe.to(t,Pr((i={},i[e]="+=0.1",i.paused=!0,i),s||{})),a=function(o,l,u){return n.resetTo(e,o,l,u)};return a.tween=n,a},isTweening:function(t){return Ut.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Mr(t.ease,_n.ease)),xg(_n,t||{})},config:function(t){return xg(Ze,t||{})},registerEffect:function(t){var e=t.name,s=t.effect,i=t.plugins,n=t.defaults,a=t.extendTimeline;(i||"").split(",").forEach(function(h){return h&&!Qe[h]&&!Ke[h]&&co(e+" effect requires "+h+" plugin.")}),Nc[e]=function(h,o,l){return s(fs(h),us(o||{},n),l)},a&&(Me.prototype[e]=function(h,o,l){return this.add(Nc[e](h,Js(o)?o:(l=o)&&{},this),l)})},registerEase:function(t,e){ut[t]=Mr(e)},parseEase:function(t,e){return arguments.length?Mr(t,e):ut},getById:function(t){return Ut.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var s=new Me(t),i,n;for(s.smoothChildTiming=Ve(t.smoothChildTiming),Ut.remove(s),s._dp=0,s._time=s._tTime=Ut._time,i=Ut._first;i;)n=i._next,(e||!(!i._dur&&i instanceof re&&i.vars.onComplete===i._targets[0]))&&ei(s,i,i._start-i._delay),i=n;return ei(Ut,s,0),s},context:function(t,e){return t?new Qg(t,e):Dt},matchMedia:function(t){return new JA(t)},matchMediaRefresh:function(){return kr.forEach(function(t){var e=t.conditions,s,i;for(i in e)e[i]&&(e[i]=!1,s=1);s&&t.revert()})||su()},addEventListener:function(t,e){var s=hl[t]||(hl[t]=[]);~s.indexOf(e)||s.push(e)},removeEventListener:function(t,e){var s=hl[t],i=s&&s.indexOf(e);i>=0&&s.splice(i,1)},utils:{wrap:MA,wrapYoyo:FA,distribute:Ig,random:Rg,snap:Pg,normalize:RA,getUnit:Ce,clamp:SA,splitColor:Og,toArray:fs,selector:Hc,mapRange:Fg,pipe:IA,unitize:PA,interpolate:kA,shuffle:Cg},install:ug,effects:Nc,ticker:ts,updateRoot:Me.updateRoot,plugins:Qe,globalTimeline:Ut,core:{PropTween:Ge,globals:dg,Tween:re,Timeline:Me,Animation:vo,getCache:Ir,_removeLinkedListItem:nl,reverting:function(){return Ae},context:function(t){return t&&Dt&&(Dt.data.push(t),t._ctx=Dt),Dt},suppressOverwrites:function(t){return Cc=t}}};Ue("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return cl[r]=re[r]}),ts.add(Me.updateRoot),wn=cl.to({},{duration:0});var tS=function(t,e){for(var s=t._pt;s&&s.p!==e&&s.op!==e&&s.fp!==e;)s=s._next;return s},eS=function(t,e){var s=t._targets,i,n,a;for(i in e)for(n=s.length;n--;)a=t._ptLookup[n][i],a&&(a=a.d)&&(a._pt&&(a=tS(a,i)),a&&a.modifier&&a.modifier(e[i],t,s[n],i))},iu=function(t,e){return{name:t,rawVars:1,init:function(i,n,a){a._onInit=function(h){var o,l;if(me(n)&&(o={},Ue(n,function(u){return o[u]=1}),n=o),e){o={};for(l in n)o[l]=e(n[l]);n=o}eS(h,n)}}}},Xe=cl.registerPlugin({name:"attr",init:function(t,e,s,i,n){var a,h,o;this.tween=s;for(a in e)o=t.getAttribute(a)||"",h=this.add(t,"setAttribute",(o||0)+"",e[a],i,n,0,0,a),h.op=a,h.b=o,this._props.push(a)},render:function(t,e){for(var s=e._pt;s;)Ae?s.set(s.t,s.p,s.b,s):s.r(t,s.d),s=s._next}},{name:"endArray",init:function(t,e){for(var s=e.length;s--;)this.add(t,s,t[s]||0,e[s],0,0,0,0,0,1)}},iu("roundProps",Yc),iu("modifiers"),iu("snap",Pg))||cl;re.version=Me.version=Xe.version="3.12.5",cg=1,Rc()&&En(),ut.Power0,ut.Power1,ut.Power2,ut.Power3,ut.Power4,ut.Linear,ut.Quad,ut.Cubic,ut.Quart,ut.Quint,ut.Strong,ut.Elastic,ut.Back,ut.SteppedEase,ut.Bounce,ut.Sine,ut.Expo,ut.Circ;/*!
1155
+ */var Ze={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},_n={duration:.5,overwrite:!1,delay:0},Tc,Ae,Dt,cs=1e8,Ft=1/cs,Ac=Math.PI*2,dA=Ac/4,fA=0,tg=Math.sqrt,pA=Math.cos,mA=Math.sin,me=function(t){return typeof t=="string"},Zt=function(t){return typeof t=="function"},wi=function(t){return typeof t=="number"},Sc=function(t){return typeof t>"u"},Js=function(t){return typeof t=="object"},Ve=function(t){return t!==!1},Cc=function(){return typeof window<"u"},Ja=function(t){return Zt(t)||me(t)},eg=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Se=Array.isArray,Ic=/(?:-?\.?\d|\.)+/gi,sg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,yn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Pc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,ig=/[+-]=-?[.\d]+/,rg=/[^,'"\[\]\s]+/gi,gA=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ut,ti,Rc,Mc,Ke={},tl={},ng,og=function(t){return(tl=Pr(t,Ke))&&Xe},Fc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},co=function(t,e){return!e&&console.warn(t)},ag=function(t,e){return t&&(Ke[t]=e)&&tl&&(tl[t]=e)||Ke},uo=function(){return 0},_A={suppressEvents:!0,isStart:!0,kill:!1},el={suppressEvents:!0,kill:!1},yA={suppressEvents:!0},kc={},Wi=[],Bc={},lg,Qe={},Dc={},hg=30,sl=[],Oc="",Lc=function(t){var e=t[0],s,i;if(Js(e)||Zt(e)||(t=[t]),!(s=(e._gsap||{}).harness)){for(i=sl.length;i--&&!sl[i].targetTest(e););s=sl[i]}for(i=t.length;i--;)t[i]&&(t[i]._gsap||(t[i]._gsap=new Ng(t[i],s)))||t.splice(i,1);return t},Ir=function(t){return t._gsap||Lc(fs(t))[0]._gsap},cg=function(t,e,s){return(s=t[e])&&Zt(s)?t[e]():Sc(s)&&t.getAttribute&&t.getAttribute(e)||s},Ue=function(t,e){return(t=t.split(",")).forEach(e)||t},te=function(t){return Math.round(t*1e5)/1e5||0},ge=function(t){return Math.round(t*1e7)/1e7||0},xn=function(t,e){var s=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),s==="+"?t+i:s==="-"?t-i:s==="*"?t*i:t/i},xA=function(t,e){for(var s=e.length,i=0;t.indexOf(e[i])<0&&++i<s;);return i<s},il=function(){var t=Wi.length,e=Wi.slice(0),s,i;for(Bc={},Wi.length=0,s=0;s<t;s++)i=e[s],i&&i._lazy&&(i.render(i._lazy[0],i._lazy[1],!0)._lazy=0)},ug=function(t,e,s,i){Wi.length&&!Ae&&il(),t.render(e,s,i||Ae&&e<0&&(t._initted||t._startAt)),Wi.length&&!Ae&&il()},dg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(rg).length<2?e:me(t)?t.trim():t},fg=function(t){return t},us=function(t,e){for(var s in e)s in t||(t[s]=e[s]);return t},vA=function(t){return function(e,s){for(var i in s)i in e||i==="duration"&&t||i==="ease"||(e[i]=s[i])}},Pr=function(t,e){for(var s in e)t[s]=e[s];return t},pg=function r(t,e){for(var s in e)s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(t[s]=Js(e[s])?r(t[s]||(t[s]={}),e[s]):e[s]);return t},rl=function(t,e){var s={},i;for(i in t)i in e||(s[i]=t[i]);return s},fo=function(t){var e=t.parent||Ut,s=t.keyframes?vA(Se(t.keyframes)):us;if(Ve(t.inherit))for(;e;)s(t,e.vars.defaults),e=e.parent||e._dp;return t},bA=function(t,e){for(var s=t.length,i=s===e.length;i&&s--&&t[s]===e[s];);return s<0},mg=function(t,e,s,i,n){s===void 0&&(s="_first"),i===void 0&&(i="_last");var a=t[i],h;if(n)for(h=e[n];a&&a[n]>h;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[s],t[s]=e),e._next?e._next._prev=e:t[i]=e,e._prev=a,e.parent=e._dp=t,e},nl=function(t,e,s,i){s===void 0&&(s="_first"),i===void 0&&(i="_last");var n=e._prev,a=e._next;n?n._next=a:t[s]===e&&(t[s]=a),a?a._prev=n:t[i]===e&&(t[i]=n),e._next=e._prev=e.parent=null},zi=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Rr=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var s=t;s;)s._dirty=1,s=s.parent;return t},wA=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Nc=function(t,e,s,i){return t._startAt&&(Ae?t._startAt.revert(el):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},EA=function r(t){return!t||t._ts&&r(t.parent)},gg=function(t){return t._repeat?vn(t._tTime,t=t.duration()+t._rDelay)*t:0},vn=function(t,e){var s=Math.floor(t/=e);return t&&s===t?s-1:s},ol=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},al=function(t){return t._end=ge(t._start+(t._tDur/Math.abs(t._ts||t._rts||Ft)||0))},ll=function(t,e){var s=t._dp;return s&&s.smoothChildTiming&&t._ts&&(t._start=ge(s._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),al(t),s._dirty||Rr(s,t)),t},_g=function(t,e){var s;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(s=ol(t.rawTime(),e),(!e._dur||mo(0,e.totalDuration(),s)-e._tTime>Ft)&&e.render(s,!0)),Rr(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(s=t;s._dp;)s.rawTime()>=0&&s.totalTime(s._tTime),s=s._dp;t._zTime=-Ft}},ei=function(t,e,s,i){return e.parent&&zi(e),e._start=ge((wi(s)?s:s||t!==Ut?ds(t,s,e):t._time)+e._delay),e._end=ge(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),mg(t,e,"_first","_last",t._sort?"_start":0),Vc(e)||(t._recent=e),i||_g(t,e),t._ts<0&&ll(t,t._tTime),t},yg=function(t,e){return(Ke.ScrollTrigger||Fc("scrollTrigger",e))&&Ke.ScrollTrigger.create(e,t)},xg=function(t,e,s,i,n){if(jc(t,e,n),!t._initted)return 1;if(!s&&t._pt&&!Ae&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&lg!==ts.frame)return Wi.push(t),t._lazy=[n,i],1},TA=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Vc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},AA=function(t,e,s,i){var n=t.ratio,a=e<0||!e&&(!t._start&&TA(t)&&!(!t._initted&&Vc(t))||(t._ts<0||t._dp._ts<0)&&!Vc(t))?0:1,h=t._rDelay,o=0,l,u,c;if(h&&t._repeat&&(o=mo(0,t._tDur,e),u=vn(o,h),t._yoyo&&u&1&&(a=1-a),u!==vn(t._tTime,h)&&(n=1-a,t.vars.repeatRefresh&&t._initted&&t.invalidate())),a!==n||Ae||i||t._zTime===Ft||!e&&t._zTime){if(!t._initted&&xg(t,e,i,s,o))return;for(c=t._zTime,t._zTime=e||(s?Ft:0),s||(s=e&&!c),t.ratio=a,t._from&&(a=1-a),t._time=0,t._tTime=o,l=t._pt;l;)l.r(a,l.d),l=l._next;e<0&&Nc(t,e,s,!0),t._onUpdate&&!s&&Je(t,"onUpdate"),o&&t._repeat&&!s&&t.parent&&Je(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===a&&(a&&zi(t,1),!s&&!Ae&&(Je(t,a?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},SA=function(t,e,s){var i;if(s>e)for(i=t._first;i&&i._start<=s;){if(i.data==="isPause"&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=s;){if(i.data==="isPause"&&i._start<e)return i;i=i._prev}},bn=function(t,e,s,i){var n=t._repeat,a=ge(e)||0,h=t._tTime/t._tDur;return h&&!i&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:ge(a*(n+1)+t._rDelay*n):a,h>0&&!i&&ll(t,t._tTime=t._tDur*h),t.parent&&al(t),s||Rr(t.parent,t),t},vg=function(t){return t instanceof Me?Rr(t):bn(t,t._dur)},CA={_start:0,endTime:uo,totalDuration:uo},ds=function r(t,e,s){var i=t.labels,n=t._recent||CA,a=t.duration()>=cs?n.endTime(!1):t._dur,h,o,l;return me(e)&&(isNaN(e)||e in i)?(o=e.charAt(0),l=e.substr(-1)==="%",h=e.indexOf("="),o==="<"||o===">"?(h>=0&&(e=e.replace(/=/,"")),(o==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(h<0?n:s).totalDuration()/100:1)):h<0?(e in i||(i[e]=a),i[e]):(o=parseFloat(e.charAt(h-1)+e.substr(h+1)),l&&s&&(o=o/100*(Se(s)?s[0]:s).totalDuration()),h>1?r(t,e.substr(0,h-1),s)+o:a+o)):e==null?a:+e},po=function(t,e,s){var i=wi(e[1]),n=(i?2:1)+(t<2?0:1),a=e[n],h,o;if(i&&(a.duration=e[1]),a.parent=s,t){for(h=a,o=s;o&&!("immediateRender"in h);)h=o.vars.defaults||{},o=Ve(o.vars.inherit)&&o.parent;a.immediateRender=Ve(h.immediateRender),t<2?a.runBackwards=1:a.startAt=e[n-1]}return new re(e[0],a,e[n+1])},ji=function(t,e){return t||t===0?e(t):e},mo=function(t,e,s){return s<t?t:s>e?e:s},Ce=function(t,e){return!me(t)||!(e=gA.exec(t))?"":e[1]},IA=function(t,e,s){return ji(s,function(i){return mo(t,e,i)})},Uc=[].slice,bg=function(t,e){return t&&Js(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Js(t[0]))&&!t.nodeType&&t!==ti},PA=function(t,e,s){return s===void 0&&(s=[]),t.forEach(function(i){var n;return me(i)&&!e||bg(i,1)?(n=s).push.apply(n,fs(i)):s.push(i)})||s},fs=function(t,e,s){return Dt&&!e&&Dt.selector?Dt.selector(t):me(t)&&!s&&(Rc||!En())?Uc.call((e||Mc).querySelectorAll(t),0):Se(t)?PA(t,s):bg(t)?Uc.call(t,0):t?[t]:[]},Gc=function(t){return t=fs(t)[0]||co("Invalid scope")||{},function(e){var s=t.current||t.nativeElement||t;return fs(e,s.querySelectorAll?s:s===t?co("Invalid scope")||Mc.createElement("div"):t)}},wg=function(t){return t.sort(function(){return .5-Math.random()})},Eg=function(t){if(Zt(t))return t;var e=Js(t)?t:{each:t},s=Mr(e.ease),i=e.from||0,n=parseFloat(e.base)||0,a={},h=i>0&&i<1,o=isNaN(i)||h,l=e.axis,u=i,c=i;return me(i)?u=c={center:.5,edges:.5,end:1}[i]||0:!h&&o&&(u=i[0],c=i[1]),function(d,f,p){var m=(p||e).length,g=a[m],_,x,y,v,b,w,E,T,A;if(!g){if(A=e.grid==="auto"?0:(e.grid||[1,cs])[1],!A){for(E=-cs;E<(E=p[A++].getBoundingClientRect().left)&&A<m;);A<m&&A--}for(g=a[m]=[],_=o?Math.min(A,m)*u-.5:i%A,x=A===cs?0:o?m*c/A-.5:i/A|0,E=0,T=cs,w=0;w<m;w++)y=w%A-_,v=x-(w/A|0),g[w]=b=l?Math.abs(l==="y"?v:y):tg(y*y+v*v),b>E&&(E=b),b<T&&(T=b);i==="random"&&wg(g),g.max=E-T,g.min=T,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(A>m?m-1:l?l==="y"?m/A:A:Math.max(A,m/A))||0)*(i==="edges"?-1:1),g.b=m<0?n-m:n,g.u=Ce(e.amount||e.each)||0,s=s&&m<0?Dg(s):s}return m=(g[d]-g.min)/g.max||0,ge(g.b+(s?s(m):m)*g.v)+g.u}},Xc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(s){var i=ge(Math.round(parseFloat(s)/t)*t*e);return(i-i%1)/e+(wi(s)?0:Ce(s))}},Tg=function(t,e){var s=Se(t),i,n;return!s&&Js(t)&&(i=s=t.radius||cs,t.values?(t=fs(t.values),(n=!wi(t[0]))&&(i*=i)):t=Xc(t.increment)),ji(e,s?Zt(t)?function(a){return n=t(a),Math.abs(n-a)<=i?n:a}:function(a){for(var h=parseFloat(n?a.x:a),o=parseFloat(n?a.y:0),l=cs,u=0,c=t.length,d,f;c--;)n?(d=t[c].x-h,f=t[c].y-o,d=d*d+f*f):d=Math.abs(t[c]-h),d<l&&(l=d,u=c);return u=!i||l<=i?t[u]:a,n||u===a||wi(a)?u:u+Ce(a)}:Xc(t))},Ag=function(t,e,s,i){return ji(Se(t)?!e:s===!0?!!(s=0):!i,function(){return Se(t)?t[~~(Math.random()*t.length)]:(s=s||1e-5)&&(i=s<1?Math.pow(10,(s+"").length-2):1)&&Math.floor(Math.round((t-s/2+Math.random()*(e-t+s*.99))/s)*s*i)/i})},RA=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return function(i){return e.reduce(function(n,a){return a(n)},i)}},MA=function(t,e){return function(s){return t(parseFloat(s))+(e||Ce(s))}},FA=function(t,e,s){return Cg(t,e,0,1,s)},Sg=function(t,e,s){return ji(s,function(i){return t[~~e(i)]})},kA=function r(t,e,s){var i=e-t;return Se(t)?Sg(t,r(0,t.length),e):ji(s,function(n){return(i+(n-t)%i)%i+t})},BA=function r(t,e,s){var i=e-t,n=i*2;return Se(t)?Sg(t,r(0,t.length-1),e):ji(s,function(a){return a=(n+(a-t)%n)%n||0,t+(a>i?n-a:a)})},go=function(t){for(var e=0,s="",i,n,a,h;~(i=t.indexOf("random(",e));)a=t.indexOf(")",i),h=t.charAt(i+7)==="[",n=t.substr(i+7,a-i-7).match(h?rg:Ic),s+=t.substr(e,i-e)+Ag(h?n:+n[0],h?0:+n[1],+n[2]||1e-5),e=a+1;return s+t.substr(e,t.length-e)},Cg=function(t,e,s,i,n){var a=e-t,h=i-s;return ji(n,function(o){return s+((o-t)/a*h||0)})},DA=function r(t,e,s,i){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var a=me(t),h={},o,l,u,c,d;if(s===!0&&(i=1)&&(s=null),a)t={p:t},e={p:e};else if(Se(t)&&!Se(e)){for(u=[],c=t.length,d=c-2,l=1;l<c;l++)u.push(r(t[l-1],t[l]));c--,n=function(p){p*=c;var m=Math.min(d,~~p);return u[m](p-m)},s=e}else i||(t=Pr(Se(t)?[]:{},t));if(!u){for(o in e)Wc.call(h,t,o,"get",e[o]);n=function(p){return Kc(p,h)||(a?t.p:t)}}}return ji(s,n)},Ig=function(t,e,s){var i=t.labels,n=cs,a,h,o;for(a in i)h=i[a]-e,h<0==!!s&&h&&n>(h=Math.abs(h))&&(o=a,n=h);return o},Je=function(t,e,s){var i=t.vars,n=i[e],a=Dt,h=t._ctx,o,l,u;if(n)return o=i[e+"Params"],l=i.callbackScope||t,s&&Wi.length&&il(),h&&(Dt=h),u=o?n.apply(l,o):n.call(l),Dt=a,u},_o=function(t){return zi(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Ae),t.progress()<1&&Je(t,"onInterrupt"),t},wn,Pg=[],Rg=function(t){if(t)if(t=!t.name&&t.default||t,Cc()||t.headless){var e=t.name,s=Zt(t),i=e&&!s&&t.init?function(){this._props=[]}:t,n={init:uo,render:Kc,add:Wc,kill:KA,modifier:ZA,rawVars:0},a={targetTest:0,get:0,getSetter:Zc,aliases:{},register:0};if(En(),t!==i){if(Qe[e])return;us(i,us(rl(t,n),a)),Pr(i.prototype,Pr(n,rl(t,a))),Qe[i.prop=e]=i,t.targetTest&&(sl.push(i),kc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}ag(e,i),t.register&&t.register(Xe,i,Ge)}else Pg.push(t)},Pt=255,yo={aqua:[0,Pt,Pt],lime:[0,Pt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Pt],navy:[0,0,128],white:[Pt,Pt,Pt],olive:[128,128,0],yellow:[Pt,Pt,0],orange:[Pt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Pt,0,0],pink:[Pt,192,203],cyan:[0,Pt,Pt],transparent:[Pt,Pt,Pt,0]},$c=function(t,e,s){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(s-e)*t*6:t<.5?s:t*3<2?e+(s-e)*(2/3-t)*6:e)*Pt+.5|0},Mg=function(t,e,s){var i=t?wi(t)?[t>>16,t>>8&Pt,t&Pt]:0:yo.black,n,a,h,o,l,u,c,d,f,p;if(!i){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),yo[t])i=yo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),a=t.charAt(2),h=t.charAt(3),t="#"+n+n+a+a+h+h+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return i=parseInt(t.substr(1,6),16),[i>>16,i>>8&Pt,i&Pt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),i=[t>>16,t>>8&Pt,t&Pt]}else if(t.substr(0,3)==="hsl"){if(i=p=t.match(Ic),!e)o=+i[0]%360/360,l=+i[1]/100,u=+i[2]/100,a=u<=.5?u*(l+1):u+l-u*l,n=u*2-a,i.length>3&&(i[3]*=1),i[0]=$c(o+1/3,n,a),i[1]=$c(o,n,a),i[2]=$c(o-1/3,n,a);else if(~t.indexOf("="))return i=t.match(sg),s&&i.length<4&&(i[3]=1),i}else i=t.match(Ic)||yo.transparent;i=i.map(Number)}return e&&!p&&(n=i[0]/Pt,a=i[1]/Pt,h=i[2]/Pt,c=Math.max(n,a,h),d=Math.min(n,a,h),u=(c+d)/2,c===d?o=l=0:(f=c-d,l=u>.5?f/(2-c-d):f/(c+d),o=c===n?(a-h)/f+(a<h?6:0):c===a?(h-n)/f+2:(n-a)/f+4,o*=60),i[0]=~~(o+.5),i[1]=~~(l*100+.5),i[2]=~~(u*100+.5)),s&&i.length<4&&(i[3]=1),i},Fg=function(t){var e=[],s=[],i=-1;return t.split(qi).forEach(function(n){var a=n.match(yn)||[];e.push.apply(e,a),s.push(i+=a.length+1)}),e.c=s,e},kg=function(t,e,s){var i="",n=(t+i).match(qi),a=e?"hsla(":"rgba(",h=0,o,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=Mg(d,e,1))&&a+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),s&&(u=Fg(t),o=s.c,o.join(i)!==u.c.join(i)))for(l=t.replace(qi,"1").split(yn),c=l.length-1;h<c;h++)i+=l[h]+(~o.indexOf(h)?n.shift()||a+"0,0,0,0)":(u.length?u:n.length?n:s).shift());if(!l)for(l=t.split(qi),c=l.length-1;h<c;h++)i+=l[h]+n[h];return i+l[c]},qi=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in yo)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),OA=/hsl[a]?\(/,Bg=function(t){var e=t.join(" "),s;if(qi.lastIndex=0,qi.test(e))return s=OA.test(e),t[1]=kg(t[1],s),t[0]=kg(t[0],s,Fg(t[1])),!0},xo,ts=function(){var r=Date.now,t=500,e=33,s=r(),i=s,n=1e3/240,a=n,h=[],o,l,u,c,d,f,p=function m(g){var _=r()-i,x=g===!0,y,v,b,w;if((_>t||_<0)&&(s+=_-e),i+=_,b=i-s,y=b-a,(y>0||x)&&(w=++c.frame,d=b-c.time*1e3,c.time=b=b/1e3,a+=y+(y>=n?4:n-y),v=1),x||(o=l(m)),v)for(f=0;f<h.length;f++)h[f](b,d,w,g)};return c={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){ng&&(!Rc&&Cc()&&(ti=Rc=window,Mc=ti.document||{},Ke.gsap=Xe,(ti.gsapVersions||(ti.gsapVersions=[])).push(Xe.version),og(tl||ti.GreenSockGlobals||!ti.gsap&&ti||{}),Pg.forEach(Rg)),u=typeof requestAnimationFrame<"u"&&requestAnimationFrame,o&&c.sleep(),l=u||function(g){return setTimeout(g,a-c.time*1e3+1|0)},xo=1,p(2))},sleep:function(){(u?cancelAnimationFrame:clearTimeout)(o),xo=0,l=uo},lagSmoothing:function(g,_){t=g||1/0,e=Math.min(_||33,t)},fps:function(g){n=1e3/(g||240),a=c.time*1e3+n},add:function(g,_,x){var y=_?function(v,b,w,E){g(v,b,w,E),c.remove(y)}:g;return c.remove(g),h[x?"unshift":"push"](y),En(),y},remove:function(g,_){~(_=h.indexOf(g))&&h.splice(_,1)&&f>=_&&f--},_listeners:h},c}(),En=function(){return!xo&&ts.wake()},ut={},LA=/^[\d.\-M][\d.\-,\s]/,NA=/["']/g,VA=function(t){for(var e={},s=t.substr(1,t.length-3).split(":"),i=s[0],n=1,a=s.length,h,o,l;n<a;n++)o=s[n],h=n!==a-1?o.lastIndexOf(","):o.length,l=o.substr(0,h),e[i]=isNaN(l)?l.replace(NA,"").trim():+l,i=o.substr(h+1).trim();return e},UA=function(t){var e=t.indexOf("(")+1,s=t.indexOf(")"),i=t.indexOf("(",e);return t.substring(e,~i&&i<s?t.indexOf(")",s+1):s)},GA=function(t){var e=(t+"").split("("),s=ut[e[0]];return s&&e.length>1&&s.config?s.config.apply(null,~t.indexOf("{")?[VA(e[1])]:UA(t).split(",").map(dg)):ut._CE&&LA.test(t)?ut._CE("",t):s},Dg=function(t){return function(e){return 1-t(1-e)}},Og=function r(t,e){for(var s=t._first,i;s;)s instanceof Me?r(s,e):s.vars.yoyoEase&&(!s._yoyo||!s._repeat)&&s._yoyo!==e&&(s.timeline?r(s.timeline,e):(i=s._ease,s._ease=s._yEase,s._yEase=i,s._yoyo=e)),s=s._next},Mr=function(t,e){return t&&(Zt(t)?t:ut[t]||GA(t))||e},Fr=function(t,e,s,i){s===void 0&&(s=function(o){return 1-e(1-o)}),i===void 0&&(i=function(o){return o<.5?e(o*2)/2:1-e((1-o)*2)/2});var n={easeIn:e,easeOut:s,easeInOut:i},a;return Ue(t,function(h){ut[h]=Ke[h]=n,ut[a=h.toLowerCase()]=s;for(var o in n)ut[a+(o==="easeIn"?".in":o==="easeOut"?".out":".inOut")]=ut[h+"."+o]=n[o]}),n},Lg=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Hc=function r(t,e,s){var i=e>=1?e:1,n=(s||(t?.3:.45))/(e<1?e:1),a=n/Ac*(Math.asin(1/i)||0),h=function(u){return u===1?1:i*Math.pow(2,-10*u)*mA((u-a)*n)+1},o=t==="out"?h:t==="in"?function(l){return 1-h(1-l)}:Lg(h);return n=Ac/n,o.config=function(l,u){return r(t,l,u)},o},Yc=function r(t,e){e===void 0&&(e=1.70158);var s=function(a){return a?--a*a*((e+1)*a+e)+1:0},i=t==="out"?s:t==="in"?function(n){return 1-s(1-n)}:Lg(s);return i.config=function(n){return r(t,n)},i};Ue("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;Fr(r+",Power"+(e-1),t?function(s){return Math.pow(s,e)}:function(s){return s},function(s){return 1-Math.pow(1-s,e)},function(s){return s<.5?Math.pow(s*2,e)/2:1-Math.pow((1-s)*2,e)/2})}),ut.Linear.easeNone=ut.none=ut.Linear.easeIn,Fr("Elastic",Hc("in"),Hc("out"),Hc()),function(r,t){var e=1/t,s=2*e,i=2.5*e,n=function(h){return h<e?r*h*h:h<s?r*Math.pow(h-1.5/t,2)+.75:h<i?r*(h-=2.25/t)*h+.9375:r*Math.pow(h-2.625/t,2)+.984375};Fr("Bounce",function(a){return 1-n(1-a)},n)}(7.5625,2.75),Fr("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),Fr("Circ",function(r){return-(tg(1-r*r)-1)}),Fr("Sine",function(r){return r===1?1:-pA(r*dA)+1}),Fr("Back",Yc("in"),Yc("out"),Yc()),ut.SteppedEase=ut.steps=Ke.SteppedEase={config:function(t,e){t===void 0&&(t=1);var s=1/t,i=t+(e?0:1),n=e?1:0,a=1-Ft;return function(h){return((i*mo(0,a,h)|0)+n)*s}}},_n.ease=ut["quad.out"],Ue("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return Oc+=r+","+r+"Params,"});var Ng=function(t,e){this.id=fA++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:cg,this.set=e?e.getSetter:Zc},vo=function(){function r(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,bn(this,+e.duration,1,1),this.data=e.data,Dt&&(this._ctx=Dt,Dt.data.push(this)),xo||ts.wake()}var t=r.prototype;return t.delay=function(s){return s||s===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+s-this._delay),this._delay=s,this):this._delay},t.duration=function(s){return arguments.length?this.totalDuration(this._repeat>0?s+(s+this._rDelay)*this._repeat:s):this.totalDuration()&&this._dur},t.totalDuration=function(s){return arguments.length?(this._dirty=0,bn(this,this._repeat<0?s:(s-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(s,i){if(En(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(ll(this,s),!n._dp||n.parent||_g(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&s<this._tDur||this._ts<0&&s>0||!this._tDur&&!s)&&ei(this._dp,this,this._start-this._delay)}return(this._tTime!==s||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===Ft||!s&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=s),ug(this,s,i)),this},t.time=function(s,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),s+gg(this))%(this._dur+this._rDelay)||(s?this._dur:0),i):this._time},t.totalProgress=function(s,i){return arguments.length?this.totalTime(this.totalDuration()*s,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(s,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-s:s)+gg(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(s,i){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(s-1)*n,i):this._repeat?vn(this._tTime,n)+1:1},t.timeScale=function(s,i){if(!arguments.length)return this._rts===-Ft?0:this._rts;if(this._rts===s)return this;var n=this.parent&&this._ts?ol(this.parent._time,this):this._tTime;return this._rts=+s||0,this._ts=this._ps||s===-Ft?0:this._rts,this.totalTime(mo(-Math.abs(this._delay),this._tDur,n),i!==!1),al(this),wA(this)},t.paused=function(s){return arguments.length?(this._ps!==s&&(this._ps=s,s?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(En(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Ft&&(this._tTime-=Ft)))),this):this._ps},t.startTime=function(s){if(arguments.length){this._start=s;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&ei(i,this,s-this._delay),this}return this._start},t.endTime=function(s){return this._start+(Ve(s)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(s){var i=this.parent||this._dp;return i?s&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?ol(i.rawTime(s),this):this._tTime:this._tTime},t.revert=function(s){s===void 0&&(s=yA);var i=Ae;return Ae=s,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(s),this.totalTime(-.01,s.suppressEvents)),this.data!=="nested"&&s.kill!==!1&&this.kill(),Ae=i,this},t.globalTime=function(s){for(var i=this,n=arguments.length?s:i.rawTime();i;)n=i._start+n/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(s):n},t.repeat=function(s){return arguments.length?(this._repeat=s===1/0?-2:s,vg(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(s){if(arguments.length){var i=this._time;return this._rDelay=s,vg(this),i?this.time(i):this}return this._rDelay},t.yoyo=function(s){return arguments.length?(this._yoyo=s,this):this._yoyo},t.seek=function(s,i){return this.totalTime(ds(this,s),Ve(i))},t.restart=function(s,i){return this.play().totalTime(s?-this._delay:0,Ve(i))},t.play=function(s,i){return s!=null&&this.seek(s,i),this.reversed(!1).paused(!1)},t.reverse=function(s,i){return s!=null&&this.seek(s||this.totalDuration(),i),this.reversed(!0).paused(!1)},t.pause=function(s,i){return s!=null&&this.seek(s,i),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(s){return arguments.length?(!!s!==this.reversed()&&this.timeScale(-this._rts||(s?-Ft:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Ft,this},t.isActive=function(){var s=this.parent||this._dp,i=this._start,n;return!!(!s||this._ts&&this._initted&&s.isActive()&&(n=s.rawTime(!0))>=i&&n<this.endTime(!0)-Ft)},t.eventCallback=function(s,i,n){var a=this.vars;return arguments.length>1?(i?(a[s]=i,n&&(a[s+"Params"]=n),s==="onUpdate"&&(this._onUpdate=i)):delete a[s],this):a[s]},t.then=function(s){var i=this;return new Promise(function(n){var a=Zt(s)?s:fg,h=function(){var l=i.then;i.then=null,Zt(a)&&(a=a(i))&&(a.then||a===i)&&(i.then=l),n(a),i.then=l};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?h():i._prom=h})},t.kill=function(){_o(this)},r}();us(vo.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ft,_prom:0,_ps:!1,_rts:1});var Me=function(r){Jm(t,r);function t(s,i){var n;return s===void 0&&(s={}),n=r.call(this,s)||this,n.labels={},n.smoothChildTiming=!!s.smoothChildTiming,n.autoRemoveChildren=!!s.autoRemoveChildren,n._sort=Ve(s.sortChildren),Ut&&ei(s.parent||Ut,bi(n),i),s.reversed&&n.reverse(),s.paused&&n.paused(!0),s.scrollTrigger&&yg(bi(n),s.scrollTrigger),n}var e=t.prototype;return e.to=function(i,n,a){return po(0,arguments,this),this},e.from=function(i,n,a){return po(1,arguments,this),this},e.fromTo=function(i,n,a,h){return po(2,arguments,this),this},e.set=function(i,n,a){return n.duration=0,n.parent=this,fo(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new re(i,n,ds(this,a),1),this},e.call=function(i,n,a){return ei(this,re.delayedCall(0,i,n),a)},e.staggerTo=function(i,n,a,h,o,l,u){return a.duration=n,a.stagger=a.stagger||h,a.onComplete=l,a.onCompleteParams=u,a.parent=this,new re(i,a,ds(this,o)),this},e.staggerFrom=function(i,n,a,h,o,l,u){return a.runBackwards=1,fo(a).immediateRender=Ve(a.immediateRender),this.staggerTo(i,n,a,h,o,l,u)},e.staggerFromTo=function(i,n,a,h,o,l,u,c){return h.startAt=a,fo(h).immediateRender=Ve(h.immediateRender),this.staggerTo(i,n,h,o,l,u,c)},e.render=function(i,n,a){var h=this._time,o=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=i<=0?0:ge(i),c=this._zTime<0!=i<0&&(this._initted||!l),d,f,p,m,g,_,x,y,v,b,w,E;if(this!==Ut&&u>o&&i>=0&&(u=o),u!==this._tTime||a||c){if(h!==this._time&&l&&(u+=this._time-h,i+=this._time-h),d=u,v=this._start,y=this._ts,_=!y,c&&(l||(h=this._zTime),(i||!n)&&(this._zTime=i)),this._repeat){if(w=this._yoyo,g=l+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,n,a);if(d=ge(u%g),u===o?(m=this._repeat,d=l):(m=~~(u/g),m&&m===u/g&&(d=l,m--),d>l&&(d=l)),b=vn(this._tTime,g),!h&&this._tTime&&b!==m&&this._tTime-b*g-this._dur<=0&&(b=m),w&&m&1&&(d=l-d,E=1),m!==b&&!this._lock){var T=w&&b&1,A=T===(w&&m&1);if(m<b&&(T=!T),h=T?0:u%l?l:u,this._lock=1,this.render(h||(E?0:ge(m*g)),n,!l)._lock=0,this._tTime=u,!n&&this.parent&&Je(this,"onRepeat"),this.vars.repeatRefresh&&!E&&(this.invalidate()._lock=1),h&&h!==this._time||_!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,o=this._tDur,A&&(this._lock=2,h=T?l:-1e-4,this.render(h,!0),this.vars.repeatRefresh&&!E&&this.invalidate()),this._lock=0,!this._ts&&!_)return this;Og(this,E)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=SA(this,ge(h),ge(d)),x&&(u-=d-(d=x._start))),this._tTime=u,this._time=d,this._act=!y,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,h=0),!h&&d&&!n&&!m&&(Je(this,"onStart"),this._tTime!==u))return this;if(d>=h&&i>=0)for(f=this._first;f;){if(p=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(i,n,a);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,n,a),d!==this._time||!this._ts&&!_){x=0,p&&(u+=this._zTime=-Ft);break}}f=p}else{f=this._last;for(var I=i<0?i:d;f;){if(p=f._prev,(f._act||I<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(i,n,a);if(f.render(f._ts>0?(I-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(I-f._start)*f._ts,n,a||Ae&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!_){x=0,p&&(u+=this._zTime=I?-Ft:Ft);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=h?0:-Ft)._zTime=d>=h?1:-1,this._ts))return this._start=v,al(this),this.render(i,n,a);this._onUpdate&&!n&&Je(this,"onUpdate",!0),(u===o&&this._tTime>=this.totalDuration()||!u&&h)&&(v===this._start||Math.abs(y)!==Math.abs(this._ts))&&(this._lock||((i||!l)&&(u===o&&this._ts>0||!u&&this._ts<0)&&zi(this,1),!n&&!(i<0&&!h)&&(u||h||!o)&&(Je(this,u===o&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<o&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(i,n){var a=this;if(wi(n)||(n=ds(this,n,i)),!(i instanceof vo)){if(Se(i))return i.forEach(function(h){return a.add(h,n)}),this;if(me(i))return this.addLabel(i,n);if(Zt(i))i=re.delayedCall(0,i);else return this}return this!==i?ei(this,i,n):this},e.getChildren=function(i,n,a,h){i===void 0&&(i=!0),n===void 0&&(n=!0),a===void 0&&(a=!0),h===void 0&&(h=-cs);for(var o=[],l=this._first;l;)l._start>=h&&(l instanceof re?n&&o.push(l):(a&&o.push(l),i&&o.push.apply(o,l.getChildren(!0,n,a)))),l=l._next;return o},e.getById=function(i){for(var n=this.getChildren(1,1,1),a=n.length;a--;)if(n[a].vars.id===i)return n[a]},e.remove=function(i){return me(i)?this.removeLabel(i):Zt(i)?this.killTweensOf(i):(nl(this,i),i===this._recent&&(this._recent=this._last),Rr(this))},e.totalTime=function(i,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ge(ts.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),r.prototype.totalTime.call(this,i,n),this._forcing=0,this):this._tTime},e.addLabel=function(i,n){return this.labels[i]=ds(this,n),this},e.removeLabel=function(i){return delete this.labels[i],this},e.addPause=function(i,n,a){var h=re.delayedCall(0,n||uo,a);return h.data="isPause",this._hasPause=1,ei(this,h,ds(this,i))},e.removePause=function(i){var n=this._first;for(i=ds(this,i);n;)n._start===i&&n.data==="isPause"&&zi(n),n=n._next},e.killTweensOf=function(i,n,a){for(var h=this.getTweensOf(i,a),o=h.length;o--;)Zi!==h[o]&&h[o].kill(i,n);return this},e.getTweensOf=function(i,n){for(var a=[],h=fs(i),o=this._first,l=wi(n),u;o;)o instanceof re?xA(o._targets,h)&&(l?(!Zi||o._initted&&o._ts)&&o.globalTime(0)<=n&&o.globalTime(o.totalDuration())>n:!n||o.isActive())&&a.push(o):(u=o.getTweensOf(h,n)).length&&a.push.apply(a,u),o=o._next;return a},e.tweenTo=function(i,n){n=n||{};var a=this,h=ds(a,i),o=n,l=o.startAt,u=o.onStart,c=o.onStartParams,d=o.immediateRender,f,p=re.to(a,us({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:h,overwrite:"auto",duration:n.duration||Math.abs((h-(l&&"time"in l?l.time:a._time))/a.timeScale())||Ft,onStart:function(){if(a.pause(),!f){var g=n.duration||Math.abs((h-(l&&"time"in l?l.time:a._time))/a.timeScale());p._dur!==g&&bn(p,g,0,1).render(p._time,!0,!0),f=1}u&&u.apply(p,c||[])}},n));return d?p.render(0):p},e.tweenFromTo=function(i,n,a){return this.tweenTo(n,us({startAt:{time:ds(this,i)}},a))},e.recent=function(){return this._recent},e.nextLabel=function(i){return i===void 0&&(i=this._time),Ig(this,ds(this,i))},e.previousLabel=function(i){return i===void 0&&(i=this._time),Ig(this,ds(this,i),1)},e.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+Ft)},e.shiftChildren=function(i,n,a){a===void 0&&(a=0);for(var h=this._first,o=this.labels,l;h;)h._start>=a&&(h._start+=i,h._end+=i),h=h._next;if(n)for(l in o)o[l]>=a&&(o[l]+=i);return Rr(this)},e.invalidate=function(i){var n=this._first;for(this._lock=0;n;)n.invalidate(i),n=n._next;return r.prototype.invalidate.call(this,i)},e.clear=function(i){i===void 0&&(i=!0);for(var n=this._first,a;n;)a=n._next,this.remove(n),n=a;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),Rr(this)},e.totalDuration=function(i){var n=0,a=this,h=a._last,o=cs,l,u,c;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-i:i));if(a._dirty){for(c=a.parent;h;)l=h._prev,h._dirty&&h.totalDuration(),u=h._start,u>o&&a._sort&&h._ts&&!a._lock?(a._lock=1,ei(a,h,u-h._delay,1)._lock=0):o=u,u<0&&h._ts&&(n-=u,(!c&&!a._dp||c&&c.smoothChildTiming)&&(a._start+=u/a._ts,a._time-=u,a._tTime-=u),a.shiftChildren(-u,!1,-1/0),o=0),h._end>n&&h._ts&&(n=h._end),h=l;bn(a,a===Ut&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},t.updateRoot=function(i){if(Ut._ts&&(ug(Ut,ol(i,Ut)),lg=ts.frame),ts.frame>=hg){hg+=Ze.autoSleep||120;var n=Ut._first;if((!n||!n._ts)&&Ze.autoSleep&&ts._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||ts.sleep()}}},t}(vo);us(Me.prototype,{_lock:0,_hasPause:0,_forcing:0});var XA=function(t,e,s,i,n,a,h){var o=new Ge(this._pt,t,e,0,1,Hg,null,n),l=0,u=0,c,d,f,p,m,g,_,x;for(o.b=s,o.e=i,s+="",i+="",(_=~i.indexOf("random("))&&(i=go(i)),a&&(x=[s,i],a(x,t,e),s=x[0],i=x[1]),d=s.match(Pc)||[];c=Pc.exec(i);)p=c[0],m=i.substring(l,c.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==d[u++]&&(g=parseFloat(d[u-1])||0,o._pt={_next:o._pt,p:m||u===1?m:",",s:g,c:p.charAt(1)==="="?xn(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=Pc.lastIndex);return o.c=l<i.length?i.substring(l,i.length):"",o.fp=h,(ig.test(i)||_)&&(o.e=0),this._pt=o,o},Wc=function(t,e,s,i,n,a,h,o,l,u){Zt(i)&&(i=i(n||0,t,a));var c=t[e],d=s!=="get"?s:Zt(c)?l?t[e.indexOf("set")||!Zt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,f=Zt(c)?l?zA:Xg:qc,p;if(me(i)&&(~i.indexOf("random(")&&(i=go(i)),i.charAt(1)==="="&&(p=xn(d,i)+(Ce(d)||0),(p||p===0)&&(i=p))),!u||d!==i||zc)return!isNaN(d*i)&&i!==""?(p=new Ge(this._pt,t,e,+d||0,i-(d||0),typeof c=="boolean"?qA:$g,0,f),l&&(p.fp=l),h&&p.modifier(h,this,t),this._pt=p):(!c&&!(e in t)&&Fc(e,i),XA.call(this,t,e,d,i,f,o||Ze.stringFilter,l))},$A=function(t,e,s,i,n){if(Zt(t)&&(t=bo(t,n,e,s,i)),!Js(t)||t.style&&t.nodeType||Se(t)||eg(t))return me(t)?bo(t,n,e,s,i):t;var a={},h;for(h in t)a[h]=bo(t[h],n,e,s,i);return a},Vg=function(t,e,s,i,n,a){var h,o,l,u;if(Qe[t]&&(h=new Qe[t]).init(n,h.rawVars?e[t]:$A(e[t],i,n,a,s),s,i,a)!==!1&&(s._pt=o=new Ge(s._pt,n,t,0,1,h.render,h,0,h.priority),s!==wn))for(l=s._ptLookup[s._targets.indexOf(n)],u=h._props.length;u--;)l[h._props[u]]=o;return h},Zi,zc,jc=function r(t,e,s){var i=t.vars,n=i.ease,a=i.startAt,h=i.immediateRender,o=i.lazy,l=i.onUpdate,u=i.runBackwards,c=i.yoyoEase,d=i.keyframes,f=i.autoRevert,p=t._dur,m=t._startAt,g=t._targets,_=t.parent,x=_&&_.data==="nested"?_.vars.targets:g,y=t._overwrite==="auto"&&!Tc,v=t.timeline,b,w,E,T,A,I,M,R,C,P,k,U,V;if(v&&(!d||!n)&&(n="none"),t._ease=Mr(n,_n.ease),t._yEase=c?Dg(Mr(c===!0?n:c,_n.ease)):0,c&&t._yoyo&&!t._repeat&&(c=t._yEase,t._yEase=t._ease,t._ease=c),t._from=!v&&!!i.runBackwards,!v||d&&!i.stagger){if(R=g[0]?Ir(g[0]).harness:0,U=R&&i[R.prop],b=rl(i,kc),m&&(m._zTime<0&&m.progress(1),e<0&&u&&h&&!f?m.render(-1,!0):m.revert(u&&p?el:_A),m._lazy=0),a){if(zi(t._startAt=re.set(g,us({data:"isStart",overwrite:!1,parent:_,immediateRender:!0,lazy:!m&&Ve(o),startAt:null,delay:0,onUpdate:l&&function(){return Je(t,"onUpdate")},stagger:0},a))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae||!h&&!f)&&t._startAt.revert(el),h&&p&&e<=0&&s<=0){e&&(t._zTime=e);return}}else if(u&&p&&!m){if(e&&(h=!1),E=us({overwrite:!1,data:"isFromStart",lazy:h&&!m&&Ve(o),immediateRender:h,stagger:0,parent:_},b),U&&(E[R.prop]=U),zi(t._startAt=re.set(g,E)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae?t._startAt.revert(el):t._startAt.render(-1,!0)),t._zTime=e,!h)r(t._startAt,Ft,Ft);else if(!e)return}for(t._pt=t._ptCache=0,o=p&&Ve(o)||o&&!p,w=0;w<g.length;w++){if(A=g[w],M=A._gsap||Lc(g)[w]._gsap,t._ptLookup[w]=P={},Bc[M.id]&&Wi.length&&il(),k=x===g?w:x.indexOf(A),R&&(C=new R).init(A,U||b,t,k,x)!==!1&&(t._pt=T=new Ge(t._pt,A,C.name,0,1,C.render,C,0,C.priority),C._props.forEach(function(L){P[L]=T}),C.priority&&(I=1)),!R||U)for(E in b)Qe[E]&&(C=Vg(E,b,t,k,A,x))?C.priority&&(I=1):P[E]=T=Wc.call(t,A,E,"get",b[E],k,x,0,i.stringFilter);t._op&&t._op[w]&&t.kill(A,t._op[w]),y&&t._pt&&(Zi=t,Ut.killTweensOf(A,P,t.globalTime(e)),V=!t.parent,Zi=0),t._pt&&o&&(Bc[M.id]=1)}I&&Yg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!V,d&&e<=0&&v.render(cs,!0,!0)},HA=function(t,e,s,i,n,a,h,o){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],u,c,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(u=d[f][e],u&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==e&&u.fp!==e;)u=u._next;if(!u)return zc=1,t.vars[e]="+=0",jc(t,h),zc=0,o?co(e+" not eligible for reset"):1;l.push(u)}for(f=l.length;f--;)c=l[f],u=c._pt||c,u.s=(i||i===0)&&!n?i:u.s+(i||0)+a*u.c,u.c=s-u.s,c.e&&(c.e=te(s)+Ce(c.e)),c.b&&(c.b=u.s+Ce(c.b))},YA=function(t,e){var s=t[0]?Ir(t[0]).harness:0,i=s&&s.aliases,n,a,h,o;if(!i)return e;n=Pr({},e);for(a in i)if(a in n)for(o=i[a].split(","),h=o.length;h--;)n[o[h]]=n[a];return n},WA=function(t,e,s,i){var n=e.ease||i||"power1.inOut",a,h;if(Se(e))h=s[t]||(s[t]=[]),e.forEach(function(o,l){return h.push({t:l/(e.length-1)*100,v:o,e:n})});else for(a in e)h=s[a]||(s[a]=[]),a==="ease"||h.push({t:parseFloat(t),v:e[a],e:n})},bo=function(t,e,s,i,n){return Zt(t)?t.call(e,s,i,n):me(t)&&~t.indexOf("random(")?go(t):t},Ug=Oc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Gg={};Ue(Ug+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return Gg[r]=1});var re=function(r){Jm(t,r);function t(s,i,n,a){var h;typeof i=="number"&&(n.duration=i,i=n,n=null),h=r.call(this,a?i:fo(i))||this;var o=h.vars,l=o.duration,u=o.delay,c=o.immediateRender,d=o.stagger,f=o.overwrite,p=o.keyframes,m=o.defaults,g=o.scrollTrigger,_=o.yoyoEase,x=i.parent||Ut,y=(Se(s)||eg(s)?wi(s[0]):"length"in i)?[s]:fs(s),v,b,w,E,T,A,I,M;if(h._targets=y.length?Lc(y):co("GSAP target "+s+" not found. https://gsap.com",!Ze.nullTargetWarn)||[],h._ptLookup=[],h._overwrite=f,p||d||Ja(l)||Ja(u)){if(i=h.vars,v=h.timeline=new Me({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:y}),v.kill(),v.parent=v._dp=bi(h),v._start=0,d||Ja(l)||Ja(u)){if(E=y.length,I=d&&Eg(d),Js(d))for(T in d)~Ug.indexOf(T)&&(M||(M={}),M[T]=d[T]);for(b=0;b<E;b++)w=rl(i,Gg),w.stagger=0,_&&(w.yoyoEase=_),M&&Pr(w,M),A=y[b],w.duration=+bo(l,bi(h),b,A,y),w.delay=(+bo(u,bi(h),b,A,y)||0)-h._delay,!d&&E===1&&w.delay&&(h._delay=u=w.delay,h._start+=u,w.delay=0),v.to(A,w,I?I(b,A,y):0),v._ease=ut.none;v.duration()?l=u=0:h.timeline=0}else if(p){fo(us(v.vars.defaults,{ease:"none"})),v._ease=Mr(p.ease||i.ease||"none");var R=0,C,P,k;if(Se(p))p.forEach(function(U){return v.to(y,U,">")}),v.duration();else{w={};for(T in p)T==="ease"||T==="easeEach"||WA(T,p[T],w,p.easeEach);for(T in w)for(C=w[T].sort(function(U,V){return U.t-V.t}),R=0,b=0;b<C.length;b++)P=C[b],k={ease:P.e,duration:(P.t-(b?C[b-1].t:0))/100*l},k[T]=P.v,v.to(y,k,R),R+=k.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||h.duration(l=v.duration())}else h.timeline=0;return f===!0&&!Tc&&(Zi=bi(h),Ut.killTweensOf(y),Zi=0),ei(x,bi(h),n),i.reversed&&h.reverse(),i.paused&&h.paused(!0),(c||!l&&!p&&h._start===ge(x._time)&&Ve(c)&&EA(bi(h))&&x.data!=="nested")&&(h._tTime=-Ft,h.render(Math.max(0,-u)||0)),g&&yg(bi(h),g),h}var e=t.prototype;return e.render=function(i,n,a){var h=this._time,o=this._tDur,l=this._dur,u=i<0,c=i>o-Ft&&!u?o:i<Ft?0:i,d,f,p,m,g,_,x,y,v;if(!l)AA(this,i,n,a);else if(c!==this._tTime||!i||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u){if(d=c,y=this.timeline,this._repeat){if(m=l+this._rDelay,this._repeat<-1&&u)return this.totalTime(m*100+i,n,a);if(d=ge(c%m),c===o?(p=this._repeat,d=l):(p=~~(c/m),p&&p===ge(c/m)&&(d=l,p--),d>l&&(d=l)),_=this._yoyo&&p&1,_&&(v=this._yEase,d=l-d),g=vn(this._tTime,m),d===h&&!a&&this._initted&&p===g)return this._tTime=c,this;p!==g&&(y&&this._yEase&&Og(y,_),this.vars.repeatRefresh&&!_&&!this._lock&&this._time!==m&&this._initted&&(this._lock=a=1,this.render(ge(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(xg(this,u?i:d,a,n,c))return this._tTime=0,this;if(h!==this._time&&!(a&&this.vars.repeatRefresh&&p!==g))return this;if(l!==this._dur)return this.render(i,n,a)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!h&&!n&&!p&&(Je(this,"onStart"),this._tTime!==c))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;y&&y.render(i<0?i:y._dur*y._ease(d/this._dur),n,a)||this._startAt&&(this._zTime=i),this._onUpdate&&!n&&(u&&Nc(this,i,n,a),Je(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&Je(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&Nc(this,i,!0,!0),(i||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&zi(this,1),!n&&!(u&&!h)&&(c||h||_)&&(Je(this,c===o?"onComplete":"onReverseComplete",!0),this._prom&&!(c<o&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),r.prototype.invalidate.call(this,i)},e.resetTo=function(i,n,a,h,o){xo||ts.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),u;return this._initted||jc(this,l),u=this._ease(l/this._dur),HA(this,i,n,a,h,u,l,o)?this.resetTo(i,n,a,h,1):(ll(this,0),this.parent||mg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(i,n){if(n===void 0&&(n="all"),!i&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?_o(this):this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(i,n,Zi&&Zi.vars.overwrite!==!0)._first||_o(this),this.parent&&a!==this.timeline.totalDuration()&&bn(this,this._dur*this.timeline._tDur/a,0,1),this}var h=this._targets,o=i?fs(i):h,l=this._ptLookup,u=this._pt,c,d,f,p,m,g,_;if((!n||n==="all")&&bA(h,o))return n==="all"&&(this._pt=0),_o(this);for(c=this._op=this._op||[],n!=="all"&&(me(n)&&(m={},Ue(n,function(x){return m[x]=1}),n=m),n=YA(h,n)),_=h.length;_--;)if(~o.indexOf(h[_])){d=l[_],n==="all"?(c[_]=n,p=d,f={}):(f=c[_]=c[_]||{},p=n);for(m in p)g=d&&d[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&nl(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&u&&_o(this),this},t.to=function(i,n){return new t(i,n,arguments[2])},t.from=function(i,n){return po(1,arguments)},t.delayedCall=function(i,n,a,h){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:n,onReverseComplete:n,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:h})},t.fromTo=function(i,n,a){return po(2,arguments)},t.set=function(i,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(i,n)},t.killTweensOf=function(i,n,a){return Ut.killTweensOf(i,n,a)},t}(vo);us(re.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ue("staggerTo,staggerFrom,staggerFromTo",function(r){re[r]=function(){var t=new Me,e=Uc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var qc=function(t,e,s){return t[e]=s},Xg=function(t,e,s){return t[e](s)},zA=function(t,e,s,i){return t[e](i.fp,s)},jA=function(t,e,s){return t.setAttribute(e,s)},Zc=function(t,e){return Zt(t[e])?Xg:Sc(t[e])&&t.setAttribute?jA:qc},$g=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},qA=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Hg=function(t,e){var s=e._pt,i="";if(!t&&e.b)i=e.b;else if(t===1&&e.e)i=e.e;else{for(;s;)i=s.p+(s.m?s.m(s.s+s.c*t):Math.round((s.s+s.c*t)*1e4)/1e4)+i,s=s._next;i+=e.c}e.set(e.t,e.p,i,e)},Kc=function(t,e){for(var s=e._pt;s;)s.r(t,s.d),s=s._next},ZA=function(t,e,s,i){for(var n=this._pt,a;n;)a=n._next,n.p===i&&n.modifier(t,e,s),n=a},KA=function(t){for(var e=this._pt,s,i;e;)i=e._next,e.p===t&&!e.op||e.op===t?nl(this,e,"_pt"):e.dep||(s=1),e=i;return!s},QA=function(t,e,s,i){i.mSet(t,e,i.m.call(i.tween,s,i.mt),i)},Yg=function(t){for(var e=t._pt,s,i,n,a;e;){for(s=e._next,i=n;i&&i.pr>e.pr;)i=i._next;(e._prev=i?i._prev:a)?e._prev._next=e:n=e,(e._next=i)?i._prev=e:a=e,e=s}t._pt=n},Ge=function(){function r(e,s,i,n,a,h,o,l,u){this.t=s,this.s=n,this.c=a,this.p=i,this.r=h||$g,this.d=o||this,this.set=l||qc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(s,i,n){this.mSet=this.mSet||this.set,this.set=QA,this.m=s,this.mt=n,this.tween=i},r}();Ue(Oc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(r){return kc[r]=1}),Ke.TweenMax=Ke.TweenLite=re,Ke.TimelineLite=Ke.TimelineMax=Me,Ut=new Me({sortChildren:!1,defaults:_n,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ze.stringFilter=Bg;var kr=[],hl={},JA=[],Wg=0,tS=0,Qc=function(t){return(hl[t]||JA).map(function(e){return e()})},Jc=function(){var t=Date.now(),e=[];t-Wg>2&&(Qc("matchMediaInit"),kr.forEach(function(s){var i=s.queries,n=s.conditions,a,h,o,l;for(h in i)a=ti.matchMedia(i[h]).matches,a&&(o=1),a!==n[h]&&(n[h]=a,l=1);l&&(s.revert(),o&&e.push(s))}),Qc("matchMediaRevert"),e.forEach(function(s){return s.onMatch(s,function(i){return s.add(null,i)})}),Wg=t,Qc("matchMedia"))},zg=function(){function r(e,s){this.selector=s&&Gc(s),this.data=[],this._r=[],this.isReverted=!1,this.id=tS++,e&&this.add(e)}var t=r.prototype;return t.add=function(s,i,n){Zt(s)&&(n=i,i=s,s=Zt);var a=this,h=function(){var l=Dt,u=a.selector,c;return l&&l!==a&&l.data.push(a),n&&(a.selector=Gc(n)),Dt=a,c=i.apply(a,arguments),Zt(c)&&a._r.push(c),Dt=l,a.selector=u,a.isReverted=!1,c};return a.last=h,s===Zt?h(a,function(o){return a.add(null,o)}):s?a[s]=h:h},t.ignore=function(s){var i=Dt;Dt=null,s(this),Dt=i},t.getTweens=function(){var s=[];return this.data.forEach(function(i){return i instanceof r?s.push.apply(s,i.getTweens()):i instanceof re&&!(i.parent&&i.parent.data==="nested")&&s.push(i)}),s},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(s,i){var n=this;if(s?function(){for(var h=n.getTweens(),o=n.data.length,l;o--;)l=n.data[o],l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(u){return h.splice(h.indexOf(u),1)}));for(h.map(function(u){return{g:u._dur||u._delay||u._sat&&!u._sat.vars.immediateRender?u.globalTime(0):-1/0,t:u}}).sort(function(u,c){return c.g-u.g||-1/0}).forEach(function(u){return u.t.revert(s)}),o=n.data.length;o--;)l=n.data[o],l instanceof Me?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof re)&&l.revert&&l.revert(s);n._r.forEach(function(u){return u(s,n)}),n.isReverted=!0}():this.data.forEach(function(h){return h.kill&&h.kill()}),this.clear(),i)for(var a=kr.length;a--;)kr[a].id===this.id&&kr.splice(a,1)},t.revert=function(s){this.kill(s||{})},r}(),eS=function(){function r(e){this.contexts=[],this.scope=e,Dt&&Dt.data.push(this)}var t=r.prototype;return t.add=function(s,i,n){Js(s)||(s={matches:s});var a=new zg(0,n||this.scope),h=a.conditions={},o,l,u;Dt&&!a.selector&&(a.selector=Dt.selector),this.contexts.push(a),i=a.add("onMatch",i),a.queries=s;for(l in s)l==="all"?u=1:(o=ti.matchMedia(s[l]),o&&(kr.indexOf(a)<0&&kr.push(a),(h[l]=o.matches)&&(u=1),o.addListener?o.addListener(Jc):o.addEventListener("change",Jc)));return u&&i(a,function(c){return a.add(null,c)}),this},t.revert=function(s){this.kill(s||{})},t.kill=function(s){this.contexts.forEach(function(i){return i.kill(s,!0)})},r}(),cl={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e.forEach(function(i){return Rg(i)})},timeline:function(t){return new Me(t)},getTweensOf:function(t,e){return Ut.getTweensOf(t,e)},getProperty:function(t,e,s,i){me(t)&&(t=fs(t)[0]);var n=Ir(t||{}).get,a=s?fg:dg;return s==="native"&&(s=""),t&&(e?a((Qe[e]&&Qe[e].get||n)(t,e,s,i)):function(h,o,l){return a((Qe[h]&&Qe[h].get||n)(t,h,o,l))})},quickSetter:function(t,e,s){if(t=fs(t),t.length>1){var i=t.map(function(u){return Xe.quickSetter(u,e,s)}),n=i.length;return function(u){for(var c=n;c--;)i[c](u)}}t=t[0]||{};var a=Qe[e],h=Ir(t),o=h.harness&&(h.harness.aliases||{})[e]||e,l=a?function(u){var c=new a;wn._pt=0,c.init(t,s?u+s:u,wn,0,[t]),c.render(1,c),wn._pt&&Kc(1,wn)}:h.set(t,o);return a?l:function(u){return l(t,o,s?u+s:u,h,1)}},quickTo:function(t,e,s){var i,n=Xe.to(t,Pr((i={},i[e]="+=0.1",i.paused=!0,i),s||{})),a=function(o,l,u){return n.resetTo(e,o,l,u)};return a.tween=n,a},isTweening:function(t){return Ut.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Mr(t.ease,_n.ease)),pg(_n,t||{})},config:function(t){return pg(Ze,t||{})},registerEffect:function(t){var e=t.name,s=t.effect,i=t.plugins,n=t.defaults,a=t.extendTimeline;(i||"").split(",").forEach(function(h){return h&&!Qe[h]&&!Ke[h]&&co(e+" effect requires "+h+" plugin.")}),Dc[e]=function(h,o,l){return s(fs(h),us(o||{},n),l)},a&&(Me.prototype[e]=function(h,o,l){return this.add(Dc[e](h,Js(o)?o:(l=o)&&{},this),l)})},registerEase:function(t,e){ut[t]=Mr(e)},parseEase:function(t,e){return arguments.length?Mr(t,e):ut},getById:function(t){return Ut.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var s=new Me(t),i,n;for(s.smoothChildTiming=Ve(t.smoothChildTiming),Ut.remove(s),s._dp=0,s._time=s._tTime=Ut._time,i=Ut._first;i;)n=i._next,(e||!(!i._dur&&i instanceof re&&i.vars.onComplete===i._targets[0]))&&ei(s,i,i._start-i._delay),i=n;return ei(Ut,s,0),s},context:function(t,e){return t?new zg(t,e):Dt},matchMedia:function(t){return new eS(t)},matchMediaRefresh:function(){return kr.forEach(function(t){var e=t.conditions,s,i;for(i in e)e[i]&&(e[i]=!1,s=1);s&&t.revert()})||Jc()},addEventListener:function(t,e){var s=hl[t]||(hl[t]=[]);~s.indexOf(e)||s.push(e)},removeEventListener:function(t,e){var s=hl[t],i=s&&s.indexOf(e);i>=0&&s.splice(i,1)},utils:{wrap:kA,wrapYoyo:BA,distribute:Eg,random:Ag,snap:Tg,normalize:FA,getUnit:Ce,clamp:IA,splitColor:Mg,toArray:fs,selector:Gc,mapRange:Cg,pipe:RA,unitize:MA,interpolate:DA,shuffle:wg},install:og,effects:Dc,ticker:ts,updateRoot:Me.updateRoot,plugins:Qe,globalTimeline:Ut,core:{PropTween:Ge,globals:ag,Tween:re,Timeline:Me,Animation:vo,getCache:Ir,_removeLinkedListItem:nl,reverting:function(){return Ae},context:function(t){return t&&Dt&&(Dt.data.push(t),t._ctx=Dt),Dt},suppressOverwrites:function(t){return Tc=t}}};Ue("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return cl[r]=re[r]}),ts.add(Me.updateRoot),wn=cl.to({},{duration:0});var sS=function(t,e){for(var s=t._pt;s&&s.p!==e&&s.op!==e&&s.fp!==e;)s=s._next;return s},iS=function(t,e){var s=t._targets,i,n,a;for(i in e)for(n=s.length;n--;)a=t._ptLookup[n][i],a&&(a=a.d)&&(a._pt&&(a=sS(a,i)),a&&a.modifier&&a.modifier(e[i],t,s[n],i))},tu=function(t,e){return{name:t,rawVars:1,init:function(i,n,a){a._onInit=function(h){var o,l;if(me(n)&&(o={},Ue(n,function(u){return o[u]=1}),n=o),e){o={};for(l in n)o[l]=e(n[l]);n=o}iS(h,n)}}}},Xe=cl.registerPlugin({name:"attr",init:function(t,e,s,i,n){var a,h,o;this.tween=s;for(a in e)o=t.getAttribute(a)||"",h=this.add(t,"setAttribute",(o||0)+"",e[a],i,n,0,0,a),h.op=a,h.b=o,this._props.push(a)},render:function(t,e){for(var s=e._pt;s;)Ae?s.set(s.t,s.p,s.b,s):s.r(t,s.d),s=s._next}},{name:"endArray",init:function(t,e){for(var s=e.length;s--;)this.add(t,s,t[s]||0,e[s],0,0,0,0,0,1)}},tu("roundProps",Xc),tu("modifiers"),tu("snap",Tg))||cl;re.version=Me.version=Xe.version="3.12.5",ng=1,Cc()&&En(),ut.Power0,ut.Power1,ut.Power2,ut.Power3,ut.Power4,ut.Linear,ut.Quad,ut.Cubic,ut.Quart,ut.Quint,ut.Strong,ut.Elastic,ut.Back,ut.SteppedEase,ut.Bounce,ut.Sine,ut.Expo,ut.Circ;/*!
1156
1156
  * CSSPlugin 3.12.5
1157
1157
  * https://gsap.com
1158
1158
  *
@@ -1160,15 +1160,15 @@ void main(void)\r
1160
1160
  * Subject to the terms at https://gsap.com/standard-license or for
1161
1161
  * Club GSAP members, the agreement issued with that membership.
1162
1162
  * @author: Jack Doyle, jack@greensock.com
1163
- */var Jg,Ki,Tn,ru,Br,t_,nu,sS=function(){return typeof window<"u"},Ei={},Dr=180/Math.PI,An=Math.PI/180,Sn=Math.atan2,e_=1e8,ou=/([A-Z])/g,iS=/(left|right|width|margin|padding|x)/i,rS=/[\s,\(]\S/,si={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},au=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},nS=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},oS=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},aS=function(t,e){var s=e.s+e.c*t;e.set(e.t,e.p,~~(s+(s<0?-.5:.5))+e.u,e)},s_=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},i_=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},lS=function(t,e,s){return t.style[e]=s},hS=function(t,e,s){return t.style.setProperty(e,s)},cS=function(t,e,s){return t._gsap[e]=s},uS=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},dS=function(t,e,s,i,n){var a=t._gsap;a.scaleX=a.scaleY=s,a.renderTransform(n,a)},fS=function(t,e,s,i,n){var a=t._gsap;a[e]=s,a.renderTransform(n,a)},Gt="transform",$e=Gt+"Origin",pS=function r(t,e){var s=this,i=this.target,n=i.style,a=i._gsap;if(t in Ei&&n){if(this.tfm=this.tfm||{},t!=="transform")t=si[t]||t,~t.indexOf(",")?t.split(",").forEach(function(h){return s.tfm[h]=Ti(i,h)}):this.tfm[t]=a.x?a[t]:Ti(i,t),t===$e&&(this.tfm.zOrigin=a.zOrigin);else return si.transform.split(",").forEach(function(h){return r.call(s,h,e)});if(this.props.indexOf(Gt)>=0)return;a.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push($e,e,"")),t=Gt}(n||e)&&this.props.push(t,e,n[t])},r_=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},mS=function(){var t=this.props,e=this.target,s=e.style,i=e._gsap,n,a;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?s[t[n]]=t[n+2]:s.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(ou,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)i[a]=this.tfm[a];i.svg&&(i.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=nu(),(!n||!n.isStart)&&!s[Gt]&&(r_(s),i.zOrigin&&s[$e]&&(s[$e]+=" "+i.zOrigin+"px",i.zOrigin=0,i.renderTransform()),i.uncache=1)}},n_=function(t,e){var s={target:t,props:[],revert:mS,save:pS};return t._gsap||Xe.core.getCache(t),e&&e.split(",").forEach(function(i){return s.save(i)}),s},o_,lu=function(t,e){var s=Ki.createElementNS?Ki.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Ki.createElement(t);return s&&s.style?s:Ki.createElement(t)},ii=function r(t,e,s){var i=getComputedStyle(t);return i[e]||i.getPropertyValue(e.replace(ou,"-$1").toLowerCase())||i.getPropertyValue(e)||!s&&r(t,Cn(e)||e,1)||""},a_="O,Moz,ms,Ms,Webkit".split(","),Cn=function(t,e,s){var i=e||Br,n=i.style,a=5;if(t in n&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(a_[a]+t in n););return a<0?null:(a===3?"ms":a>=0?a_[a]:"")+t},hu=function(){sS()&&window.document&&(Jg=window,Ki=Jg.document,Tn=Ki.documentElement,Br=lu("div")||{style:{}},lu("div"),Gt=Cn(Gt),$e=Gt+"Origin",Br.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",o_=!!Cn("perspective"),nu=Xe.core.reverting,ru=1)},cu=function r(t){var e=lu("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,i=this.nextSibling,n=this.style.cssText,a;if(Tn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(a=this._gsapBBox());return s&&(i?s.insertBefore(this,i):s.appendChild(this)),Tn.removeChild(e),this.style.cssText=n,a},l_=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},h_=function(t){var e;try{e=t.getBBox()}catch{e=cu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===cu||(e=cu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+l_(t,["x","cx","x1"])||0,y:+l_(t,["y","cy","y1"])||0,width:0,height:0}:e},c_=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&h_(t))},Or=function(t,e){if(e){var s=t.style,i;e in Ei&&e!==$e&&(e=Gt),s.removeProperty?(i=e.substr(0,2),(i==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(i==="--"?e:e.replace(ou,"-$1").toLowerCase())):s.removeAttribute(e)}},Qi=function(t,e,s,i,n,a){var h=new Ge(t._pt,e,s,0,1,a?i_:s_);return t._pt=h,h.b=i,h.e=n,t._props.push(s),h},u_={deg:1,rad:1,turn:1},gS={grid:1,flex:1},Ji=function r(t,e,s,i){var n=parseFloat(s)||0,a=(s+"").trim().substr((n+"").length)||"px",h=Br.style,o=iS.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(o?"Width":"Height"),c=100,d=i==="px",f=i==="%",p,m,g,_;if(i===a||!n||u_[i]||u_[a])return n;if(a!=="px"&&!d&&(n=r(t,e,s,"px")),_=t.getCTM&&c_(t),(f||a==="%")&&(Ei[e]||~e.indexOf("adius")))return p=_?t.getBBox()[o?"width":"height"]:t[u],te(f?n/p*c:n/100*p);if(h[o?"width":"height"]=c+(d?a:i),m=~e.indexOf("adius")||i==="em"&&t.appendChild&&!l?t:t.parentNode,_&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Ki||!m.appendChild)&&(m=Ki.body),g=m._gsap,g&&f&&g.width&&o&&g.time===ts.time&&!g.uncache)return te(n/g.width*c);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=c+i,p=t[u],x?t.style[e]=x:Or(t,e)}else(f||a==="%")&&!gS[ii(m,"display")]&&(h.position=ii(t,"position")),m===t&&(h.position="static"),m.appendChild(Br),p=Br[u],m.removeChild(Br),h.position="absolute";return o&&f&&(g=Ir(m),g.time=ts.time,g.width=m[u]),te(d?p*n/c:p&&n?c/p*n:0)},Ti=function(t,e,s,i){var n;return ru||hu(),e in si&&e!=="transform"&&(e=si[e],~e.indexOf(",")&&(e=e.split(",")[0])),Ei[e]&&e!=="transform"?(n=Eo(t,i),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dl(ii(t,$e))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||i||~(n+"").indexOf("calc("))&&(n=ul[e]&&ul[e](t,e,s)||ii(t,e)||mg(t,e)||(e==="opacity"?1:0))),s&&!~(n+"").trim().indexOf(" ")?Ji(t,e,n,s)+s:n},_S=function(t,e,s,i){if(!s||s==="none"){var n=Cn(e,t,1),a=n&&ii(t,n,1);a&&a!==s?(e=n,s=a):e==="borderColor"&&(s=ii(t,"borderTopColor"))}var h=new Ge(this._pt,t.style,e,0,1,qg),o=0,l=0,u,c,d,f,p,m,g,_,x,y,v,b;if(h.b=s,h.e=i,s+="",i+="",i==="auto"&&(m=t.style[e],t.style[e]=i,i=ii(t,e)||i,m?t.style[e]=m:Or(t,e)),u=[s,i],Vg(u),s=u[0],i=u[1],d=s.match(yn)||[],b=i.match(yn)||[],b.length){for(;c=yn.exec(i);)g=c[0],x=i.substring(o,c.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=xn(f,g)+v),_=parseFloat(g),y=g.substr((_+"").length),o=yn.lastIndex-y.length,y||(y=y||Ze.units[e]||v,o===i.length&&(i+=y,h.e+=y)),v!==y&&(f=Ji(t,e,m,y)||0),h._pt={_next:h._pt,p:x||l===1?x:",",s:f,c:_-f,m:p&&p<4||e==="zIndex"?Math.round:0});h.c=o<i.length?i.substring(o,i.length):""}else h.r=e==="display"&&i==="none"?i_:s_;return lg.test(i)&&(h.e=0),this._pt=h,h},d_={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},yS=function(t){var e=t.split(" "),s=e[0],i=e[1]||"50%";return(s==="top"||s==="bottom"||i==="left"||i==="right")&&(t=s,s=i,i=t),e[0]=d_[s]||s,e[1]=d_[i]||i,e.join(" ")},xS=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,i=s.style,n=e.u,a=s._gsap,h,o,l;if(n==="all"||n===!0)i.cssText="",o=1;else for(n=n.split(","),l=n.length;--l>-1;)h=n[l],Ei[h]&&(o=1,h=h==="transformOrigin"?$e:Gt),Or(s,h);o&&(Or(s,Gt),a&&(a.svg&&s.removeAttribute("transform"),Eo(s,1),a.uncache=1,r_(i)))}},ul={clearProps:function(t,e,s,i,n){if(n.data!=="isFromStart"){var a=t._pt=new Ge(t._pt,e,s,0,0,xS);return a.u=i,a.pr=-10,a.tween=n,t._props.push(s),1}}},wo=[1,0,0,1,0,0],f_={},p_=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},m_=function(t){var e=ii(t,Gt);return p_(e)?wo:e.substr(7).match(ag).map(te)},uu=function(t,e){var s=t._gsap||Ir(t),i=t.style,n=m_(t),a,h,o,l;return s.svg&&t.getAttribute("transform")?(o=t.transform.baseVal.consolidate().matrix,n=[o.a,o.b,o.c,o.d,o.e,o.f],n.join(",")==="1,0,0,1,0,0"?wo:n):(n===wo&&!t.offsetParent&&t!==Tn&&!s.svg&&(o=i.display,i.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,h=t.nextElementSibling,Tn.appendChild(t)),n=m_(t),o?i.display=o:Or(t,"display"),l&&(h?a.insertBefore(t,h):a?a.appendChild(t):Tn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},du=function(t,e,s,i,n,a){var h=t._gsap,o=n||uu(t,!0),l=h.xOrigin||0,u=h.yOrigin||0,c=h.xOffset||0,d=h.yOffset||0,f=o[0],p=o[1],m=o[2],g=o[3],_=o[4],x=o[5],y=e.split(" "),v=parseFloat(y[0])||0,b=parseFloat(y[1])||0,w,E,T,A;s?o!==wo&&(E=f*g-p*m)&&(T=v*(g/E)+b*(-m/E)+(m*x-g*_)/E,A=v*(-p/E)+b*(f/E)-(f*x-p*_)/E,v=T,b=A):(w=h_(t),v=w.x+(~y[0].indexOf("%")?v/100*w.width:v),b=w.y+(~(y[1]||y[0]).indexOf("%")?b/100*w.height:b)),i||i!==!1&&h.smooth?(_=v-l,x=b-u,h.xOffset=c+(_*f+x*m)-_,h.yOffset=d+(_*p+x*g)-x):h.xOffset=h.yOffset=0,h.xOrigin=v,h.yOrigin=b,h.smooth=!!i,h.origin=e,h.originIsAbsolute=!!s,t.style[$e]="0px 0px",a&&(Qi(a,h,"xOrigin",l,v),Qi(a,h,"yOrigin",u,b),Qi(a,h,"xOffset",c,h.xOffset),Qi(a,h,"yOffset",d,h.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},Eo=function(t,e){var s=t._gsap||new $g(t);if("x"in s&&!e&&!s.uncache)return s;var i=t.style,n=s.scaleX<0,a="px",h="deg",o=getComputedStyle(t),l=ii(t,$e)||"0",u,c,d,f,p,m,g,_,x,y,v,b,w,E,T,A,I,M,R,C,P,k,U,V,L,$,O,N,Z,Q,Y,lt;return u=c=d=m=g=_=x=y=v=0,f=p=1,s.svg=!!(t.getCTM&&c_(t)),o.translate&&((o.translate!=="none"||o.scale!=="none"||o.rotate!=="none")&&(i[Gt]=(o.translate!=="none"?"translate3d("+(o.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(o.rotate!=="none"?"rotate("+o.rotate+") ":"")+(o.scale!=="none"?"scale("+o.scale.split(" ").join(",")+") ":"")+(o[Gt]!=="none"?o[Gt]:"")),i.scale=i.rotate=i.translate="none"),E=uu(t,s.svg),s.svg&&(s.uncache?(L=t.getBBox(),l=s.xOrigin-L.x+"px "+(s.yOrigin-L.y)+"px",V=""):V=!e&&t.getAttribute("data-svg-origin"),du(t,V||l,!!V||s.originIsAbsolute,s.smooth!==!1,E)),b=s.xOrigin||0,w=s.yOrigin||0,E!==wo&&(M=E[0],R=E[1],C=E[2],P=E[3],u=k=E[4],c=U=E[5],E.length===6?(f=Math.sqrt(M*M+R*R),p=Math.sqrt(P*P+C*C),m=M||R?Sn(R,M)*Dr:0,x=C||P?Sn(C,P)*Dr+m:0,x&&(p*=Math.abs(Math.cos(x*An))),s.svg&&(u-=b-(b*M+w*C),c-=w-(b*R+w*P))):(lt=E[6],Q=E[7],O=E[8],N=E[9],Z=E[10],Y=E[11],u=E[12],c=E[13],d=E[14],T=Sn(lt,Z),g=T*Dr,T&&(A=Math.cos(-T),I=Math.sin(-T),V=k*A+O*I,L=U*A+N*I,$=lt*A+Z*I,O=k*-I+O*A,N=U*-I+N*A,Z=lt*-I+Z*A,Y=Q*-I+Y*A,k=V,U=L,lt=$),T=Sn(-C,Z),_=T*Dr,T&&(A=Math.cos(-T),I=Math.sin(-T),V=M*A-O*I,L=R*A-N*I,$=C*A-Z*I,Y=P*I+Y*A,M=V,R=L,C=$),T=Sn(R,M),m=T*Dr,T&&(A=Math.cos(T),I=Math.sin(T),V=M*A+R*I,L=k*A+U*I,R=R*A-M*I,U=U*A-k*I,M=V,k=L),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,_=180-_),f=te(Math.sqrt(M*M+R*R+C*C)),p=te(Math.sqrt(U*U+lt*lt)),T=Sn(k,U),x=Math.abs(T)>2e-4?T*Dr:0,v=Y?1/(Y<0?-Y:Y):0),s.svg&&(V=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!p_(ii(t,Gt)),V&&t.setAttribute("transform",V))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||s.uncache,s.x=u-((s.xPercent=u&&(!e&&s.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*s.xPercent/100:0)+a,s.y=c-((s.yPercent=c&&(!e&&s.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*s.yPercent/100:0)+a,s.z=d+a,s.scaleX=te(f),s.scaleY=te(p),s.rotation=te(m)+h,s.rotationX=te(g)+h,s.rotationY=te(_)+h,s.skewX=x+h,s.skewY=y+h,s.transformPerspective=v+a,(s.zOrigin=parseFloat(l.split(" ")[2])||!e&&s.zOrigin||0)&&(i[$e]=dl(l)),s.xOffset=s.yOffset=0,s.force3D=Ze.force3D,s.renderTransform=s.svg?bS:o_?g_:vS,s.uncache=0,s},dl=function(t){return(t=t.split(" "))[0]+" "+t[1]},fu=function(t,e,s){var i=Ce(e);return te(parseFloat(e)+parseFloat(Ji(t,"x",s+"px",i)))+i},vS=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,g_(t,e)},Lr="0deg",To="0px",Nr=") ",g_=function(t,e){var s=e||this,i=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.z,l=s.rotation,u=s.rotationY,c=s.rotationX,d=s.skewX,f=s.skewY,p=s.scaleX,m=s.scaleY,g=s.transformPerspective,_=s.force3D,x=s.target,y=s.zOrigin,v="",b=_==="auto"&&t&&t!==1||_===!0;if(y&&(c!==Lr||u!==Lr)){var w=parseFloat(u)*An,E=Math.sin(w),T=Math.cos(w),A;w=parseFloat(c)*An,A=Math.cos(w),a=fu(x,a,E*A*-y),h=fu(x,h,-Math.sin(w)*-y),o=fu(x,o,T*A*-y+y)}g!==To&&(v+="perspective("+g+Nr),(i||n)&&(v+="translate("+i+"%, "+n+"%) "),(b||a!==To||h!==To||o!==To)&&(v+=o!==To||b?"translate3d("+a+", "+h+", "+o+") ":"translate("+a+", "+h+Nr),l!==Lr&&(v+="rotate("+l+Nr),u!==Lr&&(v+="rotateY("+u+Nr),c!==Lr&&(v+="rotateX("+c+Nr),(d!==Lr||f!==Lr)&&(v+="skew("+d+", "+f+Nr),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Nr),x.style[Gt]=v||"translate(0, 0)"},bS=function(t,e){var s=e||this,i=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.rotation,l=s.skewX,u=s.skewY,c=s.scaleX,d=s.scaleY,f=s.target,p=s.xOrigin,m=s.yOrigin,g=s.xOffset,_=s.yOffset,x=s.forceCSS,y=parseFloat(a),v=parseFloat(h),b,w,E,T,A;o=parseFloat(o),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,o+=u),o||l?(o*=An,l*=An,b=Math.cos(o)*c,w=Math.sin(o)*c,E=Math.sin(o-l)*-d,T=Math.cos(o-l)*d,l&&(u*=An,A=Math.tan(l-u),A=Math.sqrt(1+A*A),E*=A,T*=A,u&&(A=Math.tan(u),A=Math.sqrt(1+A*A),b*=A,w*=A)),b=te(b),w=te(w),E=te(E),T=te(T)):(b=c,T=d,w=E=0),(y&&!~(a+"").indexOf("px")||v&&!~(h+"").indexOf("px"))&&(y=Ji(f,"x",a,"px"),v=Ji(f,"y",h,"px")),(p||m||g||_)&&(y=te(y+p-(p*b+m*E)+g),v=te(v+m-(p*w+m*T)+_)),(i||n)&&(A=f.getBBox(),y=te(y+i/100*A.width),v=te(v+n/100*A.height)),A="matrix("+b+","+w+","+E+","+T+","+y+","+v+")",f.setAttribute("transform",A),x&&(f.style[Gt]=A)},wS=function(t,e,s,i,n){var a=360,h=me(n),o=parseFloat(n)*(h&&~n.indexOf("rad")?Dr:1),l=o-i,u=i+l+"deg",c,d;return h&&(c=n.split("_")[1],c==="short"&&(l%=a,l!==l%(a/2)&&(l+=l<0?a:-a)),c==="cw"&&l<0?l=(l+a*e_)%a-~~(l/a)*a:c==="ccw"&&l>0&&(l=(l-a*e_)%a-~~(l/a)*a)),t._pt=d=new Ge(t._pt,e,s,i,l,nS),d.e=u,d.u="deg",t._props.push(s),d},__=function(t,e){for(var s in e)t[s]=e[s];return t},ES=function(t,e,s){var i=__({},s._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=s.style,h,o,l,u,c,d,f,p;i.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),a[Gt]=e,h=Eo(s,1),Or(s,Gt),s.setAttribute("transform",l)):(l=getComputedStyle(s)[Gt],a[Gt]=e,h=Eo(s,1),a[Gt]=l);for(o in Ei)l=i[o],u=h[o],l!==u&&n.indexOf(o)<0&&(f=Ce(l),p=Ce(u),c=f!==p?Ji(s,o,l,p):parseFloat(l),d=parseFloat(u),t._pt=new Ge(t._pt,h,o,c,d-c,au),t._pt.u=p||0,t._props.push(o));__(h,i)};Ue("padding,margin,Width,Radius",function(r,t){var e="Top",s="Right",i="Bottom",n="Left",a=(t<3?[e,s,i,n]:[e+n,e+s,i+s,i+n]).map(function(h){return t<2?r+h:"border"+h+r});ul[t>1?"border"+r:r]=function(h,o,l,u,c){var d,f;if(arguments.length<4)return d=a.map(function(p){return Ti(h,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(u+"").split(" "),f={},a.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),h.init(o,f,c)}});var y_={name:"css",register:hu,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,i,n){var a=this._props,h=t.style,o=s.vars.startAt,l,u,c,d,f,p,m,g,_,x,y,v,b,w,E,T;ru||hu(),this.styles=this.styles||n_(t),T=this.styles.props,this.tween=s;for(m in e)if(m!=="autoRound"&&(u=e[m],!(Qe[m]&&Hg(m,e,s,i,t,n)))){if(f=typeof u,p=ul[m],f==="function"&&(u=u.call(s,i,t,n),f=typeof u),f==="string"&&~u.indexOf("random(")&&(u=go(u)),p)p(this,t,m,u,s)&&(E=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),u+="",qi.lastIndex=0,qi.test(l)||(g=Ce(l),_=Ce(u)),_?g!==_&&(l=Ji(t,m,l,_)+_):g&&(u+=g),this.add(h,"setProperty",l,u,i,n,0,0,m),a.push(m),T.push(m,0,h[m]);else if(f!=="undefined"){if(o&&m in o?(l=typeof o[m]=="function"?o[m].call(s,i,t,n):o[m],me(l)&&~l.indexOf("random(")&&(l=go(l)),Ce(l+"")||l==="auto"||(l+=Ze.units[m]||Ce(Ti(t,m))||""),(l+"").charAt(1)==="="&&(l=Ti(t,m))):l=Ti(t,m),d=parseFloat(l),x=f==="string"&&u.charAt(1)==="="&&u.substr(0,2),x&&(u=u.substr(2)),c=parseFloat(u),m in si&&(m==="autoAlpha"&&(d===1&&Ti(t,"visibility")==="hidden"&&c&&(d=0),T.push("visibility",0,h.visibility),Qi(this,h,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),m!=="scale"&&m!=="transform"&&(m=si[m],~m.indexOf(",")&&(m=m.split(",")[0]))),y=m in Ei,y){if(this.styles.save(m),v||(b=t._gsap,b.renderTransform&&!e.parseTransform||Eo(t,e.parseTransform),w=e.smoothOrigin!==!1&&b.smooth,v=this._pt=new Ge(this._pt,h,Gt,0,1,b.renderTransform,b,0,-1),v.dep=1),m==="scale")this._pt=new Ge(this._pt,b,"scaleY",b.scaleY,(x?xn(b.scaleY,x+c):c)-b.scaleY||0,au),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){T.push($e,0,h[$e]),u=yS(u),b.svg?du(t,u,0,w,0,this):(_=parseFloat(u.split(" ")[2])||0,_!==b.zOrigin&&Qi(this,b,"zOrigin",b.zOrigin,_),Qi(this,h,m,dl(l),dl(u)));continue}else if(m==="svgOrigin"){du(t,u,1,w,0,this);continue}else if(m in f_){wS(this,b,m,d,x?xn(d,x+u):u);continue}else if(m==="smoothOrigin"){Qi(this,b,"smooth",b.smooth,u);continue}else if(m==="force3D"){b[m]=u;continue}else if(m==="transform"){ES(this,u,t);continue}}else m in h||(m=Cn(m)||m);if(y||(c||c===0)&&(d||d===0)&&!rS.test(u)&&m in h)g=(l+"").substr((d+"").length),c||(c=0),_=Ce(u)||(m in Ze.units?Ze.units[m]:g),g!==_&&(d=Ji(t,m,l,_)),this._pt=new Ge(this._pt,y?b:h,m,d,(x?xn(d,x+c):c)-d,!y&&(_==="px"||m==="zIndex")&&e.autoRound!==!1?aS:au),this._pt.u=_||0,g!==_&&_!=="%"&&(this._pt.b=l,this._pt.r=oS);else if(m in h)_S.call(this,t,m,l,x?x+u:u);else if(m in t)this.add(t,m,l||t[m],x?x+u:u,i,n);else if(m!=="parseTransform"){Dc(m,u);continue}y||(m in h?T.push(m,0,h[m]):T.push(m,1,l||t[m])),a.push(m)}}E&&Zg(this)},render:function(t,e){if(e.tween._time||!nu())for(var s=e._pt;s;)s.r(t,s.d),s=s._next;else e.styles.revert()},get:Ti,aliases:si,getSetter:function(t,e,s){var i=si[e];return i&&i.indexOf(",")<0&&(e=i),e in Ei&&e!==$e&&(t._gsap.x||Ti(t,"x"))?s&&t_===s?e==="scale"?uS:cS:(t_=s||{})&&(e==="scale"?dS:fS):t.style&&!Pc(t.style[e])?lS:~e.indexOf("-")?hS:Jc(t,e)},core:{_removeProperty:Or,_getMatrix:uu}};Xe.utils.checkPrefix=Cn,Xe.core.getStyleSaver=n_,function(r,t,e,s){var i=Ue(r+","+t+","+e,function(n){Ei[n]=1});Ue(t,function(n){Ze.units[n]="deg",f_[n]=1}),si[i[13]]=r+","+t,Ue(s,function(n){var a=n.split(":");si[a[1]]=i[a[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ue("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Ze.units[r]="px"}),Xe.registerPlugin(y_);var xt=Xe.registerPlugin(y_)||Xe;xt.core.Tween;class fl extends hs{constructor(t){super(),this.radius=0,this.enableTint=!0,this.bgColor="#fff",this.borderWidth=0,this.borderColor="black",this.bgAlpha=1;const{x:e=0,y:s=0,width:i=0,height:n=0,bgColor:a="#fff",alpha:h=1,radius:o=0,borderWidth:l=0,borderColor:u="black",enableTint:c=!0}=t;this.x=e,this.y=s,this.bgAlpha=h,this.radius=o,this.enableTint=c,this.bgColor=a,this.borderWidth=l,this.borderColor=u,this.renderBg(i,n)}updateColor(t){xt.to(this,{tint:t,duration:.25})}renderBg(t,e){this.clear(),this.enableTint?(this.beginFill("#fff",this.bgAlpha),this.tint=this.bgColor):(this.beginFill(this.bgColor,this.bgAlpha),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1)),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1),this.radius!==0?typeof this.radius=="number"?this.drawRoundedRect(0,0,t,e,this.radius):(this.moveTo(0+this.radius[0],0),this.lineTo(0+t-this.radius[1],0),this.radius[1]>0?this.arcTo(0+t,0,0+t,0+this.radius[1],this.radius[1]):this.lineTo(0+t,0),this.lineTo(0+t,0+e-this.radius[2]),this.radius[2]>0?this.arcTo(0+t,0+e,0+t-this.radius[2],0+e,this.radius[2]):this.lineTo(0+t,0+e),this.lineTo(0+this.radius[3],0+e),this.radius[3]>0?this.arcTo(0,0+e,0,0+e-this.radius[3],this.radius[3]):this.lineTo(0,0+e),this.lineTo(0,0+this.radius[0]),this.radius[0]>0?this.arcTo(0,0,0+this.radius[0],0,this.radius[0]):this.lineTo(0,0),this.closePath()):this.drawRect(0,0,t,e),this.endFill()}}class Ao extends It{constructor(t,e,s,i){if(super(),i){const n=new hs;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}s?(this._bgColorFill=new fl({width:t,height:e,bgColor:s}),this.addChild(this._bgColorFill)):(this._fill=new qe,this._fill.width=t,this._fill.height=e,this.addChild(this._fill))}setSize(t,e){this._fill&&(this._fill.width=t,this._fill.height=e),this._bgColorFill&&this._bgColorFill.renderBg(t,e)}}/*!
1163
+ */var jg,Ki,Tn,eu,Br,qg,su,rS=function(){return typeof window<"u"},Ei={},Dr=180/Math.PI,An=Math.PI/180,Sn=Math.atan2,Zg=1e8,iu=/([A-Z])/g,nS=/(left|right|width|margin|padding|x)/i,oS=/[\s,\(]\S/,si={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},ru=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},aS=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},lS=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},hS=function(t,e){var s=e.s+e.c*t;e.set(e.t,e.p,~~(s+(s<0?-.5:.5))+e.u,e)},Kg=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Qg=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},cS=function(t,e,s){return t.style[e]=s},uS=function(t,e,s){return t.style.setProperty(e,s)},dS=function(t,e,s){return t._gsap[e]=s},fS=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},pS=function(t,e,s,i,n){var a=t._gsap;a.scaleX=a.scaleY=s,a.renderTransform(n,a)},mS=function(t,e,s,i,n){var a=t._gsap;a[e]=s,a.renderTransform(n,a)},Gt="transform",$e=Gt+"Origin",gS=function r(t,e){var s=this,i=this.target,n=i.style,a=i._gsap;if(t in Ei&&n){if(this.tfm=this.tfm||{},t!=="transform")t=si[t]||t,~t.indexOf(",")?t.split(",").forEach(function(h){return s.tfm[h]=Ti(i,h)}):this.tfm[t]=a.x?a[t]:Ti(i,t),t===$e&&(this.tfm.zOrigin=a.zOrigin);else return si.transform.split(",").forEach(function(h){return r.call(s,h,e)});if(this.props.indexOf(Gt)>=0)return;a.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push($e,e,"")),t=Gt}(n||e)&&this.props.push(t,e,n[t])},Jg=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},_S=function(){var t=this.props,e=this.target,s=e.style,i=e._gsap,n,a;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?s[t[n]]=t[n+2]:s.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(iu,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)i[a]=this.tfm[a];i.svg&&(i.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=su(),(!n||!n.isStart)&&!s[Gt]&&(Jg(s),i.zOrigin&&s[$e]&&(s[$e]+=" "+i.zOrigin+"px",i.zOrigin=0,i.renderTransform()),i.uncache=1)}},t_=function(t,e){var s={target:t,props:[],revert:_S,save:gS};return t._gsap||Xe.core.getCache(t),e&&e.split(",").forEach(function(i){return s.save(i)}),s},e_,nu=function(t,e){var s=Ki.createElementNS?Ki.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Ki.createElement(t);return s&&s.style?s:Ki.createElement(t)},ii=function r(t,e,s){var i=getComputedStyle(t);return i[e]||i.getPropertyValue(e.replace(iu,"-$1").toLowerCase())||i.getPropertyValue(e)||!s&&r(t,Cn(e)||e,1)||""},s_="O,Moz,ms,Ms,Webkit".split(","),Cn=function(t,e,s){var i=e||Br,n=i.style,a=5;if(t in n&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(s_[a]+t in n););return a<0?null:(a===3?"ms":a>=0?s_[a]:"")+t},ou=function(){rS()&&window.document&&(jg=window,Ki=jg.document,Tn=Ki.documentElement,Br=nu("div")||{style:{}},nu("div"),Gt=Cn(Gt),$e=Gt+"Origin",Br.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",e_=!!Cn("perspective"),su=Xe.core.reverting,eu=1)},au=function r(t){var e=nu("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,i=this.nextSibling,n=this.style.cssText,a;if(Tn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(a=this._gsapBBox());return s&&(i?s.insertBefore(this,i):s.appendChild(this)),Tn.removeChild(e),this.style.cssText=n,a},i_=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},r_=function(t){var e;try{e=t.getBBox()}catch{e=au.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===au||(e=au.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+i_(t,["x","cx","x1"])||0,y:+i_(t,["y","cy","y1"])||0,width:0,height:0}:e},n_=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&r_(t))},Or=function(t,e){if(e){var s=t.style,i;e in Ei&&e!==$e&&(e=Gt),s.removeProperty?(i=e.substr(0,2),(i==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(i==="--"?e:e.replace(iu,"-$1").toLowerCase())):s.removeAttribute(e)}},Qi=function(t,e,s,i,n,a){var h=new Ge(t._pt,e,s,0,1,a?Qg:Kg);return t._pt=h,h.b=i,h.e=n,t._props.push(s),h},o_={deg:1,rad:1,turn:1},yS={grid:1,flex:1},Ji=function r(t,e,s,i){var n=parseFloat(s)||0,a=(s+"").trim().substr((n+"").length)||"px",h=Br.style,o=nS.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(o?"Width":"Height"),c=100,d=i==="px",f=i==="%",p,m,g,_;if(i===a||!n||o_[i]||o_[a])return n;if(a!=="px"&&!d&&(n=r(t,e,s,"px")),_=t.getCTM&&n_(t),(f||a==="%")&&(Ei[e]||~e.indexOf("adius")))return p=_?t.getBBox()[o?"width":"height"]:t[u],te(f?n/p*c:n/100*p);if(h[o?"width":"height"]=c+(d?a:i),m=~e.indexOf("adius")||i==="em"&&t.appendChild&&!l?t:t.parentNode,_&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Ki||!m.appendChild)&&(m=Ki.body),g=m._gsap,g&&f&&g.width&&o&&g.time===ts.time&&!g.uncache)return te(n/g.width*c);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=c+i,p=t[u],x?t.style[e]=x:Or(t,e)}else(f||a==="%")&&!yS[ii(m,"display")]&&(h.position=ii(t,"position")),m===t&&(h.position="static"),m.appendChild(Br),p=Br[u],m.removeChild(Br),h.position="absolute";return o&&f&&(g=Ir(m),g.time=ts.time,g.width=m[u]),te(d?p*n/c:p&&n?c/p*n:0)},Ti=function(t,e,s,i){var n;return eu||ou(),e in si&&e!=="transform"&&(e=si[e],~e.indexOf(",")&&(e=e.split(",")[0])),Ei[e]&&e!=="transform"?(n=Eo(t,i),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dl(ii(t,$e))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||i||~(n+"").indexOf("calc("))&&(n=ul[e]&&ul[e](t,e,s)||ii(t,e)||cg(t,e)||(e==="opacity"?1:0))),s&&!~(n+"").trim().indexOf(" ")?Ji(t,e,n,s)+s:n},xS=function(t,e,s,i){if(!s||s==="none"){var n=Cn(e,t,1),a=n&&ii(t,n,1);a&&a!==s?(e=n,s=a):e==="borderColor"&&(s=ii(t,"borderTopColor"))}var h=new Ge(this._pt,t.style,e,0,1,Hg),o=0,l=0,u,c,d,f,p,m,g,_,x,y,v,b;if(h.b=s,h.e=i,s+="",i+="",i==="auto"&&(m=t.style[e],t.style[e]=i,i=ii(t,e)||i,m?t.style[e]=m:Or(t,e)),u=[s,i],Bg(u),s=u[0],i=u[1],d=s.match(yn)||[],b=i.match(yn)||[],b.length){for(;c=yn.exec(i);)g=c[0],x=i.substring(o,c.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=xn(f,g)+v),_=parseFloat(g),y=g.substr((_+"").length),o=yn.lastIndex-y.length,y||(y=y||Ze.units[e]||v,o===i.length&&(i+=y,h.e+=y)),v!==y&&(f=Ji(t,e,m,y)||0),h._pt={_next:h._pt,p:x||l===1?x:",",s:f,c:_-f,m:p&&p<4||e==="zIndex"?Math.round:0});h.c=o<i.length?i.substring(o,i.length):""}else h.r=e==="display"&&i==="none"?Qg:Kg;return ig.test(i)&&(h.e=0),this._pt=h,h},a_={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},vS=function(t){var e=t.split(" "),s=e[0],i=e[1]||"50%";return(s==="top"||s==="bottom"||i==="left"||i==="right")&&(t=s,s=i,i=t),e[0]=a_[s]||s,e[1]=a_[i]||i,e.join(" ")},bS=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,i=s.style,n=e.u,a=s._gsap,h,o,l;if(n==="all"||n===!0)i.cssText="",o=1;else for(n=n.split(","),l=n.length;--l>-1;)h=n[l],Ei[h]&&(o=1,h=h==="transformOrigin"?$e:Gt),Or(s,h);o&&(Or(s,Gt),a&&(a.svg&&s.removeAttribute("transform"),Eo(s,1),a.uncache=1,Jg(i)))}},ul={clearProps:function(t,e,s,i,n){if(n.data!=="isFromStart"){var a=t._pt=new Ge(t._pt,e,s,0,0,bS);return a.u=i,a.pr=-10,a.tween=n,t._props.push(s),1}}},wo=[1,0,0,1,0,0],l_={},h_=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},c_=function(t){var e=ii(t,Gt);return h_(e)?wo:e.substr(7).match(sg).map(te)},lu=function(t,e){var s=t._gsap||Ir(t),i=t.style,n=c_(t),a,h,o,l;return s.svg&&t.getAttribute("transform")?(o=t.transform.baseVal.consolidate().matrix,n=[o.a,o.b,o.c,o.d,o.e,o.f],n.join(",")==="1,0,0,1,0,0"?wo:n):(n===wo&&!t.offsetParent&&t!==Tn&&!s.svg&&(o=i.display,i.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,h=t.nextElementSibling,Tn.appendChild(t)),n=c_(t),o?i.display=o:Or(t,"display"),l&&(h?a.insertBefore(t,h):a?a.appendChild(t):Tn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},hu=function(t,e,s,i,n,a){var h=t._gsap,o=n||lu(t,!0),l=h.xOrigin||0,u=h.yOrigin||0,c=h.xOffset||0,d=h.yOffset||0,f=o[0],p=o[1],m=o[2],g=o[3],_=o[4],x=o[5],y=e.split(" "),v=parseFloat(y[0])||0,b=parseFloat(y[1])||0,w,E,T,A;s?o!==wo&&(E=f*g-p*m)&&(T=v*(g/E)+b*(-m/E)+(m*x-g*_)/E,A=v*(-p/E)+b*(f/E)-(f*x-p*_)/E,v=T,b=A):(w=r_(t),v=w.x+(~y[0].indexOf("%")?v/100*w.width:v),b=w.y+(~(y[1]||y[0]).indexOf("%")?b/100*w.height:b)),i||i!==!1&&h.smooth?(_=v-l,x=b-u,h.xOffset=c+(_*f+x*m)-_,h.yOffset=d+(_*p+x*g)-x):h.xOffset=h.yOffset=0,h.xOrigin=v,h.yOrigin=b,h.smooth=!!i,h.origin=e,h.originIsAbsolute=!!s,t.style[$e]="0px 0px",a&&(Qi(a,h,"xOrigin",l,v),Qi(a,h,"yOrigin",u,b),Qi(a,h,"xOffset",c,h.xOffset),Qi(a,h,"yOffset",d,h.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},Eo=function(t,e){var s=t._gsap||new Ng(t);if("x"in s&&!e&&!s.uncache)return s;var i=t.style,n=s.scaleX<0,a="px",h="deg",o=getComputedStyle(t),l=ii(t,$e)||"0",u,c,d,f,p,m,g,_,x,y,v,b,w,E,T,A,I,M,R,C,P,k,U,V,L,$,O,N,Z,Q,Y,lt;return u=c=d=m=g=_=x=y=v=0,f=p=1,s.svg=!!(t.getCTM&&n_(t)),o.translate&&((o.translate!=="none"||o.scale!=="none"||o.rotate!=="none")&&(i[Gt]=(o.translate!=="none"?"translate3d("+(o.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(o.rotate!=="none"?"rotate("+o.rotate+") ":"")+(o.scale!=="none"?"scale("+o.scale.split(" ").join(",")+") ":"")+(o[Gt]!=="none"?o[Gt]:"")),i.scale=i.rotate=i.translate="none"),E=lu(t,s.svg),s.svg&&(s.uncache?(L=t.getBBox(),l=s.xOrigin-L.x+"px "+(s.yOrigin-L.y)+"px",V=""):V=!e&&t.getAttribute("data-svg-origin"),hu(t,V||l,!!V||s.originIsAbsolute,s.smooth!==!1,E)),b=s.xOrigin||0,w=s.yOrigin||0,E!==wo&&(M=E[0],R=E[1],C=E[2],P=E[3],u=k=E[4],c=U=E[5],E.length===6?(f=Math.sqrt(M*M+R*R),p=Math.sqrt(P*P+C*C),m=M||R?Sn(R,M)*Dr:0,x=C||P?Sn(C,P)*Dr+m:0,x&&(p*=Math.abs(Math.cos(x*An))),s.svg&&(u-=b-(b*M+w*C),c-=w-(b*R+w*P))):(lt=E[6],Q=E[7],O=E[8],N=E[9],Z=E[10],Y=E[11],u=E[12],c=E[13],d=E[14],T=Sn(lt,Z),g=T*Dr,T&&(A=Math.cos(-T),I=Math.sin(-T),V=k*A+O*I,L=U*A+N*I,$=lt*A+Z*I,O=k*-I+O*A,N=U*-I+N*A,Z=lt*-I+Z*A,Y=Q*-I+Y*A,k=V,U=L,lt=$),T=Sn(-C,Z),_=T*Dr,T&&(A=Math.cos(-T),I=Math.sin(-T),V=M*A-O*I,L=R*A-N*I,$=C*A-Z*I,Y=P*I+Y*A,M=V,R=L,C=$),T=Sn(R,M),m=T*Dr,T&&(A=Math.cos(T),I=Math.sin(T),V=M*A+R*I,L=k*A+U*I,R=R*A-M*I,U=U*A-k*I,M=V,k=L),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,_=180-_),f=te(Math.sqrt(M*M+R*R+C*C)),p=te(Math.sqrt(U*U+lt*lt)),T=Sn(k,U),x=Math.abs(T)>2e-4?T*Dr:0,v=Y?1/(Y<0?-Y:Y):0),s.svg&&(V=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!h_(ii(t,Gt)),V&&t.setAttribute("transform",V))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||s.uncache,s.x=u-((s.xPercent=u&&(!e&&s.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*s.xPercent/100:0)+a,s.y=c-((s.yPercent=c&&(!e&&s.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*s.yPercent/100:0)+a,s.z=d+a,s.scaleX=te(f),s.scaleY=te(p),s.rotation=te(m)+h,s.rotationX=te(g)+h,s.rotationY=te(_)+h,s.skewX=x+h,s.skewY=y+h,s.transformPerspective=v+a,(s.zOrigin=parseFloat(l.split(" ")[2])||!e&&s.zOrigin||0)&&(i[$e]=dl(l)),s.xOffset=s.yOffset=0,s.force3D=Ze.force3D,s.renderTransform=s.svg?ES:e_?u_:wS,s.uncache=0,s},dl=function(t){return(t=t.split(" "))[0]+" "+t[1]},cu=function(t,e,s){var i=Ce(e);return te(parseFloat(e)+parseFloat(Ji(t,"x",s+"px",i)))+i},wS=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,u_(t,e)},Lr="0deg",To="0px",Nr=") ",u_=function(t,e){var s=e||this,i=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.z,l=s.rotation,u=s.rotationY,c=s.rotationX,d=s.skewX,f=s.skewY,p=s.scaleX,m=s.scaleY,g=s.transformPerspective,_=s.force3D,x=s.target,y=s.zOrigin,v="",b=_==="auto"&&t&&t!==1||_===!0;if(y&&(c!==Lr||u!==Lr)){var w=parseFloat(u)*An,E=Math.sin(w),T=Math.cos(w),A;w=parseFloat(c)*An,A=Math.cos(w),a=cu(x,a,E*A*-y),h=cu(x,h,-Math.sin(w)*-y),o=cu(x,o,T*A*-y+y)}g!==To&&(v+="perspective("+g+Nr),(i||n)&&(v+="translate("+i+"%, "+n+"%) "),(b||a!==To||h!==To||o!==To)&&(v+=o!==To||b?"translate3d("+a+", "+h+", "+o+") ":"translate("+a+", "+h+Nr),l!==Lr&&(v+="rotate("+l+Nr),u!==Lr&&(v+="rotateY("+u+Nr),c!==Lr&&(v+="rotateX("+c+Nr),(d!==Lr||f!==Lr)&&(v+="skew("+d+", "+f+Nr),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Nr),x.style[Gt]=v||"translate(0, 0)"},ES=function(t,e){var s=e||this,i=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.rotation,l=s.skewX,u=s.skewY,c=s.scaleX,d=s.scaleY,f=s.target,p=s.xOrigin,m=s.yOrigin,g=s.xOffset,_=s.yOffset,x=s.forceCSS,y=parseFloat(a),v=parseFloat(h),b,w,E,T,A;o=parseFloat(o),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,o+=u),o||l?(o*=An,l*=An,b=Math.cos(o)*c,w=Math.sin(o)*c,E=Math.sin(o-l)*-d,T=Math.cos(o-l)*d,l&&(u*=An,A=Math.tan(l-u),A=Math.sqrt(1+A*A),E*=A,T*=A,u&&(A=Math.tan(u),A=Math.sqrt(1+A*A),b*=A,w*=A)),b=te(b),w=te(w),E=te(E),T=te(T)):(b=c,T=d,w=E=0),(y&&!~(a+"").indexOf("px")||v&&!~(h+"").indexOf("px"))&&(y=Ji(f,"x",a,"px"),v=Ji(f,"y",h,"px")),(p||m||g||_)&&(y=te(y+p-(p*b+m*E)+g),v=te(v+m-(p*w+m*T)+_)),(i||n)&&(A=f.getBBox(),y=te(y+i/100*A.width),v=te(v+n/100*A.height)),A="matrix("+b+","+w+","+E+","+T+","+y+","+v+")",f.setAttribute("transform",A),x&&(f.style[Gt]=A)},TS=function(t,e,s,i,n){var a=360,h=me(n),o=parseFloat(n)*(h&&~n.indexOf("rad")?Dr:1),l=o-i,u=i+l+"deg",c,d;return h&&(c=n.split("_")[1],c==="short"&&(l%=a,l!==l%(a/2)&&(l+=l<0?a:-a)),c==="cw"&&l<0?l=(l+a*Zg)%a-~~(l/a)*a:c==="ccw"&&l>0&&(l=(l-a*Zg)%a-~~(l/a)*a)),t._pt=d=new Ge(t._pt,e,s,i,l,aS),d.e=u,d.u="deg",t._props.push(s),d},d_=function(t,e){for(var s in e)t[s]=e[s];return t},AS=function(t,e,s){var i=d_({},s._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=s.style,h,o,l,u,c,d,f,p;i.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),a[Gt]=e,h=Eo(s,1),Or(s,Gt),s.setAttribute("transform",l)):(l=getComputedStyle(s)[Gt],a[Gt]=e,h=Eo(s,1),a[Gt]=l);for(o in Ei)l=i[o],u=h[o],l!==u&&n.indexOf(o)<0&&(f=Ce(l),p=Ce(u),c=f!==p?Ji(s,o,l,p):parseFloat(l),d=parseFloat(u),t._pt=new Ge(t._pt,h,o,c,d-c,ru),t._pt.u=p||0,t._props.push(o));d_(h,i)};Ue("padding,margin,Width,Radius",function(r,t){var e="Top",s="Right",i="Bottom",n="Left",a=(t<3?[e,s,i,n]:[e+n,e+s,i+s,i+n]).map(function(h){return t<2?r+h:"border"+h+r});ul[t>1?"border"+r:r]=function(h,o,l,u,c){var d,f;if(arguments.length<4)return d=a.map(function(p){return Ti(h,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(u+"").split(" "),f={},a.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),h.init(o,f,c)}});var f_={name:"css",register:ou,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,i,n){var a=this._props,h=t.style,o=s.vars.startAt,l,u,c,d,f,p,m,g,_,x,y,v,b,w,E,T;eu||ou(),this.styles=this.styles||t_(t),T=this.styles.props,this.tween=s;for(m in e)if(m!=="autoRound"&&(u=e[m],!(Qe[m]&&Vg(m,e,s,i,t,n)))){if(f=typeof u,p=ul[m],f==="function"&&(u=u.call(s,i,t,n),f=typeof u),f==="string"&&~u.indexOf("random(")&&(u=go(u)),p)p(this,t,m,u,s)&&(E=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),u+="",qi.lastIndex=0,qi.test(l)||(g=Ce(l),_=Ce(u)),_?g!==_&&(l=Ji(t,m,l,_)+_):g&&(u+=g),this.add(h,"setProperty",l,u,i,n,0,0,m),a.push(m),T.push(m,0,h[m]);else if(f!=="undefined"){if(o&&m in o?(l=typeof o[m]=="function"?o[m].call(s,i,t,n):o[m],me(l)&&~l.indexOf("random(")&&(l=go(l)),Ce(l+"")||l==="auto"||(l+=Ze.units[m]||Ce(Ti(t,m))||""),(l+"").charAt(1)==="="&&(l=Ti(t,m))):l=Ti(t,m),d=parseFloat(l),x=f==="string"&&u.charAt(1)==="="&&u.substr(0,2),x&&(u=u.substr(2)),c=parseFloat(u),m in si&&(m==="autoAlpha"&&(d===1&&Ti(t,"visibility")==="hidden"&&c&&(d=0),T.push("visibility",0,h.visibility),Qi(this,h,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),m!=="scale"&&m!=="transform"&&(m=si[m],~m.indexOf(",")&&(m=m.split(",")[0]))),y=m in Ei,y){if(this.styles.save(m),v||(b=t._gsap,b.renderTransform&&!e.parseTransform||Eo(t,e.parseTransform),w=e.smoothOrigin!==!1&&b.smooth,v=this._pt=new Ge(this._pt,h,Gt,0,1,b.renderTransform,b,0,-1),v.dep=1),m==="scale")this._pt=new Ge(this._pt,b,"scaleY",b.scaleY,(x?xn(b.scaleY,x+c):c)-b.scaleY||0,ru),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){T.push($e,0,h[$e]),u=vS(u),b.svg?hu(t,u,0,w,0,this):(_=parseFloat(u.split(" ")[2])||0,_!==b.zOrigin&&Qi(this,b,"zOrigin",b.zOrigin,_),Qi(this,h,m,dl(l),dl(u)));continue}else if(m==="svgOrigin"){hu(t,u,1,w,0,this);continue}else if(m in l_){TS(this,b,m,d,x?xn(d,x+u):u);continue}else if(m==="smoothOrigin"){Qi(this,b,"smooth",b.smooth,u);continue}else if(m==="force3D"){b[m]=u;continue}else if(m==="transform"){AS(this,u,t);continue}}else m in h||(m=Cn(m)||m);if(y||(c||c===0)&&(d||d===0)&&!oS.test(u)&&m in h)g=(l+"").substr((d+"").length),c||(c=0),_=Ce(u)||(m in Ze.units?Ze.units[m]:g),g!==_&&(d=Ji(t,m,l,_)),this._pt=new Ge(this._pt,y?b:h,m,d,(x?xn(d,x+c):c)-d,!y&&(_==="px"||m==="zIndex")&&e.autoRound!==!1?hS:ru),this._pt.u=_||0,g!==_&&_!=="%"&&(this._pt.b=l,this._pt.r=lS);else if(m in h)xS.call(this,t,m,l,x?x+u:u);else if(m in t)this.add(t,m,l||t[m],x?x+u:u,i,n);else if(m!=="parseTransform"){Fc(m,u);continue}y||(m in h?T.push(m,0,h[m]):T.push(m,1,l||t[m])),a.push(m)}}E&&Yg(this)},render:function(t,e){if(e.tween._time||!su())for(var s=e._pt;s;)s.r(t,s.d),s=s._next;else e.styles.revert()},get:Ti,aliases:si,getSetter:function(t,e,s){var i=si[e];return i&&i.indexOf(",")<0&&(e=i),e in Ei&&e!==$e&&(t._gsap.x||Ti(t,"x"))?s&&qg===s?e==="scale"?fS:dS:(qg=s||{})&&(e==="scale"?pS:mS):t.style&&!Sc(t.style[e])?cS:~e.indexOf("-")?uS:Zc(t,e)},core:{_removeProperty:Or,_getMatrix:lu}};Xe.utils.checkPrefix=Cn,Xe.core.getStyleSaver=t_,function(r,t,e,s){var i=Ue(r+","+t+","+e,function(n){Ei[n]=1});Ue(t,function(n){Ze.units[n]="deg",l_[n]=1}),si[i[13]]=r+","+t,Ue(s,function(n){var a=n.split(":");si[a[1]]=i[a[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ue("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Ze.units[r]="px"}),Xe.registerPlugin(f_);var xt=Xe.registerPlugin(f_)||Xe;xt.core.Tween;class fl extends hs{constructor(t){super(),this.radius=0,this.enableTint=!0,this.bgColor="#fff",this.borderWidth=0,this.borderColor="black",this.bgAlpha=1;const{x:e=0,y:s=0,width:i=0,height:n=0,bgColor:a="#fff",alpha:h=1,radius:o=0,borderWidth:l=0,borderColor:u="black",enableTint:c=!0}=t;this.x=e,this.y=s,this.bgAlpha=h,this.radius=o,this.enableTint=c,this.bgColor=a,this.borderWidth=l,this.borderColor=u,this.renderBg(i,n)}updateColor(t){xt.to(this,{tint:t,duration:.25})}renderBg(t,e){this.clear(),this.enableTint?(this.beginFill("#fff",this.bgAlpha),this.tint=this.bgColor):(this.beginFill(this.bgColor,this.bgAlpha),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1)),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1),this.radius!==0?typeof this.radius=="number"?this.drawRoundedRect(0,0,t,e,this.radius):(this.moveTo(0+this.radius[0],0),this.lineTo(0+t-this.radius[1],0),this.radius[1]>0?this.arcTo(0+t,0,0+t,0+this.radius[1],this.radius[1]):this.lineTo(0+t,0),this.lineTo(0+t,0+e-this.radius[2]),this.radius[2]>0?this.arcTo(0+t,0+e,0+t-this.radius[2],0+e,this.radius[2]):this.lineTo(0+t,0+e),this.lineTo(0+this.radius[3],0+e),this.radius[3]>0?this.arcTo(0,0+e,0,0+e-this.radius[3],this.radius[3]):this.lineTo(0,0+e),this.lineTo(0,0+this.radius[0]),this.radius[0]>0?this.arcTo(0,0,0+this.radius[0],0,this.radius[0]):this.lineTo(0,0),this.closePath()):this.drawRect(0,0,t,e),this.endFill()}}class Ao extends It{constructor(t,e,s,i){if(super(),i){const n=new hs;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}s?(this._bgColorFill=new fl({width:t,height:e,bgColor:s}),this.addChild(this._bgColorFill)):(this._fill=new qe,this._fill.width=t,this._fill.height=e,this.addChild(this._fill))}setSize(t,e){this._fill&&(this._fill.width=t,this._fill.height=e),this._bgColorFill&&this._bgColorFill.renderBg(t,e)}}/*!
1164
1164
  * @pixi/particle-emitter - v5.0.8
1165
1165
  * Compiled Mon, 28 Nov 2022 04:01:38 UTC
1166
1166
  *
1167
1167
  * @pixi/particle-emitter is licensed under the MIT License.
1168
1168
  * http://www.opensource.org/licenses/mit-license
1169
- */class ri{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:b_(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let i;const{value:n,time:a}=s[0],h=i=new ri(typeof n=="string"?ml(n):n,a,t.ease);if(s.length>2||s.length===2&&s[1].value!==n)for(let o=1;o<s.length;++o){const{value:l,time:u}=s[o];i.next=new ri(typeof l=="string"?ml(l):l,u),i=i.next}return h.isStepped=!!t.isStepped,h}const e=new ri(typeof t.start=="string"?ml(t.start):t.start,0);return t.end!==t.start&&(e.next=new ri(typeof t.end=="string"?ml(t.end):t.end,1)),e}}let So=q.from;const ni=Math.PI/180;function Ai(r,t){if(!r)return;const e=Math.sin(r),s=Math.cos(r),i=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=i,t.y=n}function pl(r,t,e){return r<<16|t<<8|e}function x_(r){return Math.sqrt(r.x*r.x+r.y*r.y)}function TS(r){const t=1/x_(r);r.x*=t,r.y*=t}function v_(r,t){r.x*=t,r.y*=t}function ml(r,t){t||(t={}),r.charAt(0)==="#"?r=r.substr(1):r.indexOf("0x")===0&&(r=r.substr(2));let e;return r.length===8&&(e=r.substr(0,2),r=r.substr(2)),t.r=parseInt(r.substr(0,2),16),t.g=parseInt(r.substr(2,2),16),t.b=parseInt(r.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function b_(r){const t=r.length,e=1/t;return function(s){const i=t*s|0,n=(s-i*e)*t,a=r[i]||r[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function AS(r){return r?(r=r.toUpperCase().replace(/ /g,"_"),W[r]||W.NORMAL):W.NORMAL}class pu extends qe{constructor(t){super(),this.prevChild=this.nextChild=null,this.emitter=t,this.config={},this.anchor.x=this.anchor.y=.5,this.maxLife=0,this.age=0,this.agePercent=0,this.oneOverLife=0,this.next=null,this.prev=null,this.init=this.init,this.kill=this.kill}init(t){this.maxLife=t,this.age=this.agePercent=0,this.rotation=0,this.position.x=this.position.y=0,this.scale.x=this.scale.y=1,this.tint=16777215,this.alpha=1,this.oneOverLife=1/this.maxLife,this.visible=!0}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=this.next=this.prev=null,super.destroy()}}var kt;(function(r){r[r.Spawn=0]="Spawn",r[r.Normal=2]="Normal",r[r.Late=5]="Late"})(kt||(kt={}));const mu=wt.shared,Vr=Symbol("Position particle per emitter position");class Et{constructor(t,e){this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],this.minLifetime=0,this.maxLifetime=0,this.customEase=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=new st,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new st,this._prevEmitterPos=new st,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._autoUpdate=!1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=t,e&&this.init(e),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}static registerBehavior(t){Et.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){typeof t=="number"&&t>0?this._frequency=t:this._frequency=1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase=typeof t.ease=="function"?t.ease:b_(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance=typeof t.spawnChance=="number"&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=t.emit===void 0?!0:!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map(s=>{const i=Et.knownBehaviors[s.type];return i?new i(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Vr),e.sort((s,i)=>s===Vr?i.order===kt.Spawn?1:-1:i===Vr?s.order===kt.Spawn?-1:1:s.order-i.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Vr&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Vr&&s.recycleParticle)}getBehavior(t){return Et.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof Et.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new pu(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let s=0;s<this.recycleBehaviors.length;++s)this.recycleBehaviors[s].recycleParticle(t,!e);t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next),t===this._activeParticlesLast&&(this._activeParticlesLast=t.prev),t===this._activeParticlesFirst&&(this._activeParticlesFirst=t.next),t.prev=null,t.next=this._poolFirst,this._poolFirst=t,t.parent&&t.parent.removeChild(t),--this.particleCount}rotate(t){if(this.rotation===t)return;const e=t-this.rotation;this.rotation=t,Ai(e,this.spawnPos),this._posChanged=!0}updateSpawnPos(t,e){this._posChanged=!0,this.spawnPos.x=t,this.spawnPos.y=e}updateOwnerPos(t,e){this._posChanged=!0,this.ownerPos.x=t,this.ownerPos.y=e}resetPositionTracking(){this._prevPosIsValid=!1}get emit(){return this._emit}set emit(t){this._emit=!!t,this._emitterLife=this.emitterLifetime}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){this._autoUpdate&&!t?mu.remove(this.update,this):!this._autoUpdate&&t&&mu.add(this.update,this),this._autoUpdate=!!t}playOnceAndDestroy(t){this.autoUpdate=!0,this.emit=!0,this._destroyWhenComplete=!0,this._completeCallback=t}playOnce(t){this.emit=!0,this._completeCallback=t}update(t){if(this._autoUpdate&&(t=mu.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,h;a;a=h)if(h=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let o=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?o=this.customEase(o,0,1,1):o=this.customEase(o)),a.agePercent=o;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,s;this._prevPosIsValid&&(e=this._prevEmitterPos.x,s=this._prevEmitterPos.y);const i=this.ownerPos.x+this.spawnPos.x,n=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let a,h;if(this._prevPosIsValid&&this._posChanged){const u=1+this._spawnTimer/t;a=(i-e)*u+e,h=(n-s)*u+s}else a=i,h=n;let o=null,l=null;for(let u=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),c=0;c<u;++c){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let d;if(this.minLifetime===this.maxLifetime?d=this.minLifetime:d=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=d)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new pu(this),f.init(d),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),o?(l.next=f,f.prev=l,l=f):l=o=f,++this.particleCount}if(o){this._activeParticlesLast?(this._activeParticlesLast.next=o,o.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=o,this._activeParticlesLast=l);for(let u=0;u<this.initBehaviors.length;++u){const c=this.initBehaviors[u];if(c===Vr)for(let d=o,f;d;d=f){f=d.next,this.rotation!==0&&(Ai(this.rotation,d.position),d.rotation+=this.rotation),d.position.x+=a,d.position.y+=h,d.age+=-this._spawnTimer;let p=d.age*d.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),d.agePercent=p}else c.initParticles(o)}for(let u=o,c;u;u=c){c=u.next;for(let d=0;d<this.updateBehaviors.length;++d)if(this.updateBehaviors[d].updateParticle(u,-this._spawnTimer)){this.recycle(u);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=i,this._prevEmitterPos.y=n,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const a=this._completeCallback;this._completeCallback=null,a()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let s=null,i=null;for(let n=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),a=0;a<n;++a){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let h;this._poolFirst?(h=this._poolFirst,this._poolFirst=this._poolFirst.next,h.next=null):h=new pu(this);let o;this.minLifetime===this.maxLifetime?o=this.minLifetime:o=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,h.init(o),this.addAtBack?this._parent.addChildAt(h,0):this._parent.addChild(h),s?(i.next=h,h.prev=i,i=h):i=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=i):(this._activeParticlesFirst=s,this._activeParticlesLast=i);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Vr)for(let h=s,o;h;h=o)o=h.next,this.rotation!==0&&(Ai(this.rotation,h.position),h.rotation+=this.rotation),h.position.x+=t,h.position.y+=e;else a.initParticles(s)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){this.autoUpdate=!1,this.cleanup();let t;for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}Et.knownBehaviors={};class gu{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t){t.x=Math.random()*this.w+this.x,t.y=Math.random()*this.h+this.y}}gu.type="rect",gu.editorConfig=null;class gl{constructor(t){this.x=t.x||0,this.y=t.y||0,this.radius=t.radius,this.innerRadius=t.innerRadius||0,this.rotation=!!t.affectRotation}getRandPos(t){this.innerRadius!==this.radius?t.x=Math.random()*(this.radius-this.innerRadius)+this.innerRadius:t.x=this.radius,t.y=0;const e=Math.random()*Math.PI*2;this.rotation&&(t.rotation+=e),Ai(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}gl.type="torus",gl.editorConfig=null;class _u{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(!t||!t.length)this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});else if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const s=t[e];let i=s[0];for(let n=1;n<s.length;++n){const a=s[n];this.segments.push({p1:i,p2:a,l:0}),i=a}}else{let e=t[0];for(let s=1;s<t.length;++s){const i=t[s];this.segments.push({p1:e,p2:i,l:0}),e=i}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:i}=this.segments[e],n=Math.sqrt((i.x-s.x)*(i.x-s.x)+(i.y-s.y)*(i.y-s.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let s,i;if(this.segments.length===1)s=this.segments[0],i=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],i=h===0?e:e-this.countingLengths[h-1];break}i/=s.l||1;const{p1:n,p2:a}=s;t.x=n.x+i*(a.x-n.x),t.y=n.y+i*(a.y-n.y)}}_u.type="polygonalChain",_u.editorConfig=null;class yu{constructor(t){var e;this.order=kt.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=(e=t.maxSpeed)!==null&&e!==void 0?e:0}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ai(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,i=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const a=x_(s);a>this.maxSpeed&&v_(s,this.maxSpeed/a)}t.x+=(i+s.x)/2*e,t.y+=(n+s.y)/2*e,this.rotate&&(t.rotation=Math.atan2(s.y,s.x))}}yu.type="moveAcceleration",yu.editorConfig=null;function SS(r){return this.ease&&(r=this.ease(r)),(this.first.next.value-this.first.value)*r+this.first.value}function CS(r){this.ease&&(r=this.ease(r));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*r+t.r,i=(e.g-t.g)*r+t.g,n=(e.b-t.b)*r+t.b;return pl(s,i,n)}function IS(r){this.ease&&(r=this.ease(r));let t=this.first,e=t.next;for(;r>e.time;)t=e,e=e.next;return r=(r-t.time)/(e.time-t.time),(e.value-t.value)*r+t.value}function PS(r){this.ease&&(r=this.ease(r));let t=this.first,e=t.next;for(;r>e.time;)t=e,e=e.next;r=(r-t.time)/(e.time-t.time);const s=t.value,i=e.value,n=(i.r-s.r)*r+s.r,a=(i.g-s.g)*r+s.g,h=(i.b-s.b)*r+s.b;return pl(n,a,h)}function RS(r){this.ease&&(r=this.ease(r));let t=this.first;for(;t.next&&r>t.next.time;)t=t.next;return t.value}function MS(r){this.ease&&(r=this.ease(r));let t=this.first;for(;t.next&&r>t.next.time;)t=t.next;const e=t.value;return pl(e.r,e.g,e.b)}class Co{constructor(t=!1){this.first=null,this.isColor=!!t,this.interpolate=null,this.ease=null}reset(t){this.first=t,t.next&&t.next.time>=1?this.interpolate=this.isColor?CS:SS:t.isStepped?this.interpolate=this.isColor?MS:RS:this.interpolate=this.isColor?PS:IS,this.ease=this.first.ease}}class xu{constructor(t){this.order=kt.Normal,this.list=new Co(!1),this.list.reset(ri.createList(t.alpha))}initParticles(t){let e=t;for(;e;)e.alpha=this.list.first.value,e=e.next}updateParticle(t){t.alpha=this.list.interpolate(t.agePercent)}}xu.type="alpha",xu.editorConfig=null;class vu{constructor(t){this.order=kt.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}vu.type="alphaStatic",vu.editorConfig=null;function w_(r){const t=[];for(let e=0;e<r.length;++e){let s=r[e];if(typeof s=="string")t.push(So(s));else if(s instanceof q)t.push(s);else{let i=s.count||1;for(typeof s.texture=="string"?s=So(s.texture):s=s.texture;i>0;--i)t.push(s)}}return t}class bu{constructor(t){this.order=kt.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const s=t.anims[e],i=w_(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,a={textures:i,duration:n>0?i.length/n:0,framerate:n,loop:n>0?!!s.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.anims.length),i=e.config.anim=this.anims[s];e.texture=i.textures[0],e.config.animElapsed=0,i.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}}updateParticle(t,e){const s=t.config,i=s.anim;s.animElapsed+=e,s.animElapsed>=s.animDuration&&(s.anim.loop?s.animElapsed=s.animElapsed%s.animDuration:s.animElapsed=s.animDuration-1e-6);const n=s.animElapsed*s.animFramerate+1e-7|0;t.texture=i.textures[n]||i.textures[i.textures.length-1]||q.EMPTY}}bu.type="animatedRandom",bu.editorConfig=null;class wu{constructor(t){this.order=kt.Normal;const e=t.anim,s=w_(e.textures),i=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:i>0?s.length/i:0,framerate:i,loop:i>0?!!e.loop:!1}}initParticles(t){let e=t;const s=this.anim;for(;e;)e.texture=s.textures[0],e.config.animElapsed=0,s.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=s.textures.length/e.maxLife):(e.config.animDuration=s.duration,e.config.animFramerate=s.framerate),e=e.next}updateParticle(t,e){const s=this.anim,i=t.config;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(s.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const n=i.animElapsed*i.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}wu.type="animatedSingle",wu.editorConfig=null;class Eu{constructor(t){this.order=kt.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=AS(this.value),e=e.next}}Eu.type="blendMode",Eu.editorConfig=null;class Tu{constructor(t){this.order=kt.Spawn,this.spacing=t.spacing*ni,this.start=t.start*ni,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let i;this.spacing?i=this.start+this.spacing*e:i=Math.random()*Math.PI*2,s.rotation=i,this.distance&&(s.position.x=this.distance,Ai(i,s.position)),s=s.next,++e}}}Tu.type="spawnBurst",Tu.editorConfig=null;class Au{constructor(t){this.order=kt.Normal,this.list=new Co(!0),this.list.reset(ri.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,i=pl(s.r,s.g,s.b);for(;e;)e.tint=i,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}Au.type="color",Au.editorConfig=null;class Su{constructor(t){this.order=kt.Normal;let e=t.color;e.charAt(0)==="#"?e=e.substr(1):e.indexOf("0x")===0&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}Su.type="colorStatic",Su.editorConfig=null;class Cu{constructor(t){this.order=kt.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}Cu.type="textureOrdered",Cu.editorConfig=null;const In=new st,E_=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2","abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","cos","cosh","exp","expm1","floor","fround","hypot","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh"],FS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(E_).join("|"),"g");function kS(r){const t=r.match(FS);for(let e=t.length-1;e>=0;--e)E_.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return r=t.join(""),new Function("x",`return ${r};`)}class Iu{constructor(t){var e;if(this.order=kt.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=kS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Co(!1),this.list.reset(ri.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new st(e.x,e.y),e.config.movement=0;const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=s*e,In.x=t.config.movement,In.y=this.path(In.x),Ai(t.config.initRotation,In),t.position.x=t.config.initPosition.x+In.x,t.position.y=t.config.initPosition.y+In.y}}Iu.type="movePath",Iu.editorConfig=null;class Pu{constructor(){this.order=kt.Spawn}initParticles(t){}}Pu.type="spawnPoint",Pu.editorConfig=null;class Ru{constructor(t){this.order=kt.Normal,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[s],e=e.next}}}Ru.type="textureRandom",Ru.editorConfig=null;class Mu{constructor(t){this.order=kt.Normal,this.minStart=t.minStart*ni,this.maxStart=t.maxStart*ni,this.minSpeed=t.minSpeed*ni,this.maxSpeed=t.maxSpeed*ni,this.accel=t.accel*ni}initParticles(t){let e=t;for(;e;)this.minStart===this.maxStart?e.rotation+=this.maxStart:e.rotation+=Math.random()*(this.maxStart-this.minStart)+this.minStart,e.config.rotSpeed=Math.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel){const s=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+s)/2*e}else t.rotation+=t.config.rotSpeed*e}}Mu.type="rotation",Mu.editorConfig=null;class Fu{constructor(t){this.order=kt.Normal,this.min=t.min*ni,this.max=t.max*ni}initParticles(t){let e=t;for(;e;)this.min===this.max?e.rotation+=this.max:e.rotation+=Math.random()*(this.max-this.min)+this.min,e=e.next}}Fu.type="rotationStatic",Fu.editorConfig=null;class ku{constructor(t){this.order=kt.Late+1,this.rotation=(t.rotation||0)*ni}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}ku.type="noRotation",ku.editorConfig=null;class Bu{constructor(t){var e;this.order=kt.Normal,this.list=new Co(!1),this.list.reset(ri.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=s,e.scale.x=e.scale.y=this.list.first.value*s,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Bu.type="scale",Bu.editorConfig=null;class Du{constructor(t){this.order=kt.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=s,e=e.next}}}Du.type="scaleStatic",Du.editorConfig=null;class Cs{constructor(t){this.order=kt.Spawn;const e=Cs.shapes[t.type];if(!e)throw new Error(`No shape found with type '${t.type}'`);this.shape=new e(t.data)}static registerShape(t,e){Cs.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Cs.type="spawnShape",Cs.editorConfig=null,Cs.shapes={},Cs.registerShape(_u),Cs.registerShape(gu),Cs.registerShape(gl),Cs.registerShape(gl,"circle");class Ou{constructor(t){this.order=kt.Normal,this.texture=typeof t.texture=="string"?So(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Ou.type="textureSingle",Ou.editorConfig=null;class Lu{constructor(t){var e;this.order=kt.Late,this.list=new Co(!1),this.list.reset(ri.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e.config.velocity?e.config.velocity.set(this.list.first.value*s,0):e.config.velocity=new st(this.list.first.value*s,0),Ai(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,i=t.config.velocity;TS(i),v_(i,s),t.x+=i.x*e,t.y+=i.y*e}}Lu.type="moveSpeed",Lu.editorConfig=null;class Nu{constructor(t){this.order=kt.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ai(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity;t.x+=s.x*e,t.y+=s.y*e}}Nu.type="moveSpeedStatic",Nu.editorConfig=null,Et.registerBehavior(yu),Et.registerBehavior(xu),Et.registerBehavior(vu),Et.registerBehavior(bu),Et.registerBehavior(wu),Et.registerBehavior(Eu),Et.registerBehavior(Tu),Et.registerBehavior(Au),Et.registerBehavior(Su),Et.registerBehavior(Cu),Et.registerBehavior(Iu),Et.registerBehavior(Pu),Et.registerBehavior(Ru),Et.registerBehavior(Mu),Et.registerBehavior(Fu),Et.registerBehavior(ku),Et.registerBehavior(Bu),Et.registerBehavior(Du),Et.registerBehavior(Cs),Et.registerBehavior(Ou),Et.registerBehavior(Lu),Et.registerBehavior(Nu);class _l extends za{constructor(t){const{text:e,fontSize:s=36,fontColor:i=16777215,stroke:n,strokeColor:a,strokeThickness:h,fontFamily:o="Arial",fontWeight:l="normal",wordWrap:u=!1,wordWrapWidth:c=100,lineHeight:d=1.25,align:f="left",indent:p=0,shadow:m}=t,g=new vi({fontSize:s,wordWrap:u,wordWrapWidth:c,fontWeight:l,lineHeight:d*s,breakWords:u,fill:i,align:f,fontFamily:o,stroke:n?a:"transparent",strokeThickness:n?h:0,lineJoin:"round"});m&&(g.dropShadow=!0,g.dropShadowColor=m[0],g.dropShadowAngle=m[1]*(Math.PI/180),g.dropShadowBlur=m[2],g.dropShadowDistance=m[3]),super(e,g),this.position.x=p*s}}class BS extends It{constructor(t){super();const{start:e,control:s,end:i,json:n,duration:a,ease:h="power1.out",showControl:o=!1,loop:l=!1}=t;this._particleContainer=new FT,this.addChild(this._particleContainer);const u=new Et(this._particleContainer,n),c=this._createBezierPoints([e,...s,i],100,o),d={pathThrough:0};xt.to(d,{duration:a,pathThrough:c.length-1,repeat:l?-1:0,ease:h,onStart:()=>{u.emit=!0},onUpdate:()=>{const p=Math.floor(d.pathThrough),m=c[p];u.updateOwnerPos(m.x,m.y)},onComplete:()=>{xt.to(this,{alpha:0,duration:.5,onComplete:()=>{u.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new wt;f.add(()=>{u.update(1/75)}),f.start()}_createBezierPoints(t,e,s){const i=[];s&&t.forEach((n,a)=>{const h=new _l({text:a+1,fontSize:16});h.position.set(n.x,n.y),this.addChild(h)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);i.push(a)}return i}_multiPointBezier(t,e){const s=t.length;let i=0,n=0;const a=[];for(let h=0;h<s;h++)a[h]=this._binomial(s-1,h);for(let h=0;h<s;h++){const o=t[h],l=a[h],u=Math.pow(e,h),c=Math.pow(1-e,s-1-h);i+=o.x*c*u*l,n+=o.y*c*u*l}return{x:i,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let i=1;i<=e;i++)s=s*(t-i+1)/i;return s}}var at=(r=>(r[r.Region=0]="Region",r[r.BoundingBox=1]="BoundingBox",r[r.Mesh=2]="Mesh",r[r.LinkedMesh=3]="LinkedMesh",r[r.Path=4]="Path",r[r.Point=5]="Point",r[r.Clipping=6]="Clipping",r))(at||{});class yl{constructor(t,e=new Array,s=0,i=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return e&128&&(e=this.readByte(),s|=(e&127)<<7,e&128&&(e=this.readByte(),s|=(e&127)<<14,e&128&&(e=this.readByte(),s|=(e&127)<<21,e&128&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(i),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(r=>(r[r.setup=0]="setup",r[r.first=1]="first",r[r.replace=2]="replace",r[r.add=3]="add",r))(S||{}),At=(r=>(r[r.mixIn=0]="mixIn",r[r.mixOut=1]="mixOut",r))(At||{}),ne=(r=>(r[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent",r))(ne||{}),Fe=(r=>(r[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale",r))(Fe||{}),vt=(r=>(r[r.Normal=0]="Normal",r[r.OnlyTranslation=1]="OnlyTranslation",r[r.NoRotationOrReflection=2]="NoRotationOrReflection",r[r.NoScale=3]="NoScale",r[r.NoScaleOrReflection=4]="NoScaleOrReflection",r))(vt||{});function T_(r){switch(r.toLowerCase()){case"nearest":return He.Nearest;case"linear":return He.Linear;case"mipmap":return He.MipMap;case"mipmapnearestnearest":return He.MipMapNearestNearest;case"mipmaplinearnearest":return He.MipMapLinearNearest;case"mipmapnearestlinear":return He.MipMapNearestLinear;case"mipmaplinearlinear":return He.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${r}`)}}var He=(r=>(r[r.Nearest=9728]="Nearest",r[r.Linear=9729]="Linear",r[r.MipMap=9987]="MipMap",r[r.MipMapNearestNearest=9984]="MipMapNearestNearest",r[r.MipMapLinearNearest=9985]="MipMapLinearNearest",r[r.MipMapNearestLinear=9986]="MipMapNearestLinear",r[r.MipMapLinearLinear=9987]="MipMapLinearLinear",r))(He||{}),Ur=(r=>(r[r.MirroredRepeat=33648]="MirroredRepeat",r[r.ClampToEdge=33071]="ClampToEdge",r[r.Repeat=10497]="Repeat",r))(Ur||{});class Vu{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}}class DS{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Uu{constructor(t,e,s){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,s)}addTexture(t,e){const s=this.pages;let i=null;for(let a=0;a<s.length;a++)if(s[a].baseTexture===e.baseTexture){i=s[a];break}if(i===null){i=new A_,i.name="texturePage";const a=e.baseTexture;i.width=a.realWidth,i.height=a.realHeight,i.baseTexture=a,i.minFilter=i.magFilter=He.Nearest,i.uWrap=Ur.ClampToEdge,i.vWrap=Ur.ClampToEdge,s.push(i)}const n=new S_;return n.name=t,n.page=i,n.texture=e,n.index=-1,this.regions.push(n),n}addTextureHash(t,e){for(const s in t)t.hasOwnProperty(s)&&this.addTexture(e&&s.indexOf(".")!==-1?s.substr(0,s.lastIndexOf(".")):s,t[s])}addSpineAtlas(t,e,s){return this.load(t,e,s)}load(t,e,s){if(e==null)throw new Error("textureLoader cannot be null.");const i=new OS(t),n=new Array(4);let a=null;const h={};let o=null;h.size=()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},h.format=()=>{},h.filter=()=>{a.minFilter=T_(n[1]),a.magFilter=T_(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(a.uWrap=Ur.Repeat),n[1].indexOf("y")!=-1&&(a.vWrap=Ur.Repeat)},h.pma=()=>{a.pma=n[1]=="true"};const l={};l.xy=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2])},l.size=()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},l.bounds=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2]),o.width=parseInt(n[3]),o.height=parseInt(n[4])},l.offset=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2])},l.orig=()=>{o.originalWidth=parseInt(n[1]),o.originalHeight=parseInt(n[2])},l.offsets=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2]),o.originalWidth=parseInt(n[3]),o.originalHeight=parseInt(n[4])},l.rotate=()=>{const d=n[1];let f=0;d.toLocaleLowerCase()=="true"?f=6:d.toLocaleLowerCase()=="false"?f=0:f=(720-parseFloat(d))%360/45,o.rotate=f},l.index=()=>{o.index=parseInt(n[1])};let u=i.readLine();for(;u!=null&&u.trim().length==0;)u=i.readLine();for(;!(u==null||u.trim().length==0||i.readEntry(n,u)==0);)u=i.readLine();const c=()=>{for(;;){if(u==null)return s&&s(this);if(u.trim().length==0)a=null,u=i.readLine();else if(a===null){for(a=new A_,a.name=u.trim();i.readEntry(n,u=i.readLine())!=0;){const d=h[n[0]];d&&d()}this.pages.push(a),e(a.name,d=>{if(d===null)return this.pages.splice(this.pages.indexOf(a),1),s&&s(null);a.baseTexture=d,a.pma&&(d.alphaMode=Re.PMA),d.valid||d.setSize(a.width,a.height),a.setFilters(),(!a.width||!a.height)&&(a.width=d.realWidth,a.height=d.realHeight,(!a.width||!a.height)&&console.log(`ERROR spine atlas page ${a.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),c()});break}else{o=new DS;const d=new S_;d.name=u,d.page=a;let f=null,p=null;for(;;){const v=i.readEntry(n,u=i.readLine());if(v==0)break;const b=l[n[0]];if(b)b();else{f==null&&(f=[],p=[]),f.push(n[0]);const w=[];for(let E=0;E<v;E++)w.push(parseInt(n[E+1]));p.push(w)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height);const m=a.baseTexture.resolution;o.x/=m,o.y/=m,o.width/=m,o.height/=m,o.originalWidth/=m,o.originalHeight/=m,o.offsetX/=m,o.offsetY/=m;const g=o.rotate%4!==0,_=new it(o.x,o.y,g?o.height:o.width,g?o.width:o.height),x=new it(0,0,o.originalWidth,o.originalHeight),y=new it(o.offsetX,o.originalHeight-o.height-o.offsetY,o.width,o.height);d.texture=new q(d.page.baseTexture,_,x,y,o.rotate),d.index=o.index,d.texture.updateUvs(),this.regions.push(d)}}};c()}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].baseTexture.dispose()}}class OS{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(e==null||(e=e.trim(),e.length==0))return 0;const s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){const a=e.indexOf(",",n);if(a==-1)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,a-n).trim(),n=a+1,i==4)return 4}}}class A_{constructor(){this.minFilter=He.Nearest,this.magFilter=He.Nearest,this.uWrap=Ur.ClampToEdge,this.vWrap=Ur.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==He.Linear?t.scaleMode=je.LINEAR:this.minFilter==He.Nearest?t.scaleMode=je.NEAREST:(t.mipmap=vs.POW2,e==He.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class S_ extends Vu{}class LS{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class NS{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Gr=class{constructor(r=0,t=0,e=0,s=0){this.r=r,this.g=t,this.b=e,this.a=s}set(r,t,e,s){return this.r=r,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(r){return this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this}setFromString(r){return r=r.charAt(0)=="#"?r.substr(1):r,this.r=parseInt(r.substr(0,2),16)/255,this.g=parseInt(r.substr(2,2),16)/255,this.b=parseInt(r.substr(4,2),16)/255,this.a=r.length!=8?1:parseInt(r.substr(6,2),16)/255,this}add(r,t,e,s){return this.r+=r,this.g+=t,this.b+=e,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(r,t){r.r=((t&4278190080)>>>24)/255,r.g=((t&16711680)>>>16)/255,r.b=((t&65280)>>>8)/255,r.a=(t&255)/255}static rgb888ToColor(r,t){r.r=((t&16711680)>>>16)/255,r.g=((t&65280)>>>8)/255,r.b=(t&255)/255}static fromString(r){return new Gr().setFromString(r)}};let X=Gr;X.WHITE=new Gr(1,1,1,1),X.RED=new Gr(1,0,0,1),X.GREEN=new Gr(0,1,0,1),X.BLUE=new Gr(0,0,1,1),X.MAGENTA=new Gr(1,0,1,1);const Si=class{static clamp(r,t,e){return r<t?t:r>e?e:r}static cosDeg(r){return Math.cos(r*Si.degRad)}static sinDeg(r){return Math.sin(r*Si.degRad)}static signum(r){return Math.sign(r)}static toInt(r){return r>0?Math.floor(r):Math.ceil(r)}static cbrt(r){const t=Math.pow(Math.abs(r),.3333333333333333);return r<0?-t:t}static randomTriangular(r,t){return Si.randomTriangularWith(r,t,(r+t)*.5)}static randomTriangularWith(r,t,e){const s=Math.random(),i=t-r;return s<=(e-r)/i?r+Math.sqrt(s*i*(e-r)):t-Math.sqrt((1-s)*i*(t-e))}static isPowerOfTwo(r){return r&&(r&r-1)===0}};let D=Si;D.PI=3.1415927,D.PI2=Si.PI*2,D.radiansToDegrees=180/Si.PI,D.radDeg=Si.radiansToDegrees,D.degreesToRadians=Si.PI/180,D.degRad=Si.degreesToRadians;class VS{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class US extends VS{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class C_ extends US{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Pn=class{static arrayCopy(r,t,e,s,i){for(let n=t,a=s;n<t+i;n++,a++)e[a]=r[n]}static arrayFill(r,t,e,s){for(let i=t;i<e;i++)r[i]=s}static setArraySize(r,t,e=0){const s=r.length;if(s==t)return r;if(r.length=t,s<t)for(let i=s;i<t;i++)r[i]=e;return r}static ensureArrayCapacity(r,t,e=0){return r.length>=t?r:Pn.setArraySize(r,t,e)}static newArray(r,t){const e=new Array(r);for(let s=0;s<r;s++)e[s]=t;return e}static newFloatArray(r){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(r);const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(r){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(r);const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(r){return Pn.SUPPORTS_TYPED_ARRAYS?new Float32Array(r):r}static toSinglePrecision(r){return Pn.SUPPORTS_TYPED_ARRAYS?Math.fround(r):r}static webkit602BugfixHelper(r,t){}static contains(r,t,e=!0){for(let s=0;s<r.length;s++)if(r[s]==t)return!0;return!1}static enumValue(r,t){return r[t[0].toUpperCase()+t.slice(1)]}};let B=Pn;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class GS{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class XS{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}}const $S={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},tr=[0,0,0];class HS extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class YS extends MT{constructor(t,e,s,i,n){super(t,e,s,i,n),this.region=null,this.attachment=null}}const I_=class extends It{constructor(r){if(super(),!r)throw new Error("The spineData param is required.");if(typeof r=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=r,this.createSkeleton(r),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],i=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!i)if(i.type===at.Region){const a=i.name,h=this.createSprite(s,i,a);s.currentSprite=h,s.currentSpriteName=a,n.addChild(h)}else if(i.type===at.Mesh){const a=this.createMesh(s,i);s.currentMesh=a,s.currentMeshId=i.id,s.currentMeshName=i.name,n.addChild(a)}else i.type===at.Clipping&&(this.createGraphics(s,i),n.addChild(s.clippingContainer),n.addChild(s.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(r){var t;r!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),r==null||r.registerSpine(this),this._debug=r)}get autoUpdate(){return this._autoUpdate}set autoUpdate(r){r!==this._autoUpdate&&(this._autoUpdate=r,this.updateTransform=r?I_.prototype.autoUpdateTransform:It.prototype.updateTransform)}get tint(){return eo(this.tintRgb)}set tint(r){this.tintRgb=ip(r,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:$S.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(r){var l;const t=this.delayLimit;if(r>t&&(r=t),this.state.update(r),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let i=null,n=null;s?(i=s.light,n=s.dark):i=this.tintRgb;for(let u=0,c=e.length;u<c;u++){const d=e[u],f=d.getAttachment(),p=this.slotContainers[u];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(d,f);let g=f.region;const _=f.color;switch(f!=null&&f.type){case at.Region:if(p.transform.setFromMatrix(d.bone.matrix),g=f.region,d.currentMesh&&(d.currentMesh.visible=!1,d.currentMesh=null,d.currentMeshId=void 0,d.currentMeshName=void 0),!g){d.currentSprite&&(d.currentSprite.renderable=!1);break}if(!d.currentSpriteName||d.currentSpriteName!==f.name){const v=f.name;if(d.currentSprite&&(d.currentSprite.visible=!1),d.sprites=d.sprites||{},d.sprites[v]!==void 0)d.sprites[v].visible=!0;else{const b=this.createSprite(d,f,v);p.addChild(b)}d.currentSprite=d.sprites[v],d.currentSpriteName=v}d.currentSprite.renderable=!0,d.hackRegion||this.setSpriteRegion(f,d.currentSprite,g),d.currentSprite.color?m=d.currentSprite.color:(tr[0]=i[0]*d.color.r*_.r,tr[1]=i[1]*d.color.g*_.g,tr[2]=i[2]*d.color.b*_.b,d.currentSprite.tint=eo(tr)),d.currentSprite.blendMode=d.blendMode;break;case at.Mesh:if(d.currentSprite){d.currentSprite.visible=!1,d.currentSprite=null,d.currentSpriteName=void 0;const v=new ma;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!g){d.currentMesh&&(d.currentMesh.renderable=!1);break}const y=f.id;if(d.currentMeshId===void 0||d.currentMeshId!==y){const v=y;if(d.currentMesh&&(d.currentMesh.visible=!1),d.meshes=d.meshes||{},d.meshes[v]!==void 0)d.meshes[v].visible=!0;else{const b=this.createMesh(d,f);p.addChild(b)}d.currentMesh=d.meshes[v],d.currentMeshName=f.name,d.currentMeshId=v}d.currentMesh.renderable=!0,f.computeWorldVerticesOld(d,d.currentMesh.vertices),d.currentMesh.color?m=d.currentMesh.color:(tr[0]=i[0]*d.color.r*_.r,tr[1]=i[1]*d.color.g*_.g,tr[2]=i[2]*d.color.b*_.b,d.currentMesh.tint=eo(tr)),d.currentMesh.blendMode=d.blendMode,d.hackRegion||this.setMeshRegion(f,d.currentMesh,g);break;case at.Clipping:d.currentGraphics||(this.createGraphics(d,f),p.addChild(d.clippingContainer),p.addChild(d.currentGraphics)),this.updateGraphics(d,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=d.color.r*_.r,y=d.color.g*_.g,v=d.color.b*_.b;m.setLight(i[0]*x+n[0]*(1-x),i[1]*y+n[1]*(1-y),i[2]*v+n[2]*(1-v)),d.darkColor?(x=d.darkColor.r,y=d.darkColor.g,v=d.darkColor.b):(x=0,y=0,v=0),m.setDark(i[0]*x+n[0]*(1-x),i[1]*y+n[1]*(1-y),i[2]*v+n[2]*(1-v))}p.alpha=d.color.a}const a=this.skeleton.drawOrder;let h=null,o=null;for(let u=0,c=a.length;u<c;u++){const d=e[a[u].data.index],f=this.slotContainers[a[u].data.index];if(o||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),d.currentGraphics&&d.getAttachment())o=d.clippingContainer,h=d.getAttachment(),o.children.length=0,this.children[u]=f,h.endSlot===d.data&&(h.endSlot=null);else if(o){let p=this.tempClipContainers[u];p||(p=this.tempClipContainers[u]=this.newContainer(),p.visible=!1),this.children[u]=p,f.parent=null,o.addChild(f),h.endSlot==d.data&&(o.renderable=!0,o=null,h=null)}else this.children[u]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(r,t,e){t.attachment===r&&t.region===e||(t.region=e,t.attachment=r,t.texture=e.texture,t.rotation=r.rotation*D.degRad,t.position.x=r.x,t.position.y=r.y,t.alpha=r.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=r.scaleX*r.width/e.originalWidth,t.scale.y=-r.scaleY*r.height/e.originalHeight))}setMeshRegion(r,t,e){t.attachment===r&&t.region===e||(t.region=e,t.attachment=r,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(r.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const r=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(r)}It.prototype.updateTransform.call(this)}createSprite(r,t,e){let s=t.region;r.hackAttachment===t&&(s=r.hackRegion);const i=s?s.texture:null,n=this.newSprite(i);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),r.sprites=r.sprites||{},r.sprites[e]=n,n}createMesh(r,t){let e=t.region;r.hackAttachment===t&&(e=r.hackRegion,r.hackAttachment=null,r.hackRegion=null);const s=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),xs.TRIANGLES);return typeof s._canvasPadding<"u"&&(s._canvasPadding=1.5),s.alpha=t.color.a,s.region=t.region,e&&this.setMeshRegion(t,s,e),r.meshes=r.meshes||{},r.meshes[t.id]=s,s}createGraphics(r,t){const e=this.newGraphics(),s=new Ni([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,r.currentGraphics=e,r.clippingContainer=this.newContainer(),r.clippingContainer.mask=r.currentGraphics,e}updateGraphics(r,t){const e=r.currentGraphics.geometry,s=e.graphicsData[0].shape.points,i=t.worldVerticesLength;s.length=i,t.computeWorldVertices(r,0,i,s,0,2),e.invalidate()}hackTextureBySlotIndex(r,t=null,e=null){const s=this.skeleton.slots[r];if(!s)return!1;const i=s.getAttachment();let n=i.region;return t?(n=new Vu,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=i):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(i,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(i,s.currentMesh,n),!0}hackTextureBySlotName(r,t=null,e=null){const s=this.skeleton.findSlotIndex(r);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(r,t,e,s=null){const i=this.skeleton.findSlotIndex(r),n=this.skeleton.getAttachmentByName(r,t);n.region.texture=e;const a=this.skeleton.slots[i];if(!a)return!1;const h=a.getAttachment();if(t===h.name){let o=n.region;return e?(o=new Vu,o.texture=e,o.size=s,a.hackRegion=o,a.hackAttachment=h):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=o?(this.setSpriteRegion(h,a.currentSprite,o),a.currentSprite.region=o):a.currentMesh&&a.currentMesh.region!=o&&this.setMeshRegion(h,a.currentMesh,o),!0}return!1}newContainer(){return new It}newSprite(r){return new HS(r)}newGraphics(){return new hs}newMesh(r,t,e,s,i){return new YS(r,t,e,s,i)}transformHack(){return 1}hackAttachmentGroups(r,t,e){if(!r)return;const s=[],i=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const h=this.skeleton.slots[n],o=h.currentSpriteName||h.currentMeshName||"",l=h.currentSprite||h.currentMesh;o.endsWith(r)?(l.parentGroup=t,i.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,i]}destroy(r){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const i in s.meshes)s.meshes[i].destroy(r);s.meshes=null;for(const i in s.sprites)s.sprites[i].destroy(r);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(r);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(r)}};let Gu=I_;Gu.clippingPolygon=[],Object.defineProperty(Gu.prototype,"visible",{get(){return this._visible},set(r){r!==this._visible&&(this._visible=r,r&&(this.lastTime=0))}});let P_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const R_=class extends P_{constructor(t){super(t),this.id=(R_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,i,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.deform;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];i[w]=E*_+T*x+m,i[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}i[p]=g,i[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}i[m]=x,i[m+1]=y}}}copyTo(t){this.bones!=null?(t.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices!=null?(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment}};let Xr=R_;Xr.nextID=0;let WS=class ly extends Xr{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new ly(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},zS=class hy extends Xr{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new hy(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Xu=class Ed extends Xr{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.tempColor=new X(0,0,0,0)}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();const t=new Ed(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new Ed(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(this.parentMesh!=null?this.parentMesh:this),t}},xl=class cy extends Xr{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new cy(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},jS=class uy extends Xr{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,a=s*e.b+i*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new uy(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},M_=class{constructor(t,e){if(this.deform=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};const _e=class extends P_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=i+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=i*o+this.y,f=i*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[_e.OX1]=u-f,x[_e.OY1]=d+c,x[_e.OX2]=u-_,x[_e.OY2]=g+c,x[_e.OX3]=p-_,x[_e.OY3]=g+m,x[_e.OX4]=p-f,x[_e.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){const n=this.offset,a=t instanceof M_?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[_e.OX1],p=n[_e.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[_e.OX4],p=n[_e.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}copy(){const t=new _e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,B.arrayCopy(this.uvs,0,t.uvs,0,8),B.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t}};let rt=_e;rt.OX1=0,rt.OY1=1,rt.OX2=2,rt.OY2=3,rt.OX3=4,rt.OY3=5,rt.OX4=6,rt.OY4=7,rt.X1=0,rt.Y1=1,rt.C1R=2,rt.C1G=3,rt.C1B=4,rt.C1A=5,rt.U1=6,rt.V1=7,rt.X2=8,rt.Y2=9,rt.C2R=10,rt.C2G=11,rt.C2B=12,rt.C2A=13,rt.U2=14,rt.V2=15,rt.X3=16,rt.Y3=17,rt.C3R=18,rt.C3G=19,rt.C3B=20,rt.C3A=21,rt.U3=22,rt.V3=23,rt.X4=24,rt.Y4=25,rt.C4R=26,rt.C4G=27,rt.C4B=28,rt.C4A=29,rt.U4=30,rt.V4=31,new C_(2);let oe=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(let i=0;i<e.length;i++)this.timelineIds[e[i].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,i,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let i=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?i=a+1:n=a,i==n)return(i+1)*s;a=i+n>>>1}}static linearSearch(t,e,s){for(let i=0,n=t.length-s;i<=n;i+=s)if(t[i]>e)return i;return-1}};const ee=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=B.newFloatArray((t-1)*ee.BEZIER_SIZE)}getFrameCount(){return this.curves.length/ee.BEZIER_SIZE+1}setLinear(t){this.curves[t*ee.BEZIER_SIZE]=ee.LINEAR}setStepped(t){this.curves[t*ee.BEZIER_SIZE]=ee.STEPPED}getCurveType(t){const e=t*ee.BEZIER_SIZE;if(e==this.curves.length)return ee.LINEAR;const s=this.curves[e];return s==ee.LINEAR?ee.LINEAR:s==ee.STEPPED?ee.STEPPED:ee.BEZIER}setCurve(t,e,s,i,n){const a=(-e*2+i)*.03,h=(-s*2+n)*.03,o=((e-i)*3+1)*.006,l=((s-n)*3+1)*.006;let u=a*2+o,c=h*2+l,d=e*.3+a+o*.16666667,f=s*.3+h+l*.16666667,p=t*ee.BEZIER_SIZE;const m=this.curves;m[p++]=ee.BEZIER;let g=d,_=f;for(let x=p+ee.BEZIER_SIZE-1;p<x;p+=2)m[p]=g,m[p+1]=_,d+=u,f+=c,u+=o,c+=l,g+=d,_+=f}getCurvePercent(t,e){e=D.clamp(e,0,1);const s=this.curves;let i=t*ee.BEZIER_SIZE;const n=s[i];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;i++;let a=0;for(let o=i,l=i+ee.BEZIER_SIZE-1;i<l;i+=2)if(a=s[i],a>=e){let u,c;return i==o?(u=0,c=0):(u=s[i-2],c=s[i-1]),c+(s[i+1]-c)*(e-u)/(a-u)}const h=s[i-1];return h+(1-h)*(e-a)/(1-a)}};let es=ee;es.LINEAR=0,es.STEPPED=1,es.BEZIER=2,es.BEZIER_SIZE=10*2-1;const er=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+er.ROTATION]=s}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotation=l.data.rotation;return;case S.first:const m=l.data.rotation-l.rotation;l.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*n}return}if(s>=o[o.length-er.ENTRIES]){let m=o[o.length+er.PREV_ROTATION];switch(a){case S.setup:l.rotation=l.data.rotation+m*n;break;case S.first:case S.replace:m+=l.data.rotation-l.rotation,m-=(16384-(16384.499999999996-m/360|0))*360;case S.add:l.rotation+=m*n}return}const u=oe.binarySearch(o,s,er.ENTRIES),c=o[u+er.PREV_ROTATION],d=o[u],f=this.getCurvePercent((u>>1)-1,1-(s-d)/(o[u+er.PREV_TIME]-d));let p=o[u+er.ROTATION]-c;switch(p=c+(p-(16384-(16384.499999999996-p/360|0))*360)*f,a){case S.setup:l.rotation=l.data.rotation+(p-(16384-(16384.499999999996-p/360|0))*360)*n;break;case S.first:case S.replace:p+=l.data.rotation-l.rotation;case S.add:l.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*n}}};let Ie=er;Ie.ENTRIES=2,Ie.PREV_TIME=-2,Ie.PREV_ROTATION=-1,Ie.ROTATION=1;const ke=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*ke.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,i){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=i}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.x=l.data.x,l.y=l.data.y;return;case S.first:l.x+=(l.data.x-l.x)*n,l.y+=(l.data.y-l.y)*n}return}let u=0,c=0;if(s>=o[o.length-ke.ENTRIES])u=o[o.length+ke.PREV_X],c=o[o.length+ke.PREV_Y];else{const d=oe.binarySearch(o,s,ke.ENTRIES);u=o[d+ke.PREV_X],c=o[d+ke.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ke.ENTRIES-1,1-(s-f)/(o[d+ke.PREV_TIME]-f));u+=(o[d+ke.X]-u)*p,c+=(o[d+ke.Y]-c)*p}switch(a){case S.setup:l.x=l.data.x+u*n,l.y=l.data.y+c*n;break;case S.first:case S.replace:l.x+=(l.data.x+u-l.x)*n,l.y+=(l.data.y+c-l.y)*n;break;case S.add:l.x+=u*n,l.y+=c*n}}};let ps=ke;ps.ENTRIES=3,ps.PREV_TIME=-3,ps.PREV_X=-2,ps.PREV_Y=-1,ps.X=1,ps.Y=2;let F_=class Bs extends ps{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Bs.ENTRIES])u=o[o.length+Bs.PREV_X]*l.data.scaleX,c=o[o.length+Bs.PREV_Y]*l.data.scaleY;else{const d=oe.binarySearch(o,s,Bs.ENTRIES);u=o[d+Bs.PREV_X],c=o[d+Bs.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Bs.ENTRIES-1,1-(s-f)/(o[d+Bs.PREV_TIME]-f));u=(u+(o[d+Bs.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Bs.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},k_=class Ds extends ps{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Ds.ENTRIES])u=o[o.length+Ds.PREV_X],c=o[o.length+Ds.PREV_Y];else{const d=oe.binarySearch(o,s,Ds.ENTRIES);u=o[d+Ds.PREV_X],c=o[d+Ds.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ds.ENTRIES-1,1-(s-f)/(o[d+Ds.PREV_TIME]-f));u=u+(o[d+Ds.X]-u)*p,c=c+(o[d+Ds.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Xt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Xt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,i,n,a){t*=Xt.ENTRIES,this.frames[t]=e,this.frames[t+Xt.R]=s,this.frames[t+Xt.G]=i,this.frames[t+Xt.B]=n,this.frames[t+Xt.A]=a}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color);return;case S.first:const p=o.color,m=o.data.color;p.add((m.r-p.r)*n,(m.g-p.g)*n,(m.b-p.b)*n,(m.a-p.a)*n)}return}let u=0,c=0,d=0,f=0;if(s>=l[l.length-Xt.ENTRIES]){const p=l.length;u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A]}else{const p=oe.binarySearch(l,s,Xt.ENTRIES);u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A];const m=l[p],g=this.getCurvePercent(p/Xt.ENTRIES-1,1-(s-m)/(l[p+Xt.PREV_TIME]-m));u+=(l[p+Xt.R]-u)*g,c+=(l[p+Xt.G]-c)*g,d+=(l[p+Xt.B]-d)*g,f+=(l[p+Xt.A]-f)*g}if(n==1)o.color.set(u,c,d,f);else{const p=o.color;a==S.setup&&p.setFromColor(o.data.color),p.add((u-p.r)*n,(c-p.g)*n,(d-p.b)*n,(f-p.a)*n)}}};let Ye=Xt;Ye.ENTRIES=5,Ye.PREV_TIME=-5,Ye.PREV_R=-4,Ye.PREV_G=-3,Ye.PREV_B=-2,Ye.PREV_A=-1,Ye.R=1,Ye.G=2,Ye.B=3,Ye.A=4;const dt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*dt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,i,n,a,h,o,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=i,this.frames[t+dt.B]=n,this.frames[t+dt.A]=a,this.frames[t+dt.R2]=h,this.frames[t+dt.G2]=o,this.frames[t+dt.B2]=l}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case S.first:const _=o.color,x=o.darkColor,y=o.data.color,v=o.data.darkColor;_.add((y.r-_.r)*n,(y.g-_.g)*n,(y.b-_.b)*n,(y.a-_.a)*n),x.add((v.r-x.r)*n,(v.g-x.g)*n,(v.b-x.b)*n,0)}return}let u=0,c=0,d=0,f=0,p=0,m=0,g=0;if(s>=l[l.length-dt.ENTRIES]){const _=l.length;u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2]}else{const _=oe.binarySearch(l,s,dt.ENTRIES);u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2];const x=l[_],y=this.getCurvePercent(_/dt.ENTRIES-1,1-(s-x)/(l[_+dt.PREV_TIME]-x));u+=(l[_+dt.R]-u)*y,c+=(l[_+dt.G]-c)*y,d+=(l[_+dt.B]-d)*y,f+=(l[_+dt.A]-f)*y,p+=(l[_+dt.R2]-p)*y,m+=(l[_+dt.G2]-m)*y,g+=(l[_+dt.B2]-g)*y}if(n==1)o.color.set(u,c,d,f),o.darkColor.set(p,m,g,1);else{const _=o.color,x=o.darkColor;a==S.setup&&(_.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),_.add((u-_.r)*n,(c-_.g)*n,(d-_.b)*n,(f-_.a)*n),x.add((p-x.r)*n,(m-x.g)*n,(g-x.b)*n,0)}}};let ae=dt;ae.ENTRIES=8,ae.PREV_TIME=-8,ae.PREV_R=-7,ae.PREV_G=-6,ae.PREV_B=-5,ae.PREV_A=-4,ae.PREV_R2=-3,ae.PREV_G2=-2,ae.PREV_B2=-1,ae.R=1,ae.G=2,ae.B=3,ae.A=4,ae.R2=5,ae.G2=6,ae.B2=7;let Rn=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}const l=this.frames;if(s<l[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}let u=0;s>=l[l.length-1]?u=l.length-1:u=oe.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}setAttachment(t,e,s){e.setAttachment(s==null?null:t.getAttachment(this.slotIndex,s))}},B_=null,D_=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),B_==null&&(B_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!(l instanceof Xr)||l.deformAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;break;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=oe.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},$u=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,a,h){if(i==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=oe.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)i.push(this.events[u])}},Io=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=oe.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const mt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*mt.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(t,e,s,i,n,a,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=i,this.frames[t+mt.BEND_DIRECTION]=n,this.frames[t+mt.COMPRESS]=a?1:0,this.frames[t+mt.STRETCH]=h?1:0}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case S.first:l.mix+=(l.data.mix-l.mix)*n,l.softness+=(l.data.softness-l.softness)*n,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}if(s>=o[o.length-mt.ENTRIES]){a==S.setup?(l.mix=l.data.mix+(o[o.length+mt.PREV_MIX]-l.data.mix)*n,l.softness=l.data.softness+(o[o.length+mt.PREV_SOFTNESS]-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0)):(l.mix+=(o[o.length+mt.PREV_MIX]-l.mix)*n,l.softness+=(o[o.length+mt.PREV_SOFTNESS]-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0));return}const u=oe.binarySearch(o,s,mt.ENTRIES),c=o[u+mt.PREV_MIX],d=o[u+mt.PREV_SOFTNESS],f=o[u],p=this.getCurvePercent(u/mt.ENTRIES-1,1-(s-f)/(o[u+mt.PREV_TIME]-f));a==S.setup?(l.mix=l.data.mix+(c+(o[u+mt.MIX]-c)*p-l.data.mix)*n,l.softness=l.data.softness+(d+(o[u+mt.SOFTNESS]-d)*p-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0)):(l.mix+=(c+(o[u+mt.MIX]-c)*p-l.mix)*n,l.softness+=(d+(o[u+mt.SOFTNESS]-d)*p-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0))}};let Pe=mt;Pe.ENTRIES=6,Pe.PREV_TIME=-6,Pe.PREV_MIX=-5,Pe.PREV_SOFTNESS=-4,Pe.PREV_BEND_DIRECTION=-3,Pe.PREV_COMPRESS=-2,Pe.PREV_STRETCH=-1,Pe.MIX=1,Pe.SOFTNESS=2,Pe.BEND_DIRECTION=3,Pe.COMPRESS=4,Pe.STRETCH=5;const $t=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*$t.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,i,n,a){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=i,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=a}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s<o[0]){const p=l.data;switch(a){case S.setup:l.rotateMix=p.rotateMix,l.translateMix=p.translateMix,l.scaleMix=p.scaleMix,l.shearMix=p.shearMix;return;case S.first:l.rotateMix+=(p.rotateMix-l.rotateMix)*n,l.translateMix+=(p.translateMix-l.translateMix)*n,l.scaleMix+=(p.scaleMix-l.scaleMix)*n,l.shearMix+=(p.shearMix-l.shearMix)*n}return}let u=0,c=0,d=0,f=0;if(s>=o[o.length-$t.ENTRIES]){const p=o.length;u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR]}else{const p=oe.binarySearch(o,s,$t.ENTRIES);u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR];const m=o[p],g=this.getCurvePercent(p/$t.ENTRIES-1,1-(s-m)/(o[p+$t.PREV_TIME]-m));u+=(o[p+$t.ROTATE]-u)*g,c+=(o[p+$t.TRANSLATE]-c)*g,d+=(o[p+$t.SCALE]-d)*g,f+=(o[p+$t.SHEAR]-f)*g}if(a==S.setup){const p=l.data;l.rotateMix=p.rotateMix+(u-p.rotateMix)*n,l.translateMix=p.translateMix+(c-p.translateMix)*n,l.scaleMix=p.scaleMix+(d-p.scaleMix)*n,l.shearMix=p.shearMix+(f-p.shearMix)*n}else l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n,l.scaleMix+=(d-l.scaleMix)*n,l.shearMix+=(f-l.shearMix)*n}};let We=$t;We.ENTRIES=5,We.PREV_TIME=-5,We.PREV_ROTATE=-4,We.PREV_TRANSLATE=-3,We.PREV_SCALE=-2,We.PREV_SHEAR=-1,We.ROTATE=1,We.TRANSLATE=2,We.SCALE=3,We.SHEAR=4;const Is=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Is.ENTRIES,this.frames[t]=e,this.frames[t+Is.VALUE]=s}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.position=l.data.position;return;case S.first:l.position+=(l.data.position-l.position)*n}return}let u=0;if(s>=o[o.length-Is.ENTRIES])u=o[o.length+Is.PREV_VALUE];else{const c=oe.binarySearch(o,s,Is.ENTRIES);u=o[c+Is.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/Is.ENTRIES-1,1-(s-d)/(o[c+Is.PREV_TIME]-d));u+=(o[c+Is.VALUE]-u)*f}a==S.setup?l.position=l.data.position+(u-l.data.position)*n:l.position+=(u-l.position)*n}};let Ci=Is;Ci.ENTRIES=2,Ci.PREV_TIME=-2,Ci.PREV_VALUE=-1,Ci.VALUE=1;let O_=class cr extends Ci{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-cr.ENTRIES])u=o[o.length+cr.PREV_VALUE];else{const c=oe.binarySearch(o,s,cr.ENTRIES);u=o[c+cr.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/cr.ENTRIES-1,1-(s-d)/(o[c+cr.PREV_TIME]-d));u+=(o[c+cr.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Be=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Be.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,i){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=i}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotateMix=l.data.rotateMix,l.translateMix=l.data.translateMix;return;case S.first:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*n,l.translateMix+=(l.data.translateMix-l.translateMix)*n}return}let u=0,c=0;if(s>=o[o.length-Be.ENTRIES])u=o[o.length+Be.PREV_ROTATE],c=o[o.length+Be.PREV_TRANSLATE];else{const d=oe.binarySearch(o,s,Be.ENTRIES);u=o[d+Be.PREV_ROTATE],c=o[d+Be.PREV_TRANSLATE];const f=o[d],p=this.getCurvePercent(d/Be.ENTRIES-1,1-(s-f)/(o[d+Be.PREV_TIME]-f));u+=(o[d+Be.ROTATE]-u)*p,c+=(o[d+Be.TRANSLATE]-c)*p}a==S.setup?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*n):(l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n)}};let oi=Be;oi.ENTRIES=3,oi.PREV_TIME=-3,oi.PREV_ROTATE=-2,oi.PREV_TRANSLATE=-1,oi.ROTATE=1,oi.TRANSLATE=2;const Ht=class{constructor(r){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new L_(this),this.propertyIDs=new LS,this.animationsChanged=!1,this.trackEntryPool=new GS(()=>new Hu),this.data=r}update(r){r*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i==null)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=r*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let a=i.next;if(a!=null){const h=i.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=i.timeScale==0?0:(h/i.timeScale+r)*a.timeScale,i.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=r,a=a.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&i.mixingFrom==null){t[e]=null,this.queue.end(i),this.disposeNext(i);continue}if(i.mixingFrom!=null&&this.updateMixingFrom(i,r)){let h=i.mixingFrom;for(i.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(r,t){const e=r.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,r.mixTime>0&&r.mixTime>=r.mixDuration?((e.totalAlpha==0||r.mixDuration==0)&&(r.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=r),r.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,r.mixTime+=t,!1)}apply(r){if(r==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let a=0,h=e.length;a<h;a++){const o=e[a];if(o==null||o.delay>0)continue;s=!0;const l=a==0?S.first:o.mixBlend;let u=o.alpha;o.mixingFrom!=null?u*=this.applyMixingFrom(o,r,l):o.trackTime>=o.trackEnd&&o.next==null&&(u=0);const c=o.animationLast,d=o.getAnimationTime(),f=o.animation.timelines.length,p=o.animation.timelines;if(a==0&&u==1||l==S.add)for(let m=0;m<f;m++){const g=p[m];g instanceof Rn?this.applyAttachmentTimeline(g,r,d,l,!0):g.apply(r,c,d,t,u,l,At.mixIn)}else{const m=o.timelineMode,g=o.timelinesRotation.length==0;g&&B.setArraySize(o.timelinesRotation,f<<1,null);const _=o.timelinesRotation;for(let x=0;x<f;x++){const y=p[x],v=m[x]==Ht.SUBSEQUENT?l:S.setup;y instanceof Ie?this.applyRotateTimeline(y,r,d,u,v,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,r,d,l,!0):y.apply(r,c,d,t,u,v,At.mixIn)}}this.queueEvents(o,d),t.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}const i=this.unkeyedState+Ht.SETUP,n=r.slots;for(let a=0,h=r.slots.length;a<h;a++){const o=n[a];if(o.attachmentState==i){const l=o.data.attachmentName;o.setAttachment(l==null?null:r.getAttachment(o.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(r,t,e){const s=r.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let i=0;r.mixDuration==0?(i=1,e==S.first&&(e=S.setup)):(i=r.mixTime/r.mixDuration,i>1&&(i=1),e!=S.first&&(e=s.mixBlend));const n=i<s.eventThreshold?this.events:null,a=i<s.attachmentThreshold,h=i<s.drawOrderThreshold,o=s.animationLast,l=s.getAnimationTime(),u=s.animation.timelines.length,c=s.animation.timelines,d=s.alpha*r.interruptAlpha,f=d*(1-i);if(e==S.add)for(let p=0;p<u;p++)c[p].apply(t,o,l,n,f,e,At.mixOut);else{const p=s.timelineMode,m=s.timelineHoldMix,g=s.timelinesRotation.length==0;g&&B.setArraySize(s.timelinesRotation,u<<1,null);const _=s.timelinesRotation;s.totalAlpha=0;for(let x=0;x<u;x++){const y=c[x];let v=At.mixOut,b,w=0;switch(p[x]){case Ht.SUBSEQUENT:if(!h&&y instanceof Io)continue;b=e,w=f;break;case Ht.FIRST:b=S.setup,w=f;break;case Ht.HOLD_SUBSEQUENT:b=e,w=d;break;case Ht.HOLD_FIRST:b=S.setup,w=d;break;default:b=S.setup;const E=m[x];w=d*Math.max(0,1-E.mixTime/E.mixDuration);break}s.totalAlpha+=w,y instanceof Ie?this.applyRotateTimeline(y,t,l,w,b,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,t,l,b,a):(h&&y instanceof Io&&b==S.setup&&(v=At.mixIn),y.apply(t,o,l,n,w,b,v))}}return r.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,i}applyAttachmentTimeline(r,t,e,s,i){const n=t.slots[r.slotIndex];if(!n.bone.active)return;const a=r.frames;if(e<a[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,i);else{let h;e>=a[a.length-1]?h=a.length-1:h=oe.binarySearch(a,e)-1,this.setAttachment(t,n,r.attachmentNames[h],i)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Ht.SETUP)}setAttachment(r,t,e,s){t.setAttachment(e==null?null:r.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Ht.CURRENT)}applyRotateTimeline(r,t,e,s,i,n,a,h){if(h&&(n[a]=0),s==1){r.apply(t,0,e,null,1,i,At.mixIn);return}const o=r,l=o.frames,u=t.bones[o.boneIndex];if(!u.active)return;let c=0,d=0;if(e<l[0])switch(i){case S.setup:u.rotation=u.data.rotation;default:return;case S.first:c=u.rotation,d=u.data.rotation}else if(c=i==S.setup?u.data.rotation:u.rotation,e>=l[l.length-Ie.ENTRIES])d=u.data.rotation+l[l.length+Ie.PREV_ROTATION];else{const m=oe.binarySearch(l,e,Ie.ENTRIES),g=l[m+Ie.PREV_ROTATION],_=l[m],x=o.getCurvePercent((m>>1)-1,1-(e-_)/(l[m+Ie.PREV_TIME]-_));d=l[m+Ie.ROTATION]-g,d-=(16384-(16384.499999999996-d/360|0))*360,d=g+d*x+u.data.rotation,d-=(16384-(16384.499999999996-d/360|0))*360}let f=0,p=d-c;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,g=0;h?(m=0,g=p):(m=n[a],g=n[a+1]);const _=p>0;let x=m>=0;D.signum(g)!=D.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*D.signum(m)),x=_),f=p+m-m%360,x!=_&&(f+=360*D.signum(m)),n[a]=f}n[a+1]=p,c+=f*s,u.rotation=c-(16384-(16384.499999999996-c/360|0))*360}queueEvents(r,t){const e=r.animationStart,s=r.animationEnd,i=s-e,n=r.trackLast%i,a=this.events;let h=0;const o=a.length;for(;h<o;h++){const u=a[h];if(u.time<n)break;u.time>s||this.queue.event(r,u)}let l=!1;for(r.loop?l=i==0||n>r.trackTime%i:l=t>=s&&r.animationLast<s,l&&this.queue.complete(r);h<o;h++)a[h].time<e||this.queue.event(r,a[h])}clearTracks(){const r=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=r,this.queue.drain()}clearTrack(r){if(r>=this.tracks.length)return;const t=this.tracks[r];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(s==null)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(r,t,e){const s=this.expandToIndex(r);this.tracks[r]=t,s!=null&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom!=null&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(r,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(r,s,e)}setAnimationWith(r,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,i=this.expandToIndex(r);i!=null&&(i.nextTrackLast==-1?(this.tracks[r]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.disposeNext(i),i=i.mixingFrom,s=!1):this.disposeNext(i));const n=this.trackEntry(r,t,e,i);return this.setCurrent(r,n,s),this.queue.drain(),n}addAnimation(r,t,e,s){const i=this.data.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(r,i,e,s)}addAnimationWith(r,t,e,s){if(t==null)throw new Error("animation cannot be null.");let i=this.expandToIndex(r);if(i!=null)for(;i.next!=null;)i=i.next;const n=this.trackEntry(r,t,e,i);if(i==null)this.setCurrent(r,n,!0),this.queue.drain();else if(i.next=n,s<=0){const a=i.animationEnd-i.animationStart;a!=0?(i.loop?s+=a*(1+(i.trackTime/a|0)):s+=Math.max(a,i.trackTime),s-=this.data.getMix(i.animation,t)):s=i.trackTime}return n.delay=s,n}setEmptyAnimation(r,t){const e=this.setAnimationWith(r,Ht.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(r,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(r,Ht.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(r){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const i=this.tracks[e];i!=null&&this.setEmptyAnimation(i.trackIndex,r)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(r){return r<this.tracks.length?this.tracks[r]:(B.ensureArrayCapacity(this.tracks,r+1,null),this.tracks.length=r+1,null)}trackEntry(r,t,e,s){const i=this.trackEntryPool.obtain();return i.trackIndex=r,i.animation=t,i.loop=e,i.holdPrevious=!1,i.eventThreshold=0,i.attachmentThreshold=0,i.drawOrderThreshold=0,i.animationStart=0,i.animationEnd=t.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.interruptAlpha=1,i.mixTime=0,i.mixDuration=s==null?0:this.data.getMix(s.animation,t),i.mixBlend=S.replace,i}disposeNext(r){let t=r.next;for(;t!=null;)this.queue.dispose(t),t=t.next;r.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let r=0,t=this.tracks.length;r<t;r++){let e=this.tracks[r];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=S.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(r){const t=r.mixingTo,e=r.animation.timelines,s=r.animation.timelines.length,i=B.setArraySize(r.timelineMode,s);r.timelineHoldMix.length=0;const n=B.setArraySize(r.timelineHoldMix,s),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)i[h]=a.add(e[h].getPropertyId())?Ht.HOLD_FIRST:Ht.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const o=e[h],l=o.getPropertyId();if(!a.add(l))i[h]=Ht.SUBSEQUENT;else if(t==null||o instanceof Rn||o instanceof Io||o instanceof $u||!t.animation.hasTimeline(l))i[h]=Ht.FIRST;else{for(let u=t.mixingTo;u!=null;u=u.mixingTo)if(!u.animation.hasTimeline(l)){if(r.mixDuration>0){i[h]=Ht.HOLD_MIX,n[h]=u;continue t}break}i[h]=Ht.HOLD_FIRST}}}getCurrent(r){return r>=this.tracks.length?null:this.tracks[r]}addListener(r){if(r==null)throw new Error("listener cannot be null.");this.listeners.push(r)}removeListener(r){const t=this.listeners.indexOf(r);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(r,t,e){Ht.deprecatedWarning1||(Ht.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(r,t,e)}addAnimationByName(r,t,e,s){Ht.deprecatedWarning2||(Ht.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(r,t,e,s)}hasAnimation(r){return this.data.skeletonData.findAnimation(r)!==null}hasAnimationByName(r){return Ht.deprecatedWarning3||(Ht.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(r)}};let ms=Ht;ms.emptyAnimation=new oe("<empty>",[],0),ms.SUBSEQUENT=0,ms.FIRST=1,ms.HOLD_SUBSEQUENT=2,ms.HOLD_FIRST=3,ms.HOLD_MIX=4,ms.SETUP=1,ms.CURRENT=2,ms.deprecatedWarning1=!1,ms.deprecatedWarning2=!1,ms.deprecatedWarning3=!1;const Ii=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const r=this.animationEnd-this.animationStart;return r==0?this.animationStart:this.trackTime%r+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(r){this.animationLast=r,this.nextAnimationLast=r}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ii.deprecatedWarning1||(Ii.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(r){Ii.deprecatedWarning1||(Ii.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=r}get endTime(){return Ii.deprecatedWarning2||(Ii.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(r){Ii.deprecatedWarning2||(Ii.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=r}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Hu=Ii;Hu.deprecatedWarning1=!1,Hu.deprecatedWarning2=!1;const Yu=class{constructor(r){this.objects=[],this.drainDisabled=!1,this.animState=r}start(r){this.objects.push(ss.start),this.objects.push(r),this.animState.animationsChanged=!0}interrupt(r){this.objects.push(ss.interrupt),this.objects.push(r)}end(r){this.objects.push(ss.end),this.objects.push(r),this.animState.animationsChanged=!0}dispose(r){this.objects.push(ss.dispose),this.objects.push(r)}complete(r){this.objects.push(ss.complete),this.objects.push(r)}event(r,t){this.objects.push(ss.event),this.objects.push(r),this.objects.push(t)}deprecateStuff(){return Yu.deprecatedWarning1||(Yu.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const r=this.objects,t=this.animState.listeners;for(let e=0;e<r.length;e+=2){const s=r[e],i=r[e+1];switch(s){case ss.start:i.listener!=null&&i.listener.start&&i.listener.start(i);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(i);i.onStart&&this.deprecateStuff()&&i.onStart(i.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(i.trackIndex);break;case ss.interrupt:i.listener!=null&&i.listener.interrupt&&i.listener.interrupt(i);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(i);break;case ss.end:i.listener!=null&&i.listener.end&&i.listener.end(i);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(i);i.onEnd&&this.deprecateStuff()&&i.onEnd(i.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(i.trackIndex);case ss.dispose:i.listener!=null&&i.listener.dispose&&i.listener.dispose(i);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(i);this.animState.trackEntryPool.free(i);break;case ss.complete:i.listener!=null&&i.listener.complete&&i.listener.complete(i);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(i);const n=D.toInt(i.loopsCount());i.onComplete&&this.deprecateStuff()&&i.onComplete(i.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(i.trackIndex,n);break;case ss.event:const a=r[e+++2];i.listener!=null&&i.listener.event&&i.listener.event(i,a);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(i,a);i.onEvent&&this.deprecateStuff()&&i.onEvent(i.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(i.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let L_=Yu;L_.deprecatedWarning1=!1;var ss=(r=>(r[r.start=0]="start",r[r.interrupt=1]="interrupt",r[r.end=2]="end",r[r.dispose=3]="dispose",r[r.complete=4]="complete",r[r.event=5]="event",r))(ss||{});const Wu=class{constructor(r){if(this.animationToMixTime={},this.defaultMix=0,r==null)throw new Error("skeletonData cannot be null.");this.skeletonData=r}setMix(r,t,e){const s=this.skeletonData.findAnimation(r);if(s==null)throw new Error(`Animation not found: ${r}`);const i=this.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,i,e)}setMixByName(r,t,e){Wu.deprecatedWarning1||(Wu.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(r,t,e)}setMixWith(r,t,e){if(r==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${r.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(r,t){const e=`${r.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let N_=Wu;N_.deprecatedWarning1=!1;let V_=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new rt(e);return n.region=i,n}newMeshAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Xu(e);return n.region=i,n}newBoundingBoxAttachment(t,e){return new WS(e)}newPathAttachment(t,e){return new xl(e)}newPointAttachment(t,e){return new jS(e)}newClippingAttachment(t,e){return new zS(e)}};class U_{constructor(t,e,s){if(this.matrix=new Mt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,n,a,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=a,this.ashearY=h,this.appliedValid=!0;const o=this.parent,l=this.matrix,u=this.skeleton.scaleX,c=-this.skeleton.scaleY;if(o==null){const g=this.skeleton,_=s+90+h;l.a=D.cosDeg(s+a)*i*u,l.c=D.cosDeg(_)*n*u,l.b=D.sinDeg(s+a)*i*c,l.d=D.sinDeg(_)*n*c,l.tx=t*u+g.x,l.ty=e*c+g.y;return}let d=o.matrix.a,f=o.matrix.c,p=o.matrix.b,m=o.matrix.d;switch(l.tx=d*t+f*e+o.matrix.tx,l.ty=p*t+m*e+o.matrix.ty,this.data.transformMode){case vt.Normal:{const g=s+90+h,_=D.cosDeg(s+a)*i,x=D.cosDeg(g)*n,y=D.sinDeg(s+a)*i,v=D.sinDeg(g)*n;l.a=d*_+f*y,l.c=d*x+f*v,l.b=p*_+m*y,l.d=p*x+m*v;return}case vt.OnlyTranslation:{const g=s+90+h;l.a=D.cosDeg(s+a)*i,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+a)*i,l.d=D.sinDeg(g)*n;break}case vt.NoRotationOrReflection:{let g=d*d+p*p,_=0;g>1e-4?(g=Math.abs(d*m-f*p)/g,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*g,m=d*g,_=Math.atan2(p,d)*D.radDeg):(d=0,p=0,_=90-Math.atan2(m,f)*D.radDeg);const x=s+a-_,y=s+h-_+90,v=D.cosDeg(x)*i,b=D.cosDeg(y)*n,w=D.sinDeg(x)*i,E=D.sinDeg(y)*n;l.a=d*v-f*w,l.c=d*b-f*E,l.b=p*v+m*w,l.d=p*b+m*E;break}case vt.NoScale:case vt.NoScaleOrReflection:{const g=D.cosDeg(s),_=D.sinDeg(s);let x=(d*g+f*_)/u,y=(p*g+m*_)/c,v=Math.sqrt(x*x+y*y);v>1e-5&&(v=1/v),x*=v,y*=v,v=Math.sqrt(x*x+y*y),this.data.transformMode==vt.NoScale&&d*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(y,x),w=Math.cos(b)*v,E=Math.sin(b)*v,T=D.cosDeg(a)*i,A=D.cosDeg(90+h)*n,I=D.sinDeg(a)*i,M=D.sinDeg(90+h)*n;l.a=x*T+w*I,l.c=x*A+w*M,l.b=y*T+E*I,l.d=y*A+E*M;break}}l.a*=u,l.c*=u,l.b*=c,l.d*=c}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*D.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*D.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*D.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*D.radDeg;return}const s=t.matrix,i=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,a=e.ty-s.ty;this.ax=n*s.d*i-a*s.c*i,this.ay=a*s.a*i-n*s.b*i;const h=i*s.d,o=i*s.a,l=i*s.c,u=i*s.b,c=h*e.a-l*e.b,d=h*e.c-l*e.d,f=o*e.b-u*e.a,p=o*e.d-u*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){const m=c*p-d*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*d+f*p,m)*D.radDeg,this.arotation=Math.atan2(f,c)*D.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*D.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,i=e.c,n=e.b,a=e.d,h=1/(s*a-i*n),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*a*h-l*i*h,t.y=l*s*h-o*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,i=t.y;return t.x=s*e.a+i*e.c+e.tx,t.y=s*e.b+i*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),i=this.matrix;return Math.atan2(i.a*e-i.b*s,i.d*s-i.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),i=this.matrix;return Math.atan2(s*i.b+e*i.d,s*i.a+e*i.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,i=e.c,n=e.b,a=e.d,h=D.cosDeg(t),o=D.sinDeg(t);e.a=h*s-o*n,e.c=h*i-o*a,e.b=o*s+h*n,e.d=o*i+h*a,this.appliedValid=!1}}let G_=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},zu=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},X_=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},$_=class{constructor(t){this.name=t}};class qS{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){const t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix);break}}apply1(t,e,s,i,n,a,h){t.appliedValid||t.updateAppliedTransform();const o=t.parent.matrix,l=o.a;let u=o.c;const c=o.b;let d=o.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case vt.OnlyTranslation:p=e-t.worldX,m=s-t.worldY;break;case vt.NoRotationOrReflection:const x=Math.abs(l*d-u*c)/(l*l+c*c),y=l/t.skeleton.scaleX,v=c/t.skeleton.scaleY;u=-v*x*t.skeleton.scaleX,d=y*x*t.skeleton.scaleY,f+=Math.atan2(v,y)*D.radDeg;default:const b=e-o.tx,w=s-o.ty,E=l*d-u*c;p=(b*d-w*u)/E-t.ax,m=(w*l-b*c)/E-t.ay}f+=Math.atan2(m,p)*D.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,_=t.ascaleY;if(i||n){switch(t.data.transformMode){case vt.NoScale:case vt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const x=t.data.length*g,y=Math.sqrt(p*p+m*m);if(i&&y<x||n&&y>x&&x>1e-4){const v=(y/x-1)*h+1;g*=v,a&&(_*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*h,g,_,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,a,h,o){if(o==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,u=t.ay;let c=t.ascaleX,d=c,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,_=0,x=0;c<0?(c=-c,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,_=180):_=0;const y=e.ax;let v=0,b=0,w=0,E=m.a,T=m.c,A=m.b,I=m.d;const M=Math.abs(c-f)<=1e-4;M?(v=e.ay,b=E*y+T*v+m.tx,w=A*y+I*v+m.ty):(v=0,b=E*y+m.tx,w=A*y+m.ty);const R=t.parent.matrix;E=R.a,T=R.c,A=R.b,I=R.d;const C=1/(E*I-T*A);let P=b-R.tx,k=w-R.ty;const U=(P*I-k*T)*C-l,V=(k*E-P*A)*C-u,L=Math.sqrt(U*U+V*V);let $=e.data.length*p,O,N;if(L<1e-4){this.apply1(t,s,i,!1,a,!1,o),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=i-R.ty;let Z=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-u,Y=Z*Z+Q*Q;if(h!=0){h*=c*(p+1)/2;const _t=Math.sqrt(Y),Bt=_t-L-$*c+h;if(Bt>0){let zt=Math.min(1,Bt/(h*2))-1;zt=(Bt-h*(1-zt*zt))/_t,Z-=zt*Z,Q-=zt*Q,Y=Z*Z+Q*Q}}t:if(M){$*=c;let _t=(Y-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,a&&(d*=(Math.sqrt(Y)/(L+$)-1)*o+1)),N=Math.acos(_t)*n,E=L+$*_t,T=$*Math.sin(N),O=Math.atan2(Q*E-Z*T,Z*E+Q*T)}else{E=c*$,T=f*$;const _t=E*E,Bt=T*T,zt=Math.atan2(Q,Z);A=Bt*L*L+_t*Y-_t*Bt;const Qt=-2*Bt*L,Rt=Bt-_t;if(I=Qt*Qt-4*Rt*A,I>=0){let Bn=Math.sqrt(I);Qt<0&&(Bn=-Bn),Bn=-(Qt+Bn)/2;const sy=Bn/Rt,iy=A/Bn,Dn=Math.abs(sy)<Math.abs(iy)?sy:iy;if(Dn*Dn<=Y){k=Math.sqrt(Y-Dn*Dn)*n,O=zt-Math.atan2(k,Dn),N=Math.atan2(k/f,(Dn-L)/c);break t}}let jt=D.PI,Ot=L-E,ze=Ot*Ot,rs=0,lr=0,kn=L+E,hr=kn*kn,ey=0;A=-E*L/(_t-Bt),A>=-1&&A<=1&&(A=Math.acos(A),P=E*Math.cos(A)+L,k=T*Math.sin(A),I=P*P+k*k,I<ze&&(jt=A,ze=I,Ot=P,rs=k),I>hr&&(lr=A,hr=I,kn=P,ey=k)),Y<=(ze+hr)/2?(O=zt-Math.atan2(rs*n,Ot),N=jt*n):(O=zt-Math.atan2(ey*n,kn),N=lr*n)}const lt=Math.atan2(v,y)*x;let Tt=t.arotation;O=(O-lt)*D.radDeg+g-Tt,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(l,u,Tt+O*o,d,t.ascaleY,0,0),Tt=e.arotation,N=((N+lt)*D.radDeg-e.ashearX)*x+_-Tt,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(y,v,Tt+N*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}let H_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},Y_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array}};var be=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(be||{});const $r=class{constructor(r,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,r==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=r,this.bones=new Array;for(let e=0,s=r.bones.length;e<s;e++)this.bones.push(t.findBone(r.bones[e].name));this.target=t.findSlot(r.target.name),this.position=r.position,this.spacing=r.spacing,this.rotateMix=r.rotateMix,this.translateMix=r.translateMix}isActive(){return this.active}apply(){this.update()}update(){const r=this.target.getAttachment();if(!(r instanceof xl))return;const t=this.rotateMix,e=this.translateMix,s=e>0,i=t>0;if(!s&&!i)return;const n=this.data,a=n.spacingMode,h=a==be.Length,o=n.rotateMode,l=o==Fe.Tangent,u=o==Fe.ChainScale,c=this.bones.length,d=l?c:c+1,f=this.bones,p=B.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(u||h){u&&(m=B.setArraySize(this.lengths,c));for(let w=0,E=d-1;w<E;){const T=f[w],A=T.data.length;if(A<$r.epsilon)u&&(m[w]=0),p[++w]=0;else{const I=A*T.matrix.a,M=A*T.matrix.b,R=Math.sqrt(I*I+M*M);u&&(m[w]=R),p[++w]=(h?A+g:g)*R/A}}}else for(let w=1;w<d;w++)p[w]=g;const _=this.computeWorldPositions(r,d,l,n.positionMode==ne.Percent,a==be.Percent);let x=_[0],y=_[1],v=n.offsetRotation,b=!1;if(v==0)b=o==Fe.Chain;else{b=!1;const w=this.target.bone.matrix;v*=w.a*w.d-w.b*w.c>0?D.degRad:-D.degRad}for(let w=0,E=3;w<c;w++,E+=3){const T=f[w],A=T.matrix;A.tx+=(x-A.tx)*e,A.ty+=(y-A.ty)*e;const I=_[E],M=_[E+1],R=I-x,C=M-y;if(u){const P=m[w];if(P!=0){const k=(Math.sqrt(R*R+C*C)/P-1)*t+1;A.a*=k,A.b*=k}}if(x=I,y=M,i){const P=A.a,k=A.c,U=A.b,V=A.d;let L=0,$=0,O=0;if(l&&(l?L=_[E-1]:p[w+1]==0?L=_[E+2]:L=Math.atan2(C,R)),L-=Math.atan2(U,P),b){$=Math.cos(L),O=Math.sin(L);const N=T.data.length;x+=(N*($*P-O*U)-R)*t,y+=(N*(O*P+$*U)-C)*t}else L+=v;L>D.PI?L-=D.PI2:L<-D.PI&&(L+=D.PI2),L*=t,$=Math.cos(L),O=Math.sin(L),A.a=$*P-O*U,A.c=$*k-O*V,A.b=O*P+$*U,A.d=O*k+$*V}T.appliedValid=!1}}computeWorldPositions(r,t,e,s,i){const n=this.target;let a=this.position;const h=this.spaces,o=B.setArraySize(this.positions,t*3+2);let l=null;const u=r.closed;let c=r.worldVerticesLength,d=c/6,f=$r.NONE;if(!r.constantSpeed){const L=r.lengths;d-=u?1:2;const $=L[d];if(s&&(a*=$),i)for(let O=0;O<t;O++)h[O]*=$;l=B.setArraySize(this.world,8);for(let O=0,N=0,Z=0;O<t;O++,N+=3){const Q=h[O];a+=Q;let Y=a;if(u)Y%=$,Y<0&&(Y+=$),Z=0;else if(Y<0){f!=$r.BEFORE&&(f=$r.BEFORE,r.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(Y,l,0,o,N);continue}else if(Y>$){f!=$r.AFTER&&(f=$r.AFTER,r.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(Y-$,l,0,o,N);continue}for(;;Z++){const lt=L[Z];if(!(Y>lt)){if(Z==0)Y/=lt;else{const Tt=L[Z-1];Y=(Y-Tt)/(lt-Tt)}break}}Z!=f&&(f=Z,u&&Z==d?(r.computeWorldVertices(n,c-4,4,l,0,2),r.computeWorldVertices(n,0,4,l,4,2)):r.computeWorldVertices(n,Z*6+2,8,l,0,2)),this.addCurvePosition(Y,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],o,N,e||O>0&&Q==0)}return o}u?(c+=2,l=B.setArraySize(this.world,c),r.computeWorldVertices(n,2,c-4,l,0,2),r.computeWorldVertices(n,0,2,l,c-4,2),l[c-2]=l[0],l[c-1]=l[1]):(d--,c-=4,l=B.setArraySize(this.world,c),r.computeWorldVertices(n,2,c,l,0,2));const p=B.setArraySize(this.curves,d);let m=0,g=l[0],_=l[1],x=0,y=0,v=0,b=0,w=0,E=0,T=0,A=0,I=0,M=0,R=0,C=0,P=0,k=0;for(let L=0,$=2;L<d;L++,$+=6)x=l[$],y=l[$+1],v=l[$+2],b=l[$+3],w=l[$+4],E=l[$+5],T=(g-x*2+v)*.1875,A=(_-y*2+b)*.1875,I=((x-v)*3-g+w)*.09375,M=((y-b)*3-_+E)*.09375,R=T*2+I,C=A*2+M,P=(x-g)*.75+T+I*.16666667,k=(y-_)*.75+A+M*.16666667,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,R+=I,C+=M,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,m+=Math.sqrt(P*P+k*k),P+=R+I,k+=C+M,m+=Math.sqrt(P*P+k*k),p[L]=m,g=w,_=E;if(s&&(a*=m),i)for(let L=0;L<t;L++)h[L]*=m;const U=this.segments;let V=0;for(let L=0,$=0,O=0,N=0;L<t;L++,$+=3){const Z=h[L];a+=Z;let Q=a;if(u)Q%=m,Q<0&&(Q+=m),O=0;else if(Q<0){this.addBeforePosition(Q,l,0,o,$);continue}else if(Q>m){this.addAfterPosition(Q-m,l,c-4,o,$);continue}for(;;O++){const Y=p[O];if(!(Q>Y)){if(O==0)Q/=Y;else{const lt=p[O-1];Q=(Q-lt)/(Y-lt)}break}}if(O!=f){f=O;let Y=O*6;for(g=l[Y],_=l[Y+1],x=l[Y+2],y=l[Y+3],v=l[Y+4],b=l[Y+5],w=l[Y+6],E=l[Y+7],T=(g-x*2+v)*.03,A=(_-y*2+b)*.03,I=((x-v)*3-g+w)*.006,M=((y-b)*3-_+E)*.006,R=T*2+I,C=A*2+M,P=(x-g)*.3+T+I*.16666667,k=(y-_)*.3+A+M*.16666667,V=Math.sqrt(P*P+k*k),U[0]=V,Y=1;Y<8;Y++)P+=R,k+=C,R+=I,C+=M,V+=Math.sqrt(P*P+k*k),U[Y]=V;P+=R,k+=C,V+=Math.sqrt(P*P+k*k),U[8]=V,P+=R+I,k+=C+M,V+=Math.sqrt(P*P+k*k),U[9]=V,N=0}for(Q*=V;;N++){const Y=U[N];if(!(Q>Y)){if(N==0)Q/=Y;else{const lt=U[N-1];Q=N+(Q-lt)/(Y-lt)}break}}this.addCurvePosition(Q*.1,g,_,x,y,v,b,w,E,o,$,e||L>0&&Z==0)}return o}addBeforePosition(r,t,e,s,i){const n=t[e],a=t[e+1],h=t[e+2]-n,o=t[e+3]-a,l=Math.atan2(o,h);s[i]=n+r*Math.cos(l),s[i+1]=a+r*Math.sin(l),s[i+2]=l}addAfterPosition(r,t,e,s,i){const n=t[e+2],a=t[e+3],h=n-t[e],o=a-t[e+1],l=Math.atan2(o,h);s[i]=n+r*Math.cos(l),s[i+1]=a+r*Math.sin(l),s[i+2]=l}addCurvePosition(r,t,e,s,i,n,a,h,o,l,u,c){(r==0||isNaN(r))&&(r=1e-4);const d=r*r,f=d*r,p=1-r,m=p*p,g=m*p,_=p*r,x=_*3,y=p*x,v=x*r,b=t*g+s*y+n*v+h*f,w=e*g+i*y+a*v+o*f;l[u]=b,l[u+1]=w,c&&(l[u+2]=Math.atan2(w-(e*m+i*_*2+a*d),b-(t*m+s*_*2+n*d)))}};let Po=$r;Po.NONE=-1,Po.BEFORE=-2,Po.AFTER=-3,Po.epsilon=1e-5;class ZS{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new XS,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)-Math.atan2(w,v)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=(v.x-y.tx)*e,y.ty+=(v.y-y.ty)*e,x=!0}if(s>0){let v=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(h*h+l*l);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*s)/v),y.a*=v,y.b*=v,v=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+u*u),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*s)/v),y.c*=v,y.d*=v,x=!0}if(i>0){const v=y.c,b=y.d,w=Math.atan2(b,v);let E=Math.atan2(u,o)-Math.atan2(l,h)-(w-Math.atan2(y.b,y.a));E>D.PI?E-=D.PI2:E<-D.PI&&(E+=D.PI2),E=w+(E+f)*i;const T=Math.sqrt(v*v+b*b);y.c=Math.cos(E)*T,y.d=Math.sin(E)*T,x=!0}x&&(_.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=v.x*e,y.ty+=v.y*e,x=!0}if(s>0){let v=(Math.sqrt(h*h+l*l)-1+this.data.offsetScaleX)*s+1;y.a*=v,y.b*=v,v=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*s+1,y.c*=v,y.d*=v,x=!0}if(i>0){let v=Math.atan2(u,o)-Math.atan2(l,h);v>D.PI?v-=D.PI2:v<-D.PI&&(v+=D.PI2);const b=y.c,w=y.d;v=Math.atan2(w,b)+(v-D.PI/2+f)*i;const E=Math.sqrt(b*b+w*w);y.c=Math.cos(v)*E,y.d=Math.sin(v)*E,x=!0}x&&(_.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;if(t!=0){let g=n.arotation-u+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,u+=g*t}let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax-c+this.data.offsetX)*e,d+=(n.ay-d+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*s)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*s)/p));const m=l.ashearY;if(i>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*i}l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;t!=0&&(u+=(n.arotation+this.data.offsetRotation)*t);let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax+this.data.offsetX)*e,d+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let m=l.ashearY;i>0&&(m+=(n.ashearY+this.data.offsetShearY)*i),l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}}const Ro=class{constructor(r){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,r==null)throw new Error("data cannot be null.");this.data=r,this.bones=new Array;for(let t=0;t<r.bones.length;t++){const e=r.bones[t];let s;if(e.parent==null)s=new U_(e,this,null);else{const i=this.bones[e.parent.index];s=new U_(e,this,i),i.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<r.slots.length;t++){const e=r.slots[t],s=this.bones[e.boneData.index],i=new M_(e,s);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let t=0;t<r.ikConstraints.length;t++){const e=r.ikConstraints[t];this.ikConstraints.push(new qS(e,this))}this.transformConstraints=new Array;for(let t=0;t<r.transformConstraints.length;t++){const e=r.transformConstraints[t];this.transformConstraints.push(new ZS(e,this))}this.pathConstraints=new Array;for(let t=0;t<r.pathConstraints.length;t++){const e=r.pathConstraints[t];this.pathConstraints.push(new Po(e,this))}this.color=new X(1,1,1,1),this.updateCache()}updateCache(){const r=this._updateCache;r.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,u=t.length;l<u;l++){const c=t[l];c.sorted=c.data.skinRequired,c.active=!c.sorted}if(this.skin!=null){const l=this.skin.bones;for(let u=0,c=this.skin.bones.length;u<c;u++){let d=this.bones[l[u].index];do d.sorted=!1,d.active=!0,d=d.parent;while(d!=null)}}const e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,n=e.length,a=s.length,h=i.length,o=n+a+h;t:for(let l=0;l<o;l++){for(let u=0;u<n;u++){const c=e[u];if(c.data.order==l){this.sortIkConstraint(c);continue t}}for(let u=0;u<a;u++){const c=s[u];if(c.data.order==l){this.sortTransformConstraint(c);continue t}}for(let u=0;u<h;u++){const c=i[u];if(c.data.order==l){this.sortPathConstraint(c);continue t}}}for(let l=0,u=t.length;l<u;l++)this.sortBone(t[l])}sortIkConstraint(r){if(r.active=r.target.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.target;this.sortBone(t);const e=r.bones,s=e[0];if(this.sortBone(s),e.length>1){const i=e[e.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(r),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(r){if(r.active=r.target.bone.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.target,e=t.data.index,s=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,s),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let h=0,o=this.data.skins.length;h<o;h++)this.sortPathConstraintAttachment(this.data.skins[h],e,s);const i=t.getAttachment();i instanceof xl&&this.sortPathConstraintAttachmentWith(i,s);const n=r.bones,a=n.length;for(let h=0;h<a;h++)this.sortBone(n[h]);this._updateCache.push(r);for(let h=0;h<a;h++)this.sortReset(n[h].children);for(let h=0;h<a;h++)n[h].sorted=!0}sortTransformConstraint(r){if(r.active=r.target.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;this.sortBone(r.target);const t=r.bones,e=t.length;if(r.data.local)for(let s=0;s<e;s++){const i=t[s];this.sortBone(i.parent),this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(r);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(r,t,e){const s=r.attachments[t];if(s)for(const i in s)this.sortPathConstraintAttachmentWith(s[i],e)}sortPathConstraintAttachmentWith(r,t){if(!(r instanceof xl))return;const e=r.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let i=0;for(;i<e.length;){const n=e[i++];for(let a=i+n;i<a;i++){const h=e[i];this.sortBone(s[h])}}}}sortBone(r){if(r.sorted)return;const t=r.parent;t!=null&&this.sortBone(t),r.sorted=!0,this._updateCache.push(r)}sortReset(r){for(let t=0,e=r.length;t<e;t++){const s=r[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const r=this.updateCacheReset;for(let e=0,s=r.length;e<s;e++){const i=r[e];i.ax=i.x,i.ay=i.y,i.arotation=i.rotation,i.ascaleX=i.scaleX,i.ascaleY=i.scaleY,i.ashearX=i.shearX,i.ashearY=i.shearY,i.appliedValid=!0}const t=this._updateCache;for(let e=0,s=t.length;e<s;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const r=this.bones;for(let i=0,n=r.length;i<n;i++)r[i].setToSetupPose();const t=this.ikConstraints;for(let i=0,n=t.length;i<n;i++){const a=t[i];a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}const e=this.transformConstraints;for(let i=0,n=e.length;i<n;i++){const a=e[i],h=a.data;a.rotateMix=h.rotateMix,a.translateMix=h.translateMix,a.scaleMix=h.scaleMix,a.shearMix=h.shearMix}const s=this.pathConstraints;for(let i=0,n=s.length;i<n;i++){const a=s[i],h=a.data;a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix}}setSlotsToSetupPose(){const r=this.slots;B.arrayCopy(r,0,this.drawOrder,0,r.length);for(let t=0,e=r.length;t<e;t++)r[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(r){if(r==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findBoneIndex(r){if(r==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==r)return e;return-1}findSlot(r){if(r==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findSlotIndex(r){if(r==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==r)return e;return-1}setSkinByName(r){const t=this.data.findSkin(r);if(t==null)throw new Error(`Skin not found: ${r}`);this.setSkin(t)}setSkin(r){if(r!=this.skin){if(r!=null)if(this.skin!=null)r.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const i=t[e],n=i.data.attachmentName;if(n!=null){const a=r.getAttachment(e,n);a!=null&&i.setAttachment(a)}}}this.skin=r,this.updateCache()}}getAttachmentByName(r,t){return this.getAttachment(this.data.findSlotIndex(r),t)}getAttachment(r,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(r,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(r,t):null}setAttachment(r,t){if(r==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.data.name==r){let a=null;if(t!=null&&(a=this.getAttachment(s,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${r}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${r}`)}findIkConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findTransformConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findPathConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}getBounds(r,t,e=new Array(2)){if(r==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let i=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let o=0,l=s.length;o<l;o++){const u=s[o];if(!u.bone.active)continue;let c=0,d=null;const f=u.getAttachment();if(f instanceof rt)c=8,d=B.setArraySize(e,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(f instanceof Xu){const p=f;c=p.worldVerticesLength,d=B.setArraySize(e,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(d!=null)for(let p=0,m=d.length;p<m;p+=2){const g=d[p],_=d[p+1];i=Math.min(i,g),n=Math.min(n,_),a=Math.max(a,g),h=Math.max(h,_)}}r.set(i,n),t.set(a-i,h-n)}update(r){this.time+=r}get flipX(){return this.scaleX==-1}set flipX(r){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=r?1:-1}get flipY(){return this.scaleY==-1}set flipY(r){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=r?1:-1}};let W_=Ro;W_.deprecatedWarning1=!1;let z_=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}},j_=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},q_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},Z_=class{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},ju=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];i.attachment!=null&&(i.attachment instanceof Xu?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&(s[e]=null)}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const i in s){const n=s[i];n&&t.push(new Z_(e,i,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new Z_(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}};const Kt=class{constructor(r){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=r}readSkeletonData(r){const t=this.scale,e=new z_;e.name="";const s=new yl(r);e.hash=s.readString(),e.version=s.readString(),e.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),e.x=s.readFloat(),e.y=s.readFloat(),e.width=s.readFloat(),e.height=s.readFloat();const i=s.readBoolean();i&&(e.fps=s.readFloat(),e.imagesPath=s.readString(),e.audioPath=s.readString());let n=0;n=s.readInt(!0);for(let h=0;h<n;h++)s.strings.push(s.readString());n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=h==0?null:e.bones[s.readInt(!0)],u=new G_(h,o,l);u.rotation=s.readFloat(),u.x=s.readFloat()*t,u.y=s.readFloat()*t,u.scaleX=s.readFloat(),u.scaleY=s.readFloat(),u.shearX=s.readFloat(),u.shearY=s.readFloat(),u.length=s.readFloat()*t,u.transformMode=Kt.TransformModeValues[s.readInt(!0)],u.skinRequired=s.readBoolean(),i&&X.rgba8888ToColor(u.color,s.readInt32()),e.bones.push(u)}n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=e.bones[s.readInt(!0)],u=new j_(h,o,l);X.rgba8888ToColor(u.color,s.readInt32());const c=s.readInt32();c!=-1&&X.rgb888ToColor(u.darkColor=new X,c),u.attachmentName=s.readStringRef(),u.blendMode=Kt.BlendModeValues[s.readInt(!0)],e.slots.push(u)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new H_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.mix=s.readFloat(),l.softness=s.readFloat()*t,l.bendDirection=s.readByte(),l.compress=s.readBoolean(),l.stretch=s.readBoolean(),l.uniform=s.readBoolean(),e.ikConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new q_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.local=s.readBoolean(),l.relative=s.readBoolean(),l.offsetRotation=s.readFloat(),l.offsetX=s.readFloat()*t,l.offsetY=s.readFloat()*t,l.offsetScaleX=s.readFloat(),l.offsetScaleY=s.readFloat(),l.offsetShearY=s.readFloat(),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),l.scaleMix=s.readFloat(),l.shearMix=s.readFloat(),e.transformConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new Y_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.slots[s.readInt(!0)],l.positionMode=Kt.PositionModeValues[s.readInt(!0)],l.spacingMode=Kt.SpacingModeValues[s.readInt(!0)],l.rotateMode=Kt.RotateModeValues[s.readInt(!0)],l.offsetRotation=s.readFloat(),l.position=s.readFloat(),l.positionMode==ne.Fixed&&(l.position*=t),l.spacing=s.readFloat(),(l.spacingMode==be.Length||l.spacingMode==be.Fixed)&&(l.spacing*=t),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),e.pathConstraints.push(l)}const a=this.readSkin(s,e,!0,i);a!=null&&(e.defaultSkin=a,e.skins.push(a));{let h=e.skins.length;for(B.setArraySize(e.skins,n=h+s.readInt(!0));h<n;h++)e.skins[h]=this.readSkin(s,e,!1,i)}n=this.linkedMeshes.length;for(let h=0;h<n;h++){const o=this.linkedMeshes[h],l=o.skin==null?e.defaultSkin:e.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}this.linkedMeshes.length=0,n=s.readInt(!0);for(let h=0;h<n;h++){const o=new $_(s.readStringRef());o.intValue=s.readInt(!1),o.floatValue=s.readFloat(),o.stringValue=s.readString(),o.audioPath=s.readString(),o.audioPath!=null&&(o.volume=s.readFloat(),o.balance=s.readFloat()),e.events.push(o)}n=s.readInt(!0);for(let h=0;h<n;h++)e.animations.push(this.readAnimation(s,s.readString(),e));return e}readSkin(r,t,e,s){let i=null,n=0;if(e){if(n=r.readInt(!0),n==0)return null;i=new ju("default")}else{i=new ju(r.readStringRef()),i.bones.length=r.readInt(!0);for(let a=0,h=i.bones.length;a<h;a++)i.bones[a]=t.bones[r.readInt(!0)];for(let a=0,h=r.readInt(!0);a<h;a++)i.constraints.push(t.ikConstraints[r.readInt(!0)]);for(let a=0,h=r.readInt(!0);a<h;a++)i.constraints.push(t.transformConstraints[r.readInt(!0)]);for(let a=0,h=r.readInt(!0);a<h;a++)i.constraints.push(t.pathConstraints[r.readInt(!0)]);n=r.readInt(!0)}for(let a=0;a<n;a++){const h=r.readInt(!0);for(let o=0,l=r.readInt(!0);o<l;o++){const u=r.readStringRef(),c=this.readAttachment(r,t,i,h,u,s);c!=null&&i.setAttachment(h,u,c)}}return i}readAttachment(r,t,e,s,i,n){const a=this.scale;let h=r.readStringRef();h==null&&(h=i);const o=r.readByte();switch(Kt.AttachmentTypeValues[o]){case at.Region:{let u=r.readStringRef();const c=r.readFloat(),d=r.readFloat(),f=r.readFloat(),p=r.readFloat(),m=r.readFloat(),g=r.readFloat(),_=r.readFloat(),x=r.readInt32();u==null&&(u=h);const y=this.attachmentLoader.newRegionAttachment(e,h,u);return y==null?null:(y.path=u,y.x=d*a,y.y=f*a,y.scaleX=p,y.scaleY=m,y.rotation=c,y.width=g*a,y.height=_*a,X.rgba8888ToColor(y.color,x),y)}case at.BoundingBox:{const u=r.readInt(!0),c=this.readVertices(r,u),d=n?r.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(e,h);return f==null?null:(f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,n&&X.rgba8888ToColor(f.color,d),f)}case at.Mesh:{let u=r.readStringRef();const c=r.readInt32(),d=r.readInt(!0),f=this.readFloatArray(r,d<<1,1),p=this.readShortArray(r),m=this.readVertices(r,d),g=r.readInt(!0);let _=null,x=0,y=0;n&&(_=this.readShortArray(r),x=r.readFloat(),y=r.readFloat()),u==null&&(u=h);const v=this.attachmentLoader.newMeshAttachment(e,h,u);return v==null?null:(v.path=u,X.rgba8888ToColor(v.color,c),v.bones=m.bones,v.vertices=m.vertices,v.worldVerticesLength=d<<1,v.triangles=p,v.regionUVs=new Float32Array(f),v.hullLength=g<<1,n&&(v.edges=_,v.width=x*a,v.height=y*a),v)}case at.LinkedMesh:{let u=r.readStringRef();const c=r.readInt32(),d=r.readStringRef(),f=r.readStringRef(),p=r.readBoolean();let m=0,g=0;n&&(m=r.readFloat(),g=r.readFloat()),u==null&&(u=h);const _=this.attachmentLoader.newMeshAttachment(e,h,u);return _==null?null:(_.path=u,X.rgba8888ToColor(_.color,c),n&&(_.width=m*a,_.height=g*a),this.linkedMeshes.push(new KS(_,d,s,f,p)),_)}case at.Path:{const u=r.readBoolean(),c=r.readBoolean(),d=r.readInt(!0),f=this.readVertices(r,d),p=B.newArray(d/3,0);for(let _=0,x=p.length;_<x;_++)p[_]=r.readFloat()*a;const m=n?r.readInt32():0,g=this.attachmentLoader.newPathAttachment(e,h);return g==null?null:(g.closed=u,g.constantSpeed=c,g.worldVerticesLength=d<<1,g.vertices=f.vertices,g.bones=f.bones,g.lengths=p,n&&X.rgba8888ToColor(g.color,m),g)}case at.Point:{const u=r.readFloat(),c=r.readFloat(),d=r.readFloat(),f=n?r.readInt32():0,p=this.attachmentLoader.newPointAttachment(e,h);return p==null?null:(p.x=c*a,p.y=d*a,p.rotation=u,n&&X.rgba8888ToColor(p.color,f),p)}case at.Clipping:{const u=r.readInt(!0),c=r.readInt(!0),d=this.readVertices(r,c),f=n?r.readInt32():0,p=this.attachmentLoader.newClippingAttachment(e,h);return p==null?null:(p.endSlot=t.slots[u],p.worldVerticesLength=c<<1,p.vertices=d.vertices,p.bones=d.bones,n&&X.rgba8888ToColor(p.color,f),p)}}return null}readVertices(r,t){const e=t<<1,s=new QS,i=this.scale;if(!r.readBoolean())return s.vertices=this.readFloatArray(r,e,i),s;const n=new Array,a=new Array;for(let h=0;h<t;h++){const o=r.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(r.readInt(!0)),n.push(r.readFloat()*i),n.push(r.readFloat()*i),n.push(r.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=a,s}readFloatArray(r,t,e){const s=new Array(t);if(e==1)for(let i=0;i<t;i++)s[i]=r.readFloat();else for(let i=0;i<t;i++)s[i]=r.readFloat()*e;return s}readShortArray(r){const t=r.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=r.readShort();return e}readAnimation(r,t,e){const s=new Array,i=this.scale;let n=0;const a=new X,h=new X;for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0);for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readByte(),g=r.readInt(!0);switch(m){case Kt.SLOT_ATTACHMENT:{const _=new Rn(g);_.slotIndex=d;for(let x=0;x<g;x++)_.setFrame(x,r.readFloat(),r.readStringRef());s.push(_),n=Math.max(n,_.frames[g-1]);break}case Kt.SLOT_COLOR:{const _=new Ye(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=r.readFloat();X.rgba8888ToColor(a,r.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a),x<g-1&&this.readCurve(r,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*Ye.ENTRIES]);break}case Kt.SLOT_TWO_COLOR:{const _=new ae(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=r.readFloat();X.rgba8888ToColor(a,r.readInt32()),X.rgb888ToColor(h,r.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a,h.r,h.g,h.b),x<g-1&&this.readCurve(r,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*ae.ENTRIES]);break}}}}for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0);for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readByte(),g=r.readInt(!0);switch(m){case Kt.BONE_ROTATE:{const _=new Ie(g);_.boneIndex=d;for(let x=0;x<g;x++)_.setFrame(x,r.readFloat(),r.readFloat()),x<g-1&&this.readCurve(r,x,_);s.push(_),n=Math.max(n,_.frames[(g-1)*Ie.ENTRIES]);break}case Kt.BONE_TRANSLATE:case Kt.BONE_SCALE:case Kt.BONE_SHEAR:{let _,x=1;m==Kt.BONE_SCALE?_=new F_(g):m==Kt.BONE_SHEAR?_=new k_(g):(_=new ps(g),x=i),_.boneIndex=d;for(let y=0;y<g;y++)_.setFrame(y,r.readFloat(),r.readFloat()*x,r.readFloat()*x),y<g-1&&this.readCurve(r,y,_);s.push(_),n=Math.max(n,_.frames[(g-1)*ps.ENTRIES]);break}}}}for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0),f=r.readInt(!0),p=new Pe(f);p.ikConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,r.readFloat(),r.readFloat(),r.readFloat()*i,r.readByte(),r.readBoolean(),r.readBoolean()),m<f-1&&this.readCurve(r,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0),f=r.readInt(!0),p=new We(f);p.transformConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat()),m<f-1&&this.readCurve(r,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0),f=e.pathConstraints[d];for(let p=0,m=r.readInt(!0);p<m;p++){const g=r.readByte(),_=r.readInt(!0);switch(g){case Kt.PATH_POSITION:case Kt.PATH_SPACING:{let x,y=1;g==Kt.PATH_SPACING?(x=new O_(_),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(y=i)):(x=new Ci(_),f.positionMode==ne.Fixed&&(y=i)),x.pathConstraintIndex=d;for(let v=0;v<_;v++)x.setFrame(v,r.readFloat(),r.readFloat()*y),v<_-1&&this.readCurve(r,v,x);s.push(x),n=Math.max(n,x.frames[(_-1)*Ci.ENTRIES]);break}case Kt.PATH_MIX:{const x=new oi(_);x.pathConstraintIndex=d;for(let y=0;y<_;y++)x.setFrame(y,r.readFloat(),r.readFloat(),r.readFloat()),y<_-1&&this.readCurve(r,y,x);s.push(x),n=Math.max(n,x.frames[(_-1)*oi.ENTRIES]);break}}}}for(let u=0,c=r.readInt(!0);u<c;u++){const d=e.skins[r.readInt(!0)];for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readInt(!0);for(let g=0,_=r.readInt(!0);g<_;g++){const x=d.getAttachment(m,r.readStringRef()),y=x.bones!=null,v=x.vertices,b=y?v.length/3*2:v.length,w=r.readInt(!0),E=new D_(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=r.readFloat();let I,M=r.readInt(!0);if(M==0)I=y?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=r.readInt(!0);if(M+=R,i==1)for(let C=R;C<M;C++)I[C]=r.readFloat();else for(let C=R;C<M;C++)I[C]=r.readFloat()*i;if(!y)for(let C=0,P=I.length;C<P;C++)I[C]+=v[C]}E.setFrame(T,A,I),T<w-1&&this.readCurve(r,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const o=r.readInt(!0);if(o>0){const u=new Io(o),c=e.slots.length;for(let d=0;d<o;d++){const f=r.readFloat(),p=r.readInt(!0),m=B.newArray(c,0);for(let y=c-1;y>=0;y--)m[y]=-1;const g=B.newArray(c-p,0);let _=0,x=0;for(let y=0;y<p;y++){const v=r.readInt(!0);for(;_!=v;)g[x++]=_++;m[_+r.readInt(!0)]=_++}for(;_<c;)g[x++]=_++;for(let y=c-1;y>=0;y--)m[y]==-1&&(m[y]=g[--x]);u.setFrame(d,f,m)}s.push(u),n=Math.max(n,u.frames[o-1])}const l=r.readInt(!0);if(l>0){const u=new $u(l);for(let c=0;c<l;c++){const d=r.readFloat(),f=e.events[r.readInt(!0)],p=new X_(d,f);p.intValue=r.readInt(!1),p.floatValue=r.readFloat(),p.stringValue=r.readBoolean()?r.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=r.readFloat(),p.balance=r.readFloat()),u.setFrame(c,p)}s.push(u),n=Math.max(n,u.frames[l-1])}return new oe(t,s,n)}readCurve(r,t,e){switch(r.readByte()){case Kt.CURVE_STEPPED:e.setStepped(t);break;case Kt.CURVE_BEZIER:this.setCurve(e,t,r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat());break}}setCurve(r,t,e,s,i,n){r.setCurve(t,e,s,i,n)}};let le=Kt;le.AttachmentTypeValues=[0,1,2,3,4,5,6],le.TransformModeValues=[vt.Normal,vt.OnlyTranslation,vt.NoRotationOrReflection,vt.NoScale,vt.NoScaleOrReflection],le.PositionModeValues=[ne.Fixed,ne.Percent],le.SpacingModeValues=[be.Length,be.Fixed,be.Percent],le.RotateModeValues=[Fe.Tangent,Fe.Chain,Fe.ChainScale],le.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN],le.BONE_ROTATE=0,le.BONE_TRANSLATE=1,le.BONE_SCALE=2,le.BONE_SHEAR=3,le.SLOT_ATTACHMENT=0,le.SLOT_COLOR=1,le.SLOT_TWO_COLOR=2,le.PATH_POSITION=0,le.PATH_SPACING=1,le.PATH_MIX=2,le.CURVE_LINEAR=0,le.CURVE_STEPPED=1,le.CURVE_BEZIER=2;let KS=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritDeform=n}},QS=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},JS=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new z_,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n!=null){if(s.hash=n.hash,s.version=n.spine,s.version.substr(0,3)!=="3.8"){const a=`Spine 3.8 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(a)}s.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(i.bones)for(let a=0;a<i.bones.length;a++){const h=i.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new G_(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Un.transformModeFromString(this.getValue(h,"transform","normal")),u.skinRequired=this.getValue(h,"skin",!1),s.bones.push(u)}if(i.slots)for(let a=0;a<i.slots.length;a++){const h=i.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new j_(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Un.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(i.ik)for(let a=0;a<i.ik.length;a++){const h=i.ik[a],o=new H_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.mix=this.getValue(h,"mix",1),o.softness=this.getValue(h,"softness",0)*e,o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.compress=this.getValue(h,"compress",!1),o.stretch=this.getValue(h,"stretch",!1),o.uniform=this.getValue(h,"uniform",!1),s.ikConstraints.push(o)}if(i.transform)for(let a=0;a<i.transform.length;a++){const h=i.transform[a],o=new q_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(i.path)for(let a=0;a<i.path.length;a++){const h=i.path[a],o=new Y_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Un.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Un.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Un.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==be.Length||o.spacingMode==be.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(i.skins)for(let a=0;a<i.skins.length;a++){const h=i.skins[a],o=new ju(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=s.findBone(h.bones[l]);if(u==null)throw new Error(`Skin bone not found: ${h.bones[a]}`);o.bones.push(u)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=s.findIkConstraint(h.ik[l]);if(u==null)throw new Error(`Skin IK constraint not found: ${h.ik[a]}`);o.constraints.push(u)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=s.findTransformConstraint(h.transform[l]);if(u==null)throw new Error(`Skin transform constraint not found: ${h.transform[a]}`);o.constraints.push(u)}if(h.path)for(let l=0;l<h.path.length;l++){const u=s.findPathConstraint(h.path[l]);if(u==null)throw new Error(`Skin path constraint not found: ${h.path[a]}`);o.constraints.push(u)}for(const l in h.attachments){const u=s.findSlot(l);if(u==null)throw new Error(`Slot not found: ${l}`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f!=null&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,i.events)for(const a in i.events){const h=i.events[a],o=new $_(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(i.animations)for(const a in i.animations){const h=i.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,i,n){const a=this.scale;switch(i=this.getValue(t,"name",i),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",i),l=this.attachmentLoader.newRegionAttachment(e,i,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",i),l=this.attachmentLoader.newMeshAttachment(e,i,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u),l.width=this.getValue(t,"width",0)*a,l.height=this.getValue(t,"height",0)*a;const c=this.getValue(t,"parent",null);if(c!=null)return this.linkedMeshes.push(new tC(l,this.getValue(t,"skin",null),s,c,this.getValue(t,"deform",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=this.getValue(t,"edges",null),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,i);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,i);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,i);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(i!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=i;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*i),a.push(n[o+2]*i),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const i=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new Rn(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,this.getValue(g,"time",0),g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new Ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ye.ENTRIES])}else if(c=="twoColor"){const f=new ae(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ae.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Ie(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ie.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1,m=0;c==="scale"?(f=new F_(d.length),m=1):c==="shear"?f=new k_(d.length):(f=new ps(d.length),p=i),f.boneIndex=u;let g=0;for(let _=0;_<d.length;_++){const x=d[_],y=this.getValue(x,"x",m),v=this.getValue(x,"y",m);f.setFrame(g,this.getValue(x,"time",0),y*p,v*p),this.readCurve(x,f,g),g++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ps.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new Pe(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*i,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*Pe.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new We(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*We.ENTRIES])}if(t.path)for(const o in t.path){const l=t.path[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new O_(f.length),(c.spacingMode==be.Length||c.spacingMode==be.Fixed)&&(m=i)):(p=new Ci(f.length),c.positionMode==ne.Fixed&&(m=i)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Ci.ENTRIES])}else if(d==="mix"){const p=new oi(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,this.getValue(_,"time",0),this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*oi.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new D_(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),i!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=i;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,this.getValue(E,"time",0),T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new Io(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,this.getValue(d,"time",0),f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new $u(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new X_(B.toSinglePrecision(this.getValue(c,"time",0)),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new oe(e,n,a))}readCurve(t,e,s){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(s);else{const i=t.curve;e.setCurve(s,i,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return be.Length;if(t=="fixed")return be.Fixed;if(t=="percent")return be.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},tC=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritDeform=n}};class eC extends Gu{createSkeleton(t){this.skeleton=new W_(t),this.skeleton.updateWorldTransform(),this.stateData=new N_(t),this.state=new ms(this.stateData)}}const sC={extension:H.Asset,loader:{extension:{type:H.LoadParser,priority:Ne.Normal},test(r){return Le(r,".atlas")},async load(r){return await(await z.ADAPTER.fetch(r)).text()},testParse(r,t){const e=Le(t.src,".atlas"),s=typeof r=="string";return Promise.resolve(e&&s)},async parse(r,t,e){const s=t.data;let i=bt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let n=null,a=null;const h=new Promise((u,c)=>{n=u,a=c});let o;const l=u=>{u||a(`Something went terribly wrong loading a spine .atlas file
1170
- Most likely your texture failed to load.`),n(o)};if(s.image||s.images){const u=Object.assign(s.image?{default:s.image}:{},s.images);o=new Uu(r,(c,d)=>{const f=u[c]||u.default;f&&f.baseTexture?d(f.baseTexture):d(f)},l)}else o=new Uu(r,K_(e,i,s.imageMetadata),l);return await h},unload(r){r.dispose()}}},K_=(r,t,e)=>async(s,i)=>{const n=bt.normalize([...t.split(bt.sep),s].join(bt.sep)),a=await r.load({src:n,data:e});i(a.baseTexture)};K.add(sC);function Q_(r){return r.hasOwnProperty("bones")}function iC(r){return r instanceof ArrayBuffer}class rC{constructor(){}installLoader(){const t=this,e={extension:H.Asset,loader:{extension:{type:H.LoadParser,priority:Ne.Normal},test(s){return Le(s,".skel")},async load(s){return await(await z.ADAPTER.fetch(s)).arrayBuffer()},testParse(s,i){var o;const n=Le(i.src,".json")&&Q_(s),a=Le(i.src,".skel")&&iC(s),h=((o=i.data)==null?void 0:o.spineAtlas)===!1;return Promise.resolve(n&&!h||a)},async parse(s,i,n){const a=bt.extname(i.src).toLowerCase(),h=bt.basename(i.src,a);let o=bt.dirname(i.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=Le(i.src,".json")&&Q_(s);let u=null,c=s;l?u=t.createJsonParser():(u=t.createBinaryParser(),c=new Uint8Array(s));const d=i.data||{},f=(d==null?void 0:d.spineSkeletonScale)??null;f&&(u.scale=f);const p=d.spineAtlas;if(p&&p.pages)return t.parseData(u,p,c);const m=d.atlasRawData;if(m){let x=null,y=null;const v=new Promise((E,T)=>{x=E,y=T}),b=new Uu(m,K_(n,o,d.imageMetadata),E=>{E||y(`Something went terribly wrong loading a spine .atlas file
1171
- Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u,w,c)}let g=d.spineAtlasFile;g||(g=`${o+h}.atlas`);const _=await n.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(u,_,c)}}};return K.add(e),e}}let J_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const t0=class extends J_{constructor(t){super(t),this.id=(t0.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,i,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];i[w]=E*_+T*x+m,i[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}i[p]=g,i[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}i[m]=x,i[m+1]=y}}}applyDeform(t){return this==t}};let Hr=t0;Hr.nextID=0;let nC=class extends Hr{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},oC=class extends Hr{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},aC=class extends Hr{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.inheritDeform=!1,this.tempColor=new X(0,0,0,0)}applyDeform(t){return this==t||this.inheritDeform&&this.parentMesh==t}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}},lC=class extends Hr{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},hC=class extends Hr{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,a=s*e.b+i*e.d;return Math.atan2(a,n)*D.radDeg}};class cC{constructor(t,e){if(this.attachmentVertices=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const we=class extends J_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=i+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=i*o+this.y,f=i*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[we.OX1]=u-f,x[we.OY1]=d+c,x[we.OX2]=u-_,x[we.OY2]=g+c,x[we.OX3]=p-_,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){const n=this.offset,a=t instanceof cC?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}};let nt=we;nt.OX1=0,nt.OY1=1,nt.OX2=2,nt.OY2=3,nt.OX3=4,nt.OY3=5,nt.OX4=6,nt.OY4=7,nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31,new C_(2);let Ee=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=s}apply(t,e,s,i,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let i=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?i=a+1:n=a,i==n)return(i+1)*s;a=i+n>>>1}}static linearSearch(t,e,s){for(let i=0,n=t.length-s;i<=n;i+=s)if(t[i]>e)return i;return-1}};const se=class{constructor(r){if(r<=0)throw new Error(`frameCount must be > 0: ${r}`);this.curves=B.newFloatArray((r-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(r){this.curves[r*se.BEZIER_SIZE]=se.LINEAR}setStepped(r){this.curves[r*se.BEZIER_SIZE]=se.STEPPED}getCurveType(r){const t=r*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(r,t,e,s,i){const n=(-t*2+s)*.03,a=(-e*2+i)*.03,h=((t-s)*3+1)*.006,o=((e-i)*3+1)*.006;let l=n*2+h,u=a*2+o,c=t*.3+n+h*.16666667,d=e*.3+a+o*.16666667,f=r*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=d;for(let _=f+se.BEZIER_SIZE-1;f<_;f+=2)p[f]=m,p[f+1]=g,c+=l,d+=u,l+=h,u+=o,m+=c,g+=d}getCurvePercent(r,t){t=D.clamp(t,0,1);const e=this.curves;let s=r*se.BEZIER_SIZE;const i=e[s];if(i==se.LINEAR)return t;if(i==se.STEPPED)return 0;s++;let n=0;for(let h=s,o=s+se.BEZIER_SIZE-1;s<o;s+=2)if(n=e[s],n>=t){let l,u;return s==h?(l=0,u=0):(l=e[s-2],u=e[s-1]),u+(e[s+1]-u)*(t-l)/(n-l)}const a=e[s-1];return a+(1-a)*(t-n)/(1-n)}};let is=se;is.LINEAR=0,is.STEPPED=1,is.BEZIER=2,is.BEZIER_SIZE=10*2-1;const sr=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(r,t,e){r<<=1,this.frames[r]=t,this.frames[r+sr.ROTATION]=e}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.rotation=o.data.rotation;return;case S.first:const p=o.data.rotation-o.rotation;o.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*i}return}if(e>=h[h.length-sr.ENTRIES]){let p=h[h.length+sr.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*i;break;case S.first:case S.replace:p+=o.data.rotation-o.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:o.rotation+=p*i}return}const l=Ee.binarySearch(h,e,sr.ENTRIES),u=h[l+sr.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+sr.PREV_TIME]-c));let f=h[l+sr.ROTATION]-u;switch(f=u+(f-(16384-(16384.499999999996-f/360|0))*360)*d,n){case S.setup:o.rotation=o.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*i;break;case S.first:case S.replace:f+=o.data.rotation-o.rotation;case S.add:o.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*i}}};let Mn=sr;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(r,t,e,s){r*=De.ENTRIES,this.frames[r]=t,this.frames[r+De.X]=e,this.frames[r+De.Y]=s}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let l=0,u=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],u=h[h.length+De.PREV_Y];else{const c=Ee.binarySearch(h,e,De.ENTRIES);l=h[c+De.PREV_X],u=h[c+De.PREV_Y];const d=h[c],f=this.getCurvePercent(c/De.ENTRIES-1,1-(e-d)/(h[c+De.PREV_TIME]-d));l+=(h[c+De.X]-l)*f,u+=(h[c+De.Y]-u)*f}switch(n){case S.setup:o.x=o.data.x+l*i,o.y=o.data.y+u*i;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*i,o.y+=(o.data.y+u-o.y)*i;break;case S.add:o.x+=l*i,o.y+=u*i}}};let ai=De;ai.ENTRIES=3,ai.PREV_TIME=-3,ai.PREV_X=-2,ai.PREV_Y=-1,ai.X=1,ai.Y=2;let uC=class Os extends ai{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Os.ENTRIES])u=o[o.length+Os.PREV_X]*l.data.scaleX,c=o[o.length+Os.PREV_Y]*l.data.scaleY;else{const d=Ee.binarySearch(o,s,Os.ENTRIES);u=o[d+Os.PREV_X],c=o[d+Os.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Os.ENTRIES-1,1-(s-f)/(o[d+Os.PREV_TIME]-f));u=(u+(o[d+Os.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Os.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},dC=class Ls extends ai{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Ls.ENTRIES])u=o[o.length+Ls.PREV_X],c=o[o.length+Ls.PREV_Y];else{const d=Ee.binarySearch(o,s,Ls.ENTRIES);u=o[d+Ls.PREV_X],c=o[d+Ls.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ls.ENTRIES-1,1-(s-f)/(o[d+Ls.PREV_TIME]-f));u=u+(o[d+Ls.X]-u)*p,c=c+(o[d+Ls.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Yt=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Yt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(r,t,e,s,i,n){r*=Yt.ENTRIES,this.frames[r]=t,this.frames[r+Yt.R]=e,this.frames[r+Yt.G]=s,this.frames[r+Yt.B]=i,this.frames[r+Yt.A]=n}apply(r,t,e,s,i,n,a){const h=r.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color);return;case S.first:const f=h.color,p=h.data.color;f.add((p.r-f.r)*i,(p.g-f.g)*i,(p.b-f.b)*i,(p.a-f.a)*i)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Yt.ENTRIES]){const f=o.length;l=o[f+Yt.PREV_R],u=o[f+Yt.PREV_G],c=o[f+Yt.PREV_B],d=o[f+Yt.PREV_A]}else{const f=Ee.binarySearch(o,e,Yt.ENTRIES);l=o[f+Yt.PREV_R],u=o[f+Yt.PREV_G],c=o[f+Yt.PREV_B],d=o[f+Yt.PREV_A];const p=o[f],m=this.getCurvePercent(f/Yt.ENTRIES-1,1-(e-p)/(o[f+Yt.PREV_TIME]-p));l+=(o[f+Yt.R]-l)*m,u+=(o[f+Yt.G]-u)*m,c+=(o[f+Yt.B]-c)*m,d+=(o[f+Yt.A]-d)*m}if(i==1)h.color.set(l,u,c,d);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*i,(u-f.g)*i,(c-f.b)*i,(d-f.a)*i)}}};let gs=Yt;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_R=-4,gs.PREV_G=-3,gs.PREV_B=-2,gs.PREV_A=-1,gs.R=1,gs.G=2,gs.B=3,gs.A=4;const ft=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(r,t,e,s,i,n,a,h,o){r*=ft.ENTRIES,this.frames[r]=t,this.frames[r+ft.R]=e,this.frames[r+ft.G]=s,this.frames[r+ft.B]=i,this.frames[r+ft.A]=n,this.frames[r+ft.R2]=a,this.frames[r+ft.G2]=h,this.frames[r+ft.B2]=o}apply(r,t,e,s,i,n,a){const h=r.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color),h.darkColor.setFromColor(h.data.darkColor);return;case S.first:const g=h.color,_=h.darkColor,x=h.data.color,y=h.data.darkColor;g.add((x.r-g.r)*i,(x.g-g.g)*i,(x.b-g.b)*i,(x.a-g.a)*i),_.add((y.r-_.r)*i,(y.g-_.g)*i,(y.b-_.b)*i,0)}return}let l=0,u=0,c=0,d=0,f=0,p=0,m=0;if(e>=o[o.length-ft.ENTRIES]){const g=o.length;l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2]}else{const g=Ee.binarySearch(o,e,ft.ENTRIES);l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2];const _=o[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-_)/(o[g+ft.PREV_TIME]-_));l+=(o[g+ft.R]-l)*x,u+=(o[g+ft.G]-u)*x,c+=(o[g+ft.B]-c)*x,d+=(o[g+ft.A]-d)*x,f+=(o[g+ft.R2]-f)*x,p+=(o[g+ft.G2]-p)*x,m+=(o[g+ft.B2]-m)*x}if(i==1)h.color.set(l,u,c,d),h.darkColor.set(f,p,m,1);else{const g=h.color,_=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),_.setFromColor(h.data.darkColor)),g.add((l-g.r)*i,(u-g.g)*i,(c-g.b)*i,(d-g.a)*i),_.add((f-_.r)*i,(p-_.g)*i,(m-_.b)*i,0)}}};let ye=ft;ye.ENTRIES=8,ye.PREV_TIME=-8,ye.PREV_R=-7,ye.PREV_G=-6,ye.PREV_B=-5,ye.PREV_A=-4,ye.PREV_R2=-3,ye.PREV_G2=-2,ye.PREV_B2=-1,ye.R=1,ye.G=2,ye.B=3,ye.A=4,ye.R2=5,ye.G2=6,ye.B2=7;let fC=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(h==At.mixOut&&a==S.setup){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}const l=this.frames;if(s<l[0]){if(a==S.setup||a==S.first){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let u=0;s>=l[l.length-1]?u=l.length-1:u=Ee.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}},e0=null,pC=class extends is{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),e0==null&&(e0=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Hr)||!l.applyDeform(this.attachment))return;const u=o.attachmentVertices;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},mC=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,a,h){if(i==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=Ee.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)i.push(this.events[u])}},gC=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=Ee.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const St=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(r,t,e,s,i,n){r*=St.ENTRIES,this.frames[r]=t,this.frames[r+St.MIX]=e,this.frames[r+St.BEND_DIRECTION]=s,this.frames[r+St.COMPRESS]=i?1:0,this.frames[r+St.STRETCH]=n?1:0}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.mix=o.data.mix,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*i,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(o.mix=o.data.mix+(h[h.length+St.PREV_MIX]-o.data.mix)*i,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0)):(o.mix+=(h[h.length+St.PREV_MIX]-o.mix)*i,a==At.mixIn&&(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),u=h[l+St.PREV_MIX],c=h[l],d=this.getCurvePercent(l/St.ENTRIES-1,1-(e-c)/(h[l+St.PREV_TIME]-c));n==S.setup?(o.mix=o.data.mix+(u+(h[l+St.MIX]-u)*d-o.data.mix)*i,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0)):(o.mix+=(u+(h[l+St.MIX]-u)*d-o.mix)*i,a==At.mixIn&&(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0))}};let _s=St;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_MIX=-4,_s.PREV_BEND_DIRECTION=-3,_s.PREV_COMPRESS=-2,_s.PREV_STRETCH=-1,_s.MIX=1,_s.BEND_DIRECTION=2,_s.COMPRESS=3,_s.STRETCH=4;const Wt=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(r,t,e,s,i,n){r*=Wt.ENTRIES,this.frames[r]=t,this.frames[r+Wt.ROTATE]=e,this.frames[r+Wt.TRANSLATE]=s,this.frames[r+Wt.SCALE]=i,this.frames[r+Wt.SHEAR]=n}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=o.data;switch(n){case S.setup:o.rotateMix=f.rotateMix,o.translateMix=f.translateMix,o.scaleMix=f.scaleMix,o.shearMix=f.shearMix;return;case S.first:o.rotateMix+=(f.rotateMix-o.rotateMix)*i,o.translateMix+=(f.translateMix-o.translateMix)*i,o.scaleMix+=(f.scaleMix-o.scaleMix)*i,o.shearMix+=(f.shearMix-o.shearMix)*i}return}let l=0,u=0,c=0,d=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR];const p=h[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(h[f+Wt.PREV_TIME]-p));l+=(h[f+Wt.ROTATE]-l)*m,u+=(h[f+Wt.TRANSLATE]-u)*m,c+=(h[f+Wt.SCALE]-c)*m,d+=(h[f+Wt.SHEAR]-d)*m}if(n==S.setup){const f=o.data;o.rotateMix=f.rotateMix+(l-f.rotateMix)*i,o.translateMix=f.translateMix+(u-f.translateMix)*i,o.scaleMix=f.scaleMix+(c-f.scaleMix)*i,o.shearMix=f.shearMix+(d-f.shearMix)*i}else o.rotateMix+=(l-o.rotateMix)*i,o.translateMix+=(u-o.translateMix)*i,o.scaleMix+=(c-o.scaleMix)*i,o.shearMix+=(d-o.shearMix)*i}};let ys=Wt;ys.ENTRIES=5,ys.PREV_TIME=-5,ys.PREV_ROTATE=-4,ys.PREV_TRANSLATE=-3,ys.PREV_SCALE=-2,ys.PREV_SHEAR=-1,ys.ROTATE=1,ys.TRANSLATE=2,ys.SCALE=3,ys.SHEAR=4;const Ps=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Ps.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(r,t,e){r*=Ps.ENTRIES,this.frames[r]=t,this.frames[r+Ps.VALUE]=e}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*i}return}let l=0;if(e>=h[h.length-Ps.ENTRIES])l=h[h.length+Ps.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Ps.ENTRIES);l=h[u+Ps.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Ps.ENTRIES-1,1-(e-c)/(h[u+Ps.PREV_TIME]-c));l+=(h[u+Ps.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*i:o.position+=(l-o.position)*i}};let Yr=Ps;Yr.ENTRIES=2,Yr.PREV_TIME=-2,Yr.PREV_VALUE=-1,Yr.VALUE=1;let _C=class ur extends Yr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ur.ENTRIES])u=o[o.length+ur.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ur.ENTRIES);u=o[c+ur.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ur.ENTRIES-1,1-(s-d)/(o[c+ur.PREV_TIME]-d));u+=(o[c+ur.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Oe=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(r,t,e,s){r*=Oe.ENTRIES,this.frames[r]=t,this.frames[r+Oe.ROTATE]=e,this.frames[r+Oe.TRANSLATE]=s}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.rotateMix=o.data.rotateMix,o.translateMix=o.data.translateMix;return;case S.first:o.rotateMix+=(o.data.rotateMix-o.rotateMix)*i,o.translateMix+=(o.data.translateMix-o.translateMix)*i}return}let l=0,u=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],u=h[h.length+Oe.PREV_TRANSLATE];else{const c=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[c+Oe.PREV_ROTATE],u=h[c+Oe.PREV_TRANSLATE];const d=h[c],f=this.getCurvePercent(c/Oe.ENTRIES-1,1-(e-d)/(h[c+Oe.PREV_TIME]-d));l+=(h[c+Oe.ROTATE]-l)*f,u+=(h[c+Oe.TRANSLATE]-u)*f}n==S.setup?(o.rotateMix=o.data.rotateMix+(l-o.data.rotateMix)*i,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*i):(o.rotateMix+=(l-o.rotateMix)*i,o.translateMix+=(u-o.translateMix)*i)}};let ir=Oe;ir.ENTRIES=3,ir.PREV_TIME=-3,ir.PREV_ROTATE=-2,ir.PREV_TRANSLATE=-1,ir.ROTATE=1,ir.TRANSLATE=2,new Ee("<empty>",[],0);let yC=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=i,n}newMeshAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new aC(e);return n.region=i,n}newBoundingBoxAttachment(t,e){return new nC(e)}newPathAttachment(t,e){return new lC(e)}newPointAttachment(t,e){return new hC(e)}newClippingAttachment(t,e){return new oC(e)}},xC=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},vC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},bC=class{constructor(t){this.name=t}},wC=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},EC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var rr=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(rr||{});let TC=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}},AC=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},SC=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},CC=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}},IC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new TC,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n!=null&&(s.hash=n.hash,s.version=n.spine,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images),i.bones)for(let a=0;a<i.bones.length;a++){const h=i.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new xC(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Gn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(u)}if(i.slots)for(let a=0;a<i.slots.length;a++){const h=i.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new AC(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Gn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(i.ik)for(let a=0;a<i.ik.length;a++){const h=i.ik[a],o=new wC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.mix=this.getValue(h,"mix",1),s.ikConstraints.push(o)}if(i.transform)for(let a=0;a<i.transform.length;a++){const h=i.transform[a],o=new SC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(i.path)for(let a=0;a<i.path.length;a++){const h=i.path[a],o=new EC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Gn.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Gn.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Gn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==rr.Length||o.spacingMode==rr.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(i.skins)for(const a in i.skins){const h=i.skins[a],o=new CC(a);for(const l in h){const u=s.findSlotIndex(l);if(u==-1)throw new Error(`Slot not found: ${l}`);const c=h[l];for(const d in c){const f=this.readAttachment(c[d],o,u,d,s);f!=null&&o.addAttachment(u,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,i.events)for(const a in i.events){const h=i.events[a],o=new bC(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(i.animations)for(const a in i.animations){const h=i.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,i,n){const a=this.scale;switch(i=this.getValue(t,"name",i),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",i),l=this.attachmentLoader.newRegionAttachment(e,i,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",i),l=this.attachmentLoader.newMeshAttachment(e,i,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u);const c=this.getValue(t,"parent",null);if(c!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new PC(l,this.getValue(t,"skin",null),s,c)),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,i);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,i);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,i);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(i!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=i;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*i),a.push(n[o+2]*i),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const i=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new fC(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,g.time,g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new gs(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*gs.ENTRIES])}else if(c=="twoColor"){const f=new ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ye.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Mn(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Mn.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1;c==="scale"?f=new uC(d.length):c==="shear"?f=new dC(d.length):(f=new ai(d.length),p=i),f.boneIndex=u;let m=0;for(let g=0;g<d.length;g++){const _=d[g],x=this.getValue(_,"x",0),y=this.getValue(_,"y",0);f.setFrame(m,_.time,x*p,y*p),this.readCurve(_,f,m),m++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ai.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new _s(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*_s.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new ys(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*ys.ENTRIES])}if(t.paths)for(const o in t.paths){const l=t.paths[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new _C(f.length),(c.spacingMode==rr.Length||c.spacingMode==rr.Fixed)&&(m=i)):(p=new Yr(f.length),c.positionMode==ne.Fixed&&(m=i)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,x.time,this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Yr.ENTRIES])}else if(d==="mix"){const p=new ir(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,_.time,this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*ir.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new pC(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),i!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=i;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new gC(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,d.time,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new mC(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new vC(B.toSinglePrecision(c.time),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,a))}readCurve(t,e,s){if(t.curve){if(t.curve==="stepped")e.setStepped(s);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){const i=t.curve;e.setCurve(s,i[0],i[1],i[2],i[3])}}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return rr.Length;if(t=="fixed")return rr.Fixed;if(t=="percent")return rr.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},PC=class{constructor(t,e,s,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i}};class s0{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const i0=class extends s0{constructor(r){super(r),this.id=i0.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(r,t){this.computeWorldVertices(r,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(r,t,e,s,i,n){e=i+(e>>1)*n;const a=r.bone.skeleton,h=r.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=r.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=i;b<e;v+=2,b+=n){const w=o[v],E=o[v+1];s[b]=w*g+E*_+p,s[b+1]=w*x+E*y+m}return}let u=0,c=0;for(let f=0;f<t;f+=2){const p=l[u];u+=p+1,c+=p}const d=a.bones;if(h.length==0)for(let f=i,p=c*3;f<e;f+=n){let m=0,g=0,_=l[u++];for(_+=u;u<_;u++,p+=3){const x=d[l[u]].matrix,y=o[p],v=o[p+1],b=o[p+2];m+=(y*x.a+v*x.c+x.tx)*b,g+=(y*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=i,m=c*3,g=c<<1;p<e;p+=n){let _=0,x=0,y=l[u++];for(y+=u;u<y;u++,m+=3,g+=2){const v=d[l[u]].matrix,b=o[m]+f[g],w=o[m+1]+f[g+1],E=o[m+2];_+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=_,s[p+1]=x}}}copyTo(r){this.bones?(r.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,r.bones,0,this.bones.length)):r.bones=null,this.vertices&&(r.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,r.vertices,0,this.vertices.length)),r.worldVerticesLength=this.worldVerticesLength,r.timelineAttachment=this.timelineAttachment}};let nr=i0;nr.nextID=0;class qu extends nr{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new qu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Zu extends nr{constructor(t){super(t),this.type=at.Clipping,this.endSlot=null,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new Zu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Mo extends nr{constructor(t,e){super(t),this.type=at.Mesh,this.region=null,this.triangles=[],this.color=new X(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new X(0,0,0,0),this.path=e}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,a)}newLinkedMesh(){const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t}}class Ku extends nr{constructor(t){super(t),this.type=at.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new Ku(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Qu extends nr{constructor(t){super(t),this.type=at.Point,this.x=0,this.y=0,this.rotation=0,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,a=s*e.b+i*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new Qu(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const r0=class extends s0{constructor(r,t){super(r),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const r=this.region,t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=i+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=this.x,c=this.y,d=s*o+u,f=s*l,p=i*o+c,m=i*l,g=n*o+u,_=n*l,x=a*o+c,y=a*l,v=this.offset;v[0]=d-m,v[1]=p+f,v[2]=d-y,v[3]=x+f,v[4]=g-y,v[5]=x+_,v[6]=g-m,v[7]=p+_;const b=this.uvs;r.degrees==90?(b[2]=r.u,b[3]=r.v2,b[4]=r.u,b[5]=r.v,b[6]=r.u2,b[7]=r.v,b[0]=r.u2,b[1]=r.v2):(b[0]=r.u,b[1]=r.v2,b[2]=r.u,b[3]=r.v,b[4]=r.u2,b[5]=r.v,b[6]=r.u2,b[7]=r.v2)}computeWorldVertices(r,t,e,s){this.sequence!=null&&this.sequence.apply(r,this);const i=r.bone,n=this.offset,a=i.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[2],p=n[3],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[4],p=n[5],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[6],p=n[7],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o}copy(){const r=new r0(this.name,this.path);return r.region=this.region,r.rendererObject=this.rendererObject,r.x=this.x,r.y=this.y,r.scaleX=this.scaleX,r.scaleY=this.scaleY,r.rotation=this.rotation,r.width=this.width,r.height=this.height,B.arrayCopy(this.uvs,0,r.uvs,0,8),B.arrayCopy(this.offset,0,r.offset,0,8),r.color.setFromColor(this.color),r.sequence=this.sequence!=null?this.sequence.copy():null,r}};let gt=r0;gt.X1=0,gt.Y1=1,gt.C1R=2,gt.C1G=3,gt.C1B=4,gt.C1A=5,gt.U1=6,gt.V1=7,gt.X2=8,gt.Y2=9,gt.C2R=10,gt.C2G=11,gt.C2B=12,gt.C2A=13,gt.U2=14,gt.V2=15,gt.X3=16,gt.Y3=17,gt.C3R=18,gt.C3G=19,gt.C3B=20,gt.C3A=21,gt.U3=22,gt.V3=23,gt.X4=24,gt.Y4=25,gt.C4R=26,gt.C4G=27,gt.C4B=28,gt.C4A=29,gt.U4=30,gt.V4=31;const vl=class{constructor(r){this.id=vl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(r)}copy(){const r=new vl(this.regions.length);return B.arrayCopy(this.regions,0,r.regions,0,this.regions.length),r.start=this.start,r.digits=this.digits,r.setupIndex=this.setupIndex,r}apply(r,t){let e=r.sequenceIndex;e==-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(r,t){let e=r;const s=(this.start+t).toString();for(let i=this.digits-s.length;i>0;i--)e+="0";return e+=s,e}static nextID(){return vl._nextID++}};let Ju=vl;Ju._nextID=0;var Pi=(r=>(r[r.hold=0]="hold",r[r.once=1]="once",r[r.loop=2]="loop",r[r.pingpong=3]="pingpong",r[r.onceReverse=4]="onceReverse",r[r.loopReverse=5]="loopReverse",r[r.pingpongReverse=6]="pingpongReverse",r))(Pi||{});const n0=[0,1,2,3,4,5,6];class td{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new NS,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}}const yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19};class he{constructor(t,e){this.propertyIds=e,this.frames=B.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){const s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){const i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}}class li extends he{constructor(t,e,s){super(t,s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(i-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-i+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-i)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=i+v,E=n+b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getBezierValue(t,e,s,i){const n=this.curves;if(n[i]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[i]-l)*(n[i+1]-u)}const a=i+18;for(i+=2;i<a;i+=2)if(n[i]>=t){const l=n[i-2],u=n[i-1];return u+(t-l)/(n[i]-l)*(n[i+1]-u)}e+=this.getFrameEntries();const h=n[a-2],o=n[a-1];return o+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-o)}}class hi extends li{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const i=this.curves[s>>1];switch(i){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}}class ed extends li{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class o0 extends hi{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.rotation=o.data.rotation;return;case S.first:o.rotation+=(o.data.rotation-o.rotation)*n}return}let u=this.getCurveValue(s);switch(a){case S.setup:o.rotation=o.data.rotation+u*n;break;case S.first:case S.replace:u+=o.data.rotation-o.rotation;case S.add:o.rotation+=u*n}}}class a0 extends ed{constructor(t,e,s){super(t,e,`${yt.x}|${s}`,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.x=o.data.x+u*n,o.y=o.data.y+c*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case S.add:o.x+=u*n,o.y+=c*n}}}class l0 extends hi{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x;return;case S.first:o.x+=(o.data.x-o.x)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.x=o.data.x+u*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n;break;case S.add:o.x+=u*n}}}class h0 extends hi{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.y=o.data.y;return;case S.first:o.y+=(o.data.y-o.y)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.y=o.data.y+u*n;break;case S.first:case S.replace:o.y+=(o.data.y+u-o.y)*n;break;case S.add:o.y+=u*n}}}class c0 extends ed{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX,o.scaleY=o.data.scaleY;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u,c;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(u*=o.data.scaleX,c*=o.data.scaleY,n==1)a==S.add?(o.scaleX+=u-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=u,o.scaleY=c);else{let p=0,m=0;if(h==At.mixOut)switch(a){case S.setup:p=o.data.scaleX,m=o.data.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=o.scaleX,m=o.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(a){case S.setup:p=Math.abs(o.data.scaleX)*D.signum(u),m=Math.abs(o.data.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.first:case S.replace:p=Math.abs(o.scaleX)*D.signum(u),m=Math.abs(o.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}}class u0 extends hi{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n}return}const u=this.getCurveValue(s)*o.data.scaleX;if(n==1)a==S.add?o.scaleX+=u-o.data.scaleX:o.scaleX=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}}}}class d0 extends hi{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleY=o.data.scaleY;return;case S.first:o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}const u=this.getCurveValue(s)*o.data.scaleY;if(n==1)a==S.add?o.scaleY+=u-o.data.scaleY:o.scaleY=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}}}}class f0 extends ed{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX,o.shearY=o.data.shearY;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.shearX=o.data.shearX+u*n,o.shearY=o.data.shearY+c*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case S.add:o.shearX+=u*n,o.shearY+=c*n}}}class p0 extends hi{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearX=o.data.shearX+u*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n;break;case S.add:o.shearX+=u*n}}}class m0 extends hi{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearY=o.data.shearY;return;case S.first:o.shearY+=(o.data.shearY-o.shearY)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearY=o.data.shearY+u*n;break;case S.first:case S.replace:o.shearY+=(o.data.shearY+u-o.shearY)*n;break;case S.add:o.shearY+=u*n}}}class g0 extends li{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const _=o.data.color;switch(a){case S.setup:u.setFromColor(_);return;case S.first:u.add((_.r-u.r)*n,(_.g-u.g)*n,(_.b-u.b)*n,(_.a-u.a)*n)}return}let c=0,d=0,f=0,p=0;const m=he.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const _=l[m];c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];const x=(s-_)/(l[m+5]-_);c+=(l[m+5+1]-c)*x,d+=(l[m+5+2]-d)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),f=this.getBezierValue(s,m,3,g+18*2-2),p=this.getBezierValue(s,m,4,g+18*3-2)}n==1?u.set(c,d,f,p):(a==S.setup&&u.setFromColor(o.data.color),u.add((c-u.r)*n,(d-u.g)*n,(f-u.b)*n,(p-u.a)*n))}}class _0 extends li{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const g=o.data.color;switch(a){case S.setup:u.r=g.r,u.g=g.g,u.b=g.b;return;case S.first:u.r+=(g.r-u.r)*n,u.g+=(g.g-u.g)*n,u.b+=(g.b-u.b)*n}return}let c=0,d=0,f=0;const p=he.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];c=l[p+1],d=l[p+2],f=l[p+3];const _=(s-g)/(l[p+4]-g);c+=(l[p+4+1]-c)*_,d+=(l[p+4+2]-d)*_,f+=(l[p+4+3]-f)*_;break;case 1:c=l[p+1],d=l[p+2],f=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)u.r=c,u.g=d,u.b=f;else{if(a==S.setup){const g=o.data.color;u.r=g.r,u.g=g.g,u.b=g.b}u.r+=(c-u.r)*n,u.g+=(d-u.g)*n,u.b+=(f-u.b)*n}}}class y0 extends hi{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.color;if(s<this.frames[0]){const c=o.data.color;switch(a){case S.setup:l.a=c.a;return;case S.first:l.a+=(c.a-l.a)*n}return}const u=this.getCurveValue(s);n==1?l.a=u:(a==S.setup&&(l.a=o.data.color.a),l.a+=(u-l.a)*n)}}class x0 extends li{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const b=o.data.color,w=o.data.darkColor;switch(a){case S.setup:u.setFromColor(b),c.r=w.r,c.g=w.g,c.b=w.b;return;case S.first:u.add((b.r-u.r)*n,(b.g-u.g)*n,(b.b-u.b)*n,(b.a-u.a)*n),c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0,x=0;const y=he.search(l,s,8),v=this.curves[y>>3];switch(v){case 0:const b=l[y];d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];const w=(s-b)/(l[y+8]-b);d+=(l[y+8+1]-d)*w,f+=(l[y+8+2]-f)*w,p+=(l[y+8+3]-p)*w,m+=(l[y+8+4]-m)*w,g+=(l[y+8+5]-g)*w,_+=(l[y+8+6]-_)*w,x+=(l[y+8+7]-x)*w;break;case 1:d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];break;default:d=this.getBezierValue(s,y,1,v-2),f=this.getBezierValue(s,y,2,v+18-2),p=this.getBezierValue(s,y,3,v+18*2-2),m=this.getBezierValue(s,y,4,v+18*3-2),g=this.getBezierValue(s,y,5,v+18*4-2),_=this.getBezierValue(s,y,6,v+18*5-2),x=this.getBezierValue(s,y,7,v+18*6-2)}if(n==1)u.set(d,f,p,m),c.r=g,c.g=_,c.b=x;else{if(a==S.setup){u.setFromColor(o.data.color);const b=o.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}u.add((d-u.r)*n,(f-u.g)*n,(p-u.b)*n,(m-u.a)*n),c.r+=(g-c.r)*n,c.g+=(_-c.g)*n,c.b+=(x-c.b)*n}}}class v0 extends li{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const v=o.data.color,b=o.data.darkColor;switch(a){case S.setup:u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b;return;case S.first:u.r+=(v.r-u.r)*n,u.g+=(v.g-u.g)*n,u.b+=(v.b-u.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0;const x=he.search(l,s,7),y=this.curves[x/7];switch(y){case 0:const v=l[x];d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];const b=(s-v)/(l[x+7]-v);d+=(l[x+7+1]-d)*b,f+=(l[x+7+2]-f)*b,p+=(l[x+7+3]-p)*b,m+=(l[x+7+4]-m)*b,g+=(l[x+7+5]-g)*b,_+=(l[x+7+6]-_)*b;break;case 1:d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];break;default:d=this.getBezierValue(s,x,1,y-2),f=this.getBezierValue(s,x,2,y+18-2),p=this.getBezierValue(s,x,3,y+18*2-2),m=this.getBezierValue(s,x,4,y+18*3-2),g=this.getBezierValue(s,x,5,y+18*4-2),_=this.getBezierValue(s,x,6,y+18*5-2)}if(n==1)u.r=d,u.g=f,u.b=p,c.r=m,c.g=g,c.b=_;else{if(a==S.setup){const v=o.data.color,b=o.data.darkColor;u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b}u.r+=(d-u.r)*n,u.g+=(f-u.g)*n,u.b+=(p-u.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(_-c.b)*n}}}class b0 extends he{constructor(t,e){super(t,[`${yt.attachment}|${e}`]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(o.bone.active){if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}if(s<this.frames[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}this.setAttachment(t,o,this.attachmentNames[he.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class w0 extends li{constructor(t,e,s,i){super(t,e,[`${yt.deform}|${s}|${i.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(i-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-i+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-i)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=i+v,E=b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let i=s[e];switch(i){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(i-=2,s[i]>t){const o=this.frames[e];return s[i+1]*(t-o)/(s[i]-o)}const n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){const o=s[i-2],l=s[i-1];return l+(t-o)/(s[i]-o)*(s[i+1]-l)}const a=s[n-2],h=s[n-1];return h+(1-h)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof nr)||l.timelineAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;return}u.length=d;const x=l;if(x.bones){n=1-n;for(let y=0;y<d;y++)u[y]*=n}else{const y=x.vertices;for(let v=0;v<d;v++)u[v]+=(y[v]-u[v])*n}}return}if(u.length=d,s>=f[f.length-1]){const x=c[f.length-1];if(n==1)if(a==S.add){const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v];else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,u,0,d);else switch(a){case S.setup:{const v=l;if(v.bones)for(let b=0;b<d;b++)u[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<d;w++){const E=b[w];u[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<d;v++)u[v]+=(x[v]-u[v])*n;break;case S.add:const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v]*n;else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=(x[b]-v[b])*n}}return}const p=he.search1(f,s),m=this.getCurvePercent(s,p),g=c[p],_=c[p+1];if(n==1)if(a==S.add){const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=v+(_[y]-v)*m}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=b+(_[v]-b)*m-y[v]}}}else for(let x=0;x<d;x++){const y=g[x];u[x]=y+(_[x]-y)*m}else switch(a){case S.setup:{const y=l;if(y.bones)for(let v=0;v<d;v++){const b=g[v];u[v]=(b+(_[v]-b)*m)*n}else{const v=y.vertices;for(let b=0;b<d;b++){const w=g[b],E=v[b];u[b]=E+(w+(_[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m-u[y])*n}break;case S.add:const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m)*n}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=(b+(_[v]-b)*m-y[v])*n}}}}}const E0=class extends he{constructor(r){super(r,E0.propertyIds),this.events=new Array(r)}getFrameCount(){return this.frames.length}setFrame(r,t){this.frames[r]=t.time,this.events[r]=t}apply(r,t,e,s,i,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(r,t,Number.MAX_VALUE,s,i,n,a),t=-1;else if(t>=h[o-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=he.search1(h,t)+1;const u=h[l];for(;l>0&&h[l-1]==u;)l--}for(;l<o&&e>=h[l];l++)s.push(this.events[l])}};let sd=E0;sd.propertyIds=[`${yt.event}`];const T0=class extends he{constructor(r){super(r,T0.propertyIds),this.drawOrders=new Array(r)}getFrameCount(){return this.frames.length}setFrame(r,t,e){this.frames[r]=t,this.drawOrders[r]=e}apply(r,t,e,s,i,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);else{const l=r.drawOrder,u=r.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let id=T0;id.propertyIds=[`${yt.drawOrder}`];class A0 extends li{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,i,n,a,h){const o=t.ikConstraints[this.ikConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let u=0,c=0;const d=he.search(l,s,6),f=this.curves[d/6];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+6]-p);u+=(l[d+6+1]-u)*m,c+=(l[d+6+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}a==S.setup?(o.mix=o.data.mix+(u-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,h==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0)):(o.mix+=(u-o.mix)*n,o.softness+=(c-o.softness)*n,h==At.mixIn&&(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0))}}class S0 extends li{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,i,n,a,h){const o=t.transformConstraints[this.transformConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){const x=o.data;switch(a){case S.setup:o.mixRotate=x.mixRotate,o.mixX=x.mixX,o.mixY=x.mixY,o.mixScaleX=x.mixScaleX,o.mixScaleY=x.mixScaleY,o.mixShearY=x.mixShearY;return;case S.first:o.mixRotate+=(x.mixRotate-o.mixRotate)*n,o.mixX+=(x.mixX-o.mixX)*n,o.mixY+=(x.mixY-o.mixY)*n,o.mixScaleX+=(x.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(x.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(x.mixShearY-o.mixShearY)*n}return}let u,c,d,f,p,m;const g=he.search(l,s,7),_=this.curves[g/7];switch(_){case 0:const x=l[g];u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const y=(s-x)/(l[g+7]-x);u+=(l[g+7+1]-u)*y,c+=(l[g+7+2]-c)*y,d+=(l[g+7+3]-d)*y,f+=(l[g+7+4]-f)*y,p+=(l[g+7+5]-p)*y,m+=(l[g+7+6]-m)*y;break;case 1:u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:u=this.getBezierValue(s,g,1,_-2),c=this.getBezierValue(s,g,2,_+18-2),d=this.getBezierValue(s,g,3,_+18*2-2),f=this.getBezierValue(s,g,4,_+18*3-2),p=this.getBezierValue(s,g,5,_+18*4-2),m=this.getBezierValue(s,g,6,_+18*5-2)}if(a==S.setup){const x=o.data;o.mixRotate=x.mixRotate+(u-x.mixRotate)*n,o.mixX=x.mixX+(c-x.mixX)*n,o.mixY=x.mixY+(d-x.mixY)*n,o.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,o.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,o.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n,o.mixScaleX+=(f-o.mixScaleX)*n,o.mixScaleY+=(p-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class C0 extends hi{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,i,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*n}return}const u=this.getCurveValue(s);a==S.setup?o.position=o.data.position+(u-o.data.position)*n:o.position+=(u-o.position)*n}}class I0 extends hi{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,i,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.spacing=o.data.spacing;return;case S.first:o.spacing+=(o.data.spacing-o.spacing)*n}return}const u=this.getCurveValue(s);a==S.setup?o.spacing=o.data.spacing+(u-o.data.spacing)*n:o.spacing+=(u-o.spacing)*n}}class P0 extends li{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=n}apply(t,e,s,i,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,o.mixY=o.data.mixY;return;case S.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u,c,d;const f=he.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];u=l[f+1],c=l[f+2],d=l[f+3];const g=(s-m)/(l[f+4]-m);u+=(l[f+4+1]-u)*g,c+=(l[f+4+2]-c)*g,d+=(l[f+4+3]-d)*g;break;case 1:u=l[f+1],c=l[f+2],d=l[f+3];break;default:u=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2)}if(a==S.setup){const m=o.data;o.mixRotate=m.mixRotate+(u-m.mixRotate)*n,o.mixX=m.mixX+(c-m.mixX)*n,o.mixY=m.mixY+(d-m.mixY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n}}const or=class extends he{constructor(r,t,e){super(r,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return or.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(r,t,e,s,i){const n=this.frames;r*=or.ENTRIES,n[r]=t,n[r+or.MODE]=e|s<<4,n[r+or.DELAY]=i}apply(r,t,e,s,i,n,a){const h=r.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof nr)||o.timelineAttachment!=l))return;const u=this.frames;if(e<u[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const c=he.search(u,e,or.ENTRIES),d=u[c],f=u[c+or.MODE],p=u[c+or.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=n0[f&15];if(_!=Pi.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pi.once:m=Math.min(g-1,m);break;case Pi.loop:m%=g;break;case Pi.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pi.onceReverse:m=Math.max(g-1-m,0);break;case Pi.loopReverse:m=g-1-m%g;break;case Pi.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=or;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new td("<empty>",[],0);class R0{constructor(t){this.atlas=t}loadSequence(t,e,s){const i=s.regions;for(let n=0,a=i.length;n<a;n++){const h=s.getPath(e,n),o=this.atlas.findRegion(h);if(o==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);i[n]=o,i[n].renderObject=i[n]}}newRegionAttachment(t,e,s,i){const n=new gt(e,s);if(i!=null)this.loadSequence(e,s,i);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);a.renderObject=a,n.region=a}return n}newMeshAttachment(t,e,s,i){const n=new Mo(e,s);if(i!=null)this.loadSequence(e,s,i);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);a.renderObject=a,n.region=a}return n}newBoundingBoxAttachment(t,e){return new qu(e)}newPathAttachment(t,e){return new Ku(e)}newPointAttachment(t,e){return new Qu(e)}newClippingAttachment(t,e){return new Zu(e)}}class M0{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class rd{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let F0=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class k0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class B0 extends rd{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class D0 extends rd{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Rs.Fixed,this.rotateMode=Fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Rs=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r[r.Proportional=3]="Proportional",r))(Rs||{});class O0{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}}class L0{constructor(t,e,s){if(this.index=0,this.color=new X(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=W.NORMAL,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class N0 extends rd{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class V0{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class nd{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];i.attachment&&(i.attachment instanceof Mo?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const i in s){const n=s[i];n&&t.push(new V0(e,i,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new V0(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u&&n.setAttachment(u);break}}}s++}}}class U0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new O0;s.name="";const i=new yl(t),n=i.readInt32(),a=i.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=i.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const c=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(c)}this.ver40=h==="4.0",s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat();const o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let l=0;l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readString();if(!d)throw new Error("String in string table must not be null.");i.strings.push(d)}l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[i.readInt(!0)],p=new M0(c,d,f);p.rotation=i.readFloat(),p.x=i.readFloat()*e,p.y=i.readFloat()*e,p.scaleX=i.readFloat(),p.scaleY=i.readFloat(),p.shearX=i.readFloat(),p.shearY=i.readFloat(),p.length=i.readFloat()*e,p.transformMode=i.readInt(!0),p.skinRequired=i.readBoolean(),o&&X.rgba8888ToColor(p.color,i.readInt32()),s.bones.push(p)}l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[i.readInt(!0)],p=new L0(c,d,f);X.rgba8888ToColor(p.color,i.readInt32());const m=i.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=i.readStringRef(),p.blendMode=i.readInt(!0),s.slots.push(p)}l=i.readInt(!0);for(let c=0,d;c<l;c++){const f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new B0(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),d=i.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.bones[i.readInt(!0)],p.mix=i.readFloat(),p.softness=i.readFloat()*e,p.bendDirection=i.readByte(),p.compress=i.readBoolean(),p.stretch=i.readBoolean(),p.uniform=i.readBoolean(),s.ikConstraints.push(p)}l=i.readInt(!0);for(let c=0,d;c<l;c++){const f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new N0(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),d=i.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.bones[i.readInt(!0)],p.local=i.readBoolean(),p.relative=i.readBoolean(),p.offsetRotation=i.readFloat(),p.offsetX=i.readFloat()*e,p.offsetY=i.readFloat()*e,p.offsetScaleX=i.readFloat(),p.offsetScaleY=i.readFloat(),p.offsetShearY=i.readFloat(),p.mixRotate=i.readFloat(),p.mixX=i.readFloat(),p.mixY=i.readFloat(),p.mixScaleX=i.readFloat(),p.mixScaleY=i.readFloat(),p.mixShearY=i.readFloat(),s.transformConstraints.push(p)}l=i.readInt(!0);for(let c=0,d;c<l;c++){const f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new D0(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),d=i.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.slots[i.readInt(!0)],p.positionMode=i.readInt(!0),p.spacingMode=i.readInt(!0),p.rotateMode=i.readInt(!0),p.offsetRotation=i.readFloat(),p.position=i.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=i.readFloat(),(p.spacingMode==Rs.Length||p.spacingMode==Rs.Fixed)&&(p.spacing*=e),p.mixRotate=i.readFloat(),p.mixX=i.readFloat(),p.mixY=i.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(i,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+i.readInt(!0));c<l;c++){const d=this.readSkin(i,s,!1,o);if(!d)throw new Error("readSkin() should not have returned null.");s.skins[c]=d}}l=this.linkedMeshes.length;for(let c=0;c<l;c++){const d=this.linkedMeshes[c],f=d.skin?s.findSkin(d.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readStringRef();if(!d)throw new Error;const f=new k0(d);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,d,s))}return s}readSkin(t,e,s,i){let n=null,a=0;if(s){if(a=t.readInt(!0),a==0)return null;n=new nd("default")}else{const h=t.readStringRef();if(!h)throw new Error("Skin name must not be null.");n=new nd(h),n.bones.length=t.readInt(!0);for(let o=0,l=n.bones.length;o<l;o++)n.bones[o]=e.bones[t.readInt(!0)];for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let h=0;h<a;h++){const o=t.readInt(!0);for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,n,o,c,i);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,i,n,a){const h=this.scale;let o=t.readStringRef();switch(o||(o=n),t.readByte()){case at.Region:{let l=t.readStringRef();const u=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),_=t.readInt32(),x=this.readSequence(t);l||(l=o);const y=this.attachmentLoader.newRegionAttachment(s,o,l,x);return y?(y.path=l,y.x=c*h,y.y=d*h,y.scaleX=f,y.scaleY=p,y.rotation=u,y.width=m*h,y.height=g*h,X.rgba8888ToColor(y.color,_),y.sequence=x,x==null&&y.updateRegion(),y):null}case at.BoundingBox:{const l=t.readInt(!0),u=this.readVertices(t,l),c=a?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l<<1,d.vertices=u.vertices,d.bones=u.bones,a&&X.rgba8888ToColor(d.color,c),d):null}case at.Mesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readInt(!0),d=this.readFloatArray(t,c<<1,1),f=this.readShortArray(t),p=this.readVertices(t,c),m=t.readInt(!0),g=this.readSequence(t);let _=[],x=0,y=0;a&&(_=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),l||(l=o);const v=this.attachmentLoader.newMeshAttachment(s,o,l,g);return v?(v.path=l,X.rgba8888ToColor(v.color,u),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=c<<1,v.triangles=f,v.regionUVs=new Float32Array(d),v.hullLength=m<<1,v.sequence=g,a&&(v.edges=_,v.width=x*h,v.height=y*h),v):null}case at.LinkedMesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;a&&(m=t.readFloat(),g=t.readFloat()),l||(l=o);const _=this.attachmentLoader.newMeshAttachment(s,o,l,p);return _?(_.path=l,X.rgba8888ToColor(_.color,u),_.sequence=p,a&&(_.width=m*h,_.height=g*h),this.linkedMeshes.push(new RC(_,c,i,d,f)),_):null}case at.Path:{const l=t.readBoolean(),u=t.readBoolean(),c=t.readInt(!0),d=this.readVertices(t,c),f=B.newArray(c/3,0);for(let g=0,_=f.length;g<_;g++)f[g]=t.readFloat()*h;const p=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=u,m.worldVerticesLength=c<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&X.rgba8888ToColor(m.color,p),m):null}case at.Point:{const l=t.readFloat(),u=t.readFloat(),c=t.readFloat(),d=a?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=u*h,f.y=c*h,f.rotation=l,a&&X.rgba8888ToColor(f.color,d),f):null}case at.Clipping:{const l=t.readInt(!0),u=t.readInt(!0),c=this.readVertices(t,u),d=a?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,o);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,a&&X.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Ju(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?G0:t.readByte()}readVertices(t,e){const s=this.scale,i=e<<1,n=new MC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,i,s),n;const a=new Array,h=new Array;for(let o=0;o<e;o++){const l=t.readInt(!0);h.push(l);for(let u=0;u<l;u++)h.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=B.toFloatArray(a),n.bones=h,n}readFloatArray(t,e,s){const i=new Array(e);if(s==1)for(let n=0;n<e;n++)i[n]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const i=new Array,n=this.scale;for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case XC:{const _=new b0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());i.push(_);break}case $C:{const _=t.readInt(!0),x=new g0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let T=0,A=0;x.setFrame(T,y,v,b,w,E),T!=g;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(T);break;case Fs:ct(t,x,A++,T,0,y,I,v,M,1),ct(t,x,A++,T,1,y,I,b,R,1),ct(t,x,A++,T,2,y,I,w,C,1),ct(t,x,A++,T,3,y,I,E,P,1)}y=I,v=M,b=R,w=C,E=P}i.push(x);break}case HC:{const _=t.readInt(!0),x=new _0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,y,v,b,w),E!=g;E++){const A=t.readFloat(),I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(E);break;case Fs:ct(t,x,T++,E,0,y,A,v,I,1),ct(t,x,T++,E,1,y,A,b,M,1),ct(t,x,T++,E,2,y,A,w,R,1)}y=A,v=I,b=M,w=R}i.push(x);break}case YC:{const _=t.readInt(!0),x=new x0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,R=0;x.setFrame(M,y,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(M);break;case Fs:ct(t,x,R++,M,0,y,C,v,P,1),ct(t,x,R++,M,1,y,C,b,k,1),ct(t,x,R++,M,2,y,C,w,U,1),ct(t,x,R++,M,3,y,C,E,V,1),ct(t,x,R++,M,4,y,C,T,L,1),ct(t,x,R++,M,5,y,C,A,$,1),ct(t,x,R++,M,6,y,C,I,O,1)}y=C,v=P,b=k,w=U,E=V,T=L,A=$,I=O}i.push(x);break}case WC:{const _=t.readInt(!0),x=new v0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,v,b,w,E,T,A),I!=g;I++){const R=t.readFloat(),C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(I);break;case Fs:ct(t,x,M++,I,0,y,R,v,C,1),ct(t,x,M++,I,1,y,R,b,P,1),ct(t,x,M++,I,2,y,R,w,k,1),ct(t,x,M++,I,3,y,R,E,U,1),ct(t,x,M++,I,4,y,R,T,V,1),ct(t,x,M++,I,5,y,R,A,L,1)}y=R,v=C,b=P,w=k,E=U,T=V,A=L}i.push(x);break}case zC:{const _=new y0(m,t.readInt(!0),c);let x=t.readFloat(),y=t.readUnsignedByte()/255;for(let v=0,b=0;_.setFrame(v,x,y),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:_.setStepped(v);break;case Fs:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}i.push(_)}}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case FC:i.push(Ri(t,new o0(m,g,c),1));break;case kC:i.push(od(t,new a0(m,g,c),n));break;case BC:i.push(Ri(t,new l0(m,g,c),n));break;case DC:i.push(Ri(t,new h0(m,g,c),n));break;case OC:i.push(od(t,new c0(m,g,c),1));break;case LC:i.push(Ri(t,new u0(m,g,c),1));break;case NC:i.push(Ri(t,new d0(m,g,c),1));break;case VC:i.push(od(t,new f0(m,g,c),1));break;case UC:i.push(Ri(t,new p0(m,g,c),1));break;case GC:i.push(Ri(t,new m0(m,g,c),1))}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new A0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat()*n;for(let x=0,y=0;p.setFrame(x,m,g,_,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Ms:p.setStepped(x);break;case Fs:ct(t,p,y++,x,0,m,v,g,b,1),ct(t,p,y++,x,1,m,v,_,w,n)}m=v,g=b,_=w}i.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new S0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,_,x,y,v,b),w!=f;w++){const T=t.readFloat(),A=t.readFloat(),I=t.readFloat(),M=t.readFloat(),R=t.readFloat(),C=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Ms:p.setStepped(w);break;case Fs:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,_,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,y,R,1),ct(t,p,E++,w,4,m,T,v,C,1),ct(t,p,E++,w,5,m,T,b,P,1)}m=T,g=A,_=I,x=M,y=R,v=C,b=P}i.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case qC:i.push(Ri(t,new C0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case ZC:i.push(Ri(t,new I0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Rs.Length||d.spacingMode==Rs.Fixed?n:1));break;case KC:const m=new P0(t.readInt(!0),t.readInt(!0),c);let g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,_,x,y),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Ms:m.setStepped(v);break;case Fs:ct(t,m,b++,v,0,g,E,_,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,y,I,1)}g=E,_=T,x=A,y=I}i.push(m)}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const _=t.readStringRef();if(!_)throw new Error("attachmentName must not be null.");const x=c.getAttachment(p,_),y=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(y){case G0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new w0(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,U=t.readInt(!0);if(U==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(U+=L,n==1)for(let $=L;$<U;$++)k[$]=t.readFloat();else for(let $=L;$<U;$++)k[$]=t.readFloat()*n;if(!E)for(let $=0,O=k.length;$<O;$++)k[$]+=T[$]}if(M.setFrame(C,R,k),C==b)break;const V=t.readFloat();switch(t.readByte()){case Ms:M.setStepped(C);break;case Fs:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}i.push(M);break}case jC:{const w=new Fo(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,n0[A&15],A>>4,t.readFloat())}i.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new id(a),u=s.slots.length;for(let c=0;c<a;c++){const d=t.readFloat(),f=t.readInt(!0),p=B.newArray(u,0);for(let x=u-1;x>=0;x--)p[x]=-1;const m=B.newArray(u-f,0);let g=0,_=0;for(let x=0;x<f;x++){const y=t.readInt(!0);for(;g!=y;)m[_++]=g++;p[g+t.readInt(!0)]=g++}for(;g<u;)m[_++]=g++;for(let x=u-1;x>=0;x--)p[x]==-1&&(p[x]=m[--_]);l.setFrame(c,d,p)}i.push(l)}const h=t.readInt(!0);if(h>0){const l=new sd(h);for(let u=0;u<h;u++){const c=t.readFloat(),d=s.events[t.readInt(!0)],f=new F0(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():d.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(u,f)}i.push(l)}let o=0;for(let l=0,u=i.length;l<u;l++)o=Math.max(o,i[l].getDuration());return new td(e,i,o)}}U0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let RC=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};class MC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Ri(r,t,e){let s=r.readFloat(),i=r.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,i),n!=h;n++){const o=r.readFloat(),l=r.readFloat()*e;switch(r.readByte()){case Ms:t.setStepped(n);break;case Fs:ct(r,t,a++,n,0,s,o,i,l,e)}s=o,i=l}return t}function od(r,t,e){let s=r.readFloat(),i=r.readFloat()*e,n=r.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,i,n),a!=o;a++){const l=r.readFloat(),u=r.readFloat()*e,c=r.readFloat()*e;switch(r.readByte()){case Ms:t.setStepped(a);break;case Fs:ct(r,t,h++,a,0,s,l,i,u,e),ct(r,t,h++,a,1,s,l,n,c,e)}s=l,i=u,n=c}return t}function ct(r,t,e,s,i,n,a,h,o,l){t.setBezier(e,s,i,n,h,r.readFloat(),r.readFloat()*l,r.readFloat(),r.readFloat()*l,a,o)}const FC=0,kC=1,BC=2,DC=3,OC=4,LC=5,NC=6,VC=7,UC=8,GC=9,XC=0,$C=1,HC=2,YC=3,WC=4,zC=5,G0=0,jC=1,qC=0,ZC=1,KC=2,Ms=1,Fs=2;class ad{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new O0,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const a=s.version.substr(0,3);if(a!=="4.0"&&a!=="4.1"){const h=`Spine 4.1 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(h)}s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(i.bones)for(let a=0;a<i.bones.length;a++){const h=i.bones[a];let o=null;const l=F(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new M0(s.bones.length,h.name,o);u.length=F(h,"length",0)*e,u.x=F(h,"x",0)*e,u.y=F(h,"y",0)*e,u.rotation=F(h,"rotation",0),u.scaleX=F(h,"scaleX",1),u.scaleY=F(h,"scaleY",1),u.shearX=F(h,"shearX",0),u.shearY=F(h,"shearY",0),u.transformMode=B.enumValue(vt,F(h,"transform","Normal")),u.skinRequired=F(h,"skin",!1);const c=F(h,"color",null);c&&u.color.setFromString(c),s.bones.push(u)}if(i.slots)for(let a=0;a<i.slots.length;a++){const h=i.slots[a],o=s.findBone(h.bone);if(!o)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new L0(s.slots.length,h.name,o),u=F(h,"color",null);u&&l.color.setFromString(u);const c=F(h,"dark",null);c&&(l.darkColor=X.fromString(c)),l.attachmentName=F(h,"attachment",null),l.blendMode=ad.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(i.ik)for(let a=0;a<i.ik.length;a++){const h=i.ik[a],o=new B0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(c==null)throw new Error(`IK bone not found: ${u}`);o.bones.push(c)}o.target=s.findBone(h.target),o.mix=F(h,"mix",1),o.softness=F(h,"softness",0)*e,o.bendDirection=F(h,"bendPositive",!0)?1:-1,o.compress=F(h,"compress",!1),o.stretch=F(h,"stretch",!1),o.uniform=F(h,"uniform",!1),s.ikConstraints.push(o)}if(i.transform)for(let a=0;a<i.transform.length;a++){const h=i.transform[a],o=new N0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findBone(l);if(!u)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);o.target=u,o.local=F(h,"local",!1),o.relative=F(h,"relative",!1),o.offsetRotation=F(h,"rotation",0),o.offsetX=F(h,"x",0)*e,o.offsetY=F(h,"y",0)*e,o.offsetScaleX=F(h,"scaleX",0),o.offsetScaleY=F(h,"scaleY",0),o.offsetShearY=F(h,"shearY",0),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),o.mixScaleX=F(h,"mixScaleX",1),o.mixScaleY=F(h,"mixScaleY",o.mixScaleX),o.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(o)}if(i.path)for(let a=0;a<i.path.length;a++){const h=i.path[a],o=new D0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findSlot(l);if(!u)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);o.target=u,o.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),o.spacingMode=B.enumValue(Rs,F(h,"spacingMode","Length")),o.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),o.offsetRotation=F(h,"rotation",0),o.position=F(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=F(h,"spacing",0),(o.spacingMode==Rs.Length||o.spacingMode==Rs.Fixed)&&(o.spacing*=e),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),s.pathConstraints.push(o)}if(i.skins)for(let a=0;a<i.skins.length;a++){const h=i.skins[a],o=new nd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(!c)throw new Error(`Couldn't find bone ${u} for skin ${h.name}.`);o.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=h.ik[l],c=s.findIkConstraint(u);if(!c)throw new Error(`Couldn't find IK constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=h.transform[l],c=s.findTransformConstraint(u);if(!c)throw new Error(`Couldn't find transform constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const u=h.path[l],c=s.findPathConstraint(u);if(!c)throw new Error(`Couldn't find path constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}for(const l in h.attachments){const u=s.findSlot(l);if(!u)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin?s.findSkin(o.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(!u)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.timelineAttachment=o.inheritTimeline?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,i.events)for(const a in i.events){const h=i.events[a],o=new k0(a);o.intValue=F(h,"int",0),o.floatValue=F(h,"float",0),o.stringValue=F(h,"string",""),o.audioPath=F(h,"audio",null),o.audioPath&&(o.volume=F(h,"volume",1),o.balance=F(h,"balance",0)),s.events.push(o)}if(i.animations)for(const a in i.animations){const h=i.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,i,n){const a=this.scale;switch(i=F(t,"name",i),F(t,"type","region")){case"region":{const h=F(t,"path",i),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,i,h,o);if(!l)return null;l.path=h,l.x=F(t,"x",0)*a,l.y=F(t,"y",0)*a,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*a,l.height=t.height*a,l.sequence=o;const u=F(t,"color",null);return u&&l.color.setFromString(u),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"mesh":case"linkedmesh":{const h=F(t,"path",i),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,i,h,o);if(!l)return null;l.path=h;const u=F(t,"color",null);u&&l.color.setFromString(u),l.width=F(t,"width",0)*a,l.height=F(t,"height",0)*a,l.sequence=o;const c=F(t,"parent",null);if(c)return this.linkedMeshes.push(new QC(l,F(t,"skin",null),s,c,F(t,"timelines",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,i);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,h,o<<1);const l=B.newArray(o/3,0);for(let c=0;c<t.lengths.length;c++)l[c]=t.lengths[c]*a;h.lengths=l;const u=F(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,i);if(!h)return null;h.x=F(t,"x",0)*a,h.y=F(t,"y",0)*a,h.rotation=F(t,"rotation",0);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,i);if(!h)return null;const o=F(t,"end",null);if(o!=null){const c=n.findSlot(o);if(c==null)throw new Error(`Clipping end slot not found: ${o}`);h.endSlot=c}const l=t.vertexCount;this.readVertices(t,h,l<<1);const u=F(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return null;const e=new Ju(F(t,"count",0));return e.start=F(t,"start",1),e.digits=F(t,"digits",0),e.setupIndex=F(t,"setup",0),e}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(i!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=i;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*i),a.push(n[o+2]*i),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const i=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const o=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const u=l.index;for(const c in o){const d=o[c];if(!d)continue;const f=d.length;if(c=="attachment"){const p=new b0(f,u);for(let m=0;m<f;m++){const g=d[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(c=="rgba"){const p=new g0(f,f<<2,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b,_.a);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1),y=pt(E,p,y,x,3,g,b,_.a,w.a,1)),g=b,_=w,m=v}n.push(p)}else if(c=="rgb"){const p=new _0(f,f*3,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1)),g=b,_=w,m=v}n.push(p)}else if(c=="alpha")n.push(ci(d,new y0(f,f,u),0,1));else if(c=="rgba2"){const p=new x0(f,f*7,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,_.a,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,_.a,E.a,1),v=pt(A,p,v,y,4,g,w,x.r,T.r,1),v=pt(A,p,v,y,5,g,w,x.g,T.g,1),v=pt(A,p,v,y,6,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}else if(c=="rgb2"){const p=new v0(f,f*6,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,x.r,T.r,1),v=pt(A,p,v,y,4,g,w,x.g,T.g,1),v=pt(A,p,v,y,5,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const o=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const u=l.index;for(const c in o){const d=o[c],f=d.length;if(f!=0){if(c==="rotate")n.push(ci(d,new o0(f,f,u),0,1));else if(c==="translate"){const p=new a0(f,f<<1,u);n.push(ld(d,p,"x","y",0,i))}else if(c==="translatex"){const p=new l0(f,f,u);n.push(ci(d,p,0,i))}else if(c==="translatey"){const p=new h0(f,f,u);n.push(ci(d,p,0,i))}else if(c==="scale"){const p=new c0(f,f<<1,u);n.push(ld(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new u0(f,f,u);n.push(ci(d,p,1,1))}else if(c==="scaley"){const p=new d0(f,f,u);n.push(ci(d,p,1,1))}else if(c==="shear"){const p=new f0(f,f<<1,u);n.push(ld(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new p0(f,f,u);n.push(ci(d,p,0,1))}else if(c==="sheary"){const p=new m0(f,f,u);n.push(ci(d,p,0,1))}}}}if(t.ik)for(const h in t.ik){const o=t.ik[h];let l=o[0];if(!l)continue;const u=s.findIkConstraint(h);if(!u)throw new Error(`IK Constraint not found: ${h}`);const c=s.ikConstraints.indexOf(u),d=new A0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*i;for(let g=0,_=0;;g++){d.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=o[g+1];if(!x){d.shrink(_);break}const y=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*i,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,i)),f=y,p=v,m=b,l=x}n.push(d)}if(t.transform)for(const h in t.transform){const o=t.transform[h];let l=o[0];if(!l)continue;const u=s.findTransformConstraint(h);if(!u)throw new Error(`Transform constraint not found: ${h}`);const c=s.transformConstraints.indexOf(u),d=new S0(o.length,o.length*6,c);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),_=F(l,"mixScaleX",1),x=F(l,"mixScaleY",_);const y=F(l,"mixShearY",1);for(let v=0,b=0;;v++){d.setFrame(v,f,p,m,g,_,x,y);const w=o[v+1];if(!w){d.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=F(w,"mixScaleX",1),R=F(w,"mixScaleY",M),C=F(w,"mixShearY",1),P=l.curve;P&&(b=pt(P,d,b,v,0,f,E,p,T,1),b=pt(P,d,b,v,1,f,E,m,A,1),b=pt(P,d,b,v,2,f,E,g,I,1),b=pt(P,d,b,v,3,f,E,_,M,1),b=pt(P,d,b,v,4,f,E,x,R,1),b=pt(P,d,b,v,5,f,E,y,C,1)),f=E,p=T,m=A,g=I,_=M,x=R,_=M,l=w}n.push(d)}if(t.path)for(const h in t.path){const o=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const u=s.pathConstraints.indexOf(l);for(const c in o){const d=o[c];let f=d[0];if(!f)continue;const p=d.length;if(c==="position"){const m=new C0(p,p,u);n.push(ci(d,m,0,l.positionMode==ne.Fixed?i:1))}else if(c==="spacing"){const m=new I0(p,p,u);n.push(ci(d,m,0,l.spacingMode==Rs.Length||l.spacingMode==Rs.Fixed?i:1))}else if(c==="mix"){const m=new P0(p,p*3,u);let g=F(f,"time",0),_=F(f,"mixRotate",1),x=F(f,"mixX",1),y=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,_,x,y);const w=d[v+1];if(!w){m.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=f.curve;M&&(b=pt(M,m,b,v,0,g,E,_,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,y,I,1)),g=E,_=T,x=A,y=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const o=t.deform[h],l=t.attachments[h]={};for(const u in o){const c=o[u],d=l[u]={};for(const f in c)d[f]={deform:c[f]}}}}if(t.attachments)for(const h in t.attachments){const o=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const u in o){const c=o[u],d=s.findSlot(u);if(!d)throw new Error(`Slot not found: ${u}`);const f=d.index;for(const p in c){const m=c[p],g=l.getAttachment(f,p);for(const _ in m){const x=m[_];let y=x[0];if(y){if(_=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new w0(x.length,x.length,f,g);let T=F(y,"time",0);for(let A=0,I=0;;A++){let M;const R=F(y,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const U=F(y,"offset",0);if(B.arrayCopy(R,0,M,U,R.length),i!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=i;if(!v)for(let V=0;V<w;V++)M[V]+=b[V]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=y.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,y=C}n.push(E)}else if(_=="sequence"){const v=new Fo(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(y,"delay",b),T=F(y,"time",0),A=Pi[F(y,"mode","hold")],I=F(y,"index",0);v.setFrame(w,T,A,I,E),b=E,y=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new id(t.drawOrder.length),o=s.slots.length;let l=0;for(let u=0;u<t.drawOrder.length;u++,l++){const c=t.drawOrder[u];let d=null;const f=F(c,"offsets",null);if(f){d=B.newArray(o,-1);const p=B.newArray(o-f.length,0);let m=0,g=0;for(let _=0;_<f.length;_++){const x=f[_],y=s.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);const v=y.index;for(;m!=v;)p[g++]=m++;d[m+x.offset]=m++}for(;m<o;)p[g++]=m++;for(let _=o-1;_>=0;_--)d[_]==-1&&(d[_]=p[--g])}h.setFrame(l,F(c,"time",0),d)}n.push(h)}if(t.events){const h=new sd(t.events.length);let o=0;for(let l=0;l<t.events.length;l++,o++){const u=t.events[l],c=s.findEvent(u.name);if(!c)throw new Error(`Event not found: ${u.name}`);const d=new F0(B.toSinglePrecision(F(u,"time",0)),c);d.intValue=F(u,"int",c.intValue),d.floatValue=F(u,"float",c.floatValue),d.stringValue=F(u,"string",c.stringValue),d.data.audioPath&&(d.volume=F(u,"volume",1),d.balance=F(u,"balance",0)),h.setFrame(o,d)}n.push(h)}let a=0;for(let h=0,o=n.length;h<o;h++)a=Math.max(a,n[h].getDuration());if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new td(e,n,a))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}}class QC{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}}function ci(r,t,e,s){let i=r[0],n=F(i,"time",0),a=F(i,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=r[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;i.curve&&(h=pt(i.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,i=l}}function ld(r,t,e,s,i,n){let a=r[0],h=F(a,"time",0),o=F(a,e,i)*n,l=F(a,s,i)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=r[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,i)*n,m=F(d,s,i)*n,g=a.curve;g&&(u=pt(g,t,u,c,0,h,f,o,p,n),u=pt(g,t,u,c,1,h,f,l,m,n)),h=f,o=p,l=m,a=d}}function pt(r,t,e,s,i,n,a,h,o,l){if(r=="stepped")return t.setStepped(s),e;const u=i<<2,c=r[u],d=r[u+1]*l,f=r[u+2],p=r[u+3]*l;return t.setBezier(e,s,i,n,h,c,d,f,p,a,o),e+1}function F(r,t,e){return r[t]!==void 0?r[t]:e}var ar=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.VER37=37]="VER37",r[r.VER38=38]="VER38",r[r.VER40=40]="VER40",r[r.VER41=41]="VER41",r))(ar||{});function hd(r){const t=r.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:e<37?37:0}class JC{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,i=this.readVersionOldFormat(e),n=hd(i);if(n===ar.VER38&&(s=new le(new V_(t))),i=this.readVersionNewFormat(e),n=hd(i),(n===ar.VER40||n===ar.VER41)&&(s=new U0(new R0(t))),!s){const a=`Unsupported version of spine model ${i}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new yl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new yl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class tI{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,i=hd(s);let n=null;if(i===ar.VER37&&(n=new IC(new yC(t))),i===ar.VER38&&(n=new JS(new V_(t))),(i===ar.VER40||i===ar.VER41)&&(n=new ad(new R0(t))),!n){const a=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(a)}return n.scale=this.scale,n.readSkeletonData(e)}}class eI extends rC{createBinaryParser(){return new JC}createJsonParser(){return new tI}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new eI().installLoader();class sI extends eC{constructor(t,e){const{followPointList:s,visible:i=!1}=e||{};let n;typeof t=="string"?n=Gi.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=i,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(a=>{a.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(a.boneName),follow:a.follow,onUpdate:a.onUpdate,angleFollow:a.angleFollow||!1,scaleFollow:a.scaleFollow===void 0?!0:a.scaleFollow})})),this._loopFn=this._loop.bind(this),wt.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{s()}}})}addAnimation(t="animation",e=!1,s=0){return new Promise(i=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{i()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){wt.system.remove(this._loopFn),this.destroy({children:!0})}_loop(){if(this.destroyed){wt.system.remove(this._loopFn);return}this.update(wt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,i=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:i,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=i),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,s+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{xt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const iI=(r,t)=>{let e=null,s=!1;return(...i)=>{s||(r(...i),s=!0),e&&clearTimeout(e),e=setTimeout(()=>{s=!1},t)}},Mi=(r,t,e,s={})=>{const{once:i=!1,debounce:n=!1,debounceTime:a=1e3}=s;r.cursor="pointer",r.eventMode="static";const h=l=>{l.button!==2&&e(l)},o=n?iI(h,a):h;return i?r.once(t,o):r.on(t,o),()=>{r.off(t,o)}};class rI extends It{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:i,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=i,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),i&&(this._btn.tint=i),Mi(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mi(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,i&&(this._btn.tint=i))})}toggleTexture(t,e){this._texture=t,this._hoverTexture=e,this._btn._texture=e}setDisabled(t){this.disabled=t,this._btn.tint=t?this._disabledColor:this._tintColor||"#fff",this._btn.texture=this._texture}}class nI extends Ao{constructor(t){const{sprite:e,onClick:s}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Mi(this,"pointerenter",()=>{xt.to(e,{duration:.25,rotation:180*(Math.PI/180)})});const i=Mi(this,"pointerleave",()=>{e.alpha=1,xt.to(e,{duration:.25,rotation:0})});Mi(this,"pointerdown",()=>{e.alpha=.5}),Mi(this,"pointerup",()=>{s(),i()})}}class oI extends It{constructor(t){super(),this._maskUI=new fl({bgColor:"#000",width:1080,height:1920}),this.addChild(this._maskUI),this._maskUI.alpha=0,this._maskUI.eventMode="static",this._drawerContainer=t,this.addChild(this._drawerContainer),this._drawerContainer.y=this._maskUI.height,xt.to(this._maskUI,{duration:.25,alpha:.5}),xt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){xt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await xt.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class aI extends It{constructor(t){super(),this.COLLECT_TIME=5*1e3,this._nowTime=0,this._lastTime=0,this._drawCount=0,this._maxDrawCount=0,this._tempMaxDrawCount=0,this._lastCollectTime=0,this._containerWidth=590,this._containerHeight=50,this.pivot.x=this._containerWidth/2,this._resize(window.innerWidth,window.innerHeight),window.addEventListener("resize",()=>{this._resize(window.innerWidth,window.innerHeight)}),this._bg=new fl({width:this._containerWidth,height:this._containerHeight,bgColor:"#000",alpha:.75}),this.addChild(this._bg);const e=new It;this.addChild(e),e.x=25,e.y=this._containerHeight/2,this._fpsText=new cd("FPS"),e.addChild(this._fpsText),this._drawCallText=new cd("Draw Call"),e.addChild(this._drawCallText),this._drawCallText.x=125,this._maxDrawCallText=new cd("Max Draw Call"),e.addChild(this._maxDrawCallText),this._maxDrawCallText.x=320,this._renderer=t.renderer,this._drawElements=this._renderer.gl.drawElements,this.init()}init(){this._renderer.gl.drawElements=(...t)=>{this._drawElements.call(this._renderer.gl,...t),this._drawCount++},wt.shared.add(()=>{const t=wt.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTextInfo("fps",Number(Math.floor(t).toFixed(0))),this._lastTime=this._nowTime),this._nowTime-this._lastCollectTime<this.COLLECT_TIME?this._tempMaxDrawCount<this._drawCount&&(this._tempMaxDrawCount=this._drawCount):(this._maxDrawCount=this._tempMaxDrawCount,this._tempMaxDrawCount=0,this._lastCollectTime=this._nowTime),this._setTextInfo("drawCall",this._drawCount),this._setTextInfo("maxDrawCall",this._maxDrawCount),this._drawCount=0},Vi.UTILITY)}_setTextInfo(t,e){const i={fps:this._fpsText,drawCall:this._drawCallText,maxDrawCall:this._maxDrawCallText}[t];i.updateValue(e),t==="fps"?i.updateColor(this.getFpsColor(e)):i.updateColor(this.getDrawCallColor(e))}getFpsColor(t){let e="#00ff04";return t<30&&(e="#ffd20a"),t<20&&(e="#ff000d"),e}getDrawCallColor(t){let e="#00ff04";return t>=75&&(e="#ffd20a"),t>=100&&(e="#ff000d"),e}_resize(t,e){t>e?this.x=1920/2:this.x=1080/2}}class cd extends It{constructor(t,e=26){super();const s=new _l({text:t,fontSize:e,fontWeight:"bold"});this.addChild(s),s.anchor.y=.5,this._valueText=new _l({text:"0",fontSize:e,fontWeight:"bold"}),this.addChild(this._valueText),this._valueText.anchor.y=.5,this._valueText.x=s.width+10}updateColor(t){this._valueText.style.fill=t}updateValue(t){this._valueText.text=t}}class lI extends It{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:i,barHeight:n,bgTexture:a,barTexture:h}=t,o=new qe(a);this.addChild(o),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-i)/2,this._progressBar.y=(s-n)/2;const l=new hs;l.beginFill(16777215),l.drawRect(0,0,0,this._progressBar.height),l.endFill(),this._progressBar.addChild(l),this._progressBar.mask=l,this._maskGraphics=l}setProgress(t){const e=Math.max(0,Math.min(1,t));this._maskGraphics.clear(),this._maskGraphics.beginFill(16777215),this._maskGraphics.drawRect(0,0,this._progressBar.width*e,this._progressBar.height),this._maskGraphics.endFill()}}class hI extends Ao{constructor(t){const{width:e,height:s,scrollContent:i,bottomMargin:n=50}=t;if(super(e,s),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=i,this._content=new It,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new qe;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new hs,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,s),this._maskGraphics.endFill(),this.mask=this._maskGraphics,this.eventMode="static",this.on("pointerdown",this._onDragStart,this),this.on("pointermove",this._onDragMove,this),this.on("pointerup",this._onDragEnd,this),this.on("pointerupoutside",this._onDragEnd,this),this.on("wheel",this._onWheelScroll,this)}setDimensions(t,e){this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,t,e),this._maskGraphics.endFill(),this.setSize(t,e)}scrollToTop(){xt.killTweensOf(this._content),this._content.y=0}addContent(t){this._scrollContent.addChild(t)}_onDragStart(t){if(this._content.height<=this._maskGraphics.height)return;const e=t.getLocalPosition(this);this._startY=e.y-this._content.y,this._isDragging=!0,this._velocity=0,this._startTime=Date.now(),this._startPosition=this._content.y,xt.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const s=t.getLocalPosition(this).y-this._startY;this._content.y=s}}_onDragEnd(){this._isDragging=!1;const e=Date.now()-this._startTime;e<250?(this._velocity=(this._content.y-this._startPosition)/e,this._applyInertia()):this._velocity=0,this._limitScrollRange()}_onWheelScroll(t){if(this._content.height<=this._maskGraphics.height)return;let e=this._content.y-t.deltaY*(this._scrollSpeed/100);e>0?e=0:Math.abs(e)>=this._content.height-this._maskGraphics.height&&(e=-(this._content.height-this._maskGraphics.height)),xt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){xt.to(this._content,{y:this._content.y+this._velocity*250,duration:.5,ease:"power1.out",onUpdate:this._limitScrollRange.bind(this)})}_limitScrollRange(){if(this._content.y>0)xt.to(this._content,{duration:.75,y:0,ease:"elastic.out"});else if(Math.abs(this._content.y)>=this._content.height-this._maskGraphics.height)if(this._content.height>this._maskGraphics.height){const t=-(this._content.height-this._maskGraphics.height);xt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else xt.to(this._content,{duration:.25,y:0})}}class cI extends Ao{constructor(t){const{width:e,height:s,content:i,slideCallback:n,scrollCallback:a,pageNum:h,pageHeight:o}=t;super(e,s),this._currentIndex=0,this._scrollHeight=0,this._slideHeight=0,this._startY=0,this._offsetY=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1;const l=new hs;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=o,this._slideArea=i,this._slideCallback=n,this._scrollCallback=a,this._pageNum=h-1,this.addChild(this._slideArea),this._slideArea.x=e/2,this._slideArea.y=this._scrollHeight/2,this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}updatePosition(t,e){this._slideArea.y=t,this._currentIndex=e}slideTo(t){var e;t<0?(xt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var s;(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var s;(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:.1,onUpdate:()=>{var s;(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}})),(e=this._slideCallback)==null||e.call(this,this._currentIndex)}setDepth(t,e,s=0){const i=e-s,n=Math.floor(Math.abs(i)/this._slideHeight),a=Math.abs(i)%this._slideHeight/this._slideHeight,h=n-1,o=n+1,l=n+2,u=t[n];if(u.alpha=this.lerp(.5,1,1-a),u.scale.y=this.lerp(.85,1,1-a),o<t.length){const c=t[o];c.alpha=this.lerp(.5,1,a),c.scale.y=this.lerp(.85,1,a)}if(l<t.length){const c=t[l];c.alpha=this.lerp(.1,.5,a)}if(h>=0){const c=t[h];c.alpha=this.lerp(.1,.5,1-a)}}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var a;if(!this._isDragging)return;const e=t.pageY-this._startY;let s=this._offsetY+e;const i=this._scrollHeight/2,n=-this._pageNum*this._slideHeight+this._scrollHeight/2;s>i&&(s=i),s<n&&(s=n),this._slideArea.y=s,(a=this._scrollCallback)==null||a.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startY-t.pageY,i=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||i>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}lerp(t,e,s){return t*(1-s)+e*s}}const X0=r=>{const t=new hs;return t.beginFill(16777215),t.drawRect(0,0,r.width,r.height),t.endFill(),r.addChild(t),r.mask=t,t};class uI extends Ao{constructor(t){const{width:e,height:s,slideList:i,slideCallback:n,enableDepth:a=!1,depthAlpha:h=.5,depthScale:o=.5}=t;super(e,s),this._currentIndex=0,this._slideWidth=0,this._slideHeight=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,X0(this),this._slideArea=new It,this._slideWidth=e,this._slideHeight=s,this._slideList=i,this._enableDepth=a,this._depthAlpha=h,this._depthScale=o,this.slideCallback=n,this._pageNum=i.length-1,this._slideList.forEach((l,u)=>{this._slideArea.addChild(l),l.x=u*e+this._slideWidth/2,l.y=this._slideHeight/2,l.pivot.set(this._slideWidth/2,this._slideHeight/2)}),this.addChild(this._slideArea),this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}prev(){this._slideTo(this._currentIndex-1)}next(){this._slideTo(this._currentIndex+1)}_slideTo(t){t<0?(xt.to(this._slideArea,{x:0,duration:.25,onUpdate:()=>{this._setDepth()}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5,onUpdate:()=>{this._setDepth()}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25,onUpdate:()=>{this._setDepth()}})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){if(!this._isDragging)return;const e=t.pageX-this._startX;this._slideArea.x=this._offsetX+e,this._setDepth()}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,i=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||i>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}_setDepth(){if(!this._enableDepth)return;const t=this._slideArea.x,e=Math.floor(Math.abs(t)/this._slideWidth),s=Math.abs(t)%this._slideWidth/this._slideWidth,i=e-1,n=e+1,a=this._slideList[e];if(a.alpha=this.lerp(this._depthAlpha,1,1-s),a.scale.set(this.lerp(this._depthScale,1,1-s)),n<this._slideList.length){const h=this._slideList[n];h.alpha=this.lerp(this._depthAlpha,1,s),h.scale.set(this.lerp(this._depthScale,1,s))}if(i>=0){const h=this._slideList[i];h.alpha=this.lerp(this._depthAlpha,1,1-s),h.scale.set(this.lerp(this._depthScale,1,1-s))}}lerp(t,e,s){return t*(1-s)+e*s}}class dI{constructor(t,e){this._currentIndex=0,this._numsLength=0,this._isDown=!1,this._onChange=e,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}class fI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:i,onDisabled:n}=t;this._onAmountIndex=i,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new dI(s,a=>{this._onAmountIndex(a),this.minMaxUpdateIndex(a)}),this.minMaxUpdateIndex(e),this._baseNumSteper.updateIndex(e)}min(){this.minMaxUpdateIndex(0),this._onAmountIndex(0)}max(){const t=this._betAmountListLength-1;this.minMaxUpdateIndex(t),this._onAmountIndex(t)}sub(){this._baseNumSteper.down("sub")}add(){this._baseNumSteper.down("add")}minMaxUpdateIndex(t){t===0?this._onDisabled("min"):t===this._betAmountListLength-1?this._onDisabled("max"):this._onDisabled(),this._baseNumSteper.updateIndex(t)}}const $0=(r,t,e)=>{const s=t/r.width*r.scale.x,i=e?e/r.height*r.scale.y:s,n=Math.min(s,i);r.scale.set(n>1?1:n)};class pI extends It{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:i=100,fontColor:n="#fff",firstColumnFontColor:a="#fff",fontSize:h=30,lineWidth:o=2,lineColor:l="#5b5b5b",outsideBorder:u=!0,fontBold:c=!0}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=i,this._fontColor=n,this._fontSize=h,this._lineWidth=o,this._lineColor=l,this._outsideBorder=u,this._fontBold=c,this._firstColumnFontColor=a,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new hs;s.lineStyle(this._lineWidth,this._lineColor),this._outsideBorder&&s.drawRect(0,0,t,e);for(let i=1;i<this._rows;i++)s.moveTo(0,i*this._cellHeight),s.lineTo(t,i*this._cellHeight);for(let i=1;i<this._cols;i++)s.moveTo(i*this._cellWidth,0),s.lineTo(i*this._cellWidth,e);this.addChild(s)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const s=this._data[t][e];this._createNumberText(s,e,t)}}_createNumberText(t,e,s){const i=new za(t.toString(),{_fontSize:this._fontSize,fill:e===0?this._firstColumnFontColor:this._fontColor,fontWeight:this._fontBold?"bold":"normal"}),n=e*this._cellWidth+this._cellWidth/2,a=s*this._cellHeight+this._cellHeight/2;this.addChild(i),i.anchor.set(.5),i.position.set(n,a),$0(i,this._cellWidth*.9)}}var ud={};/*!
1169
+ */class ri{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:g_(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let i;const{value:n,time:a}=s[0],h=i=new ri(typeof n=="string"?ml(n):n,a,t.ease);if(s.length>2||s.length===2&&s[1].value!==n)for(let o=1;o<s.length;++o){const{value:l,time:u}=s[o];i.next=new ri(typeof l=="string"?ml(l):l,u),i=i.next}return h.isStepped=!!t.isStepped,h}const e=new ri(typeof t.start=="string"?ml(t.start):t.start,0);return t.end!==t.start&&(e.next=new ri(typeof t.end=="string"?ml(t.end):t.end,1)),e}}let So=q.from;const ni=Math.PI/180;function Ai(r,t){if(!r)return;const e=Math.sin(r),s=Math.cos(r),i=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=i,t.y=n}function pl(r,t,e){return r<<16|t<<8|e}function p_(r){return Math.sqrt(r.x*r.x+r.y*r.y)}function SS(r){const t=1/p_(r);r.x*=t,r.y*=t}function m_(r,t){r.x*=t,r.y*=t}function ml(r,t){t||(t={}),r.charAt(0)==="#"?r=r.substr(1):r.indexOf("0x")===0&&(r=r.substr(2));let e;return r.length===8&&(e=r.substr(0,2),r=r.substr(2)),t.r=parseInt(r.substr(0,2),16),t.g=parseInt(r.substr(2,2),16),t.b=parseInt(r.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function g_(r){const t=r.length,e=1/t;return function(s){const i=t*s|0,n=(s-i*e)*t,a=r[i]||r[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function CS(r){return r?(r=r.toUpperCase().replace(/ /g,"_"),W[r]||W.NORMAL):W.NORMAL}class uu extends qe{constructor(t){super(),this.prevChild=this.nextChild=null,this.emitter=t,this.config={},this.anchor.x=this.anchor.y=.5,this.maxLife=0,this.age=0,this.agePercent=0,this.oneOverLife=0,this.next=null,this.prev=null,this.init=this.init,this.kill=this.kill}init(t){this.maxLife=t,this.age=this.agePercent=0,this.rotation=0,this.position.x=this.position.y=0,this.scale.x=this.scale.y=1,this.tint=16777215,this.alpha=1,this.oneOverLife=1/this.maxLife,this.visible=!0}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=this.next=this.prev=null,super.destroy()}}var kt;(function(r){r[r.Spawn=0]="Spawn",r[r.Normal=2]="Normal",r[r.Late=5]="Late"})(kt||(kt={}));const du=wt.shared,Vr=Symbol("Position particle per emitter position");class Et{constructor(t,e){this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],this.minLifetime=0,this.maxLifetime=0,this.customEase=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=new st,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new st,this._prevEmitterPos=new st,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._autoUpdate=!1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=t,e&&this.init(e),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}static registerBehavior(t){Et.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){typeof t=="number"&&t>0?this._frequency=t:this._frequency=1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase=typeof t.ease=="function"?t.ease:g_(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance=typeof t.spawnChance=="number"&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=t.emit===void 0?!0:!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map(s=>{const i=Et.knownBehaviors[s.type];return i?new i(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Vr),e.sort((s,i)=>s===Vr?i.order===kt.Spawn?1:-1:i===Vr?s.order===kt.Spawn?-1:1:s.order-i.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Vr&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Vr&&s.recycleParticle)}getBehavior(t){return Et.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof Et.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new uu(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let s=0;s<this.recycleBehaviors.length;++s)this.recycleBehaviors[s].recycleParticle(t,!e);t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next),t===this._activeParticlesLast&&(this._activeParticlesLast=t.prev),t===this._activeParticlesFirst&&(this._activeParticlesFirst=t.next),t.prev=null,t.next=this._poolFirst,this._poolFirst=t,t.parent&&t.parent.removeChild(t),--this.particleCount}rotate(t){if(this.rotation===t)return;const e=t-this.rotation;this.rotation=t,Ai(e,this.spawnPos),this._posChanged=!0}updateSpawnPos(t,e){this._posChanged=!0,this.spawnPos.x=t,this.spawnPos.y=e}updateOwnerPos(t,e){this._posChanged=!0,this.ownerPos.x=t,this.ownerPos.y=e}resetPositionTracking(){this._prevPosIsValid=!1}get emit(){return this._emit}set emit(t){this._emit=!!t,this._emitterLife=this.emitterLifetime}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){this._autoUpdate&&!t?du.remove(this.update,this):!this._autoUpdate&&t&&du.add(this.update,this),this._autoUpdate=!!t}playOnceAndDestroy(t){this.autoUpdate=!0,this.emit=!0,this._destroyWhenComplete=!0,this._completeCallback=t}playOnce(t){this.emit=!0,this._completeCallback=t}update(t){if(this._autoUpdate&&(t=du.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,h;a;a=h)if(h=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let o=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?o=this.customEase(o,0,1,1):o=this.customEase(o)),a.agePercent=o;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,s;this._prevPosIsValid&&(e=this._prevEmitterPos.x,s=this._prevEmitterPos.y);const i=this.ownerPos.x+this.spawnPos.x,n=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let a,h;if(this._prevPosIsValid&&this._posChanged){const u=1+this._spawnTimer/t;a=(i-e)*u+e,h=(n-s)*u+s}else a=i,h=n;let o=null,l=null;for(let u=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),c=0;c<u;++c){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let d;if(this.minLifetime===this.maxLifetime?d=this.minLifetime:d=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=d)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new uu(this),f.init(d),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),o?(l.next=f,f.prev=l,l=f):l=o=f,++this.particleCount}if(o){this._activeParticlesLast?(this._activeParticlesLast.next=o,o.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=o,this._activeParticlesLast=l);for(let u=0;u<this.initBehaviors.length;++u){const c=this.initBehaviors[u];if(c===Vr)for(let d=o,f;d;d=f){f=d.next,this.rotation!==0&&(Ai(this.rotation,d.position),d.rotation+=this.rotation),d.position.x+=a,d.position.y+=h,d.age+=-this._spawnTimer;let p=d.age*d.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),d.agePercent=p}else c.initParticles(o)}for(let u=o,c;u;u=c){c=u.next;for(let d=0;d<this.updateBehaviors.length;++d)if(this.updateBehaviors[d].updateParticle(u,-this._spawnTimer)){this.recycle(u);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=i,this._prevEmitterPos.y=n,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const a=this._completeCallback;this._completeCallback=null,a()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let s=null,i=null;for(let n=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),a=0;a<n;++a){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let h;this._poolFirst?(h=this._poolFirst,this._poolFirst=this._poolFirst.next,h.next=null):h=new uu(this);let o;this.minLifetime===this.maxLifetime?o=this.minLifetime:o=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,h.init(o),this.addAtBack?this._parent.addChildAt(h,0):this._parent.addChild(h),s?(i.next=h,h.prev=i,i=h):i=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=i):(this._activeParticlesFirst=s,this._activeParticlesLast=i);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Vr)for(let h=s,o;h;h=o)o=h.next,this.rotation!==0&&(Ai(this.rotation,h.position),h.rotation+=this.rotation),h.position.x+=t,h.position.y+=e;else a.initParticles(s)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){this.autoUpdate=!1,this.cleanup();let t;for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}Et.knownBehaviors={};class fu{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t){t.x=Math.random()*this.w+this.x,t.y=Math.random()*this.h+this.y}}fu.type="rect",fu.editorConfig=null;class gl{constructor(t){this.x=t.x||0,this.y=t.y||0,this.radius=t.radius,this.innerRadius=t.innerRadius||0,this.rotation=!!t.affectRotation}getRandPos(t){this.innerRadius!==this.radius?t.x=Math.random()*(this.radius-this.innerRadius)+this.innerRadius:t.x=this.radius,t.y=0;const e=Math.random()*Math.PI*2;this.rotation&&(t.rotation+=e),Ai(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}gl.type="torus",gl.editorConfig=null;class pu{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(!t||!t.length)this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});else if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const s=t[e];let i=s[0];for(let n=1;n<s.length;++n){const a=s[n];this.segments.push({p1:i,p2:a,l:0}),i=a}}else{let e=t[0];for(let s=1;s<t.length;++s){const i=t[s];this.segments.push({p1:e,p2:i,l:0}),e=i}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:i}=this.segments[e],n=Math.sqrt((i.x-s.x)*(i.x-s.x)+(i.y-s.y)*(i.y-s.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let s,i;if(this.segments.length===1)s=this.segments[0],i=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],i=h===0?e:e-this.countingLengths[h-1];break}i/=s.l||1;const{p1:n,p2:a}=s;t.x=n.x+i*(a.x-n.x),t.y=n.y+i*(a.y-n.y)}}pu.type="polygonalChain",pu.editorConfig=null;class mu{constructor(t){var e;this.order=kt.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=(e=t.maxSpeed)!==null&&e!==void 0?e:0}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ai(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,i=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const a=p_(s);a>this.maxSpeed&&m_(s,this.maxSpeed/a)}t.x+=(i+s.x)/2*e,t.y+=(n+s.y)/2*e,this.rotate&&(t.rotation=Math.atan2(s.y,s.x))}}mu.type="moveAcceleration",mu.editorConfig=null;function IS(r){return this.ease&&(r=this.ease(r)),(this.first.next.value-this.first.value)*r+this.first.value}function PS(r){this.ease&&(r=this.ease(r));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*r+t.r,i=(e.g-t.g)*r+t.g,n=(e.b-t.b)*r+t.b;return pl(s,i,n)}function RS(r){this.ease&&(r=this.ease(r));let t=this.first,e=t.next;for(;r>e.time;)t=e,e=e.next;return r=(r-t.time)/(e.time-t.time),(e.value-t.value)*r+t.value}function MS(r){this.ease&&(r=this.ease(r));let t=this.first,e=t.next;for(;r>e.time;)t=e,e=e.next;r=(r-t.time)/(e.time-t.time);const s=t.value,i=e.value,n=(i.r-s.r)*r+s.r,a=(i.g-s.g)*r+s.g,h=(i.b-s.b)*r+s.b;return pl(n,a,h)}function FS(r){this.ease&&(r=this.ease(r));let t=this.first;for(;t.next&&r>t.next.time;)t=t.next;return t.value}function kS(r){this.ease&&(r=this.ease(r));let t=this.first;for(;t.next&&r>t.next.time;)t=t.next;const e=t.value;return pl(e.r,e.g,e.b)}class Co{constructor(t=!1){this.first=null,this.isColor=!!t,this.interpolate=null,this.ease=null}reset(t){this.first=t,t.next&&t.next.time>=1?this.interpolate=this.isColor?PS:IS:t.isStepped?this.interpolate=this.isColor?kS:FS:this.interpolate=this.isColor?MS:RS,this.ease=this.first.ease}}class gu{constructor(t){this.order=kt.Normal,this.list=new Co(!1),this.list.reset(ri.createList(t.alpha))}initParticles(t){let e=t;for(;e;)e.alpha=this.list.first.value,e=e.next}updateParticle(t){t.alpha=this.list.interpolate(t.agePercent)}}gu.type="alpha",gu.editorConfig=null;class _u{constructor(t){this.order=kt.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}_u.type="alphaStatic",_u.editorConfig=null;function __(r){const t=[];for(let e=0;e<r.length;++e){let s=r[e];if(typeof s=="string")t.push(So(s));else if(s instanceof q)t.push(s);else{let i=s.count||1;for(typeof s.texture=="string"?s=So(s.texture):s=s.texture;i>0;--i)t.push(s)}}return t}class yu{constructor(t){this.order=kt.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const s=t.anims[e],i=__(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,a={textures:i,duration:n>0?i.length/n:0,framerate:n,loop:n>0?!!s.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.anims.length),i=e.config.anim=this.anims[s];e.texture=i.textures[0],e.config.animElapsed=0,i.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}}updateParticle(t,e){const s=t.config,i=s.anim;s.animElapsed+=e,s.animElapsed>=s.animDuration&&(s.anim.loop?s.animElapsed=s.animElapsed%s.animDuration:s.animElapsed=s.animDuration-1e-6);const n=s.animElapsed*s.animFramerate+1e-7|0;t.texture=i.textures[n]||i.textures[i.textures.length-1]||q.EMPTY}}yu.type="animatedRandom",yu.editorConfig=null;class xu{constructor(t){this.order=kt.Normal;const e=t.anim,s=__(e.textures),i=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:i>0?s.length/i:0,framerate:i,loop:i>0?!!e.loop:!1}}initParticles(t){let e=t;const s=this.anim;for(;e;)e.texture=s.textures[0],e.config.animElapsed=0,s.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=s.textures.length/e.maxLife):(e.config.animDuration=s.duration,e.config.animFramerate=s.framerate),e=e.next}updateParticle(t,e){const s=this.anim,i=t.config;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(s.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const n=i.animElapsed*i.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}xu.type="animatedSingle",xu.editorConfig=null;class vu{constructor(t){this.order=kt.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=CS(this.value),e=e.next}}vu.type="blendMode",vu.editorConfig=null;class bu{constructor(t){this.order=kt.Spawn,this.spacing=t.spacing*ni,this.start=t.start*ni,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let i;this.spacing?i=this.start+this.spacing*e:i=Math.random()*Math.PI*2,s.rotation=i,this.distance&&(s.position.x=this.distance,Ai(i,s.position)),s=s.next,++e}}}bu.type="spawnBurst",bu.editorConfig=null;class wu{constructor(t){this.order=kt.Normal,this.list=new Co(!0),this.list.reset(ri.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,i=pl(s.r,s.g,s.b);for(;e;)e.tint=i,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}wu.type="color",wu.editorConfig=null;class Eu{constructor(t){this.order=kt.Normal;let e=t.color;e.charAt(0)==="#"?e=e.substr(1):e.indexOf("0x")===0&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}Eu.type="colorStatic",Eu.editorConfig=null;class Tu{constructor(t){this.order=kt.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}Tu.type="textureOrdered",Tu.editorConfig=null;const In=new st,y_=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2","abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","cos","cosh","exp","expm1","floor","fround","hypot","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh"],BS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(y_).join("|"),"g");function DS(r){const t=r.match(BS);for(let e=t.length-1;e>=0;--e)y_.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return r=t.join(""),new Function("x",`return ${r};`)}class Au{constructor(t){var e;if(this.order=kt.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=DS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Co(!1),this.list.reset(ri.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new st(e.x,e.y),e.config.movement=0;const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=s*e,In.x=t.config.movement,In.y=this.path(In.x),Ai(t.config.initRotation,In),t.position.x=t.config.initPosition.x+In.x,t.position.y=t.config.initPosition.y+In.y}}Au.type="movePath",Au.editorConfig=null;class Su{constructor(){this.order=kt.Spawn}initParticles(t){}}Su.type="spawnPoint",Su.editorConfig=null;class Cu{constructor(t){this.order=kt.Normal,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[s],e=e.next}}}Cu.type="textureRandom",Cu.editorConfig=null;class Iu{constructor(t){this.order=kt.Normal,this.minStart=t.minStart*ni,this.maxStart=t.maxStart*ni,this.minSpeed=t.minSpeed*ni,this.maxSpeed=t.maxSpeed*ni,this.accel=t.accel*ni}initParticles(t){let e=t;for(;e;)this.minStart===this.maxStart?e.rotation+=this.maxStart:e.rotation+=Math.random()*(this.maxStart-this.minStart)+this.minStart,e.config.rotSpeed=Math.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel){const s=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+s)/2*e}else t.rotation+=t.config.rotSpeed*e}}Iu.type="rotation",Iu.editorConfig=null;class Pu{constructor(t){this.order=kt.Normal,this.min=t.min*ni,this.max=t.max*ni}initParticles(t){let e=t;for(;e;)this.min===this.max?e.rotation+=this.max:e.rotation+=Math.random()*(this.max-this.min)+this.min,e=e.next}}Pu.type="rotationStatic",Pu.editorConfig=null;class Ru{constructor(t){this.order=kt.Late+1,this.rotation=(t.rotation||0)*ni}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Ru.type="noRotation",Ru.editorConfig=null;class Mu{constructor(t){var e;this.order=kt.Normal,this.list=new Co(!1),this.list.reset(ri.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=s,e.scale.x=e.scale.y=this.list.first.value*s,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Mu.type="scale",Mu.editorConfig=null;class Fu{constructor(t){this.order=kt.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=s,e=e.next}}}Fu.type="scaleStatic",Fu.editorConfig=null;class Cs{constructor(t){this.order=kt.Spawn;const e=Cs.shapes[t.type];if(!e)throw new Error(`No shape found with type '${t.type}'`);this.shape=new e(t.data)}static registerShape(t,e){Cs.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Cs.type="spawnShape",Cs.editorConfig=null,Cs.shapes={},Cs.registerShape(pu),Cs.registerShape(fu),Cs.registerShape(gl),Cs.registerShape(gl,"circle");class ku{constructor(t){this.order=kt.Normal,this.texture=typeof t.texture=="string"?So(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}ku.type="textureSingle",ku.editorConfig=null;class Bu{constructor(t){var e;this.order=kt.Late,this.list=new Co(!1),this.list.reset(ri.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e.config.velocity?e.config.velocity.set(this.list.first.value*s,0):e.config.velocity=new st(this.list.first.value*s,0),Ai(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,i=t.config.velocity;SS(i),m_(i,s),t.x+=i.x*e,t.y+=i.y*e}}Bu.type="moveSpeed",Bu.editorConfig=null;class Du{constructor(t){this.order=kt.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ai(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity;t.x+=s.x*e,t.y+=s.y*e}}Du.type="moveSpeedStatic",Du.editorConfig=null,Et.registerBehavior(mu),Et.registerBehavior(gu),Et.registerBehavior(_u),Et.registerBehavior(yu),Et.registerBehavior(xu),Et.registerBehavior(vu),Et.registerBehavior(bu),Et.registerBehavior(wu),Et.registerBehavior(Eu),Et.registerBehavior(Tu),Et.registerBehavior(Au),Et.registerBehavior(Su),Et.registerBehavior(Cu),Et.registerBehavior(Iu),Et.registerBehavior(Pu),Et.registerBehavior(Ru),Et.registerBehavior(Mu),Et.registerBehavior(Fu),Et.registerBehavior(Cs),Et.registerBehavior(ku),Et.registerBehavior(Bu),Et.registerBehavior(Du);class _l extends za{constructor(t){const{text:e,fontSize:s=36,fontColor:i=16777215,stroke:n,strokeColor:a,strokeThickness:h,fontFamily:o="Arial",fontWeight:l="normal",wordWrap:u=!1,wordWrapWidth:c=100,lineHeight:d=1.25,align:f="left",indent:p=0,shadow:m}=t,g=new vi({fontSize:s,wordWrap:u,wordWrapWidth:c,fontWeight:l,lineHeight:d*s,breakWords:u,fill:i,align:f,fontFamily:o,stroke:n?a:"transparent",strokeThickness:n?h:0,lineJoin:"round"});m&&(g.dropShadow=!0,g.dropShadowColor=m[0],g.dropShadowAngle=m[1]*(Math.PI/180),g.dropShadowBlur=m[2],g.dropShadowDistance=m[3]),super(e,g),this.position.x=p*s}}class OS extends It{constructor(t){super();const{start:e,control:s,end:i,json:n,duration:a,ease:h="power1.out",showControl:o=!1,loop:l=!1}=t;this._particleContainer=new BT,this.addChild(this._particleContainer);const u=new Et(this._particleContainer,n),c=this._createBezierPoints([e,...s,i],100,o),d={pathThrough:0};xt.to(d,{duration:a,pathThrough:c.length-1,repeat:l?-1:0,ease:h,onStart:()=>{u.emit=!0},onUpdate:()=>{const p=Math.floor(d.pathThrough),m=c[p];u.updateOwnerPos(m.x,m.y)},onComplete:()=>{xt.to(this,{alpha:0,duration:.5,onComplete:()=>{u.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new wt;f.add(()=>{u.update(1/75)}),f.start()}_createBezierPoints(t,e,s){const i=[];s&&t.forEach((n,a)=>{const h=new _l({text:a+1,fontSize:16});h.position.set(n.x,n.y),this.addChild(h)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);i.push(a)}return i}_multiPointBezier(t,e){const s=t.length;let i=0,n=0;const a=[];for(let h=0;h<s;h++)a[h]=this._binomial(s-1,h);for(let h=0;h<s;h++){const o=t[h],l=a[h],u=Math.pow(e,h),c=Math.pow(1-e,s-1-h);i+=o.x*c*u*l,n+=o.y*c*u*l}return{x:i,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let i=1;i<=e;i++)s=s*(t-i+1)/i;return s}}var at=(r=>(r[r.Region=0]="Region",r[r.BoundingBox=1]="BoundingBox",r[r.Mesh=2]="Mesh",r[r.LinkedMesh=3]="LinkedMesh",r[r.Path=4]="Path",r[r.Point=5]="Point",r[r.Clipping=6]="Clipping",r))(at||{});class yl{constructor(t,e=new Array,s=0,i=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return e&128&&(e=this.readByte(),s|=(e&127)<<7,e&128&&(e=this.readByte(),s|=(e&127)<<14,e&128&&(e=this.readByte(),s|=(e&127)<<21,e&128&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(i),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(r=>(r[r.setup=0]="setup",r[r.first=1]="first",r[r.replace=2]="replace",r[r.add=3]="add",r))(S||{}),At=(r=>(r[r.mixIn=0]="mixIn",r[r.mixOut=1]="mixOut",r))(At||{}),ne=(r=>(r[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent",r))(ne||{}),Fe=(r=>(r[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale",r))(Fe||{}),vt=(r=>(r[r.Normal=0]="Normal",r[r.OnlyTranslation=1]="OnlyTranslation",r[r.NoRotationOrReflection=2]="NoRotationOrReflection",r[r.NoScale=3]="NoScale",r[r.NoScaleOrReflection=4]="NoScaleOrReflection",r))(vt||{});function x_(r){switch(r.toLowerCase()){case"nearest":return He.Nearest;case"linear":return He.Linear;case"mipmap":return He.MipMap;case"mipmapnearestnearest":return He.MipMapNearestNearest;case"mipmaplinearnearest":return He.MipMapLinearNearest;case"mipmapnearestlinear":return He.MipMapNearestLinear;case"mipmaplinearlinear":return He.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${r}`)}}var He=(r=>(r[r.Nearest=9728]="Nearest",r[r.Linear=9729]="Linear",r[r.MipMap=9987]="MipMap",r[r.MipMapNearestNearest=9984]="MipMapNearestNearest",r[r.MipMapLinearNearest=9985]="MipMapLinearNearest",r[r.MipMapNearestLinear=9986]="MipMapNearestLinear",r[r.MipMapLinearLinear=9987]="MipMapLinearLinear",r))(He||{}),Ur=(r=>(r[r.MirroredRepeat=33648]="MirroredRepeat",r[r.ClampToEdge=33071]="ClampToEdge",r[r.Repeat=10497]="Repeat",r))(Ur||{});class Ou{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}}class LS{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Lu{constructor(t,e,s){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,s)}addTexture(t,e){const s=this.pages;let i=null;for(let a=0;a<s.length;a++)if(s[a].baseTexture===e.baseTexture){i=s[a];break}if(i===null){i=new v_,i.name="texturePage";const a=e.baseTexture;i.width=a.realWidth,i.height=a.realHeight,i.baseTexture=a,i.minFilter=i.magFilter=He.Nearest,i.uWrap=Ur.ClampToEdge,i.vWrap=Ur.ClampToEdge,s.push(i)}const n=new b_;return n.name=t,n.page=i,n.texture=e,n.index=-1,this.regions.push(n),n}addTextureHash(t,e){for(const s in t)t.hasOwnProperty(s)&&this.addTexture(e&&s.indexOf(".")!==-1?s.substr(0,s.lastIndexOf(".")):s,t[s])}addSpineAtlas(t,e,s){return this.load(t,e,s)}load(t,e,s){if(e==null)throw new Error("textureLoader cannot be null.");const i=new NS(t),n=new Array(4);let a=null;const h={};let o=null;h.size=()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},h.format=()=>{},h.filter=()=>{a.minFilter=x_(n[1]),a.magFilter=x_(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(a.uWrap=Ur.Repeat),n[1].indexOf("y")!=-1&&(a.vWrap=Ur.Repeat)},h.pma=()=>{a.pma=n[1]=="true"};const l={};l.xy=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2])},l.size=()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},l.bounds=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2]),o.width=parseInt(n[3]),o.height=parseInt(n[4])},l.offset=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2])},l.orig=()=>{o.originalWidth=parseInt(n[1]),o.originalHeight=parseInt(n[2])},l.offsets=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2]),o.originalWidth=parseInt(n[3]),o.originalHeight=parseInt(n[4])},l.rotate=()=>{const d=n[1];let f=0;d.toLocaleLowerCase()=="true"?f=6:d.toLocaleLowerCase()=="false"?f=0:f=(720-parseFloat(d))%360/45,o.rotate=f},l.index=()=>{o.index=parseInt(n[1])};let u=i.readLine();for(;u!=null&&u.trim().length==0;)u=i.readLine();for(;!(u==null||u.trim().length==0||i.readEntry(n,u)==0);)u=i.readLine();const c=()=>{for(;;){if(u==null)return s&&s(this);if(u.trim().length==0)a=null,u=i.readLine();else if(a===null){for(a=new v_,a.name=u.trim();i.readEntry(n,u=i.readLine())!=0;){const d=h[n[0]];d&&d()}this.pages.push(a),e(a.name,d=>{if(d===null)return this.pages.splice(this.pages.indexOf(a),1),s&&s(null);a.baseTexture=d,a.pma&&(d.alphaMode=Re.PMA),d.valid||d.setSize(a.width,a.height),a.setFilters(),(!a.width||!a.height)&&(a.width=d.realWidth,a.height=d.realHeight,(!a.width||!a.height)&&console.log(`ERROR spine atlas page ${a.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),c()});break}else{o=new LS;const d=new b_;d.name=u,d.page=a;let f=null,p=null;for(;;){const v=i.readEntry(n,u=i.readLine());if(v==0)break;const b=l[n[0]];if(b)b();else{f==null&&(f=[],p=[]),f.push(n[0]);const w=[];for(let E=0;E<v;E++)w.push(parseInt(n[E+1]));p.push(w)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height);const m=a.baseTexture.resolution;o.x/=m,o.y/=m,o.width/=m,o.height/=m,o.originalWidth/=m,o.originalHeight/=m,o.offsetX/=m,o.offsetY/=m;const g=o.rotate%4!==0,_=new it(o.x,o.y,g?o.height:o.width,g?o.width:o.height),x=new it(0,0,o.originalWidth,o.originalHeight),y=new it(o.offsetX,o.originalHeight-o.height-o.offsetY,o.width,o.height);d.texture=new q(d.page.baseTexture,_,x,y,o.rotate),d.index=o.index,d.texture.updateUvs(),this.regions.push(d)}}};c()}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].baseTexture.dispose()}}class NS{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(e==null||(e=e.trim(),e.length==0))return 0;const s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){const a=e.indexOf(",",n);if(a==-1)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,a-n).trim(),n=a+1,i==4)return 4}}}class v_{constructor(){this.minFilter=He.Nearest,this.magFilter=He.Nearest,this.uWrap=Ur.ClampToEdge,this.vWrap=Ur.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==He.Linear?t.scaleMode=je.LINEAR:this.minFilter==He.Nearest?t.scaleMode=je.NEAREST:(t.mipmap=vs.POW2,e==He.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class b_ extends Ou{}class VS{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class US{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Gr=class{constructor(r=0,t=0,e=0,s=0){this.r=r,this.g=t,this.b=e,this.a=s}set(r,t,e,s){return this.r=r,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(r){return this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this}setFromString(r){return r=r.charAt(0)=="#"?r.substr(1):r,this.r=parseInt(r.substr(0,2),16)/255,this.g=parseInt(r.substr(2,2),16)/255,this.b=parseInt(r.substr(4,2),16)/255,this.a=r.length!=8?1:parseInt(r.substr(6,2),16)/255,this}add(r,t,e,s){return this.r+=r,this.g+=t,this.b+=e,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(r,t){r.r=((t&4278190080)>>>24)/255,r.g=((t&16711680)>>>16)/255,r.b=((t&65280)>>>8)/255,r.a=(t&255)/255}static rgb888ToColor(r,t){r.r=((t&16711680)>>>16)/255,r.g=((t&65280)>>>8)/255,r.b=(t&255)/255}static fromString(r){return new Gr().setFromString(r)}};let X=Gr;X.WHITE=new Gr(1,1,1,1),X.RED=new Gr(1,0,0,1),X.GREEN=new Gr(0,1,0,1),X.BLUE=new Gr(0,0,1,1),X.MAGENTA=new Gr(1,0,1,1);const Si=class{static clamp(r,t,e){return r<t?t:r>e?e:r}static cosDeg(r){return Math.cos(r*Si.degRad)}static sinDeg(r){return Math.sin(r*Si.degRad)}static signum(r){return Math.sign(r)}static toInt(r){return r>0?Math.floor(r):Math.ceil(r)}static cbrt(r){const t=Math.pow(Math.abs(r),.3333333333333333);return r<0?-t:t}static randomTriangular(r,t){return Si.randomTriangularWith(r,t,(r+t)*.5)}static randomTriangularWith(r,t,e){const s=Math.random(),i=t-r;return s<=(e-r)/i?r+Math.sqrt(s*i*(e-r)):t-Math.sqrt((1-s)*i*(t-e))}static isPowerOfTwo(r){return r&&(r&r-1)===0}};let D=Si;D.PI=3.1415927,D.PI2=Si.PI*2,D.radiansToDegrees=180/Si.PI,D.radDeg=Si.radiansToDegrees,D.degreesToRadians=Si.PI/180,D.degRad=Si.degreesToRadians;class GS{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class XS extends GS{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class w_ extends XS{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Pn=class{static arrayCopy(r,t,e,s,i){for(let n=t,a=s;n<t+i;n++,a++)e[a]=r[n]}static arrayFill(r,t,e,s){for(let i=t;i<e;i++)r[i]=s}static setArraySize(r,t,e=0){const s=r.length;if(s==t)return r;if(r.length=t,s<t)for(let i=s;i<t;i++)r[i]=e;return r}static ensureArrayCapacity(r,t,e=0){return r.length>=t?r:Pn.setArraySize(r,t,e)}static newArray(r,t){const e=new Array(r);for(let s=0;s<r;s++)e[s]=t;return e}static newFloatArray(r){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(r);const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(r){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(r);const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(r){return Pn.SUPPORTS_TYPED_ARRAYS?new Float32Array(r):r}static toSinglePrecision(r){return Pn.SUPPORTS_TYPED_ARRAYS?Math.fround(r):r}static webkit602BugfixHelper(r,t){}static contains(r,t,e=!0){for(let s=0;s<r.length;s++)if(r[s]==t)return!0;return!1}static enumValue(r,t){return r[t[0].toUpperCase()+t.slice(1)]}};let B=Pn;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class $S{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class HS{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}}const YS={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},tr=[0,0,0];class WS extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class zS extends kT{constructor(t,e,s,i,n){super(t,e,s,i,n),this.region=null,this.attachment=null}}const E_=class extends It{constructor(r){if(super(),!r)throw new Error("The spineData param is required.");if(typeof r=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=r,this.createSkeleton(r),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],i=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!i)if(i.type===at.Region){const a=i.name,h=this.createSprite(s,i,a);s.currentSprite=h,s.currentSpriteName=a,n.addChild(h)}else if(i.type===at.Mesh){const a=this.createMesh(s,i);s.currentMesh=a,s.currentMeshId=i.id,s.currentMeshName=i.name,n.addChild(a)}else i.type===at.Clipping&&(this.createGraphics(s,i),n.addChild(s.clippingContainer),n.addChild(s.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(r){var t;r!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),r==null||r.registerSpine(this),this._debug=r)}get autoUpdate(){return this._autoUpdate}set autoUpdate(r){r!==this._autoUpdate&&(this._autoUpdate=r,this.updateTransform=r?E_.prototype.autoUpdateTransform:It.prototype.updateTransform)}get tint(){return eo(this.tintRgb)}set tint(r){this.tintRgb=Qf(r,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:YS.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(r){var l;const t=this.delayLimit;if(r>t&&(r=t),this.state.update(r),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let i=null,n=null;s?(i=s.light,n=s.dark):i=this.tintRgb;for(let u=0,c=e.length;u<c;u++){const d=e[u],f=d.getAttachment(),p=this.slotContainers[u];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(d,f);let g=f.region;const _=f.color;switch(f!=null&&f.type){case at.Region:if(p.transform.setFromMatrix(d.bone.matrix),g=f.region,d.currentMesh&&(d.currentMesh.visible=!1,d.currentMesh=null,d.currentMeshId=void 0,d.currentMeshName=void 0),!g){d.currentSprite&&(d.currentSprite.renderable=!1);break}if(!d.currentSpriteName||d.currentSpriteName!==f.name){const v=f.name;if(d.currentSprite&&(d.currentSprite.visible=!1),d.sprites=d.sprites||{},d.sprites[v]!==void 0)d.sprites[v].visible=!0;else{const b=this.createSprite(d,f,v);p.addChild(b)}d.currentSprite=d.sprites[v],d.currentSpriteName=v}d.currentSprite.renderable=!0,d.hackRegion||this.setSpriteRegion(f,d.currentSprite,g),d.currentSprite.color?m=d.currentSprite.color:(tr[0]=i[0]*d.color.r*_.r,tr[1]=i[1]*d.color.g*_.g,tr[2]=i[2]*d.color.b*_.b,d.currentSprite.tint=eo(tr)),d.currentSprite.blendMode=d.blendMode;break;case at.Mesh:if(d.currentSprite){d.currentSprite.visible=!1,d.currentSprite=null,d.currentSpriteName=void 0;const v=new ma;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!g){d.currentMesh&&(d.currentMesh.renderable=!1);break}const y=f.id;if(d.currentMeshId===void 0||d.currentMeshId!==y){const v=y;if(d.currentMesh&&(d.currentMesh.visible=!1),d.meshes=d.meshes||{},d.meshes[v]!==void 0)d.meshes[v].visible=!0;else{const b=this.createMesh(d,f);p.addChild(b)}d.currentMesh=d.meshes[v],d.currentMeshName=f.name,d.currentMeshId=v}d.currentMesh.renderable=!0,f.computeWorldVerticesOld(d,d.currentMesh.vertices),d.currentMesh.color?m=d.currentMesh.color:(tr[0]=i[0]*d.color.r*_.r,tr[1]=i[1]*d.color.g*_.g,tr[2]=i[2]*d.color.b*_.b,d.currentMesh.tint=eo(tr)),d.currentMesh.blendMode=d.blendMode,d.hackRegion||this.setMeshRegion(f,d.currentMesh,g);break;case at.Clipping:d.currentGraphics||(this.createGraphics(d,f),p.addChild(d.clippingContainer),p.addChild(d.currentGraphics)),this.updateGraphics(d,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=d.color.r*_.r,y=d.color.g*_.g,v=d.color.b*_.b;m.setLight(i[0]*x+n[0]*(1-x),i[1]*y+n[1]*(1-y),i[2]*v+n[2]*(1-v)),d.darkColor?(x=d.darkColor.r,y=d.darkColor.g,v=d.darkColor.b):(x=0,y=0,v=0),m.setDark(i[0]*x+n[0]*(1-x),i[1]*y+n[1]*(1-y),i[2]*v+n[2]*(1-v))}p.alpha=d.color.a}const a=this.skeleton.drawOrder;let h=null,o=null;for(let u=0,c=a.length;u<c;u++){const d=e[a[u].data.index],f=this.slotContainers[a[u].data.index];if(o||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),d.currentGraphics&&d.getAttachment())o=d.clippingContainer,h=d.getAttachment(),o.children.length=0,this.children[u]=f,h.endSlot===d.data&&(h.endSlot=null);else if(o){let p=this.tempClipContainers[u];p||(p=this.tempClipContainers[u]=this.newContainer(),p.visible=!1),this.children[u]=p,f.parent=null,o.addChild(f),h.endSlot==d.data&&(o.renderable=!0,o=null,h=null)}else this.children[u]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(r,t,e){t.attachment===r&&t.region===e||(t.region=e,t.attachment=r,t.texture=e.texture,t.rotation=r.rotation*D.degRad,t.position.x=r.x,t.position.y=r.y,t.alpha=r.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=r.scaleX*r.width/e.originalWidth,t.scale.y=-r.scaleY*r.height/e.originalHeight))}setMeshRegion(r,t,e){t.attachment===r&&t.region===e||(t.region=e,t.attachment=r,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(r.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const r=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(r)}It.prototype.updateTransform.call(this)}createSprite(r,t,e){let s=t.region;r.hackAttachment===t&&(s=r.hackRegion);const i=s?s.texture:null,n=this.newSprite(i);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),r.sprites=r.sprites||{},r.sprites[e]=n,n}createMesh(r,t){let e=t.region;r.hackAttachment===t&&(e=r.hackRegion,r.hackAttachment=null,r.hackRegion=null);const s=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),xs.TRIANGLES);return typeof s._canvasPadding<"u"&&(s._canvasPadding=1.5),s.alpha=t.color.a,s.region=t.region,e&&this.setMeshRegion(t,s,e),r.meshes=r.meshes||{},r.meshes[t.id]=s,s}createGraphics(r,t){const e=this.newGraphics(),s=new Ni([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,r.currentGraphics=e,r.clippingContainer=this.newContainer(),r.clippingContainer.mask=r.currentGraphics,e}updateGraphics(r,t){const e=r.currentGraphics.geometry,s=e.graphicsData[0].shape.points,i=t.worldVerticesLength;s.length=i,t.computeWorldVertices(r,0,i,s,0,2),e.invalidate()}hackTextureBySlotIndex(r,t=null,e=null){const s=this.skeleton.slots[r];if(!s)return!1;const i=s.getAttachment();let n=i.region;return t?(n=new Ou,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=i):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(i,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(i,s.currentMesh,n),!0}hackTextureBySlotName(r,t=null,e=null){const s=this.skeleton.findSlotIndex(r);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(r,t,e,s=null){const i=this.skeleton.findSlotIndex(r),n=this.skeleton.getAttachmentByName(r,t);n.region.texture=e;const a=this.skeleton.slots[i];if(!a)return!1;const h=a.getAttachment();if(t===h.name){let o=n.region;return e?(o=new Ou,o.texture=e,o.size=s,a.hackRegion=o,a.hackAttachment=h):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=o?(this.setSpriteRegion(h,a.currentSprite,o),a.currentSprite.region=o):a.currentMesh&&a.currentMesh.region!=o&&this.setMeshRegion(h,a.currentMesh,o),!0}return!1}newContainer(){return new It}newSprite(r){return new WS(r)}newGraphics(){return new hs}newMesh(r,t,e,s,i){return new zS(r,t,e,s,i)}transformHack(){return 1}hackAttachmentGroups(r,t,e){if(!r)return;const s=[],i=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const h=this.skeleton.slots[n],o=h.currentSpriteName||h.currentMeshName||"",l=h.currentSprite||h.currentMesh;o.endsWith(r)?(l.parentGroup=t,i.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,i]}destroy(r){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const i in s.meshes)s.meshes[i].destroy(r);s.meshes=null;for(const i in s.sprites)s.sprites[i].destroy(r);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(r);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(r)}};let Nu=E_;Nu.clippingPolygon=[],Object.defineProperty(Nu.prototype,"visible",{get(){return this._visible},set(r){r!==this._visible&&(this._visible=r,r&&(this.lastTime=0))}});let T_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const A_=class extends T_{constructor(t){super(t),this.id=(A_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,i,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.deform;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];i[w]=E*_+T*x+m,i[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}i[p]=g,i[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}i[m]=x,i[m+1]=y}}}copyTo(t){this.bones!=null?(t.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices!=null?(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment}};let Xr=A_;Xr.nextID=0;let jS=class iy extends Xr{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new iy(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},qS=class ry extends Xr{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new ry(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Vu=class vd extends Xr{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.tempColor=new X(0,0,0,0)}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();const t=new vd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new vd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(this.parentMesh!=null?this.parentMesh:this),t}},xl=class ny extends Xr{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new ny(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},ZS=class oy extends Xr{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,a=s*e.b+i*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new oy(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},S_=class{constructor(t,e){if(this.deform=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};const _e=class extends T_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=i+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=i*o+this.y,f=i*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[_e.OX1]=u-f,x[_e.OY1]=d+c,x[_e.OX2]=u-_,x[_e.OY2]=g+c,x[_e.OX3]=p-_,x[_e.OY3]=g+m,x[_e.OX4]=p-f,x[_e.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){const n=this.offset,a=t instanceof S_?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[_e.OX1],p=n[_e.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[_e.OX4],p=n[_e.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}copy(){const t=new _e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,B.arrayCopy(this.uvs,0,t.uvs,0,8),B.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t}};let rt=_e;rt.OX1=0,rt.OY1=1,rt.OX2=2,rt.OY2=3,rt.OX3=4,rt.OY3=5,rt.OX4=6,rt.OY4=7,rt.X1=0,rt.Y1=1,rt.C1R=2,rt.C1G=3,rt.C1B=4,rt.C1A=5,rt.U1=6,rt.V1=7,rt.X2=8,rt.Y2=9,rt.C2R=10,rt.C2G=11,rt.C2B=12,rt.C2A=13,rt.U2=14,rt.V2=15,rt.X3=16,rt.Y3=17,rt.C3R=18,rt.C3G=19,rt.C3B=20,rt.C3A=21,rt.U3=22,rt.V3=23,rt.X4=24,rt.Y4=25,rt.C4R=26,rt.C4G=27,rt.C4B=28,rt.C4A=29,rt.U4=30,rt.V4=31,new w_(2);let oe=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(let i=0;i<e.length;i++)this.timelineIds[e[i].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,i,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let i=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?i=a+1:n=a,i==n)return(i+1)*s;a=i+n>>>1}}static linearSearch(t,e,s){for(let i=0,n=t.length-s;i<=n;i+=s)if(t[i]>e)return i;return-1}};const ee=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=B.newFloatArray((t-1)*ee.BEZIER_SIZE)}getFrameCount(){return this.curves.length/ee.BEZIER_SIZE+1}setLinear(t){this.curves[t*ee.BEZIER_SIZE]=ee.LINEAR}setStepped(t){this.curves[t*ee.BEZIER_SIZE]=ee.STEPPED}getCurveType(t){const e=t*ee.BEZIER_SIZE;if(e==this.curves.length)return ee.LINEAR;const s=this.curves[e];return s==ee.LINEAR?ee.LINEAR:s==ee.STEPPED?ee.STEPPED:ee.BEZIER}setCurve(t,e,s,i,n){const a=(-e*2+i)*.03,h=(-s*2+n)*.03,o=((e-i)*3+1)*.006,l=((s-n)*3+1)*.006;let u=a*2+o,c=h*2+l,d=e*.3+a+o*.16666667,f=s*.3+h+l*.16666667,p=t*ee.BEZIER_SIZE;const m=this.curves;m[p++]=ee.BEZIER;let g=d,_=f;for(let x=p+ee.BEZIER_SIZE-1;p<x;p+=2)m[p]=g,m[p+1]=_,d+=u,f+=c,u+=o,c+=l,g+=d,_+=f}getCurvePercent(t,e){e=D.clamp(e,0,1);const s=this.curves;let i=t*ee.BEZIER_SIZE;const n=s[i];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;i++;let a=0;for(let o=i,l=i+ee.BEZIER_SIZE-1;i<l;i+=2)if(a=s[i],a>=e){let u,c;return i==o?(u=0,c=0):(u=s[i-2],c=s[i-1]),c+(s[i+1]-c)*(e-u)/(a-u)}const h=s[i-1];return h+(1-h)*(e-a)/(1-a)}};let es=ee;es.LINEAR=0,es.STEPPED=1,es.BEZIER=2,es.BEZIER_SIZE=10*2-1;const er=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+er.ROTATION]=s}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotation=l.data.rotation;return;case S.first:const m=l.data.rotation-l.rotation;l.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*n}return}if(s>=o[o.length-er.ENTRIES]){let m=o[o.length+er.PREV_ROTATION];switch(a){case S.setup:l.rotation=l.data.rotation+m*n;break;case S.first:case S.replace:m+=l.data.rotation-l.rotation,m-=(16384-(16384.499999999996-m/360|0))*360;case S.add:l.rotation+=m*n}return}const u=oe.binarySearch(o,s,er.ENTRIES),c=o[u+er.PREV_ROTATION],d=o[u],f=this.getCurvePercent((u>>1)-1,1-(s-d)/(o[u+er.PREV_TIME]-d));let p=o[u+er.ROTATION]-c;switch(p=c+(p-(16384-(16384.499999999996-p/360|0))*360)*f,a){case S.setup:l.rotation=l.data.rotation+(p-(16384-(16384.499999999996-p/360|0))*360)*n;break;case S.first:case S.replace:p+=l.data.rotation-l.rotation;case S.add:l.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*n}}};let Ie=er;Ie.ENTRIES=2,Ie.PREV_TIME=-2,Ie.PREV_ROTATION=-1,Ie.ROTATION=1;const ke=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*ke.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,i){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=i}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.x=l.data.x,l.y=l.data.y;return;case S.first:l.x+=(l.data.x-l.x)*n,l.y+=(l.data.y-l.y)*n}return}let u=0,c=0;if(s>=o[o.length-ke.ENTRIES])u=o[o.length+ke.PREV_X],c=o[o.length+ke.PREV_Y];else{const d=oe.binarySearch(o,s,ke.ENTRIES);u=o[d+ke.PREV_X],c=o[d+ke.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ke.ENTRIES-1,1-(s-f)/(o[d+ke.PREV_TIME]-f));u+=(o[d+ke.X]-u)*p,c+=(o[d+ke.Y]-c)*p}switch(a){case S.setup:l.x=l.data.x+u*n,l.y=l.data.y+c*n;break;case S.first:case S.replace:l.x+=(l.data.x+u-l.x)*n,l.y+=(l.data.y+c-l.y)*n;break;case S.add:l.x+=u*n,l.y+=c*n}}};let ps=ke;ps.ENTRIES=3,ps.PREV_TIME=-3,ps.PREV_X=-2,ps.PREV_Y=-1,ps.X=1,ps.Y=2;let C_=class Bs extends ps{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Bs.ENTRIES])u=o[o.length+Bs.PREV_X]*l.data.scaleX,c=o[o.length+Bs.PREV_Y]*l.data.scaleY;else{const d=oe.binarySearch(o,s,Bs.ENTRIES);u=o[d+Bs.PREV_X],c=o[d+Bs.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Bs.ENTRIES-1,1-(s-f)/(o[d+Bs.PREV_TIME]-f));u=(u+(o[d+Bs.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Bs.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},I_=class Ds extends ps{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Ds.ENTRIES])u=o[o.length+Ds.PREV_X],c=o[o.length+Ds.PREV_Y];else{const d=oe.binarySearch(o,s,Ds.ENTRIES);u=o[d+Ds.PREV_X],c=o[d+Ds.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ds.ENTRIES-1,1-(s-f)/(o[d+Ds.PREV_TIME]-f));u=u+(o[d+Ds.X]-u)*p,c=c+(o[d+Ds.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Xt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Xt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,i,n,a){t*=Xt.ENTRIES,this.frames[t]=e,this.frames[t+Xt.R]=s,this.frames[t+Xt.G]=i,this.frames[t+Xt.B]=n,this.frames[t+Xt.A]=a}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color);return;case S.first:const p=o.color,m=o.data.color;p.add((m.r-p.r)*n,(m.g-p.g)*n,(m.b-p.b)*n,(m.a-p.a)*n)}return}let u=0,c=0,d=0,f=0;if(s>=l[l.length-Xt.ENTRIES]){const p=l.length;u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A]}else{const p=oe.binarySearch(l,s,Xt.ENTRIES);u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A];const m=l[p],g=this.getCurvePercent(p/Xt.ENTRIES-1,1-(s-m)/(l[p+Xt.PREV_TIME]-m));u+=(l[p+Xt.R]-u)*g,c+=(l[p+Xt.G]-c)*g,d+=(l[p+Xt.B]-d)*g,f+=(l[p+Xt.A]-f)*g}if(n==1)o.color.set(u,c,d,f);else{const p=o.color;a==S.setup&&p.setFromColor(o.data.color),p.add((u-p.r)*n,(c-p.g)*n,(d-p.b)*n,(f-p.a)*n)}}};let Ye=Xt;Ye.ENTRIES=5,Ye.PREV_TIME=-5,Ye.PREV_R=-4,Ye.PREV_G=-3,Ye.PREV_B=-2,Ye.PREV_A=-1,Ye.R=1,Ye.G=2,Ye.B=3,Ye.A=4;const dt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*dt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,i,n,a,h,o,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=i,this.frames[t+dt.B]=n,this.frames[t+dt.A]=a,this.frames[t+dt.R2]=h,this.frames[t+dt.G2]=o,this.frames[t+dt.B2]=l}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case S.first:const _=o.color,x=o.darkColor,y=o.data.color,v=o.data.darkColor;_.add((y.r-_.r)*n,(y.g-_.g)*n,(y.b-_.b)*n,(y.a-_.a)*n),x.add((v.r-x.r)*n,(v.g-x.g)*n,(v.b-x.b)*n,0)}return}let u=0,c=0,d=0,f=0,p=0,m=0,g=0;if(s>=l[l.length-dt.ENTRIES]){const _=l.length;u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2]}else{const _=oe.binarySearch(l,s,dt.ENTRIES);u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2];const x=l[_],y=this.getCurvePercent(_/dt.ENTRIES-1,1-(s-x)/(l[_+dt.PREV_TIME]-x));u+=(l[_+dt.R]-u)*y,c+=(l[_+dt.G]-c)*y,d+=(l[_+dt.B]-d)*y,f+=(l[_+dt.A]-f)*y,p+=(l[_+dt.R2]-p)*y,m+=(l[_+dt.G2]-m)*y,g+=(l[_+dt.B2]-g)*y}if(n==1)o.color.set(u,c,d,f),o.darkColor.set(p,m,g,1);else{const _=o.color,x=o.darkColor;a==S.setup&&(_.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),_.add((u-_.r)*n,(c-_.g)*n,(d-_.b)*n,(f-_.a)*n),x.add((p-x.r)*n,(m-x.g)*n,(g-x.b)*n,0)}}};let ae=dt;ae.ENTRIES=8,ae.PREV_TIME=-8,ae.PREV_R=-7,ae.PREV_G=-6,ae.PREV_B=-5,ae.PREV_A=-4,ae.PREV_R2=-3,ae.PREV_G2=-2,ae.PREV_B2=-1,ae.R=1,ae.G=2,ae.B=3,ae.A=4,ae.R2=5,ae.G2=6,ae.B2=7;let Rn=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}const l=this.frames;if(s<l[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}let u=0;s>=l[l.length-1]?u=l.length-1:u=oe.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}setAttachment(t,e,s){e.setAttachment(s==null?null:t.getAttachment(this.slotIndex,s))}},P_=null,R_=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),P_==null&&(P_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!(l instanceof Xr)||l.deformAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;break;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=oe.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},Uu=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,a,h){if(i==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=oe.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)i.push(this.events[u])}},Io=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=oe.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const mt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*mt.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(t,e,s,i,n,a,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=i,this.frames[t+mt.BEND_DIRECTION]=n,this.frames[t+mt.COMPRESS]=a?1:0,this.frames[t+mt.STRETCH]=h?1:0}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case S.first:l.mix+=(l.data.mix-l.mix)*n,l.softness+=(l.data.softness-l.softness)*n,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}if(s>=o[o.length-mt.ENTRIES]){a==S.setup?(l.mix=l.data.mix+(o[o.length+mt.PREV_MIX]-l.data.mix)*n,l.softness=l.data.softness+(o[o.length+mt.PREV_SOFTNESS]-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0)):(l.mix+=(o[o.length+mt.PREV_MIX]-l.mix)*n,l.softness+=(o[o.length+mt.PREV_SOFTNESS]-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0));return}const u=oe.binarySearch(o,s,mt.ENTRIES),c=o[u+mt.PREV_MIX],d=o[u+mt.PREV_SOFTNESS],f=o[u],p=this.getCurvePercent(u/mt.ENTRIES-1,1-(s-f)/(o[u+mt.PREV_TIME]-f));a==S.setup?(l.mix=l.data.mix+(c+(o[u+mt.MIX]-c)*p-l.data.mix)*n,l.softness=l.data.softness+(d+(o[u+mt.SOFTNESS]-d)*p-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0)):(l.mix+=(c+(o[u+mt.MIX]-c)*p-l.mix)*n,l.softness+=(d+(o[u+mt.SOFTNESS]-d)*p-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0))}};let Pe=mt;Pe.ENTRIES=6,Pe.PREV_TIME=-6,Pe.PREV_MIX=-5,Pe.PREV_SOFTNESS=-4,Pe.PREV_BEND_DIRECTION=-3,Pe.PREV_COMPRESS=-2,Pe.PREV_STRETCH=-1,Pe.MIX=1,Pe.SOFTNESS=2,Pe.BEND_DIRECTION=3,Pe.COMPRESS=4,Pe.STRETCH=5;const $t=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*$t.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,i,n,a){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=i,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=a}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s<o[0]){const p=l.data;switch(a){case S.setup:l.rotateMix=p.rotateMix,l.translateMix=p.translateMix,l.scaleMix=p.scaleMix,l.shearMix=p.shearMix;return;case S.first:l.rotateMix+=(p.rotateMix-l.rotateMix)*n,l.translateMix+=(p.translateMix-l.translateMix)*n,l.scaleMix+=(p.scaleMix-l.scaleMix)*n,l.shearMix+=(p.shearMix-l.shearMix)*n}return}let u=0,c=0,d=0,f=0;if(s>=o[o.length-$t.ENTRIES]){const p=o.length;u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR]}else{const p=oe.binarySearch(o,s,$t.ENTRIES);u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR];const m=o[p],g=this.getCurvePercent(p/$t.ENTRIES-1,1-(s-m)/(o[p+$t.PREV_TIME]-m));u+=(o[p+$t.ROTATE]-u)*g,c+=(o[p+$t.TRANSLATE]-c)*g,d+=(o[p+$t.SCALE]-d)*g,f+=(o[p+$t.SHEAR]-f)*g}if(a==S.setup){const p=l.data;l.rotateMix=p.rotateMix+(u-p.rotateMix)*n,l.translateMix=p.translateMix+(c-p.translateMix)*n,l.scaleMix=p.scaleMix+(d-p.scaleMix)*n,l.shearMix=p.shearMix+(f-p.shearMix)*n}else l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n,l.scaleMix+=(d-l.scaleMix)*n,l.shearMix+=(f-l.shearMix)*n}};let We=$t;We.ENTRIES=5,We.PREV_TIME=-5,We.PREV_ROTATE=-4,We.PREV_TRANSLATE=-3,We.PREV_SCALE=-2,We.PREV_SHEAR=-1,We.ROTATE=1,We.TRANSLATE=2,We.SCALE=3,We.SHEAR=4;const Is=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Is.ENTRIES,this.frames[t]=e,this.frames[t+Is.VALUE]=s}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.position=l.data.position;return;case S.first:l.position+=(l.data.position-l.position)*n}return}let u=0;if(s>=o[o.length-Is.ENTRIES])u=o[o.length+Is.PREV_VALUE];else{const c=oe.binarySearch(o,s,Is.ENTRIES);u=o[c+Is.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/Is.ENTRIES-1,1-(s-d)/(o[c+Is.PREV_TIME]-d));u+=(o[c+Is.VALUE]-u)*f}a==S.setup?l.position=l.data.position+(u-l.data.position)*n:l.position+=(u-l.position)*n}};let Ci=Is;Ci.ENTRIES=2,Ci.PREV_TIME=-2,Ci.PREV_VALUE=-1,Ci.VALUE=1;let M_=class cr extends Ci{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-cr.ENTRIES])u=o[o.length+cr.PREV_VALUE];else{const c=oe.binarySearch(o,s,cr.ENTRIES);u=o[c+cr.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/cr.ENTRIES-1,1-(s-d)/(o[c+cr.PREV_TIME]-d));u+=(o[c+cr.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Be=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Be.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,i){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=i}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotateMix=l.data.rotateMix,l.translateMix=l.data.translateMix;return;case S.first:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*n,l.translateMix+=(l.data.translateMix-l.translateMix)*n}return}let u=0,c=0;if(s>=o[o.length-Be.ENTRIES])u=o[o.length+Be.PREV_ROTATE],c=o[o.length+Be.PREV_TRANSLATE];else{const d=oe.binarySearch(o,s,Be.ENTRIES);u=o[d+Be.PREV_ROTATE],c=o[d+Be.PREV_TRANSLATE];const f=o[d],p=this.getCurvePercent(d/Be.ENTRIES-1,1-(s-f)/(o[d+Be.PREV_TIME]-f));u+=(o[d+Be.ROTATE]-u)*p,c+=(o[d+Be.TRANSLATE]-c)*p}a==S.setup?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*n):(l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n)}};let oi=Be;oi.ENTRIES=3,oi.PREV_TIME=-3,oi.PREV_ROTATE=-2,oi.PREV_TRANSLATE=-1,oi.ROTATE=1,oi.TRANSLATE=2;const Ht=class{constructor(r){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new F_(this),this.propertyIDs=new VS,this.animationsChanged=!1,this.trackEntryPool=new $S(()=>new Gu),this.data=r}update(r){r*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i==null)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=r*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let a=i.next;if(a!=null){const h=i.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=i.timeScale==0?0:(h/i.timeScale+r)*a.timeScale,i.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=r,a=a.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&i.mixingFrom==null){t[e]=null,this.queue.end(i),this.disposeNext(i);continue}if(i.mixingFrom!=null&&this.updateMixingFrom(i,r)){let h=i.mixingFrom;for(i.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(r,t){const e=r.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,r.mixTime>0&&r.mixTime>=r.mixDuration?((e.totalAlpha==0||r.mixDuration==0)&&(r.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=r),r.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,r.mixTime+=t,!1)}apply(r){if(r==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let a=0,h=e.length;a<h;a++){const o=e[a];if(o==null||o.delay>0)continue;s=!0;const l=a==0?S.first:o.mixBlend;let u=o.alpha;o.mixingFrom!=null?u*=this.applyMixingFrom(o,r,l):o.trackTime>=o.trackEnd&&o.next==null&&(u=0);const c=o.animationLast,d=o.getAnimationTime(),f=o.animation.timelines.length,p=o.animation.timelines;if(a==0&&u==1||l==S.add)for(let m=0;m<f;m++){const g=p[m];g instanceof Rn?this.applyAttachmentTimeline(g,r,d,l,!0):g.apply(r,c,d,t,u,l,At.mixIn)}else{const m=o.timelineMode,g=o.timelinesRotation.length==0;g&&B.setArraySize(o.timelinesRotation,f<<1,null);const _=o.timelinesRotation;for(let x=0;x<f;x++){const y=p[x],v=m[x]==Ht.SUBSEQUENT?l:S.setup;y instanceof Ie?this.applyRotateTimeline(y,r,d,u,v,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,r,d,l,!0):y.apply(r,c,d,t,u,v,At.mixIn)}}this.queueEvents(o,d),t.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}const i=this.unkeyedState+Ht.SETUP,n=r.slots;for(let a=0,h=r.slots.length;a<h;a++){const o=n[a];if(o.attachmentState==i){const l=o.data.attachmentName;o.setAttachment(l==null?null:r.getAttachment(o.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(r,t,e){const s=r.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let i=0;r.mixDuration==0?(i=1,e==S.first&&(e=S.setup)):(i=r.mixTime/r.mixDuration,i>1&&(i=1),e!=S.first&&(e=s.mixBlend));const n=i<s.eventThreshold?this.events:null,a=i<s.attachmentThreshold,h=i<s.drawOrderThreshold,o=s.animationLast,l=s.getAnimationTime(),u=s.animation.timelines.length,c=s.animation.timelines,d=s.alpha*r.interruptAlpha,f=d*(1-i);if(e==S.add)for(let p=0;p<u;p++)c[p].apply(t,o,l,n,f,e,At.mixOut);else{const p=s.timelineMode,m=s.timelineHoldMix,g=s.timelinesRotation.length==0;g&&B.setArraySize(s.timelinesRotation,u<<1,null);const _=s.timelinesRotation;s.totalAlpha=0;for(let x=0;x<u;x++){const y=c[x];let v=At.mixOut,b,w=0;switch(p[x]){case Ht.SUBSEQUENT:if(!h&&y instanceof Io)continue;b=e,w=f;break;case Ht.FIRST:b=S.setup,w=f;break;case Ht.HOLD_SUBSEQUENT:b=e,w=d;break;case Ht.HOLD_FIRST:b=S.setup,w=d;break;default:b=S.setup;const E=m[x];w=d*Math.max(0,1-E.mixTime/E.mixDuration);break}s.totalAlpha+=w,y instanceof Ie?this.applyRotateTimeline(y,t,l,w,b,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,t,l,b,a):(h&&y instanceof Io&&b==S.setup&&(v=At.mixIn),y.apply(t,o,l,n,w,b,v))}}return r.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,i}applyAttachmentTimeline(r,t,e,s,i){const n=t.slots[r.slotIndex];if(!n.bone.active)return;const a=r.frames;if(e<a[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,i);else{let h;e>=a[a.length-1]?h=a.length-1:h=oe.binarySearch(a,e)-1,this.setAttachment(t,n,r.attachmentNames[h],i)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Ht.SETUP)}setAttachment(r,t,e,s){t.setAttachment(e==null?null:r.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Ht.CURRENT)}applyRotateTimeline(r,t,e,s,i,n,a,h){if(h&&(n[a]=0),s==1){r.apply(t,0,e,null,1,i,At.mixIn);return}const o=r,l=o.frames,u=t.bones[o.boneIndex];if(!u.active)return;let c=0,d=0;if(e<l[0])switch(i){case S.setup:u.rotation=u.data.rotation;default:return;case S.first:c=u.rotation,d=u.data.rotation}else if(c=i==S.setup?u.data.rotation:u.rotation,e>=l[l.length-Ie.ENTRIES])d=u.data.rotation+l[l.length+Ie.PREV_ROTATION];else{const m=oe.binarySearch(l,e,Ie.ENTRIES),g=l[m+Ie.PREV_ROTATION],_=l[m],x=o.getCurvePercent((m>>1)-1,1-(e-_)/(l[m+Ie.PREV_TIME]-_));d=l[m+Ie.ROTATION]-g,d-=(16384-(16384.499999999996-d/360|0))*360,d=g+d*x+u.data.rotation,d-=(16384-(16384.499999999996-d/360|0))*360}let f=0,p=d-c;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,g=0;h?(m=0,g=p):(m=n[a],g=n[a+1]);const _=p>0;let x=m>=0;D.signum(g)!=D.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*D.signum(m)),x=_),f=p+m-m%360,x!=_&&(f+=360*D.signum(m)),n[a]=f}n[a+1]=p,c+=f*s,u.rotation=c-(16384-(16384.499999999996-c/360|0))*360}queueEvents(r,t){const e=r.animationStart,s=r.animationEnd,i=s-e,n=r.trackLast%i,a=this.events;let h=0;const o=a.length;for(;h<o;h++){const u=a[h];if(u.time<n)break;u.time>s||this.queue.event(r,u)}let l=!1;for(r.loop?l=i==0||n>r.trackTime%i:l=t>=s&&r.animationLast<s,l&&this.queue.complete(r);h<o;h++)a[h].time<e||this.queue.event(r,a[h])}clearTracks(){const r=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=r,this.queue.drain()}clearTrack(r){if(r>=this.tracks.length)return;const t=this.tracks[r];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(s==null)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(r,t,e){const s=this.expandToIndex(r);this.tracks[r]=t,s!=null&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom!=null&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(r,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(r,s,e)}setAnimationWith(r,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,i=this.expandToIndex(r);i!=null&&(i.nextTrackLast==-1?(this.tracks[r]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.disposeNext(i),i=i.mixingFrom,s=!1):this.disposeNext(i));const n=this.trackEntry(r,t,e,i);return this.setCurrent(r,n,s),this.queue.drain(),n}addAnimation(r,t,e,s){const i=this.data.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(r,i,e,s)}addAnimationWith(r,t,e,s){if(t==null)throw new Error("animation cannot be null.");let i=this.expandToIndex(r);if(i!=null)for(;i.next!=null;)i=i.next;const n=this.trackEntry(r,t,e,i);if(i==null)this.setCurrent(r,n,!0),this.queue.drain();else if(i.next=n,s<=0){const a=i.animationEnd-i.animationStart;a!=0?(i.loop?s+=a*(1+(i.trackTime/a|0)):s+=Math.max(a,i.trackTime),s-=this.data.getMix(i.animation,t)):s=i.trackTime}return n.delay=s,n}setEmptyAnimation(r,t){const e=this.setAnimationWith(r,Ht.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(r,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(r,Ht.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(r){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const i=this.tracks[e];i!=null&&this.setEmptyAnimation(i.trackIndex,r)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(r){return r<this.tracks.length?this.tracks[r]:(B.ensureArrayCapacity(this.tracks,r+1,null),this.tracks.length=r+1,null)}trackEntry(r,t,e,s){const i=this.trackEntryPool.obtain();return i.trackIndex=r,i.animation=t,i.loop=e,i.holdPrevious=!1,i.eventThreshold=0,i.attachmentThreshold=0,i.drawOrderThreshold=0,i.animationStart=0,i.animationEnd=t.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.interruptAlpha=1,i.mixTime=0,i.mixDuration=s==null?0:this.data.getMix(s.animation,t),i.mixBlend=S.replace,i}disposeNext(r){let t=r.next;for(;t!=null;)this.queue.dispose(t),t=t.next;r.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let r=0,t=this.tracks.length;r<t;r++){let e=this.tracks[r];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=S.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(r){const t=r.mixingTo,e=r.animation.timelines,s=r.animation.timelines.length,i=B.setArraySize(r.timelineMode,s);r.timelineHoldMix.length=0;const n=B.setArraySize(r.timelineHoldMix,s),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)i[h]=a.add(e[h].getPropertyId())?Ht.HOLD_FIRST:Ht.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const o=e[h],l=o.getPropertyId();if(!a.add(l))i[h]=Ht.SUBSEQUENT;else if(t==null||o instanceof Rn||o instanceof Io||o instanceof Uu||!t.animation.hasTimeline(l))i[h]=Ht.FIRST;else{for(let u=t.mixingTo;u!=null;u=u.mixingTo)if(!u.animation.hasTimeline(l)){if(r.mixDuration>0){i[h]=Ht.HOLD_MIX,n[h]=u;continue t}break}i[h]=Ht.HOLD_FIRST}}}getCurrent(r){return r>=this.tracks.length?null:this.tracks[r]}addListener(r){if(r==null)throw new Error("listener cannot be null.");this.listeners.push(r)}removeListener(r){const t=this.listeners.indexOf(r);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(r,t,e){Ht.deprecatedWarning1||(Ht.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(r,t,e)}addAnimationByName(r,t,e,s){Ht.deprecatedWarning2||(Ht.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(r,t,e,s)}hasAnimation(r){return this.data.skeletonData.findAnimation(r)!==null}hasAnimationByName(r){return Ht.deprecatedWarning3||(Ht.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(r)}};let ms=Ht;ms.emptyAnimation=new oe("<empty>",[],0),ms.SUBSEQUENT=0,ms.FIRST=1,ms.HOLD_SUBSEQUENT=2,ms.HOLD_FIRST=3,ms.HOLD_MIX=4,ms.SETUP=1,ms.CURRENT=2,ms.deprecatedWarning1=!1,ms.deprecatedWarning2=!1,ms.deprecatedWarning3=!1;const Ii=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const r=this.animationEnd-this.animationStart;return r==0?this.animationStart:this.trackTime%r+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(r){this.animationLast=r,this.nextAnimationLast=r}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ii.deprecatedWarning1||(Ii.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(r){Ii.deprecatedWarning1||(Ii.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=r}get endTime(){return Ii.deprecatedWarning2||(Ii.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(r){Ii.deprecatedWarning2||(Ii.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=r}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Gu=Ii;Gu.deprecatedWarning1=!1,Gu.deprecatedWarning2=!1;const Xu=class{constructor(r){this.objects=[],this.drainDisabled=!1,this.animState=r}start(r){this.objects.push(ss.start),this.objects.push(r),this.animState.animationsChanged=!0}interrupt(r){this.objects.push(ss.interrupt),this.objects.push(r)}end(r){this.objects.push(ss.end),this.objects.push(r),this.animState.animationsChanged=!0}dispose(r){this.objects.push(ss.dispose),this.objects.push(r)}complete(r){this.objects.push(ss.complete),this.objects.push(r)}event(r,t){this.objects.push(ss.event),this.objects.push(r),this.objects.push(t)}deprecateStuff(){return Xu.deprecatedWarning1||(Xu.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const r=this.objects,t=this.animState.listeners;for(let e=0;e<r.length;e+=2){const s=r[e],i=r[e+1];switch(s){case ss.start:i.listener!=null&&i.listener.start&&i.listener.start(i);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(i);i.onStart&&this.deprecateStuff()&&i.onStart(i.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(i.trackIndex);break;case ss.interrupt:i.listener!=null&&i.listener.interrupt&&i.listener.interrupt(i);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(i);break;case ss.end:i.listener!=null&&i.listener.end&&i.listener.end(i);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(i);i.onEnd&&this.deprecateStuff()&&i.onEnd(i.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(i.trackIndex);case ss.dispose:i.listener!=null&&i.listener.dispose&&i.listener.dispose(i);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(i);this.animState.trackEntryPool.free(i);break;case ss.complete:i.listener!=null&&i.listener.complete&&i.listener.complete(i);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(i);const n=D.toInt(i.loopsCount());i.onComplete&&this.deprecateStuff()&&i.onComplete(i.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(i.trackIndex,n);break;case ss.event:const a=r[e+++2];i.listener!=null&&i.listener.event&&i.listener.event(i,a);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(i,a);i.onEvent&&this.deprecateStuff()&&i.onEvent(i.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(i.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let F_=Xu;F_.deprecatedWarning1=!1;var ss=(r=>(r[r.start=0]="start",r[r.interrupt=1]="interrupt",r[r.end=2]="end",r[r.dispose=3]="dispose",r[r.complete=4]="complete",r[r.event=5]="event",r))(ss||{});const $u=class{constructor(r){if(this.animationToMixTime={},this.defaultMix=0,r==null)throw new Error("skeletonData cannot be null.");this.skeletonData=r}setMix(r,t,e){const s=this.skeletonData.findAnimation(r);if(s==null)throw new Error(`Animation not found: ${r}`);const i=this.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,i,e)}setMixByName(r,t,e){$u.deprecatedWarning1||($u.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(r,t,e)}setMixWith(r,t,e){if(r==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${r.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(r,t){const e=`${r.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let k_=$u;k_.deprecatedWarning1=!1;let B_=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new rt(e);return n.region=i,n}newMeshAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Vu(e);return n.region=i,n}newBoundingBoxAttachment(t,e){return new jS(e)}newPathAttachment(t,e){return new xl(e)}newPointAttachment(t,e){return new ZS(e)}newClippingAttachment(t,e){return new qS(e)}};class D_{constructor(t,e,s){if(this.matrix=new Mt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,n,a,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=a,this.ashearY=h,this.appliedValid=!0;const o=this.parent,l=this.matrix,u=this.skeleton.scaleX,c=-this.skeleton.scaleY;if(o==null){const g=this.skeleton,_=s+90+h;l.a=D.cosDeg(s+a)*i*u,l.c=D.cosDeg(_)*n*u,l.b=D.sinDeg(s+a)*i*c,l.d=D.sinDeg(_)*n*c,l.tx=t*u+g.x,l.ty=e*c+g.y;return}let d=o.matrix.a,f=o.matrix.c,p=o.matrix.b,m=o.matrix.d;switch(l.tx=d*t+f*e+o.matrix.tx,l.ty=p*t+m*e+o.matrix.ty,this.data.transformMode){case vt.Normal:{const g=s+90+h,_=D.cosDeg(s+a)*i,x=D.cosDeg(g)*n,y=D.sinDeg(s+a)*i,v=D.sinDeg(g)*n;l.a=d*_+f*y,l.c=d*x+f*v,l.b=p*_+m*y,l.d=p*x+m*v;return}case vt.OnlyTranslation:{const g=s+90+h;l.a=D.cosDeg(s+a)*i,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+a)*i,l.d=D.sinDeg(g)*n;break}case vt.NoRotationOrReflection:{let g=d*d+p*p,_=0;g>1e-4?(g=Math.abs(d*m-f*p)/g,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*g,m=d*g,_=Math.atan2(p,d)*D.radDeg):(d=0,p=0,_=90-Math.atan2(m,f)*D.radDeg);const x=s+a-_,y=s+h-_+90,v=D.cosDeg(x)*i,b=D.cosDeg(y)*n,w=D.sinDeg(x)*i,E=D.sinDeg(y)*n;l.a=d*v-f*w,l.c=d*b-f*E,l.b=p*v+m*w,l.d=p*b+m*E;break}case vt.NoScale:case vt.NoScaleOrReflection:{const g=D.cosDeg(s),_=D.sinDeg(s);let x=(d*g+f*_)/u,y=(p*g+m*_)/c,v=Math.sqrt(x*x+y*y);v>1e-5&&(v=1/v),x*=v,y*=v,v=Math.sqrt(x*x+y*y),this.data.transformMode==vt.NoScale&&d*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(y,x),w=Math.cos(b)*v,E=Math.sin(b)*v,T=D.cosDeg(a)*i,A=D.cosDeg(90+h)*n,I=D.sinDeg(a)*i,M=D.sinDeg(90+h)*n;l.a=x*T+w*I,l.c=x*A+w*M,l.b=y*T+E*I,l.d=y*A+E*M;break}}l.a*=u,l.c*=u,l.b*=c,l.d*=c}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*D.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*D.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*D.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*D.radDeg;return}const s=t.matrix,i=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,a=e.ty-s.ty;this.ax=n*s.d*i-a*s.c*i,this.ay=a*s.a*i-n*s.b*i;const h=i*s.d,o=i*s.a,l=i*s.c,u=i*s.b,c=h*e.a-l*e.b,d=h*e.c-l*e.d,f=o*e.b-u*e.a,p=o*e.d-u*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){const m=c*p-d*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*d+f*p,m)*D.radDeg,this.arotation=Math.atan2(f,c)*D.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*D.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,i=e.c,n=e.b,a=e.d,h=1/(s*a-i*n),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*a*h-l*i*h,t.y=l*s*h-o*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,i=t.y;return t.x=s*e.a+i*e.c+e.tx,t.y=s*e.b+i*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),i=this.matrix;return Math.atan2(i.a*e-i.b*s,i.d*s-i.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),i=this.matrix;return Math.atan2(s*i.b+e*i.d,s*i.a+e*i.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,i=e.c,n=e.b,a=e.d,h=D.cosDeg(t),o=D.sinDeg(t);e.a=h*s-o*n,e.c=h*i-o*a,e.b=o*s+h*n,e.d=o*i+h*a,this.appliedValid=!1}}let O_=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},Hu=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},L_=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},N_=class{constructor(t){this.name=t}};class KS{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){const t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix);break}}apply1(t,e,s,i,n,a,h){t.appliedValid||t.updateAppliedTransform();const o=t.parent.matrix,l=o.a;let u=o.c;const c=o.b;let d=o.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case vt.OnlyTranslation:p=e-t.worldX,m=s-t.worldY;break;case vt.NoRotationOrReflection:const x=Math.abs(l*d-u*c)/(l*l+c*c),y=l/t.skeleton.scaleX,v=c/t.skeleton.scaleY;u=-v*x*t.skeleton.scaleX,d=y*x*t.skeleton.scaleY,f+=Math.atan2(v,y)*D.radDeg;default:const b=e-o.tx,w=s-o.ty,E=l*d-u*c;p=(b*d-w*u)/E-t.ax,m=(w*l-b*c)/E-t.ay}f+=Math.atan2(m,p)*D.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,_=t.ascaleY;if(i||n){switch(t.data.transformMode){case vt.NoScale:case vt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const x=t.data.length*g,y=Math.sqrt(p*p+m*m);if(i&&y<x||n&&y>x&&x>1e-4){const v=(y/x-1)*h+1;g*=v,a&&(_*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*h,g,_,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,a,h,o){if(o==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,u=t.ay;let c=t.ascaleX,d=c,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,_=0,x=0;c<0?(c=-c,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,_=180):_=0;const y=e.ax;let v=0,b=0,w=0,E=m.a,T=m.c,A=m.b,I=m.d;const M=Math.abs(c-f)<=1e-4;M?(v=e.ay,b=E*y+T*v+m.tx,w=A*y+I*v+m.ty):(v=0,b=E*y+m.tx,w=A*y+m.ty);const R=t.parent.matrix;E=R.a,T=R.c,A=R.b,I=R.d;const C=1/(E*I-T*A);let P=b-R.tx,k=w-R.ty;const U=(P*I-k*T)*C-l,V=(k*E-P*A)*C-u,L=Math.sqrt(U*U+V*V);let $=e.data.length*p,O,N;if(L<1e-4){this.apply1(t,s,i,!1,a,!1,o),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=i-R.ty;let Z=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-u,Y=Z*Z+Q*Q;if(h!=0){h*=c*(p+1)/2;const _t=Math.sqrt(Y),Bt=_t-L-$*c+h;if(Bt>0){let zt=Math.min(1,Bt/(h*2))-1;zt=(Bt-h*(1-zt*zt))/_t,Z-=zt*Z,Q-=zt*Q,Y=Z*Z+Q*Q}}t:if(M){$*=c;let _t=(Y-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,a&&(d*=(Math.sqrt(Y)/(L+$)-1)*o+1)),N=Math.acos(_t)*n,E=L+$*_t,T=$*Math.sin(N),O=Math.atan2(Q*E-Z*T,Z*E+Q*T)}else{E=c*$,T=f*$;const _t=E*E,Bt=T*T,zt=Math.atan2(Q,Z);A=Bt*L*L+_t*Y-_t*Bt;const Qt=-2*Bt*L,Rt=Bt-_t;if(I=Qt*Qt-4*Rt*A,I>=0){let Bn=Math.sqrt(I);Qt<0&&(Bn=-Bn),Bn=-(Qt+Bn)/2;const K0=Bn/Rt,Q0=A/Bn,Dn=Math.abs(K0)<Math.abs(Q0)?K0:Q0;if(Dn*Dn<=Y){k=Math.sqrt(Y-Dn*Dn)*n,O=zt-Math.atan2(k,Dn),N=Math.atan2(k/f,(Dn-L)/c);break t}}let jt=D.PI,Ot=L-E,ze=Ot*Ot,rs=0,lr=0,kn=L+E,hr=kn*kn,Z0=0;A=-E*L/(_t-Bt),A>=-1&&A<=1&&(A=Math.acos(A),P=E*Math.cos(A)+L,k=T*Math.sin(A),I=P*P+k*k,I<ze&&(jt=A,ze=I,Ot=P,rs=k),I>hr&&(lr=A,hr=I,kn=P,Z0=k)),Y<=(ze+hr)/2?(O=zt-Math.atan2(rs*n,Ot),N=jt*n):(O=zt-Math.atan2(Z0*n,kn),N=lr*n)}const lt=Math.atan2(v,y)*x;let Tt=t.arotation;O=(O-lt)*D.radDeg+g-Tt,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(l,u,Tt+O*o,d,t.ascaleY,0,0),Tt=e.arotation,N=((N+lt)*D.radDeg-e.ashearX)*x+_-Tt,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(y,v,Tt+N*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}let V_=class extends Hu{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},U_=class extends Hu{constructor(t){super(t,0,!1),this.bones=new Array}};var be=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(be||{});const $r=class{constructor(r,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,r==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=r,this.bones=new Array;for(let e=0,s=r.bones.length;e<s;e++)this.bones.push(t.findBone(r.bones[e].name));this.target=t.findSlot(r.target.name),this.position=r.position,this.spacing=r.spacing,this.rotateMix=r.rotateMix,this.translateMix=r.translateMix}isActive(){return this.active}apply(){this.update()}update(){const r=this.target.getAttachment();if(!(r instanceof xl))return;const t=this.rotateMix,e=this.translateMix,s=e>0,i=t>0;if(!s&&!i)return;const n=this.data,a=n.spacingMode,h=a==be.Length,o=n.rotateMode,l=o==Fe.Tangent,u=o==Fe.ChainScale,c=this.bones.length,d=l?c:c+1,f=this.bones,p=B.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(u||h){u&&(m=B.setArraySize(this.lengths,c));for(let w=0,E=d-1;w<E;){const T=f[w],A=T.data.length;if(A<$r.epsilon)u&&(m[w]=0),p[++w]=0;else{const I=A*T.matrix.a,M=A*T.matrix.b,R=Math.sqrt(I*I+M*M);u&&(m[w]=R),p[++w]=(h?A+g:g)*R/A}}}else for(let w=1;w<d;w++)p[w]=g;const _=this.computeWorldPositions(r,d,l,n.positionMode==ne.Percent,a==be.Percent);let x=_[0],y=_[1],v=n.offsetRotation,b=!1;if(v==0)b=o==Fe.Chain;else{b=!1;const w=this.target.bone.matrix;v*=w.a*w.d-w.b*w.c>0?D.degRad:-D.degRad}for(let w=0,E=3;w<c;w++,E+=3){const T=f[w],A=T.matrix;A.tx+=(x-A.tx)*e,A.ty+=(y-A.ty)*e;const I=_[E],M=_[E+1],R=I-x,C=M-y;if(u){const P=m[w];if(P!=0){const k=(Math.sqrt(R*R+C*C)/P-1)*t+1;A.a*=k,A.b*=k}}if(x=I,y=M,i){const P=A.a,k=A.c,U=A.b,V=A.d;let L=0,$=0,O=0;if(l&&(l?L=_[E-1]:p[w+1]==0?L=_[E+2]:L=Math.atan2(C,R)),L-=Math.atan2(U,P),b){$=Math.cos(L),O=Math.sin(L);const N=T.data.length;x+=(N*($*P-O*U)-R)*t,y+=(N*(O*P+$*U)-C)*t}else L+=v;L>D.PI?L-=D.PI2:L<-D.PI&&(L+=D.PI2),L*=t,$=Math.cos(L),O=Math.sin(L),A.a=$*P-O*U,A.c=$*k-O*V,A.b=O*P+$*U,A.d=O*k+$*V}T.appliedValid=!1}}computeWorldPositions(r,t,e,s,i){const n=this.target;let a=this.position;const h=this.spaces,o=B.setArraySize(this.positions,t*3+2);let l=null;const u=r.closed;let c=r.worldVerticesLength,d=c/6,f=$r.NONE;if(!r.constantSpeed){const L=r.lengths;d-=u?1:2;const $=L[d];if(s&&(a*=$),i)for(let O=0;O<t;O++)h[O]*=$;l=B.setArraySize(this.world,8);for(let O=0,N=0,Z=0;O<t;O++,N+=3){const Q=h[O];a+=Q;let Y=a;if(u)Y%=$,Y<0&&(Y+=$),Z=0;else if(Y<0){f!=$r.BEFORE&&(f=$r.BEFORE,r.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(Y,l,0,o,N);continue}else if(Y>$){f!=$r.AFTER&&(f=$r.AFTER,r.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(Y-$,l,0,o,N);continue}for(;;Z++){const lt=L[Z];if(!(Y>lt)){if(Z==0)Y/=lt;else{const Tt=L[Z-1];Y=(Y-Tt)/(lt-Tt)}break}}Z!=f&&(f=Z,u&&Z==d?(r.computeWorldVertices(n,c-4,4,l,0,2),r.computeWorldVertices(n,0,4,l,4,2)):r.computeWorldVertices(n,Z*6+2,8,l,0,2)),this.addCurvePosition(Y,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],o,N,e||O>0&&Q==0)}return o}u?(c+=2,l=B.setArraySize(this.world,c),r.computeWorldVertices(n,2,c-4,l,0,2),r.computeWorldVertices(n,0,2,l,c-4,2),l[c-2]=l[0],l[c-1]=l[1]):(d--,c-=4,l=B.setArraySize(this.world,c),r.computeWorldVertices(n,2,c,l,0,2));const p=B.setArraySize(this.curves,d);let m=0,g=l[0],_=l[1],x=0,y=0,v=0,b=0,w=0,E=0,T=0,A=0,I=0,M=0,R=0,C=0,P=0,k=0;for(let L=0,$=2;L<d;L++,$+=6)x=l[$],y=l[$+1],v=l[$+2],b=l[$+3],w=l[$+4],E=l[$+5],T=(g-x*2+v)*.1875,A=(_-y*2+b)*.1875,I=((x-v)*3-g+w)*.09375,M=((y-b)*3-_+E)*.09375,R=T*2+I,C=A*2+M,P=(x-g)*.75+T+I*.16666667,k=(y-_)*.75+A+M*.16666667,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,R+=I,C+=M,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,m+=Math.sqrt(P*P+k*k),P+=R+I,k+=C+M,m+=Math.sqrt(P*P+k*k),p[L]=m,g=w,_=E;if(s&&(a*=m),i)for(let L=0;L<t;L++)h[L]*=m;const U=this.segments;let V=0;for(let L=0,$=0,O=0,N=0;L<t;L++,$+=3){const Z=h[L];a+=Z;let Q=a;if(u)Q%=m,Q<0&&(Q+=m),O=0;else if(Q<0){this.addBeforePosition(Q,l,0,o,$);continue}else if(Q>m){this.addAfterPosition(Q-m,l,c-4,o,$);continue}for(;;O++){const Y=p[O];if(!(Q>Y)){if(O==0)Q/=Y;else{const lt=p[O-1];Q=(Q-lt)/(Y-lt)}break}}if(O!=f){f=O;let Y=O*6;for(g=l[Y],_=l[Y+1],x=l[Y+2],y=l[Y+3],v=l[Y+4],b=l[Y+5],w=l[Y+6],E=l[Y+7],T=(g-x*2+v)*.03,A=(_-y*2+b)*.03,I=((x-v)*3-g+w)*.006,M=((y-b)*3-_+E)*.006,R=T*2+I,C=A*2+M,P=(x-g)*.3+T+I*.16666667,k=(y-_)*.3+A+M*.16666667,V=Math.sqrt(P*P+k*k),U[0]=V,Y=1;Y<8;Y++)P+=R,k+=C,R+=I,C+=M,V+=Math.sqrt(P*P+k*k),U[Y]=V;P+=R,k+=C,V+=Math.sqrt(P*P+k*k),U[8]=V,P+=R+I,k+=C+M,V+=Math.sqrt(P*P+k*k),U[9]=V,N=0}for(Q*=V;;N++){const Y=U[N];if(!(Q>Y)){if(N==0)Q/=Y;else{const lt=U[N-1];Q=N+(Q-lt)/(Y-lt)}break}}this.addCurvePosition(Q*.1,g,_,x,y,v,b,w,E,o,$,e||L>0&&Z==0)}return o}addBeforePosition(r,t,e,s,i){const n=t[e],a=t[e+1],h=t[e+2]-n,o=t[e+3]-a,l=Math.atan2(o,h);s[i]=n+r*Math.cos(l),s[i+1]=a+r*Math.sin(l),s[i+2]=l}addAfterPosition(r,t,e,s,i){const n=t[e+2],a=t[e+3],h=n-t[e],o=a-t[e+1],l=Math.atan2(o,h);s[i]=n+r*Math.cos(l),s[i+1]=a+r*Math.sin(l),s[i+2]=l}addCurvePosition(r,t,e,s,i,n,a,h,o,l,u,c){(r==0||isNaN(r))&&(r=1e-4);const d=r*r,f=d*r,p=1-r,m=p*p,g=m*p,_=p*r,x=_*3,y=p*x,v=x*r,b=t*g+s*y+n*v+h*f,w=e*g+i*y+a*v+o*f;l[u]=b,l[u+1]=w,c&&(l[u+2]=Math.atan2(w-(e*m+i*_*2+a*d),b-(t*m+s*_*2+n*d)))}};let Po=$r;Po.NONE=-1,Po.BEFORE=-2,Po.AFTER=-3,Po.epsilon=1e-5;class QS{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new HS,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)-Math.atan2(w,v)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=(v.x-y.tx)*e,y.ty+=(v.y-y.ty)*e,x=!0}if(s>0){let v=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(h*h+l*l);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*s)/v),y.a*=v,y.b*=v,v=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+u*u),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*s)/v),y.c*=v,y.d*=v,x=!0}if(i>0){const v=y.c,b=y.d,w=Math.atan2(b,v);let E=Math.atan2(u,o)-Math.atan2(l,h)-(w-Math.atan2(y.b,y.a));E>D.PI?E-=D.PI2:E<-D.PI&&(E+=D.PI2),E=w+(E+f)*i;const T=Math.sqrt(v*v+b*b);y.c=Math.cos(E)*T,y.d=Math.sin(E)*T,x=!0}x&&(_.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=v.x*e,y.ty+=v.y*e,x=!0}if(s>0){let v=(Math.sqrt(h*h+l*l)-1+this.data.offsetScaleX)*s+1;y.a*=v,y.b*=v,v=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*s+1,y.c*=v,y.d*=v,x=!0}if(i>0){let v=Math.atan2(u,o)-Math.atan2(l,h);v>D.PI?v-=D.PI2:v<-D.PI&&(v+=D.PI2);const b=y.c,w=y.d;v=Math.atan2(w,b)+(v-D.PI/2+f)*i;const E=Math.sqrt(b*b+w*w);y.c=Math.cos(v)*E,y.d=Math.sin(v)*E,x=!0}x&&(_.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;if(t!=0){let g=n.arotation-u+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,u+=g*t}let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax-c+this.data.offsetX)*e,d+=(n.ay-d+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*s)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*s)/p));const m=l.ashearY;if(i>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*i}l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;t!=0&&(u+=(n.arotation+this.data.offsetRotation)*t);let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax+this.data.offsetX)*e,d+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let m=l.ashearY;i>0&&(m+=(n.ashearY+this.data.offsetShearY)*i),l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}}const Ro=class{constructor(r){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,r==null)throw new Error("data cannot be null.");this.data=r,this.bones=new Array;for(let t=0;t<r.bones.length;t++){const e=r.bones[t];let s;if(e.parent==null)s=new D_(e,this,null);else{const i=this.bones[e.parent.index];s=new D_(e,this,i),i.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<r.slots.length;t++){const e=r.slots[t],s=this.bones[e.boneData.index],i=new S_(e,s);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let t=0;t<r.ikConstraints.length;t++){const e=r.ikConstraints[t];this.ikConstraints.push(new KS(e,this))}this.transformConstraints=new Array;for(let t=0;t<r.transformConstraints.length;t++){const e=r.transformConstraints[t];this.transformConstraints.push(new QS(e,this))}this.pathConstraints=new Array;for(let t=0;t<r.pathConstraints.length;t++){const e=r.pathConstraints[t];this.pathConstraints.push(new Po(e,this))}this.color=new X(1,1,1,1),this.updateCache()}updateCache(){const r=this._updateCache;r.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,u=t.length;l<u;l++){const c=t[l];c.sorted=c.data.skinRequired,c.active=!c.sorted}if(this.skin!=null){const l=this.skin.bones;for(let u=0,c=this.skin.bones.length;u<c;u++){let d=this.bones[l[u].index];do d.sorted=!1,d.active=!0,d=d.parent;while(d!=null)}}const e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,n=e.length,a=s.length,h=i.length,o=n+a+h;t:for(let l=0;l<o;l++){for(let u=0;u<n;u++){const c=e[u];if(c.data.order==l){this.sortIkConstraint(c);continue t}}for(let u=0;u<a;u++){const c=s[u];if(c.data.order==l){this.sortTransformConstraint(c);continue t}}for(let u=0;u<h;u++){const c=i[u];if(c.data.order==l){this.sortPathConstraint(c);continue t}}}for(let l=0,u=t.length;l<u;l++)this.sortBone(t[l])}sortIkConstraint(r){if(r.active=r.target.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.target;this.sortBone(t);const e=r.bones,s=e[0];if(this.sortBone(s),e.length>1){const i=e[e.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(r),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(r){if(r.active=r.target.bone.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.target,e=t.data.index,s=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,s),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let h=0,o=this.data.skins.length;h<o;h++)this.sortPathConstraintAttachment(this.data.skins[h],e,s);const i=t.getAttachment();i instanceof xl&&this.sortPathConstraintAttachmentWith(i,s);const n=r.bones,a=n.length;for(let h=0;h<a;h++)this.sortBone(n[h]);this._updateCache.push(r);for(let h=0;h<a;h++)this.sortReset(n[h].children);for(let h=0;h<a;h++)n[h].sorted=!0}sortTransformConstraint(r){if(r.active=r.target.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;this.sortBone(r.target);const t=r.bones,e=t.length;if(r.data.local)for(let s=0;s<e;s++){const i=t[s];this.sortBone(i.parent),this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(r);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(r,t,e){const s=r.attachments[t];if(s)for(const i in s)this.sortPathConstraintAttachmentWith(s[i],e)}sortPathConstraintAttachmentWith(r,t){if(!(r instanceof xl))return;const e=r.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let i=0;for(;i<e.length;){const n=e[i++];for(let a=i+n;i<a;i++){const h=e[i];this.sortBone(s[h])}}}}sortBone(r){if(r.sorted)return;const t=r.parent;t!=null&&this.sortBone(t),r.sorted=!0,this._updateCache.push(r)}sortReset(r){for(let t=0,e=r.length;t<e;t++){const s=r[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const r=this.updateCacheReset;for(let e=0,s=r.length;e<s;e++){const i=r[e];i.ax=i.x,i.ay=i.y,i.arotation=i.rotation,i.ascaleX=i.scaleX,i.ascaleY=i.scaleY,i.ashearX=i.shearX,i.ashearY=i.shearY,i.appliedValid=!0}const t=this._updateCache;for(let e=0,s=t.length;e<s;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const r=this.bones;for(let i=0,n=r.length;i<n;i++)r[i].setToSetupPose();const t=this.ikConstraints;for(let i=0,n=t.length;i<n;i++){const a=t[i];a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}const e=this.transformConstraints;for(let i=0,n=e.length;i<n;i++){const a=e[i],h=a.data;a.rotateMix=h.rotateMix,a.translateMix=h.translateMix,a.scaleMix=h.scaleMix,a.shearMix=h.shearMix}const s=this.pathConstraints;for(let i=0,n=s.length;i<n;i++){const a=s[i],h=a.data;a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix}}setSlotsToSetupPose(){const r=this.slots;B.arrayCopy(r,0,this.drawOrder,0,r.length);for(let t=0,e=r.length;t<e;t++)r[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(r){if(r==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findBoneIndex(r){if(r==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==r)return e;return-1}findSlot(r){if(r==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findSlotIndex(r){if(r==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==r)return e;return-1}setSkinByName(r){const t=this.data.findSkin(r);if(t==null)throw new Error(`Skin not found: ${r}`);this.setSkin(t)}setSkin(r){if(r!=this.skin){if(r!=null)if(this.skin!=null)r.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const i=t[e],n=i.data.attachmentName;if(n!=null){const a=r.getAttachment(e,n);a!=null&&i.setAttachment(a)}}}this.skin=r,this.updateCache()}}getAttachmentByName(r,t){return this.getAttachment(this.data.findSlotIndex(r),t)}getAttachment(r,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(r,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(r,t):null}setAttachment(r,t){if(r==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.data.name==r){let a=null;if(t!=null&&(a=this.getAttachment(s,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${r}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${r}`)}findIkConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findTransformConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findPathConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}getBounds(r,t,e=new Array(2)){if(r==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let i=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let o=0,l=s.length;o<l;o++){const u=s[o];if(!u.bone.active)continue;let c=0,d=null;const f=u.getAttachment();if(f instanceof rt)c=8,d=B.setArraySize(e,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(f instanceof Vu){const p=f;c=p.worldVerticesLength,d=B.setArraySize(e,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(d!=null)for(let p=0,m=d.length;p<m;p+=2){const g=d[p],_=d[p+1];i=Math.min(i,g),n=Math.min(n,_),a=Math.max(a,g),h=Math.max(h,_)}}r.set(i,n),t.set(a-i,h-n)}update(r){this.time+=r}get flipX(){return this.scaleX==-1}set flipX(r){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=r?1:-1}get flipY(){return this.scaleY==-1}set flipY(r){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=r?1:-1}};let G_=Ro;G_.deprecatedWarning1=!1;let X_=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}},$_=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},H_=class extends Hu{constructor(t){super(t,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},Y_=class{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Yu=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];i.attachment!=null&&(i.attachment instanceof Vu?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&(s[e]=null)}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const i in s){const n=s[i];n&&t.push(new Y_(e,i,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new Y_(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}};const Kt=class{constructor(r){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=r}readSkeletonData(r){const t=this.scale,e=new X_;e.name="";const s=new yl(r);e.hash=s.readString(),e.version=s.readString(),e.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),e.x=s.readFloat(),e.y=s.readFloat(),e.width=s.readFloat(),e.height=s.readFloat();const i=s.readBoolean();i&&(e.fps=s.readFloat(),e.imagesPath=s.readString(),e.audioPath=s.readString());let n=0;n=s.readInt(!0);for(let h=0;h<n;h++)s.strings.push(s.readString());n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=h==0?null:e.bones[s.readInt(!0)],u=new O_(h,o,l);u.rotation=s.readFloat(),u.x=s.readFloat()*t,u.y=s.readFloat()*t,u.scaleX=s.readFloat(),u.scaleY=s.readFloat(),u.shearX=s.readFloat(),u.shearY=s.readFloat(),u.length=s.readFloat()*t,u.transformMode=Kt.TransformModeValues[s.readInt(!0)],u.skinRequired=s.readBoolean(),i&&X.rgba8888ToColor(u.color,s.readInt32()),e.bones.push(u)}n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=e.bones[s.readInt(!0)],u=new $_(h,o,l);X.rgba8888ToColor(u.color,s.readInt32());const c=s.readInt32();c!=-1&&X.rgb888ToColor(u.darkColor=new X,c),u.attachmentName=s.readStringRef(),u.blendMode=Kt.BlendModeValues[s.readInt(!0)],e.slots.push(u)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new V_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.mix=s.readFloat(),l.softness=s.readFloat()*t,l.bendDirection=s.readByte(),l.compress=s.readBoolean(),l.stretch=s.readBoolean(),l.uniform=s.readBoolean(),e.ikConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new H_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.local=s.readBoolean(),l.relative=s.readBoolean(),l.offsetRotation=s.readFloat(),l.offsetX=s.readFloat()*t,l.offsetY=s.readFloat()*t,l.offsetScaleX=s.readFloat(),l.offsetScaleY=s.readFloat(),l.offsetShearY=s.readFloat(),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),l.scaleMix=s.readFloat(),l.shearMix=s.readFloat(),e.transformConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new U_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.slots[s.readInt(!0)],l.positionMode=Kt.PositionModeValues[s.readInt(!0)],l.spacingMode=Kt.SpacingModeValues[s.readInt(!0)],l.rotateMode=Kt.RotateModeValues[s.readInt(!0)],l.offsetRotation=s.readFloat(),l.position=s.readFloat(),l.positionMode==ne.Fixed&&(l.position*=t),l.spacing=s.readFloat(),(l.spacingMode==be.Length||l.spacingMode==be.Fixed)&&(l.spacing*=t),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),e.pathConstraints.push(l)}const a=this.readSkin(s,e,!0,i);a!=null&&(e.defaultSkin=a,e.skins.push(a));{let h=e.skins.length;for(B.setArraySize(e.skins,n=h+s.readInt(!0));h<n;h++)e.skins[h]=this.readSkin(s,e,!1,i)}n=this.linkedMeshes.length;for(let h=0;h<n;h++){const o=this.linkedMeshes[h],l=o.skin==null?e.defaultSkin:e.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}this.linkedMeshes.length=0,n=s.readInt(!0);for(let h=0;h<n;h++){const o=new N_(s.readStringRef());o.intValue=s.readInt(!1),o.floatValue=s.readFloat(),o.stringValue=s.readString(),o.audioPath=s.readString(),o.audioPath!=null&&(o.volume=s.readFloat(),o.balance=s.readFloat()),e.events.push(o)}n=s.readInt(!0);for(let h=0;h<n;h++)e.animations.push(this.readAnimation(s,s.readString(),e));return e}readSkin(r,t,e,s){let i=null,n=0;if(e){if(n=r.readInt(!0),n==0)return null;i=new Yu("default")}else{i=new Yu(r.readStringRef()),i.bones.length=r.readInt(!0);for(let a=0,h=i.bones.length;a<h;a++)i.bones[a]=t.bones[r.readInt(!0)];for(let a=0,h=r.readInt(!0);a<h;a++)i.constraints.push(t.ikConstraints[r.readInt(!0)]);for(let a=0,h=r.readInt(!0);a<h;a++)i.constraints.push(t.transformConstraints[r.readInt(!0)]);for(let a=0,h=r.readInt(!0);a<h;a++)i.constraints.push(t.pathConstraints[r.readInt(!0)]);n=r.readInt(!0)}for(let a=0;a<n;a++){const h=r.readInt(!0);for(let o=0,l=r.readInt(!0);o<l;o++){const u=r.readStringRef(),c=this.readAttachment(r,t,i,h,u,s);c!=null&&i.setAttachment(h,u,c)}}return i}readAttachment(r,t,e,s,i,n){const a=this.scale;let h=r.readStringRef();h==null&&(h=i);const o=r.readByte();switch(Kt.AttachmentTypeValues[o]){case at.Region:{let u=r.readStringRef();const c=r.readFloat(),d=r.readFloat(),f=r.readFloat(),p=r.readFloat(),m=r.readFloat(),g=r.readFloat(),_=r.readFloat(),x=r.readInt32();u==null&&(u=h);const y=this.attachmentLoader.newRegionAttachment(e,h,u);return y==null?null:(y.path=u,y.x=d*a,y.y=f*a,y.scaleX=p,y.scaleY=m,y.rotation=c,y.width=g*a,y.height=_*a,X.rgba8888ToColor(y.color,x),y)}case at.BoundingBox:{const u=r.readInt(!0),c=this.readVertices(r,u),d=n?r.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(e,h);return f==null?null:(f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,n&&X.rgba8888ToColor(f.color,d),f)}case at.Mesh:{let u=r.readStringRef();const c=r.readInt32(),d=r.readInt(!0),f=this.readFloatArray(r,d<<1,1),p=this.readShortArray(r),m=this.readVertices(r,d),g=r.readInt(!0);let _=null,x=0,y=0;n&&(_=this.readShortArray(r),x=r.readFloat(),y=r.readFloat()),u==null&&(u=h);const v=this.attachmentLoader.newMeshAttachment(e,h,u);return v==null?null:(v.path=u,X.rgba8888ToColor(v.color,c),v.bones=m.bones,v.vertices=m.vertices,v.worldVerticesLength=d<<1,v.triangles=p,v.regionUVs=new Float32Array(f),v.hullLength=g<<1,n&&(v.edges=_,v.width=x*a,v.height=y*a),v)}case at.LinkedMesh:{let u=r.readStringRef();const c=r.readInt32(),d=r.readStringRef(),f=r.readStringRef(),p=r.readBoolean();let m=0,g=0;n&&(m=r.readFloat(),g=r.readFloat()),u==null&&(u=h);const _=this.attachmentLoader.newMeshAttachment(e,h,u);return _==null?null:(_.path=u,X.rgba8888ToColor(_.color,c),n&&(_.width=m*a,_.height=g*a),this.linkedMeshes.push(new JS(_,d,s,f,p)),_)}case at.Path:{const u=r.readBoolean(),c=r.readBoolean(),d=r.readInt(!0),f=this.readVertices(r,d),p=B.newArray(d/3,0);for(let _=0,x=p.length;_<x;_++)p[_]=r.readFloat()*a;const m=n?r.readInt32():0,g=this.attachmentLoader.newPathAttachment(e,h);return g==null?null:(g.closed=u,g.constantSpeed=c,g.worldVerticesLength=d<<1,g.vertices=f.vertices,g.bones=f.bones,g.lengths=p,n&&X.rgba8888ToColor(g.color,m),g)}case at.Point:{const u=r.readFloat(),c=r.readFloat(),d=r.readFloat(),f=n?r.readInt32():0,p=this.attachmentLoader.newPointAttachment(e,h);return p==null?null:(p.x=c*a,p.y=d*a,p.rotation=u,n&&X.rgba8888ToColor(p.color,f),p)}case at.Clipping:{const u=r.readInt(!0),c=r.readInt(!0),d=this.readVertices(r,c),f=n?r.readInt32():0,p=this.attachmentLoader.newClippingAttachment(e,h);return p==null?null:(p.endSlot=t.slots[u],p.worldVerticesLength=c<<1,p.vertices=d.vertices,p.bones=d.bones,n&&X.rgba8888ToColor(p.color,f),p)}}return null}readVertices(r,t){const e=t<<1,s=new tC,i=this.scale;if(!r.readBoolean())return s.vertices=this.readFloatArray(r,e,i),s;const n=new Array,a=new Array;for(let h=0;h<t;h++){const o=r.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(r.readInt(!0)),n.push(r.readFloat()*i),n.push(r.readFloat()*i),n.push(r.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=a,s}readFloatArray(r,t,e){const s=new Array(t);if(e==1)for(let i=0;i<t;i++)s[i]=r.readFloat();else for(let i=0;i<t;i++)s[i]=r.readFloat()*e;return s}readShortArray(r){const t=r.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=r.readShort();return e}readAnimation(r,t,e){const s=new Array,i=this.scale;let n=0;const a=new X,h=new X;for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0);for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readByte(),g=r.readInt(!0);switch(m){case Kt.SLOT_ATTACHMENT:{const _=new Rn(g);_.slotIndex=d;for(let x=0;x<g;x++)_.setFrame(x,r.readFloat(),r.readStringRef());s.push(_),n=Math.max(n,_.frames[g-1]);break}case Kt.SLOT_COLOR:{const _=new Ye(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=r.readFloat();X.rgba8888ToColor(a,r.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a),x<g-1&&this.readCurve(r,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*Ye.ENTRIES]);break}case Kt.SLOT_TWO_COLOR:{const _=new ae(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=r.readFloat();X.rgba8888ToColor(a,r.readInt32()),X.rgb888ToColor(h,r.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a,h.r,h.g,h.b),x<g-1&&this.readCurve(r,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*ae.ENTRIES]);break}}}}for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0);for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readByte(),g=r.readInt(!0);switch(m){case Kt.BONE_ROTATE:{const _=new Ie(g);_.boneIndex=d;for(let x=0;x<g;x++)_.setFrame(x,r.readFloat(),r.readFloat()),x<g-1&&this.readCurve(r,x,_);s.push(_),n=Math.max(n,_.frames[(g-1)*Ie.ENTRIES]);break}case Kt.BONE_TRANSLATE:case Kt.BONE_SCALE:case Kt.BONE_SHEAR:{let _,x=1;m==Kt.BONE_SCALE?_=new C_(g):m==Kt.BONE_SHEAR?_=new I_(g):(_=new ps(g),x=i),_.boneIndex=d;for(let y=0;y<g;y++)_.setFrame(y,r.readFloat(),r.readFloat()*x,r.readFloat()*x),y<g-1&&this.readCurve(r,y,_);s.push(_),n=Math.max(n,_.frames[(g-1)*ps.ENTRIES]);break}}}}for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0),f=r.readInt(!0),p=new Pe(f);p.ikConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,r.readFloat(),r.readFloat(),r.readFloat()*i,r.readByte(),r.readBoolean(),r.readBoolean()),m<f-1&&this.readCurve(r,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0),f=r.readInt(!0),p=new We(f);p.transformConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat()),m<f-1&&this.readCurve(r,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let u=0,c=r.readInt(!0);u<c;u++){const d=r.readInt(!0),f=e.pathConstraints[d];for(let p=0,m=r.readInt(!0);p<m;p++){const g=r.readByte(),_=r.readInt(!0);switch(g){case Kt.PATH_POSITION:case Kt.PATH_SPACING:{let x,y=1;g==Kt.PATH_SPACING?(x=new M_(_),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(y=i)):(x=new Ci(_),f.positionMode==ne.Fixed&&(y=i)),x.pathConstraintIndex=d;for(let v=0;v<_;v++)x.setFrame(v,r.readFloat(),r.readFloat()*y),v<_-1&&this.readCurve(r,v,x);s.push(x),n=Math.max(n,x.frames[(_-1)*Ci.ENTRIES]);break}case Kt.PATH_MIX:{const x=new oi(_);x.pathConstraintIndex=d;for(let y=0;y<_;y++)x.setFrame(y,r.readFloat(),r.readFloat(),r.readFloat()),y<_-1&&this.readCurve(r,y,x);s.push(x),n=Math.max(n,x.frames[(_-1)*oi.ENTRIES]);break}}}}for(let u=0,c=r.readInt(!0);u<c;u++){const d=e.skins[r.readInt(!0)];for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readInt(!0);for(let g=0,_=r.readInt(!0);g<_;g++){const x=d.getAttachment(m,r.readStringRef()),y=x.bones!=null,v=x.vertices,b=y?v.length/3*2:v.length,w=r.readInt(!0),E=new R_(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=r.readFloat();let I,M=r.readInt(!0);if(M==0)I=y?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=r.readInt(!0);if(M+=R,i==1)for(let C=R;C<M;C++)I[C]=r.readFloat();else for(let C=R;C<M;C++)I[C]=r.readFloat()*i;if(!y)for(let C=0,P=I.length;C<P;C++)I[C]+=v[C]}E.setFrame(T,A,I),T<w-1&&this.readCurve(r,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const o=r.readInt(!0);if(o>0){const u=new Io(o),c=e.slots.length;for(let d=0;d<o;d++){const f=r.readFloat(),p=r.readInt(!0),m=B.newArray(c,0);for(let y=c-1;y>=0;y--)m[y]=-1;const g=B.newArray(c-p,0);let _=0,x=0;for(let y=0;y<p;y++){const v=r.readInt(!0);for(;_!=v;)g[x++]=_++;m[_+r.readInt(!0)]=_++}for(;_<c;)g[x++]=_++;for(let y=c-1;y>=0;y--)m[y]==-1&&(m[y]=g[--x]);u.setFrame(d,f,m)}s.push(u),n=Math.max(n,u.frames[o-1])}const l=r.readInt(!0);if(l>0){const u=new Uu(l);for(let c=0;c<l;c++){const d=r.readFloat(),f=e.events[r.readInt(!0)],p=new L_(d,f);p.intValue=r.readInt(!1),p.floatValue=r.readFloat(),p.stringValue=r.readBoolean()?r.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=r.readFloat(),p.balance=r.readFloat()),u.setFrame(c,p)}s.push(u),n=Math.max(n,u.frames[l-1])}return new oe(t,s,n)}readCurve(r,t,e){switch(r.readByte()){case Kt.CURVE_STEPPED:e.setStepped(t);break;case Kt.CURVE_BEZIER:this.setCurve(e,t,r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat());break}}setCurve(r,t,e,s,i,n){r.setCurve(t,e,s,i,n)}};let le=Kt;le.AttachmentTypeValues=[0,1,2,3,4,5,6],le.TransformModeValues=[vt.Normal,vt.OnlyTranslation,vt.NoRotationOrReflection,vt.NoScale,vt.NoScaleOrReflection],le.PositionModeValues=[ne.Fixed,ne.Percent],le.SpacingModeValues=[be.Length,be.Fixed,be.Percent],le.RotateModeValues=[Fe.Tangent,Fe.Chain,Fe.ChainScale],le.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN],le.BONE_ROTATE=0,le.BONE_TRANSLATE=1,le.BONE_SCALE=2,le.BONE_SHEAR=3,le.SLOT_ATTACHMENT=0,le.SLOT_COLOR=1,le.SLOT_TWO_COLOR=2,le.PATH_POSITION=0,le.PATH_SPACING=1,le.PATH_MIX=2,le.CURVE_LINEAR=0,le.CURVE_STEPPED=1,le.CURVE_BEZIER=2;let JS=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritDeform=n}},tC=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},eC=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new X_,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n!=null){if(s.hash=n.hash,s.version=n.spine,s.version.substr(0,3)!=="3.8"){const a=`Spine 3.8 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(a)}s.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(i.bones)for(let a=0;a<i.bones.length;a++){const h=i.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new O_(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Un.transformModeFromString(this.getValue(h,"transform","normal")),u.skinRequired=this.getValue(h,"skin",!1),s.bones.push(u)}if(i.slots)for(let a=0;a<i.slots.length;a++){const h=i.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new $_(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Un.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(i.ik)for(let a=0;a<i.ik.length;a++){const h=i.ik[a],o=new V_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.mix=this.getValue(h,"mix",1),o.softness=this.getValue(h,"softness",0)*e,o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.compress=this.getValue(h,"compress",!1),o.stretch=this.getValue(h,"stretch",!1),o.uniform=this.getValue(h,"uniform",!1),s.ikConstraints.push(o)}if(i.transform)for(let a=0;a<i.transform.length;a++){const h=i.transform[a],o=new H_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(i.path)for(let a=0;a<i.path.length;a++){const h=i.path[a],o=new U_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Un.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Un.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Un.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==be.Length||o.spacingMode==be.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(i.skins)for(let a=0;a<i.skins.length;a++){const h=i.skins[a],o=new Yu(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=s.findBone(h.bones[l]);if(u==null)throw new Error(`Skin bone not found: ${h.bones[a]}`);o.bones.push(u)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=s.findIkConstraint(h.ik[l]);if(u==null)throw new Error(`Skin IK constraint not found: ${h.ik[a]}`);o.constraints.push(u)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=s.findTransformConstraint(h.transform[l]);if(u==null)throw new Error(`Skin transform constraint not found: ${h.transform[a]}`);o.constraints.push(u)}if(h.path)for(let l=0;l<h.path.length;l++){const u=s.findPathConstraint(h.path[l]);if(u==null)throw new Error(`Skin path constraint not found: ${h.path[a]}`);o.constraints.push(u)}for(const l in h.attachments){const u=s.findSlot(l);if(u==null)throw new Error(`Slot not found: ${l}`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f!=null&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,i.events)for(const a in i.events){const h=i.events[a],o=new N_(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(i.animations)for(const a in i.animations){const h=i.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,i,n){const a=this.scale;switch(i=this.getValue(t,"name",i),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",i),l=this.attachmentLoader.newRegionAttachment(e,i,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",i),l=this.attachmentLoader.newMeshAttachment(e,i,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u),l.width=this.getValue(t,"width",0)*a,l.height=this.getValue(t,"height",0)*a;const c=this.getValue(t,"parent",null);if(c!=null)return this.linkedMeshes.push(new sC(l,this.getValue(t,"skin",null),s,c,this.getValue(t,"deform",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=this.getValue(t,"edges",null),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,i);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,i);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,i);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(i!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=i;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*i),a.push(n[o+2]*i),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const i=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new Rn(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,this.getValue(g,"time",0),g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new Ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ye.ENTRIES])}else if(c=="twoColor"){const f=new ae(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ae.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Ie(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ie.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1,m=0;c==="scale"?(f=new C_(d.length),m=1):c==="shear"?f=new I_(d.length):(f=new ps(d.length),p=i),f.boneIndex=u;let g=0;for(let _=0;_<d.length;_++){const x=d[_],y=this.getValue(x,"x",m),v=this.getValue(x,"y",m);f.setFrame(g,this.getValue(x,"time",0),y*p,v*p),this.readCurve(x,f,g),g++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ps.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new Pe(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*i,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*Pe.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new We(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*We.ENTRIES])}if(t.path)for(const o in t.path){const l=t.path[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new M_(f.length),(c.spacingMode==be.Length||c.spacingMode==be.Fixed)&&(m=i)):(p=new Ci(f.length),c.positionMode==ne.Fixed&&(m=i)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Ci.ENTRIES])}else if(d==="mix"){const p=new oi(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,this.getValue(_,"time",0),this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*oi.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new R_(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),i!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=i;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,this.getValue(E,"time",0),T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new Io(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,this.getValue(d,"time",0),f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new Uu(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new L_(B.toSinglePrecision(this.getValue(c,"time",0)),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new oe(e,n,a))}readCurve(t,e,s){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(s);else{const i=t.curve;e.setCurve(s,i,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return be.Length;if(t=="fixed")return be.Fixed;if(t=="percent")return be.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},sC=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritDeform=n}};class iC extends Nu{createSkeleton(t){this.skeleton=new G_(t),this.skeleton.updateWorldTransform(),this.stateData=new k_(t),this.state=new ms(this.stateData)}}const rC={extension:H.Asset,loader:{extension:{type:H.LoadParser,priority:Ne.Normal},test(r){return Le(r,".atlas")},async load(r){return await(await z.ADAPTER.fetch(r)).text()},testParse(r,t){const e=Le(t.src,".atlas"),s=typeof r=="string";return Promise.resolve(e&&s)},async parse(r,t,e){const s=t.data;let i=bt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let n=null,a=null;const h=new Promise((u,c)=>{n=u,a=c});let o;const l=u=>{u||a(`Something went terribly wrong loading a spine .atlas file
1170
+ Most likely your texture failed to load.`),n(o)};if(s.image||s.images){const u=Object.assign(s.image?{default:s.image}:{},s.images);o=new Lu(r,(c,d)=>{const f=u[c]||u.default;f&&f.baseTexture?d(f.baseTexture):d(f)},l)}else o=new Lu(r,W_(e,i,s.imageMetadata),l);return await h},unload(r){r.dispose()}}},W_=(r,t,e)=>async(s,i)=>{const n=bt.normalize([...t.split(bt.sep),s].join(bt.sep)),a=await r.load({src:n,data:e});i(a.baseTexture)};K.add(rC);function z_(r){return r.hasOwnProperty("bones")}function nC(r){return r instanceof ArrayBuffer}class oC{constructor(){}installLoader(){const t=this,e={extension:H.Asset,loader:{extension:{type:H.LoadParser,priority:Ne.Normal},test(s){return Le(s,".skel")},async load(s){return await(await z.ADAPTER.fetch(s)).arrayBuffer()},testParse(s,i){var o;const n=Le(i.src,".json")&&z_(s),a=Le(i.src,".skel")&&nC(s),h=((o=i.data)==null?void 0:o.spineAtlas)===!1;return Promise.resolve(n&&!h||a)},async parse(s,i,n){const a=bt.extname(i.src).toLowerCase(),h=bt.basename(i.src,a);let o=bt.dirname(i.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=Le(i.src,".json")&&z_(s);let u=null,c=s;l?u=t.createJsonParser():(u=t.createBinaryParser(),c=new Uint8Array(s));const d=i.data||{},f=(d==null?void 0:d.spineSkeletonScale)??null;f&&(u.scale=f);const p=d.spineAtlas;if(p&&p.pages)return t.parseData(u,p,c);const m=d.atlasRawData;if(m){let x=null,y=null;const v=new Promise((E,T)=>{x=E,y=T}),b=new Lu(m,W_(n,o,d.imageMetadata),E=>{E||y(`Something went terribly wrong loading a spine .atlas file
1171
+ Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u,w,c)}let g=d.spineAtlasFile;g||(g=`${o+h}.atlas`);const _=await n.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(u,_,c)}}};return K.add(e),e}}let j_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const q_=class extends j_{constructor(t){super(t),this.id=(q_.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,i,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];i[w]=E*_+T*x+m,i[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}i[p]=g,i[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}i[m]=x,i[m+1]=y}}}applyDeform(t){return this==t}};let Hr=q_;Hr.nextID=0;let aC=class extends Hr{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},lC=class extends Hr{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},hC=class extends Hr{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.inheritDeform=!1,this.tempColor=new X(0,0,0,0)}applyDeform(t){return this==t||this.inheritDeform&&this.parentMesh==t}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}},cC=class extends Hr{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},uC=class extends Hr{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,a=s*e.b+i*e.d;return Math.atan2(a,n)*D.radDeg}};class dC{constructor(t,e){if(this.attachmentVertices=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const we=class extends j_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=i+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=i*o+this.y,f=i*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[we.OX1]=u-f,x[we.OY1]=d+c,x[we.OX2]=u-_,x[we.OY2]=g+c,x[we.OX3]=p-_,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){const n=this.offset,a=t instanceof dC?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=i,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}};let nt=we;nt.OX1=0,nt.OY1=1,nt.OX2=2,nt.OY2=3,nt.OX3=4,nt.OY3=5,nt.OX4=6,nt.OY4=7,nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31,new w_(2);let Ee=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=s}apply(t,e,s,i,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let i=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?i=a+1:n=a,i==n)return(i+1)*s;a=i+n>>>1}}static linearSearch(t,e,s){for(let i=0,n=t.length-s;i<=n;i+=s)if(t[i]>e)return i;return-1}};const se=class{constructor(r){if(r<=0)throw new Error(`frameCount must be > 0: ${r}`);this.curves=B.newFloatArray((r-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(r){this.curves[r*se.BEZIER_SIZE]=se.LINEAR}setStepped(r){this.curves[r*se.BEZIER_SIZE]=se.STEPPED}getCurveType(r){const t=r*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(r,t,e,s,i){const n=(-t*2+s)*.03,a=(-e*2+i)*.03,h=((t-s)*3+1)*.006,o=((e-i)*3+1)*.006;let l=n*2+h,u=a*2+o,c=t*.3+n+h*.16666667,d=e*.3+a+o*.16666667,f=r*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=d;for(let _=f+se.BEZIER_SIZE-1;f<_;f+=2)p[f]=m,p[f+1]=g,c+=l,d+=u,l+=h,u+=o,m+=c,g+=d}getCurvePercent(r,t){t=D.clamp(t,0,1);const e=this.curves;let s=r*se.BEZIER_SIZE;const i=e[s];if(i==se.LINEAR)return t;if(i==se.STEPPED)return 0;s++;let n=0;for(let h=s,o=s+se.BEZIER_SIZE-1;s<o;s+=2)if(n=e[s],n>=t){let l,u;return s==h?(l=0,u=0):(l=e[s-2],u=e[s-1]),u+(e[s+1]-u)*(t-l)/(n-l)}const a=e[s-1];return a+(1-a)*(t-n)/(1-n)}};let is=se;is.LINEAR=0,is.STEPPED=1,is.BEZIER=2,is.BEZIER_SIZE=10*2-1;const sr=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(r,t,e){r<<=1,this.frames[r]=t,this.frames[r+sr.ROTATION]=e}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.rotation=o.data.rotation;return;case S.first:const p=o.data.rotation-o.rotation;o.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*i}return}if(e>=h[h.length-sr.ENTRIES]){let p=h[h.length+sr.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*i;break;case S.first:case S.replace:p+=o.data.rotation-o.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:o.rotation+=p*i}return}const l=Ee.binarySearch(h,e,sr.ENTRIES),u=h[l+sr.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+sr.PREV_TIME]-c));let f=h[l+sr.ROTATION]-u;switch(f=u+(f-(16384-(16384.499999999996-f/360|0))*360)*d,n){case S.setup:o.rotation=o.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*i;break;case S.first:case S.replace:f+=o.data.rotation-o.rotation;case S.add:o.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*i}}};let Mn=sr;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(r,t,e,s){r*=De.ENTRIES,this.frames[r]=t,this.frames[r+De.X]=e,this.frames[r+De.Y]=s}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let l=0,u=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],u=h[h.length+De.PREV_Y];else{const c=Ee.binarySearch(h,e,De.ENTRIES);l=h[c+De.PREV_X],u=h[c+De.PREV_Y];const d=h[c],f=this.getCurvePercent(c/De.ENTRIES-1,1-(e-d)/(h[c+De.PREV_TIME]-d));l+=(h[c+De.X]-l)*f,u+=(h[c+De.Y]-u)*f}switch(n){case S.setup:o.x=o.data.x+l*i,o.y=o.data.y+u*i;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*i,o.y+=(o.data.y+u-o.y)*i;break;case S.add:o.x+=l*i,o.y+=u*i}}};let ai=De;ai.ENTRIES=3,ai.PREV_TIME=-3,ai.PREV_X=-2,ai.PREV_Y=-1,ai.X=1,ai.Y=2;let fC=class Os extends ai{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Os.ENTRIES])u=o[o.length+Os.PREV_X]*l.data.scaleX,c=o[o.length+Os.PREV_Y]*l.data.scaleY;else{const d=Ee.binarySearch(o,s,Os.ENTRIES);u=o[d+Os.PREV_X],c=o[d+Os.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Os.ENTRIES-1,1-(s-f)/(o[d+Os.PREV_TIME]-f));u=(u+(o[d+Os.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Os.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},pC=class Ls extends ai{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Ls.ENTRIES])u=o[o.length+Ls.PREV_X],c=o[o.length+Ls.PREV_Y];else{const d=Ee.binarySearch(o,s,Ls.ENTRIES);u=o[d+Ls.PREV_X],c=o[d+Ls.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ls.ENTRIES-1,1-(s-f)/(o[d+Ls.PREV_TIME]-f));u=u+(o[d+Ls.X]-u)*p,c=c+(o[d+Ls.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Yt=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Yt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(r,t,e,s,i,n){r*=Yt.ENTRIES,this.frames[r]=t,this.frames[r+Yt.R]=e,this.frames[r+Yt.G]=s,this.frames[r+Yt.B]=i,this.frames[r+Yt.A]=n}apply(r,t,e,s,i,n,a){const h=r.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color);return;case S.first:const f=h.color,p=h.data.color;f.add((p.r-f.r)*i,(p.g-f.g)*i,(p.b-f.b)*i,(p.a-f.a)*i)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Yt.ENTRIES]){const f=o.length;l=o[f+Yt.PREV_R],u=o[f+Yt.PREV_G],c=o[f+Yt.PREV_B],d=o[f+Yt.PREV_A]}else{const f=Ee.binarySearch(o,e,Yt.ENTRIES);l=o[f+Yt.PREV_R],u=o[f+Yt.PREV_G],c=o[f+Yt.PREV_B],d=o[f+Yt.PREV_A];const p=o[f],m=this.getCurvePercent(f/Yt.ENTRIES-1,1-(e-p)/(o[f+Yt.PREV_TIME]-p));l+=(o[f+Yt.R]-l)*m,u+=(o[f+Yt.G]-u)*m,c+=(o[f+Yt.B]-c)*m,d+=(o[f+Yt.A]-d)*m}if(i==1)h.color.set(l,u,c,d);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*i,(u-f.g)*i,(c-f.b)*i,(d-f.a)*i)}}};let gs=Yt;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_R=-4,gs.PREV_G=-3,gs.PREV_B=-2,gs.PREV_A=-1,gs.R=1,gs.G=2,gs.B=3,gs.A=4;const ft=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(r,t,e,s,i,n,a,h,o){r*=ft.ENTRIES,this.frames[r]=t,this.frames[r+ft.R]=e,this.frames[r+ft.G]=s,this.frames[r+ft.B]=i,this.frames[r+ft.A]=n,this.frames[r+ft.R2]=a,this.frames[r+ft.G2]=h,this.frames[r+ft.B2]=o}apply(r,t,e,s,i,n,a){const h=r.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color),h.darkColor.setFromColor(h.data.darkColor);return;case S.first:const g=h.color,_=h.darkColor,x=h.data.color,y=h.data.darkColor;g.add((x.r-g.r)*i,(x.g-g.g)*i,(x.b-g.b)*i,(x.a-g.a)*i),_.add((y.r-_.r)*i,(y.g-_.g)*i,(y.b-_.b)*i,0)}return}let l=0,u=0,c=0,d=0,f=0,p=0,m=0;if(e>=o[o.length-ft.ENTRIES]){const g=o.length;l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2]}else{const g=Ee.binarySearch(o,e,ft.ENTRIES);l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2];const _=o[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-_)/(o[g+ft.PREV_TIME]-_));l+=(o[g+ft.R]-l)*x,u+=(o[g+ft.G]-u)*x,c+=(o[g+ft.B]-c)*x,d+=(o[g+ft.A]-d)*x,f+=(o[g+ft.R2]-f)*x,p+=(o[g+ft.G2]-p)*x,m+=(o[g+ft.B2]-m)*x}if(i==1)h.color.set(l,u,c,d),h.darkColor.set(f,p,m,1);else{const g=h.color,_=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),_.setFromColor(h.data.darkColor)),g.add((l-g.r)*i,(u-g.g)*i,(c-g.b)*i,(d-g.a)*i),_.add((f-_.r)*i,(p-_.g)*i,(m-_.b)*i,0)}}};let ye=ft;ye.ENTRIES=8,ye.PREV_TIME=-8,ye.PREV_R=-7,ye.PREV_G=-6,ye.PREV_B=-5,ye.PREV_A=-4,ye.PREV_R2=-3,ye.PREV_G2=-2,ye.PREV_B2=-1,ye.R=1,ye.G=2,ye.B=3,ye.A=4,ye.R2=5,ye.G2=6,ye.B2=7;let mC=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(h==At.mixOut&&a==S.setup){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}const l=this.frames;if(s<l[0]){if(a==S.setup||a==S.first){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let u=0;s>=l[l.length-1]?u=l.length-1:u=Ee.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}},Z_=null,gC=class extends is{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),Z_==null&&(Z_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Hr)||!l.applyDeform(this.attachment))return;const u=o.attachmentVertices;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},_C=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,a,h){if(i==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=Ee.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)i.push(this.events[u])}},yC=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=Ee.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const St=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(r,t,e,s,i,n){r*=St.ENTRIES,this.frames[r]=t,this.frames[r+St.MIX]=e,this.frames[r+St.BEND_DIRECTION]=s,this.frames[r+St.COMPRESS]=i?1:0,this.frames[r+St.STRETCH]=n?1:0}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.mix=o.data.mix,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*i,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(o.mix=o.data.mix+(h[h.length+St.PREV_MIX]-o.data.mix)*i,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0)):(o.mix+=(h[h.length+St.PREV_MIX]-o.mix)*i,a==At.mixIn&&(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),u=h[l+St.PREV_MIX],c=h[l],d=this.getCurvePercent(l/St.ENTRIES-1,1-(e-c)/(h[l+St.PREV_TIME]-c));n==S.setup?(o.mix=o.data.mix+(u+(h[l+St.MIX]-u)*d-o.data.mix)*i,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0)):(o.mix+=(u+(h[l+St.MIX]-u)*d-o.mix)*i,a==At.mixIn&&(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0))}};let _s=St;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_MIX=-4,_s.PREV_BEND_DIRECTION=-3,_s.PREV_COMPRESS=-2,_s.PREV_STRETCH=-1,_s.MIX=1,_s.BEND_DIRECTION=2,_s.COMPRESS=3,_s.STRETCH=4;const Wt=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(r,t,e,s,i,n){r*=Wt.ENTRIES,this.frames[r]=t,this.frames[r+Wt.ROTATE]=e,this.frames[r+Wt.TRANSLATE]=s,this.frames[r+Wt.SCALE]=i,this.frames[r+Wt.SHEAR]=n}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=o.data;switch(n){case S.setup:o.rotateMix=f.rotateMix,o.translateMix=f.translateMix,o.scaleMix=f.scaleMix,o.shearMix=f.shearMix;return;case S.first:o.rotateMix+=(f.rotateMix-o.rotateMix)*i,o.translateMix+=(f.translateMix-o.translateMix)*i,o.scaleMix+=(f.scaleMix-o.scaleMix)*i,o.shearMix+=(f.shearMix-o.shearMix)*i}return}let l=0,u=0,c=0,d=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR];const p=h[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(h[f+Wt.PREV_TIME]-p));l+=(h[f+Wt.ROTATE]-l)*m,u+=(h[f+Wt.TRANSLATE]-u)*m,c+=(h[f+Wt.SCALE]-c)*m,d+=(h[f+Wt.SHEAR]-d)*m}if(n==S.setup){const f=o.data;o.rotateMix=f.rotateMix+(l-f.rotateMix)*i,o.translateMix=f.translateMix+(u-f.translateMix)*i,o.scaleMix=f.scaleMix+(c-f.scaleMix)*i,o.shearMix=f.shearMix+(d-f.shearMix)*i}else o.rotateMix+=(l-o.rotateMix)*i,o.translateMix+=(u-o.translateMix)*i,o.scaleMix+=(c-o.scaleMix)*i,o.shearMix+=(d-o.shearMix)*i}};let ys=Wt;ys.ENTRIES=5,ys.PREV_TIME=-5,ys.PREV_ROTATE=-4,ys.PREV_TRANSLATE=-3,ys.PREV_SCALE=-2,ys.PREV_SHEAR=-1,ys.ROTATE=1,ys.TRANSLATE=2,ys.SCALE=3,ys.SHEAR=4;const Ps=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Ps.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(r,t,e){r*=Ps.ENTRIES,this.frames[r]=t,this.frames[r+Ps.VALUE]=e}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*i}return}let l=0;if(e>=h[h.length-Ps.ENTRIES])l=h[h.length+Ps.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Ps.ENTRIES);l=h[u+Ps.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Ps.ENTRIES-1,1-(e-c)/(h[u+Ps.PREV_TIME]-c));l+=(h[u+Ps.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*i:o.position+=(l-o.position)*i}};let Yr=Ps;Yr.ENTRIES=2,Yr.PREV_TIME=-2,Yr.PREV_VALUE=-1,Yr.VALUE=1;let xC=class ur extends Yr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,i,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ur.ENTRIES])u=o[o.length+ur.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ur.ENTRIES);u=o[c+ur.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ur.ENTRIES-1,1-(s-d)/(o[c+ur.PREV_TIME]-d));u+=(o[c+ur.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Oe=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(r,t,e,s){r*=Oe.ENTRIES,this.frames[r]=t,this.frames[r+Oe.ROTATE]=e,this.frames[r+Oe.TRANSLATE]=s}apply(r,t,e,s,i,n,a){const h=this.frames,o=r.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.rotateMix=o.data.rotateMix,o.translateMix=o.data.translateMix;return;case S.first:o.rotateMix+=(o.data.rotateMix-o.rotateMix)*i,o.translateMix+=(o.data.translateMix-o.translateMix)*i}return}let l=0,u=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],u=h[h.length+Oe.PREV_TRANSLATE];else{const c=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[c+Oe.PREV_ROTATE],u=h[c+Oe.PREV_TRANSLATE];const d=h[c],f=this.getCurvePercent(c/Oe.ENTRIES-1,1-(e-d)/(h[c+Oe.PREV_TIME]-d));l+=(h[c+Oe.ROTATE]-l)*f,u+=(h[c+Oe.TRANSLATE]-u)*f}n==S.setup?(o.rotateMix=o.data.rotateMix+(l-o.data.rotateMix)*i,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*i):(o.rotateMix+=(l-o.rotateMix)*i,o.translateMix+=(u-o.translateMix)*i)}};let ir=Oe;ir.ENTRIES=3,ir.PREV_TIME=-3,ir.PREV_ROTATE=-2,ir.PREV_TRANSLATE=-1,ir.ROTATE=1,ir.TRANSLATE=2,new Ee("<empty>",[],0);let vC=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=i,n}newMeshAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new hC(e);return n.region=i,n}newBoundingBoxAttachment(t,e){return new aC(e)}newPathAttachment(t,e){return new cC(e)}newPointAttachment(t,e){return new uC(e)}newClippingAttachment(t,e){return new lC(e)}},bC=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},wC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},EC=class{constructor(t){this.name=t}},TC=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},AC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var rr=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(rr||{});let SC=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}},CC=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},IC=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},PC=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}},RC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new SC,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n!=null&&(s.hash=n.hash,s.version=n.spine,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images),i.bones)for(let a=0;a<i.bones.length;a++){const h=i.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new bC(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Gn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(u)}if(i.slots)for(let a=0;a<i.slots.length;a++){const h=i.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new CC(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Gn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(i.ik)for(let a=0;a<i.ik.length;a++){const h=i.ik[a],o=new TC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.mix=this.getValue(h,"mix",1),s.ikConstraints.push(o)}if(i.transform)for(let a=0;a<i.transform.length;a++){const h=i.transform[a],o=new IC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(i.path)for(let a=0;a<i.path.length;a++){const h=i.path[a],o=new AC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Gn.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Gn.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Gn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==rr.Length||o.spacingMode==rr.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(i.skins)for(const a in i.skins){const h=i.skins[a],o=new PC(a);for(const l in h){const u=s.findSlotIndex(l);if(u==-1)throw new Error(`Slot not found: ${l}`);const c=h[l];for(const d in c){const f=this.readAttachment(c[d],o,u,d,s);f!=null&&o.addAttachment(u,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,i.events)for(const a in i.events){const h=i.events[a],o=new EC(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(i.animations)for(const a in i.animations){const h=i.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,i,n){const a=this.scale;switch(i=this.getValue(t,"name",i),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",i),l=this.attachmentLoader.newRegionAttachment(e,i,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",i),l=this.attachmentLoader.newMeshAttachment(e,i,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u);const c=this.getValue(t,"parent",null);if(c!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new MC(l,this.getValue(t,"skin",null),s,c)),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,i);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,i);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,i);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(i!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=i;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*i),a.push(n[o+2]*i),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const i=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new mC(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,g.time,g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new gs(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*gs.ENTRIES])}else if(c=="twoColor"){const f=new ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ye.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Mn(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Mn.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1;c==="scale"?f=new fC(d.length):c==="shear"?f=new pC(d.length):(f=new ai(d.length),p=i),f.boneIndex=u;let m=0;for(let g=0;g<d.length;g++){const _=d[g],x=this.getValue(_,"x",0),y=this.getValue(_,"y",0);f.setFrame(m,_.time,x*p,y*p),this.readCurve(_,f,m),m++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ai.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new _s(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*_s.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new ys(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*ys.ENTRIES])}if(t.paths)for(const o in t.paths){const l=t.paths[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new xC(f.length),(c.spacingMode==rr.Length||c.spacingMode==rr.Fixed)&&(m=i)):(p=new Yr(f.length),c.positionMode==ne.Fixed&&(m=i)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,x.time,this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Yr.ENTRIES])}else if(d==="mix"){const p=new ir(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,_.time,this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*ir.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new gC(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),i!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=i;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new yC(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,d.time,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new _C(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new wC(B.toSinglePrecision(c.time),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,a))}readCurve(t,e,s){if(t.curve){if(t.curve==="stepped")e.setStepped(s);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){const i=t.curve;e.setCurve(s,i[0],i[1],i[2],i[3])}}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return rr.Length;if(t=="fixed")return rr.Fixed;if(t=="percent")return rr.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},MC=class{constructor(t,e,s,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i}};class K_{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const Q_=class extends K_{constructor(r){super(r),this.id=Q_.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(r,t){this.computeWorldVertices(r,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(r,t,e,s,i,n){e=i+(e>>1)*n;const a=r.bone.skeleton,h=r.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=r.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=i;b<e;v+=2,b+=n){const w=o[v],E=o[v+1];s[b]=w*g+E*_+p,s[b+1]=w*x+E*y+m}return}let u=0,c=0;for(let f=0;f<t;f+=2){const p=l[u];u+=p+1,c+=p}const d=a.bones;if(h.length==0)for(let f=i,p=c*3;f<e;f+=n){let m=0,g=0,_=l[u++];for(_+=u;u<_;u++,p+=3){const x=d[l[u]].matrix,y=o[p],v=o[p+1],b=o[p+2];m+=(y*x.a+v*x.c+x.tx)*b,g+=(y*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=i,m=c*3,g=c<<1;p<e;p+=n){let _=0,x=0,y=l[u++];for(y+=u;u<y;u++,m+=3,g+=2){const v=d[l[u]].matrix,b=o[m]+f[g],w=o[m+1]+f[g+1],E=o[m+2];_+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=_,s[p+1]=x}}}copyTo(r){this.bones?(r.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,r.bones,0,this.bones.length)):r.bones=null,this.vertices&&(r.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,r.vertices,0,this.vertices.length)),r.worldVerticesLength=this.worldVerticesLength,r.timelineAttachment=this.timelineAttachment}};let nr=Q_;nr.nextID=0;class Wu extends nr{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new Wu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class zu extends nr{constructor(t){super(t),this.type=at.Clipping,this.endSlot=null,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new zu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Mo extends nr{constructor(t,e){super(t),this.type=at.Mesh,this.region=null,this.triangles=[],this.color=new X(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new X(0,0,0,0),this.path=e}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,a)}newLinkedMesh(){const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t}}class ju extends nr{constructor(t){super(t),this.type=at.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new ju(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class qu extends nr{constructor(t){super(t),this.type=at.Point,this.x=0,this.y=0,this.rotation=0,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,a=s*e.b+i*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new qu(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const J_=class extends K_{constructor(r,t){super(r),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const r=this.region,t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=i+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=this.x,c=this.y,d=s*o+u,f=s*l,p=i*o+c,m=i*l,g=n*o+u,_=n*l,x=a*o+c,y=a*l,v=this.offset;v[0]=d-m,v[1]=p+f,v[2]=d-y,v[3]=x+f,v[4]=g-y,v[5]=x+_,v[6]=g-m,v[7]=p+_;const b=this.uvs;r.degrees==90?(b[2]=r.u,b[3]=r.v2,b[4]=r.u,b[5]=r.v,b[6]=r.u2,b[7]=r.v,b[0]=r.u2,b[1]=r.v2):(b[0]=r.u,b[1]=r.v2,b[2]=r.u,b[3]=r.v,b[4]=r.u2,b[5]=r.v,b[6]=r.u2,b[7]=r.v2)}computeWorldVertices(r,t,e,s){this.sequence!=null&&this.sequence.apply(r,this);const i=r.bone,n=this.offset,a=i.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[2],p=n[3],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[4],p=n[5],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[6],p=n[7],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o}copy(){const r=new J_(this.name,this.path);return r.region=this.region,r.rendererObject=this.rendererObject,r.x=this.x,r.y=this.y,r.scaleX=this.scaleX,r.scaleY=this.scaleY,r.rotation=this.rotation,r.width=this.width,r.height=this.height,B.arrayCopy(this.uvs,0,r.uvs,0,8),B.arrayCopy(this.offset,0,r.offset,0,8),r.color.setFromColor(this.color),r.sequence=this.sequence!=null?this.sequence.copy():null,r}};let gt=J_;gt.X1=0,gt.Y1=1,gt.C1R=2,gt.C1G=3,gt.C1B=4,gt.C1A=5,gt.U1=6,gt.V1=7,gt.X2=8,gt.Y2=9,gt.C2R=10,gt.C2G=11,gt.C2B=12,gt.C2A=13,gt.U2=14,gt.V2=15,gt.X3=16,gt.Y3=17,gt.C3R=18,gt.C3G=19,gt.C3B=20,gt.C3A=21,gt.U3=22,gt.V3=23,gt.X4=24,gt.Y4=25,gt.C4R=26,gt.C4G=27,gt.C4B=28,gt.C4A=29,gt.U4=30,gt.V4=31;const vl=class{constructor(r){this.id=vl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(r)}copy(){const r=new vl(this.regions.length);return B.arrayCopy(this.regions,0,r.regions,0,this.regions.length),r.start=this.start,r.digits=this.digits,r.setupIndex=this.setupIndex,r}apply(r,t){let e=r.sequenceIndex;e==-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(r,t){let e=r;const s=(this.start+t).toString();for(let i=this.digits-s.length;i>0;i--)e+="0";return e+=s,e}static nextID(){return vl._nextID++}};let Zu=vl;Zu._nextID=0;var Pi=(r=>(r[r.hold=0]="hold",r[r.once=1]="once",r[r.loop=2]="loop",r[r.pingpong=3]="pingpong",r[r.onceReverse=4]="onceReverse",r[r.loopReverse=5]="loopReverse",r[r.pingpongReverse=6]="pingpongReverse",r))(Pi||{});const t0=[0,1,2,3,4,5,6];class Ku{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new US,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}}const yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19};class he{constructor(t,e){this.propertyIds=e,this.frames=B.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){const s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){const i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}}class li extends he{constructor(t,e,s){super(t,s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(i-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-i+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-i)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=i+v,E=n+b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getBezierValue(t,e,s,i){const n=this.curves;if(n[i]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[i]-l)*(n[i+1]-u)}const a=i+18;for(i+=2;i<a;i+=2)if(n[i]>=t){const l=n[i-2],u=n[i-1];return u+(t-l)/(n[i]-l)*(n[i+1]-u)}e+=this.getFrameEntries();const h=n[a-2],o=n[a-1];return o+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-o)}}class hi extends li{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const i=this.curves[s>>1];switch(i){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}}class Qu extends li{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class e0 extends hi{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.rotation=o.data.rotation;return;case S.first:o.rotation+=(o.data.rotation-o.rotation)*n}return}let u=this.getCurveValue(s);switch(a){case S.setup:o.rotation=o.data.rotation+u*n;break;case S.first:case S.replace:u+=o.data.rotation-o.rotation;case S.add:o.rotation+=u*n}}}class s0 extends Qu{constructor(t,e,s){super(t,e,`${yt.x}|${s}`,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.x=o.data.x+u*n,o.y=o.data.y+c*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case S.add:o.x+=u*n,o.y+=c*n}}}class i0 extends hi{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x;return;case S.first:o.x+=(o.data.x-o.x)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.x=o.data.x+u*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n;break;case S.add:o.x+=u*n}}}class r0 extends hi{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.y=o.data.y;return;case S.first:o.y+=(o.data.y-o.y)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.y=o.data.y+u*n;break;case S.first:case S.replace:o.y+=(o.data.y+u-o.y)*n;break;case S.add:o.y+=u*n}}}class n0 extends Qu{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX,o.scaleY=o.data.scaleY;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u,c;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(u*=o.data.scaleX,c*=o.data.scaleY,n==1)a==S.add?(o.scaleX+=u-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=u,o.scaleY=c);else{let p=0,m=0;if(h==At.mixOut)switch(a){case S.setup:p=o.data.scaleX,m=o.data.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=o.scaleX,m=o.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(a){case S.setup:p=Math.abs(o.data.scaleX)*D.signum(u),m=Math.abs(o.data.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.first:case S.replace:p=Math.abs(o.scaleX)*D.signum(u),m=Math.abs(o.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}}class o0 extends hi{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n}return}const u=this.getCurveValue(s)*o.data.scaleX;if(n==1)a==S.add?o.scaleX+=u-o.data.scaleX:o.scaleX=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}}}}class a0 extends hi{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleY=o.data.scaleY;return;case S.first:o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}const u=this.getCurveValue(s)*o.data.scaleY;if(n==1)a==S.add?o.scaleY+=u-o.data.scaleY:o.scaleY=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}}}}class l0 extends Qu{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX,o.shearY=o.data.shearY;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.shearX=o.data.shearX+u*n,o.shearY=o.data.shearY+c*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case S.add:o.shearX+=u*n,o.shearY+=c*n}}}class h0 extends hi{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearX=o.data.shearX+u*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n;break;case S.add:o.shearX+=u*n}}}class c0 extends hi{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearY=o.data.shearY;return;case S.first:o.shearY+=(o.data.shearY-o.shearY)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearY=o.data.shearY+u*n;break;case S.first:case S.replace:o.shearY+=(o.data.shearY+u-o.shearY)*n;break;case S.add:o.shearY+=u*n}}}class u0 extends li{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const _=o.data.color;switch(a){case S.setup:u.setFromColor(_);return;case S.first:u.add((_.r-u.r)*n,(_.g-u.g)*n,(_.b-u.b)*n,(_.a-u.a)*n)}return}let c=0,d=0,f=0,p=0;const m=he.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const _=l[m];c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];const x=(s-_)/(l[m+5]-_);c+=(l[m+5+1]-c)*x,d+=(l[m+5+2]-d)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),f=this.getBezierValue(s,m,3,g+18*2-2),p=this.getBezierValue(s,m,4,g+18*3-2)}n==1?u.set(c,d,f,p):(a==S.setup&&u.setFromColor(o.data.color),u.add((c-u.r)*n,(d-u.g)*n,(f-u.b)*n,(p-u.a)*n))}}class d0 extends li{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const g=o.data.color;switch(a){case S.setup:u.r=g.r,u.g=g.g,u.b=g.b;return;case S.first:u.r+=(g.r-u.r)*n,u.g+=(g.g-u.g)*n,u.b+=(g.b-u.b)*n}return}let c=0,d=0,f=0;const p=he.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];c=l[p+1],d=l[p+2],f=l[p+3];const _=(s-g)/(l[p+4]-g);c+=(l[p+4+1]-c)*_,d+=(l[p+4+2]-d)*_,f+=(l[p+4+3]-f)*_;break;case 1:c=l[p+1],d=l[p+2],f=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)u.r=c,u.g=d,u.b=f;else{if(a==S.setup){const g=o.data.color;u.r=g.r,u.g=g.g,u.b=g.b}u.r+=(c-u.r)*n,u.g+=(d-u.g)*n,u.b+=(f-u.b)*n}}}class f0 extends hi{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.color;if(s<this.frames[0]){const c=o.data.color;switch(a){case S.setup:l.a=c.a;return;case S.first:l.a+=(c.a-l.a)*n}return}const u=this.getCurveValue(s);n==1?l.a=u:(a==S.setup&&(l.a=o.data.color.a),l.a+=(u-l.a)*n)}}class p0 extends li{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const b=o.data.color,w=o.data.darkColor;switch(a){case S.setup:u.setFromColor(b),c.r=w.r,c.g=w.g,c.b=w.b;return;case S.first:u.add((b.r-u.r)*n,(b.g-u.g)*n,(b.b-u.b)*n,(b.a-u.a)*n),c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0,x=0;const y=he.search(l,s,8),v=this.curves[y>>3];switch(v){case 0:const b=l[y];d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];const w=(s-b)/(l[y+8]-b);d+=(l[y+8+1]-d)*w,f+=(l[y+8+2]-f)*w,p+=(l[y+8+3]-p)*w,m+=(l[y+8+4]-m)*w,g+=(l[y+8+5]-g)*w,_+=(l[y+8+6]-_)*w,x+=(l[y+8+7]-x)*w;break;case 1:d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];break;default:d=this.getBezierValue(s,y,1,v-2),f=this.getBezierValue(s,y,2,v+18-2),p=this.getBezierValue(s,y,3,v+18*2-2),m=this.getBezierValue(s,y,4,v+18*3-2),g=this.getBezierValue(s,y,5,v+18*4-2),_=this.getBezierValue(s,y,6,v+18*5-2),x=this.getBezierValue(s,y,7,v+18*6-2)}if(n==1)u.set(d,f,p,m),c.r=g,c.g=_,c.b=x;else{if(a==S.setup){u.setFromColor(o.data.color);const b=o.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}u.add((d-u.r)*n,(f-u.g)*n,(p-u.b)*n,(m-u.a)*n),c.r+=(g-c.r)*n,c.g+=(_-c.g)*n,c.b+=(x-c.b)*n}}}class m0 extends li{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const v=o.data.color,b=o.data.darkColor;switch(a){case S.setup:u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b;return;case S.first:u.r+=(v.r-u.r)*n,u.g+=(v.g-u.g)*n,u.b+=(v.b-u.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0;const x=he.search(l,s,7),y=this.curves[x/7];switch(y){case 0:const v=l[x];d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];const b=(s-v)/(l[x+7]-v);d+=(l[x+7+1]-d)*b,f+=(l[x+7+2]-f)*b,p+=(l[x+7+3]-p)*b,m+=(l[x+7+4]-m)*b,g+=(l[x+7+5]-g)*b,_+=(l[x+7+6]-_)*b;break;case 1:d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];break;default:d=this.getBezierValue(s,x,1,y-2),f=this.getBezierValue(s,x,2,y+18-2),p=this.getBezierValue(s,x,3,y+18*2-2),m=this.getBezierValue(s,x,4,y+18*3-2),g=this.getBezierValue(s,x,5,y+18*4-2),_=this.getBezierValue(s,x,6,y+18*5-2)}if(n==1)u.r=d,u.g=f,u.b=p,c.r=m,c.g=g,c.b=_;else{if(a==S.setup){const v=o.data.color,b=o.data.darkColor;u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b}u.r+=(d-u.r)*n,u.g+=(f-u.g)*n,u.b+=(p-u.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(_-c.b)*n}}}class g0 extends he{constructor(t,e){super(t,[`${yt.attachment}|${e}`]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(o.bone.active){if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}if(s<this.frames[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}this.setAttachment(t,o,this.attachmentNames[he.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class _0 extends li{constructor(t,e,s,i){super(t,e,[`${yt.deform}|${s}|${i.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(i-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-i+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-i)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=i+v,E=b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let i=s[e];switch(i){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(i-=2,s[i]>t){const o=this.frames[e];return s[i+1]*(t-o)/(s[i]-o)}const n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){const o=s[i-2],l=s[i-1];return l+(t-o)/(s[i]-o)*(s[i+1]-l)}const a=s[n-2],h=s[n-1];return h+(1-h)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,i,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof nr)||l.timelineAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;return}u.length=d;const x=l;if(x.bones){n=1-n;for(let y=0;y<d;y++)u[y]*=n}else{const y=x.vertices;for(let v=0;v<d;v++)u[v]+=(y[v]-u[v])*n}}return}if(u.length=d,s>=f[f.length-1]){const x=c[f.length-1];if(n==1)if(a==S.add){const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v];else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,u,0,d);else switch(a){case S.setup:{const v=l;if(v.bones)for(let b=0;b<d;b++)u[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<d;w++){const E=b[w];u[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<d;v++)u[v]+=(x[v]-u[v])*n;break;case S.add:const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v]*n;else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=(x[b]-v[b])*n}}return}const p=he.search1(f,s),m=this.getCurvePercent(s,p),g=c[p],_=c[p+1];if(n==1)if(a==S.add){const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=v+(_[y]-v)*m}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=b+(_[v]-b)*m-y[v]}}}else for(let x=0;x<d;x++){const y=g[x];u[x]=y+(_[x]-y)*m}else switch(a){case S.setup:{const y=l;if(y.bones)for(let v=0;v<d;v++){const b=g[v];u[v]=(b+(_[v]-b)*m)*n}else{const v=y.vertices;for(let b=0;b<d;b++){const w=g[b],E=v[b];u[b]=E+(w+(_[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m-u[y])*n}break;case S.add:const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m)*n}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=(b+(_[v]-b)*m-y[v])*n}}}}}const y0=class extends he{constructor(r){super(r,y0.propertyIds),this.events=new Array(r)}getFrameCount(){return this.frames.length}setFrame(r,t){this.frames[r]=t.time,this.events[r]=t}apply(r,t,e,s,i,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(r,t,Number.MAX_VALUE,s,i,n,a),t=-1;else if(t>=h[o-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=he.search1(h,t)+1;const u=h[l];for(;l>0&&h[l-1]==u;)l--}for(;l<o&&e>=h[l];l++)s.push(this.events[l])}};let Ju=y0;Ju.propertyIds=[`${yt.event}`];const x0=class extends he{constructor(r){super(r,x0.propertyIds),this.drawOrders=new Array(r)}getFrameCount(){return this.frames.length}setFrame(r,t,e){this.frames[r]=t,this.drawOrders[r]=e}apply(r,t,e,s,i,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);else{const l=r.drawOrder,u=r.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let td=x0;td.propertyIds=[`${yt.drawOrder}`];class v0 extends li{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,i,n,a,h){const o=t.ikConstraints[this.ikConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let u=0,c=0;const d=he.search(l,s,6),f=this.curves[d/6];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+6]-p);u+=(l[d+6+1]-u)*m,c+=(l[d+6+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}a==S.setup?(o.mix=o.data.mix+(u-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,h==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0)):(o.mix+=(u-o.mix)*n,o.softness+=(c-o.softness)*n,h==At.mixIn&&(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0))}}class b0 extends li{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,i,n,a,h){const o=t.transformConstraints[this.transformConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){const x=o.data;switch(a){case S.setup:o.mixRotate=x.mixRotate,o.mixX=x.mixX,o.mixY=x.mixY,o.mixScaleX=x.mixScaleX,o.mixScaleY=x.mixScaleY,o.mixShearY=x.mixShearY;return;case S.first:o.mixRotate+=(x.mixRotate-o.mixRotate)*n,o.mixX+=(x.mixX-o.mixX)*n,o.mixY+=(x.mixY-o.mixY)*n,o.mixScaleX+=(x.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(x.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(x.mixShearY-o.mixShearY)*n}return}let u,c,d,f,p,m;const g=he.search(l,s,7),_=this.curves[g/7];switch(_){case 0:const x=l[g];u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const y=(s-x)/(l[g+7]-x);u+=(l[g+7+1]-u)*y,c+=(l[g+7+2]-c)*y,d+=(l[g+7+3]-d)*y,f+=(l[g+7+4]-f)*y,p+=(l[g+7+5]-p)*y,m+=(l[g+7+6]-m)*y;break;case 1:u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:u=this.getBezierValue(s,g,1,_-2),c=this.getBezierValue(s,g,2,_+18-2),d=this.getBezierValue(s,g,3,_+18*2-2),f=this.getBezierValue(s,g,4,_+18*3-2),p=this.getBezierValue(s,g,5,_+18*4-2),m=this.getBezierValue(s,g,6,_+18*5-2)}if(a==S.setup){const x=o.data;o.mixRotate=x.mixRotate+(u-x.mixRotate)*n,o.mixX=x.mixX+(c-x.mixX)*n,o.mixY=x.mixY+(d-x.mixY)*n,o.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,o.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,o.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n,o.mixScaleX+=(f-o.mixScaleX)*n,o.mixScaleY+=(p-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class w0 extends hi{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,i,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*n}return}const u=this.getCurveValue(s);a==S.setup?o.position=o.data.position+(u-o.data.position)*n:o.position+=(u-o.position)*n}}class E0 extends hi{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,i,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.spacing=o.data.spacing;return;case S.first:o.spacing+=(o.data.spacing-o.spacing)*n}return}const u=this.getCurveValue(s);a==S.setup?o.spacing=o.data.spacing+(u-o.data.spacing)*n:o.spacing+=(u-o.spacing)*n}}class T0 extends li{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=n}apply(t,e,s,i,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,o.mixY=o.data.mixY;return;case S.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u,c,d;const f=he.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];u=l[f+1],c=l[f+2],d=l[f+3];const g=(s-m)/(l[f+4]-m);u+=(l[f+4+1]-u)*g,c+=(l[f+4+2]-c)*g,d+=(l[f+4+3]-d)*g;break;case 1:u=l[f+1],c=l[f+2],d=l[f+3];break;default:u=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2)}if(a==S.setup){const m=o.data;o.mixRotate=m.mixRotate+(u-m.mixRotate)*n,o.mixX=m.mixX+(c-m.mixX)*n,o.mixY=m.mixY+(d-m.mixY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n}}const or=class extends he{constructor(r,t,e){super(r,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return or.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(r,t,e,s,i){const n=this.frames;r*=or.ENTRIES,n[r]=t,n[r+or.MODE]=e|s<<4,n[r+or.DELAY]=i}apply(r,t,e,s,i,n,a){const h=r.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof nr)||o.timelineAttachment!=l))return;const u=this.frames;if(e<u[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const c=he.search(u,e,or.ENTRIES),d=u[c],f=u[c+or.MODE],p=u[c+or.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=t0[f&15];if(_!=Pi.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pi.once:m=Math.min(g-1,m);break;case Pi.loop:m%=g;break;case Pi.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pi.onceReverse:m=Math.max(g-1-m,0);break;case Pi.loopReverse:m=g-1-m%g;break;case Pi.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=or;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new Ku("<empty>",[],0);class A0{constructor(t){this.atlas=t}loadSequence(t,e,s){const i=s.regions;for(let n=0,a=i.length;n<a;n++){const h=s.getPath(e,n),o=this.atlas.findRegion(h);if(o==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);i[n]=o,i[n].renderObject=i[n]}}newRegionAttachment(t,e,s,i){const n=new gt(e,s);if(i!=null)this.loadSequence(e,s,i);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);a.renderObject=a,n.region=a}return n}newMeshAttachment(t,e,s,i){const n=new Mo(e,s);if(i!=null)this.loadSequence(e,s,i);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);a.renderObject=a,n.region=a}return n}newBoundingBoxAttachment(t,e){return new Wu(e)}newPathAttachment(t,e){return new ju(e)}newPointAttachment(t,e){return new qu(e)}newClippingAttachment(t,e){return new zu(e)}}class S0{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class ed{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let C0=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class I0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class P0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class R0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Rs.Fixed,this.rotateMode=Fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Rs=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r[r.Proportional=3]="Proportional",r))(Rs||{});class M0{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}}class F0{constructor(t,e,s){if(this.index=0,this.color=new X(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=W.NORMAL,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class k0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class B0{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class sd{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];i.attachment&&(i.attachment instanceof Mo?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const i in s){const n=s[i];n&&t.push(new B0(e,i,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new B0(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u&&n.setAttachment(u);break}}}s++}}}class D0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new M0;s.name="";const i=new yl(t),n=i.readInt32(),a=i.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=i.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const c=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(c)}this.ver40=h==="4.0",s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat();const o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let l=0;l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readString();if(!d)throw new Error("String in string table must not be null.");i.strings.push(d)}l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[i.readInt(!0)],p=new S0(c,d,f);p.rotation=i.readFloat(),p.x=i.readFloat()*e,p.y=i.readFloat()*e,p.scaleX=i.readFloat(),p.scaleY=i.readFloat(),p.shearX=i.readFloat(),p.shearY=i.readFloat(),p.length=i.readFloat()*e,p.transformMode=i.readInt(!0),p.skinRequired=i.readBoolean(),o&&X.rgba8888ToColor(p.color,i.readInt32()),s.bones.push(p)}l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[i.readInt(!0)],p=new F0(c,d,f);X.rgba8888ToColor(p.color,i.readInt32());const m=i.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=i.readStringRef(),p.blendMode=i.readInt(!0),s.slots.push(p)}l=i.readInt(!0);for(let c=0,d;c<l;c++){const f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new P0(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),d=i.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.bones[i.readInt(!0)],p.mix=i.readFloat(),p.softness=i.readFloat()*e,p.bendDirection=i.readByte(),p.compress=i.readBoolean(),p.stretch=i.readBoolean(),p.uniform=i.readBoolean(),s.ikConstraints.push(p)}l=i.readInt(!0);for(let c=0,d;c<l;c++){const f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new k0(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),d=i.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.bones[i.readInt(!0)],p.local=i.readBoolean(),p.relative=i.readBoolean(),p.offsetRotation=i.readFloat(),p.offsetX=i.readFloat()*e,p.offsetY=i.readFloat()*e,p.offsetScaleX=i.readFloat(),p.offsetScaleY=i.readFloat(),p.offsetShearY=i.readFloat(),p.mixRotate=i.readFloat(),p.mixX=i.readFloat(),p.mixY=i.readFloat(),p.mixScaleX=i.readFloat(),p.mixScaleY=i.readFloat(),p.mixShearY=i.readFloat(),s.transformConstraints.push(p)}l=i.readInt(!0);for(let c=0,d;c<l;c++){const f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new R0(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),d=i.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.slots[i.readInt(!0)],p.positionMode=i.readInt(!0),p.spacingMode=i.readInt(!0),p.rotateMode=i.readInt(!0),p.offsetRotation=i.readFloat(),p.position=i.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=i.readFloat(),(p.spacingMode==Rs.Length||p.spacingMode==Rs.Fixed)&&(p.spacing*=e),p.mixRotate=i.readFloat(),p.mixX=i.readFloat(),p.mixY=i.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(i,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+i.readInt(!0));c<l;c++){const d=this.readSkin(i,s,!1,o);if(!d)throw new Error("readSkin() should not have returned null.");s.skins[c]=d}}l=this.linkedMeshes.length;for(let c=0;c<l;c++){const d=this.linkedMeshes[c],f=d.skin?s.findSkin(d.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readStringRef();if(!d)throw new Error;const f=new I0(d);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}l=i.readInt(!0);for(let c=0;c<l;c++){const d=i.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,d,s))}return s}readSkin(t,e,s,i){let n=null,a=0;if(s){if(a=t.readInt(!0),a==0)return null;n=new sd("default")}else{const h=t.readStringRef();if(!h)throw new Error("Skin name must not be null.");n=new sd(h),n.bones.length=t.readInt(!0);for(let o=0,l=n.bones.length;o<l;o++)n.bones[o]=e.bones[t.readInt(!0)];for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let h=0;h<a;h++){const o=t.readInt(!0);for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,n,o,c,i);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,i,n,a){const h=this.scale;let o=t.readStringRef();switch(o||(o=n),t.readByte()){case at.Region:{let l=t.readStringRef();const u=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),_=t.readInt32(),x=this.readSequence(t);l||(l=o);const y=this.attachmentLoader.newRegionAttachment(s,o,l,x);return y?(y.path=l,y.x=c*h,y.y=d*h,y.scaleX=f,y.scaleY=p,y.rotation=u,y.width=m*h,y.height=g*h,X.rgba8888ToColor(y.color,_),y.sequence=x,x==null&&y.updateRegion(),y):null}case at.BoundingBox:{const l=t.readInt(!0),u=this.readVertices(t,l),c=a?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l<<1,d.vertices=u.vertices,d.bones=u.bones,a&&X.rgba8888ToColor(d.color,c),d):null}case at.Mesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readInt(!0),d=this.readFloatArray(t,c<<1,1),f=this.readShortArray(t),p=this.readVertices(t,c),m=t.readInt(!0),g=this.readSequence(t);let _=[],x=0,y=0;a&&(_=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),l||(l=o);const v=this.attachmentLoader.newMeshAttachment(s,o,l,g);return v?(v.path=l,X.rgba8888ToColor(v.color,u),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=c<<1,v.triangles=f,v.regionUVs=new Float32Array(d),v.hullLength=m<<1,v.sequence=g,a&&(v.edges=_,v.width=x*h,v.height=y*h),v):null}case at.LinkedMesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;a&&(m=t.readFloat(),g=t.readFloat()),l||(l=o);const _=this.attachmentLoader.newMeshAttachment(s,o,l,p);return _?(_.path=l,X.rgba8888ToColor(_.color,u),_.sequence=p,a&&(_.width=m*h,_.height=g*h),this.linkedMeshes.push(new FC(_,c,i,d,f)),_):null}case at.Path:{const l=t.readBoolean(),u=t.readBoolean(),c=t.readInt(!0),d=this.readVertices(t,c),f=B.newArray(c/3,0);for(let g=0,_=f.length;g<_;g++)f[g]=t.readFloat()*h;const p=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=u,m.worldVerticesLength=c<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&X.rgba8888ToColor(m.color,p),m):null}case at.Point:{const l=t.readFloat(),u=t.readFloat(),c=t.readFloat(),d=a?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=u*h,f.y=c*h,f.rotation=l,a&&X.rgba8888ToColor(f.color,d),f):null}case at.Clipping:{const l=t.readInt(!0),u=t.readInt(!0),c=this.readVertices(t,u),d=a?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,o);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,a&&X.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Zu(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?O0:t.readByte()}readVertices(t,e){const s=this.scale,i=e<<1,n=new kC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,i,s),n;const a=new Array,h=new Array;for(let o=0;o<e;o++){const l=t.readInt(!0);h.push(l);for(let u=0;u<l;u++)h.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=B.toFloatArray(a),n.bones=h,n}readFloatArray(t,e,s){const i=new Array(e);if(s==1)for(let n=0;n<e;n++)i[n]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const i=new Array,n=this.scale;for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case HC:{const _=new g0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());i.push(_);break}case YC:{const _=t.readInt(!0),x=new u0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let T=0,A=0;x.setFrame(T,y,v,b,w,E),T!=g;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(T);break;case Fs:ct(t,x,A++,T,0,y,I,v,M,1),ct(t,x,A++,T,1,y,I,b,R,1),ct(t,x,A++,T,2,y,I,w,C,1),ct(t,x,A++,T,3,y,I,E,P,1)}y=I,v=M,b=R,w=C,E=P}i.push(x);break}case WC:{const _=t.readInt(!0),x=new d0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,y,v,b,w),E!=g;E++){const A=t.readFloat(),I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(E);break;case Fs:ct(t,x,T++,E,0,y,A,v,I,1),ct(t,x,T++,E,1,y,A,b,M,1),ct(t,x,T++,E,2,y,A,w,R,1)}y=A,v=I,b=M,w=R}i.push(x);break}case zC:{const _=t.readInt(!0),x=new p0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,R=0;x.setFrame(M,y,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(M);break;case Fs:ct(t,x,R++,M,0,y,C,v,P,1),ct(t,x,R++,M,1,y,C,b,k,1),ct(t,x,R++,M,2,y,C,w,U,1),ct(t,x,R++,M,3,y,C,E,V,1),ct(t,x,R++,M,4,y,C,T,L,1),ct(t,x,R++,M,5,y,C,A,$,1),ct(t,x,R++,M,6,y,C,I,O,1)}y=C,v=P,b=k,w=U,E=V,T=L,A=$,I=O}i.push(x);break}case jC:{const _=t.readInt(!0),x=new m0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,v,b,w,E,T,A),I!=g;I++){const R=t.readFloat(),C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(I);break;case Fs:ct(t,x,M++,I,0,y,R,v,C,1),ct(t,x,M++,I,1,y,R,b,P,1),ct(t,x,M++,I,2,y,R,w,k,1),ct(t,x,M++,I,3,y,R,E,U,1),ct(t,x,M++,I,4,y,R,T,V,1),ct(t,x,M++,I,5,y,R,A,L,1)}y=R,v=C,b=P,w=k,E=U,T=V,A=L}i.push(x);break}case qC:{const _=new f0(m,t.readInt(!0),c);let x=t.readFloat(),y=t.readUnsignedByte()/255;for(let v=0,b=0;_.setFrame(v,x,y),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:_.setStepped(v);break;case Fs:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}i.push(_)}}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case BC:i.push(Ri(t,new e0(m,g,c),1));break;case DC:i.push(id(t,new s0(m,g,c),n));break;case OC:i.push(Ri(t,new i0(m,g,c),n));break;case LC:i.push(Ri(t,new r0(m,g,c),n));break;case NC:i.push(id(t,new n0(m,g,c),1));break;case VC:i.push(Ri(t,new o0(m,g,c),1));break;case UC:i.push(Ri(t,new a0(m,g,c),1));break;case GC:i.push(id(t,new l0(m,g,c),1));break;case XC:i.push(Ri(t,new h0(m,g,c),1));break;case $C:i.push(Ri(t,new c0(m,g,c),1))}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new v0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat()*n;for(let x=0,y=0;p.setFrame(x,m,g,_,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Ms:p.setStepped(x);break;case Fs:ct(t,p,y++,x,0,m,v,g,b,1),ct(t,p,y++,x,1,m,v,_,w,n)}m=v,g=b,_=w}i.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new b0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,_,x,y,v,b),w!=f;w++){const T=t.readFloat(),A=t.readFloat(),I=t.readFloat(),M=t.readFloat(),R=t.readFloat(),C=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Ms:p.setStepped(w);break;case Fs:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,_,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,y,R,1),ct(t,p,E++,w,4,m,T,v,C,1),ct(t,p,E++,w,5,m,T,b,P,1)}m=T,g=A,_=I,x=M,y=R,v=C,b=P}i.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case KC:i.push(Ri(t,new w0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case QC:i.push(Ri(t,new E0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Rs.Length||d.spacingMode==Rs.Fixed?n:1));break;case JC:const m=new T0(t.readInt(!0),t.readInt(!0),c);let g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,_,x,y),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Ms:m.setStepped(v);break;case Fs:ct(t,m,b++,v,0,g,E,_,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,y,I,1)}g=E,_=T,x=A,y=I}i.push(m)}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const _=t.readStringRef();if(!_)throw new Error("attachmentName must not be null.");const x=c.getAttachment(p,_),y=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(y){case O0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new _0(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,U=t.readInt(!0);if(U==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(U+=L,n==1)for(let $=L;$<U;$++)k[$]=t.readFloat();else for(let $=L;$<U;$++)k[$]=t.readFloat()*n;if(!E)for(let $=0,O=k.length;$<O;$++)k[$]+=T[$]}if(M.setFrame(C,R,k),C==b)break;const V=t.readFloat();switch(t.readByte()){case Ms:M.setStepped(C);break;case Fs:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}i.push(M);break}case ZC:{const w=new Fo(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,t0[A&15],A>>4,t.readFloat())}i.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new td(a),u=s.slots.length;for(let c=0;c<a;c++){const d=t.readFloat(),f=t.readInt(!0),p=B.newArray(u,0);for(let x=u-1;x>=0;x--)p[x]=-1;const m=B.newArray(u-f,0);let g=0,_=0;for(let x=0;x<f;x++){const y=t.readInt(!0);for(;g!=y;)m[_++]=g++;p[g+t.readInt(!0)]=g++}for(;g<u;)m[_++]=g++;for(let x=u-1;x>=0;x--)p[x]==-1&&(p[x]=m[--_]);l.setFrame(c,d,p)}i.push(l)}const h=t.readInt(!0);if(h>0){const l=new Ju(h);for(let u=0;u<h;u++){const c=t.readFloat(),d=s.events[t.readInt(!0)],f=new C0(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():d.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(u,f)}i.push(l)}let o=0;for(let l=0,u=i.length;l<u;l++)o=Math.max(o,i[l].getDuration());return new Ku(e,i,o)}}D0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let FC=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};class kC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Ri(r,t,e){let s=r.readFloat(),i=r.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,i),n!=h;n++){const o=r.readFloat(),l=r.readFloat()*e;switch(r.readByte()){case Ms:t.setStepped(n);break;case Fs:ct(r,t,a++,n,0,s,o,i,l,e)}s=o,i=l}return t}function id(r,t,e){let s=r.readFloat(),i=r.readFloat()*e,n=r.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,i,n),a!=o;a++){const l=r.readFloat(),u=r.readFloat()*e,c=r.readFloat()*e;switch(r.readByte()){case Ms:t.setStepped(a);break;case Fs:ct(r,t,h++,a,0,s,l,i,u,e),ct(r,t,h++,a,1,s,l,n,c,e)}s=l,i=u,n=c}return t}function ct(r,t,e,s,i,n,a,h,o,l){t.setBezier(e,s,i,n,h,r.readFloat(),r.readFloat()*l,r.readFloat(),r.readFloat()*l,a,o)}const BC=0,DC=1,OC=2,LC=3,NC=4,VC=5,UC=6,GC=7,XC=8,$C=9,HC=0,YC=1,WC=2,zC=3,jC=4,qC=5,O0=0,ZC=1,KC=0,QC=1,JC=2,Ms=1,Fs=2;class rd{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new M0,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const a=s.version.substr(0,3);if(a!=="4.0"&&a!=="4.1"){const h=`Spine 4.1 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(h)}s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(i.bones)for(let a=0;a<i.bones.length;a++){const h=i.bones[a];let o=null;const l=F(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new S0(s.bones.length,h.name,o);u.length=F(h,"length",0)*e,u.x=F(h,"x",0)*e,u.y=F(h,"y",0)*e,u.rotation=F(h,"rotation",0),u.scaleX=F(h,"scaleX",1),u.scaleY=F(h,"scaleY",1),u.shearX=F(h,"shearX",0),u.shearY=F(h,"shearY",0),u.transformMode=B.enumValue(vt,F(h,"transform","Normal")),u.skinRequired=F(h,"skin",!1);const c=F(h,"color",null);c&&u.color.setFromString(c),s.bones.push(u)}if(i.slots)for(let a=0;a<i.slots.length;a++){const h=i.slots[a],o=s.findBone(h.bone);if(!o)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new F0(s.slots.length,h.name,o),u=F(h,"color",null);u&&l.color.setFromString(u);const c=F(h,"dark",null);c&&(l.darkColor=X.fromString(c)),l.attachmentName=F(h,"attachment",null),l.blendMode=rd.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(i.ik)for(let a=0;a<i.ik.length;a++){const h=i.ik[a],o=new P0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(c==null)throw new Error(`IK bone not found: ${u}`);o.bones.push(c)}o.target=s.findBone(h.target),o.mix=F(h,"mix",1),o.softness=F(h,"softness",0)*e,o.bendDirection=F(h,"bendPositive",!0)?1:-1,o.compress=F(h,"compress",!1),o.stretch=F(h,"stretch",!1),o.uniform=F(h,"uniform",!1),s.ikConstraints.push(o)}if(i.transform)for(let a=0;a<i.transform.length;a++){const h=i.transform[a],o=new k0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findBone(l);if(!u)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);o.target=u,o.local=F(h,"local",!1),o.relative=F(h,"relative",!1),o.offsetRotation=F(h,"rotation",0),o.offsetX=F(h,"x",0)*e,o.offsetY=F(h,"y",0)*e,o.offsetScaleX=F(h,"scaleX",0),o.offsetScaleY=F(h,"scaleY",0),o.offsetShearY=F(h,"shearY",0),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),o.mixScaleX=F(h,"mixScaleX",1),o.mixScaleY=F(h,"mixScaleY",o.mixScaleX),o.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(o)}if(i.path)for(let a=0;a<i.path.length;a++){const h=i.path[a],o=new R0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findSlot(l);if(!u)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);o.target=u,o.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),o.spacingMode=B.enumValue(Rs,F(h,"spacingMode","Length")),o.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),o.offsetRotation=F(h,"rotation",0),o.position=F(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=F(h,"spacing",0),(o.spacingMode==Rs.Length||o.spacingMode==Rs.Fixed)&&(o.spacing*=e),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),s.pathConstraints.push(o)}if(i.skins)for(let a=0;a<i.skins.length;a++){const h=i.skins[a],o=new sd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(!c)throw new Error(`Couldn't find bone ${u} for skin ${h.name}.`);o.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=h.ik[l],c=s.findIkConstraint(u);if(!c)throw new Error(`Couldn't find IK constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=h.transform[l],c=s.findTransformConstraint(u);if(!c)throw new Error(`Couldn't find transform constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const u=h.path[l],c=s.findPathConstraint(u);if(!c)throw new Error(`Couldn't find path constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}for(const l in h.attachments){const u=s.findSlot(l);if(!u)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin?s.findSkin(o.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(!u)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.timelineAttachment=o.inheritTimeline?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,i.events)for(const a in i.events){const h=i.events[a],o=new I0(a);o.intValue=F(h,"int",0),o.floatValue=F(h,"float",0),o.stringValue=F(h,"string",""),o.audioPath=F(h,"audio",null),o.audioPath&&(o.volume=F(h,"volume",1),o.balance=F(h,"balance",0)),s.events.push(o)}if(i.animations)for(const a in i.animations){const h=i.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,i,n){const a=this.scale;switch(i=F(t,"name",i),F(t,"type","region")){case"region":{const h=F(t,"path",i),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,i,h,o);if(!l)return null;l.path=h,l.x=F(t,"x",0)*a,l.y=F(t,"y",0)*a,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*a,l.height=t.height*a,l.sequence=o;const u=F(t,"color",null);return u&&l.color.setFromString(u),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"mesh":case"linkedmesh":{const h=F(t,"path",i),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,i,h,o);if(!l)return null;l.path=h;const u=F(t,"color",null);u&&l.color.setFromString(u),l.width=F(t,"width",0)*a,l.height=F(t,"height",0)*a,l.sequence=o;const c=F(t,"parent",null);if(c)return this.linkedMeshes.push(new tI(l,F(t,"skin",null),s,c,F(t,"timelines",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,i);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,h,o<<1);const l=B.newArray(o/3,0);for(let c=0;c<t.lengths.length;c++)l[c]=t.lengths[c]*a;h.lengths=l;const u=F(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,i);if(!h)return null;h.x=F(t,"x",0)*a,h.y=F(t,"y",0)*a,h.rotation=F(t,"rotation",0);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,i);if(!h)return null;const o=F(t,"end",null);if(o!=null){const c=n.findSlot(o);if(c==null)throw new Error(`Clipping end slot not found: ${o}`);h.endSlot=c}const l=t.vertexCount;this.readVertices(t,h,l<<1);const u=F(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return null;const e=new Zu(F(t,"count",0));return e.start=F(t,"start",1),e.digits=F(t,"digits",0),e.setupIndex=F(t,"setup",0),e}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(i!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=i;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*i),a.push(n[o+2]*i),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const i=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const o=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const u=l.index;for(const c in o){const d=o[c];if(!d)continue;const f=d.length;if(c=="attachment"){const p=new g0(f,u);for(let m=0;m<f;m++){const g=d[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(c=="rgba"){const p=new u0(f,f<<2,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b,_.a);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1),y=pt(E,p,y,x,3,g,b,_.a,w.a,1)),g=b,_=w,m=v}n.push(p)}else if(c=="rgb"){const p=new d0(f,f*3,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1)),g=b,_=w,m=v}n.push(p)}else if(c=="alpha")n.push(ci(d,new f0(f,f,u),0,1));else if(c=="rgba2"){const p=new p0(f,f*7,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,_.a,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,_.a,E.a,1),v=pt(A,p,v,y,4,g,w,x.r,T.r,1),v=pt(A,p,v,y,5,g,w,x.g,T.g,1),v=pt(A,p,v,y,6,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}else if(c=="rgb2"){const p=new m0(f,f*6,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,x.r,T.r,1),v=pt(A,p,v,y,4,g,w,x.g,T.g,1),v=pt(A,p,v,y,5,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const o=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const u=l.index;for(const c in o){const d=o[c],f=d.length;if(f!=0){if(c==="rotate")n.push(ci(d,new e0(f,f,u),0,1));else if(c==="translate"){const p=new s0(f,f<<1,u);n.push(nd(d,p,"x","y",0,i))}else if(c==="translatex"){const p=new i0(f,f,u);n.push(ci(d,p,0,i))}else if(c==="translatey"){const p=new r0(f,f,u);n.push(ci(d,p,0,i))}else if(c==="scale"){const p=new n0(f,f<<1,u);n.push(nd(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new o0(f,f,u);n.push(ci(d,p,1,1))}else if(c==="scaley"){const p=new a0(f,f,u);n.push(ci(d,p,1,1))}else if(c==="shear"){const p=new l0(f,f<<1,u);n.push(nd(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new h0(f,f,u);n.push(ci(d,p,0,1))}else if(c==="sheary"){const p=new c0(f,f,u);n.push(ci(d,p,0,1))}}}}if(t.ik)for(const h in t.ik){const o=t.ik[h];let l=o[0];if(!l)continue;const u=s.findIkConstraint(h);if(!u)throw new Error(`IK Constraint not found: ${h}`);const c=s.ikConstraints.indexOf(u),d=new v0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*i;for(let g=0,_=0;;g++){d.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=o[g+1];if(!x){d.shrink(_);break}const y=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*i,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,i)),f=y,p=v,m=b,l=x}n.push(d)}if(t.transform)for(const h in t.transform){const o=t.transform[h];let l=o[0];if(!l)continue;const u=s.findTransformConstraint(h);if(!u)throw new Error(`Transform constraint not found: ${h}`);const c=s.transformConstraints.indexOf(u),d=new b0(o.length,o.length*6,c);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),_=F(l,"mixScaleX",1),x=F(l,"mixScaleY",_);const y=F(l,"mixShearY",1);for(let v=0,b=0;;v++){d.setFrame(v,f,p,m,g,_,x,y);const w=o[v+1];if(!w){d.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=F(w,"mixScaleX",1),R=F(w,"mixScaleY",M),C=F(w,"mixShearY",1),P=l.curve;P&&(b=pt(P,d,b,v,0,f,E,p,T,1),b=pt(P,d,b,v,1,f,E,m,A,1),b=pt(P,d,b,v,2,f,E,g,I,1),b=pt(P,d,b,v,3,f,E,_,M,1),b=pt(P,d,b,v,4,f,E,x,R,1),b=pt(P,d,b,v,5,f,E,y,C,1)),f=E,p=T,m=A,g=I,_=M,x=R,_=M,l=w}n.push(d)}if(t.path)for(const h in t.path){const o=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const u=s.pathConstraints.indexOf(l);for(const c in o){const d=o[c];let f=d[0];if(!f)continue;const p=d.length;if(c==="position"){const m=new w0(p,p,u);n.push(ci(d,m,0,l.positionMode==ne.Fixed?i:1))}else if(c==="spacing"){const m=new E0(p,p,u);n.push(ci(d,m,0,l.spacingMode==Rs.Length||l.spacingMode==Rs.Fixed?i:1))}else if(c==="mix"){const m=new T0(p,p*3,u);let g=F(f,"time",0),_=F(f,"mixRotate",1),x=F(f,"mixX",1),y=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,_,x,y);const w=d[v+1];if(!w){m.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=f.curve;M&&(b=pt(M,m,b,v,0,g,E,_,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,y,I,1)),g=E,_=T,x=A,y=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const o=t.deform[h],l=t.attachments[h]={};for(const u in o){const c=o[u],d=l[u]={};for(const f in c)d[f]={deform:c[f]}}}}if(t.attachments)for(const h in t.attachments){const o=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const u in o){const c=o[u],d=s.findSlot(u);if(!d)throw new Error(`Slot not found: ${u}`);const f=d.index;for(const p in c){const m=c[p],g=l.getAttachment(f,p);for(const _ in m){const x=m[_];let y=x[0];if(y){if(_=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new _0(x.length,x.length,f,g);let T=F(y,"time",0);for(let A=0,I=0;;A++){let M;const R=F(y,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const U=F(y,"offset",0);if(B.arrayCopy(R,0,M,U,R.length),i!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=i;if(!v)for(let V=0;V<w;V++)M[V]+=b[V]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=y.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,y=C}n.push(E)}else if(_=="sequence"){const v=new Fo(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(y,"delay",b),T=F(y,"time",0),A=Pi[F(y,"mode","hold")],I=F(y,"index",0);v.setFrame(w,T,A,I,E),b=E,y=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new td(t.drawOrder.length),o=s.slots.length;let l=0;for(let u=0;u<t.drawOrder.length;u++,l++){const c=t.drawOrder[u];let d=null;const f=F(c,"offsets",null);if(f){d=B.newArray(o,-1);const p=B.newArray(o-f.length,0);let m=0,g=0;for(let _=0;_<f.length;_++){const x=f[_],y=s.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);const v=y.index;for(;m!=v;)p[g++]=m++;d[m+x.offset]=m++}for(;m<o;)p[g++]=m++;for(let _=o-1;_>=0;_--)d[_]==-1&&(d[_]=p[--g])}h.setFrame(l,F(c,"time",0),d)}n.push(h)}if(t.events){const h=new Ju(t.events.length);let o=0;for(let l=0;l<t.events.length;l++,o++){const u=t.events[l],c=s.findEvent(u.name);if(!c)throw new Error(`Event not found: ${u.name}`);const d=new C0(B.toSinglePrecision(F(u,"time",0)),c);d.intValue=F(u,"int",c.intValue),d.floatValue=F(u,"float",c.floatValue),d.stringValue=F(u,"string",c.stringValue),d.data.audioPath&&(d.volume=F(u,"volume",1),d.balance=F(u,"balance",0)),h.setFrame(o,d)}n.push(h)}let a=0;for(let h=0,o=n.length;h<o;h++)a=Math.max(a,n[h].getDuration());if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ku(e,n,a))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}}class tI{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}}function ci(r,t,e,s){let i=r[0],n=F(i,"time",0),a=F(i,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=r[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;i.curve&&(h=pt(i.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,i=l}}function nd(r,t,e,s,i,n){let a=r[0],h=F(a,"time",0),o=F(a,e,i)*n,l=F(a,s,i)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=r[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,i)*n,m=F(d,s,i)*n,g=a.curve;g&&(u=pt(g,t,u,c,0,h,f,o,p,n),u=pt(g,t,u,c,1,h,f,l,m,n)),h=f,o=p,l=m,a=d}}function pt(r,t,e,s,i,n,a,h,o,l){if(r=="stepped")return t.setStepped(s),e;const u=i<<2,c=r[u],d=r[u+1]*l,f=r[u+2],p=r[u+3]*l;return t.setBezier(e,s,i,n,h,c,d,f,p,a,o),e+1}function F(r,t,e){return r[t]!==void 0?r[t]:e}var ar=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.VER37=37]="VER37",r[r.VER38=38]="VER38",r[r.VER40=40]="VER40",r[r.VER41=41]="VER41",r))(ar||{});function od(r){const t=r.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:e<37?37:0}class eI{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,i=this.readVersionOldFormat(e),n=od(i);if(n===ar.VER38&&(s=new le(new B_(t))),i=this.readVersionNewFormat(e),n=od(i),(n===ar.VER40||n===ar.VER41)&&(s=new D0(new A0(t))),!s){const a=`Unsupported version of spine model ${i}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new yl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new yl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class sI{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,i=od(s);let n=null;if(i===ar.VER37&&(n=new RC(new vC(t))),i===ar.VER38&&(n=new eC(new B_(t))),(i===ar.VER40||i===ar.VER41)&&(n=new rd(new A0(t))),!n){const a=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(a)}return n.scale=this.scale,n.readSkeletonData(e)}}class iI extends oC{createBinaryParser(){return new eI}createJsonParser(){return new sI}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new iI().installLoader();class rI extends iC{constructor(t,e){const{followPointList:s,visible:i=!1}=e||{};let n;typeof t=="string"?n=Gi.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=i,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(a=>{a.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(a.boneName),follow:a.follow,onUpdate:a.onUpdate,angleFollow:a.angleFollow||!1,scaleFollow:a.scaleFollow===void 0?!0:a.scaleFollow})})),this._loopFn=this._loop.bind(this),wt.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{s()}}})}addAnimation(t="animation",e=!1,s=0){return new Promise(i=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{i()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){wt.system.remove(this._loopFn),this.destroy({children:!0})}_loop(){if(this.destroyed){wt.system.remove(this._loopFn);return}this.update(wt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,i=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:i,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=i),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,s+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{xt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const nI=(r,t)=>{let e=null,s=!1;return(...i)=>{s||(r(...i),s=!0),e&&clearTimeout(e),e=setTimeout(()=>{s=!1},t)}},Mi=(r,t,e,s={})=>{const{once:i=!1,debounce:n=!1,debounceTime:a=1e3}=s;r.cursor="pointer",r.eventMode="static";const h=l=>{l.button!==2&&e(l)},o=n?nI(h,a):h;return i?r.once(t,o):r.on(t,o),()=>{r.off(t,o)}};class oI extends It{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:i,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=i,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),i&&(this._btn.tint=i),Mi(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mi(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,i&&(this._btn.tint=i))})}toggleTexture(t,e){this._texture=t,this._hoverTexture=e,this._btn._texture=e}setDisabled(t){this.disabled=t,this._btn.tint=t?this._disabledColor:this._tintColor||"#fff",this._btn.texture=this._texture}}class aI extends Ao{constructor(t){const{sprite:e,onClick:s}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Mi(this,"pointerenter",()=>{xt.to(e,{duration:.25,rotation:180*(Math.PI/180)})});const i=Mi(this,"pointerleave",()=>{e.alpha=1,xt.to(e,{duration:.25,rotation:0})});Mi(this,"pointerdown",()=>{e.alpha=.5}),Mi(this,"pointertap",()=>{s(),i()})}}class lI extends It{constructor(t){super(),this._maskUI=new fl({bgColor:"#000",width:1080,height:1920}),this.addChild(this._maskUI),this._maskUI.alpha=0,this._maskUI.eventMode="static",this._drawerContainer=t,this.addChild(this._drawerContainer),this._drawerContainer.y=this._maskUI.height,xt.to(this._maskUI,{duration:.25,alpha:.5}),xt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){xt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await xt.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class hI extends It{constructor(t){super(),this.COLLECT_TIME=5*1e3,this._nowTime=0,this._lastTime=0,this._drawCount=0,this._maxDrawCount=0,this._tempMaxDrawCount=0,this._lastCollectTime=0,this._containerWidth=590,this._containerHeight=50,this.pivot.x=this._containerWidth/2,this._resize(window.innerWidth,window.innerHeight),window.addEventListener("resize",()=>{this._resize(window.innerWidth,window.innerHeight)}),this._bg=new fl({width:this._containerWidth,height:this._containerHeight,bgColor:"#000",alpha:.75}),this.addChild(this._bg);const e=new It;this.addChild(e),e.x=25,e.y=this._containerHeight/2,this._fpsText=new ad("FPS"),e.addChild(this._fpsText),this._drawCallText=new ad("Draw Call"),e.addChild(this._drawCallText),this._drawCallText.x=125,this._maxDrawCallText=new ad("Max Draw Call"),e.addChild(this._maxDrawCallText),this._maxDrawCallText.x=320,this._renderer=t.renderer,this._drawElements=this._renderer.gl.drawElements,this.init()}init(){this._renderer.gl.drawElements=(...t)=>{this._drawElements.call(this._renderer.gl,...t),this._drawCount++},wt.shared.add(()=>{const t=wt.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTextInfo("fps",Number(Math.floor(t).toFixed(0))),this._lastTime=this._nowTime),this._nowTime-this._lastCollectTime<this.COLLECT_TIME?this._tempMaxDrawCount<this._drawCount&&(this._tempMaxDrawCount=this._drawCount):(this._maxDrawCount=this._tempMaxDrawCount,this._tempMaxDrawCount=0,this._lastCollectTime=this._nowTime),this._setTextInfo("drawCall",this._drawCount),this._setTextInfo("maxDrawCall",this._maxDrawCount),this._drawCount=0},Vi.UTILITY)}_setTextInfo(t,e){const i={fps:this._fpsText,drawCall:this._drawCallText,maxDrawCall:this._maxDrawCallText}[t];i.updateValue(e),t==="fps"?i.updateColor(this.getFpsColor(e)):i.updateColor(this.getDrawCallColor(e))}getFpsColor(t){let e="#00ff04";return t<30&&(e="#ffd20a"),t<20&&(e="#ff000d"),e}getDrawCallColor(t){let e="#00ff04";return t>=75&&(e="#ffd20a"),t>=100&&(e="#ff000d"),e}_resize(t,e){t>e?this.x=1920/2:this.x=1080/2}}class ad extends It{constructor(t,e=26){super();const s=new _l({text:t,fontSize:e,fontWeight:"bold"});this.addChild(s),s.anchor.y=.5,this._valueText=new _l({text:"0",fontSize:e,fontWeight:"bold"}),this.addChild(this._valueText),this._valueText.anchor.y=.5,this._valueText.x=s.width+10}updateColor(t){this._valueText.style.fill=t}updateValue(t){this._valueText.text=t}}class cI extends It{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:i,barHeight:n,bgTexture:a,barTexture:h}=t,o=new qe(a);this.addChild(o),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-i)/2,this._progressBar.y=(s-n)/2;const l=new hs;l.beginFill(16777215),l.drawRect(0,0,0,this._progressBar.height),l.endFill(),this._progressBar.addChild(l),this._progressBar.mask=l,this._maskGraphics=l}setProgress(t){const e=Math.max(0,Math.min(1,t));this._maskGraphics.clear(),this._maskGraphics.beginFill(16777215),this._maskGraphics.drawRect(0,0,this._progressBar.width*e,this._progressBar.height),this._maskGraphics.endFill()}}class uI extends Ao{constructor(t){const{width:e,height:s,scrollContent:i,bottomMargin:n=50}=t;if(super(e,s),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=i,this._content=new It,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new qe;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new hs,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,s),this._maskGraphics.endFill(),this.mask=this._maskGraphics,this.eventMode="static",this.on("pointerdown",this._onDragStart,this),this.on("pointermove",this._onDragMove,this),this.on("pointerup",this._onDragEnd,this),this.on("pointerupoutside",this._onDragEnd,this),this.on("wheel",this._onWheelScroll,this)}setDimensions(t,e){this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,t,e),this._maskGraphics.endFill(),this.setSize(t,e)}scrollToTop(){xt.killTweensOf(this._content),this._content.y=0}addContent(t){this._scrollContent.addChild(t)}_onDragStart(t){if(this._content.height<=this._maskGraphics.height)return;const e=t.getLocalPosition(this);this._startY=e.y-this._content.y,this._isDragging=!0,this._velocity=0,this._startTime=Date.now(),this._startPosition=this._content.y,xt.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const s=t.getLocalPosition(this).y-this._startY;this._content.y=s}}_onDragEnd(){this._isDragging=!1;const e=Date.now()-this._startTime;e<250?(this._velocity=(this._content.y-this._startPosition)/e,this._applyInertia()):this._velocity=0,this._limitScrollRange()}_onWheelScroll(t){if(this._content.height<=this._maskGraphics.height)return;let e=this._content.y-t.deltaY*(this._scrollSpeed/100);e>0?e=0:Math.abs(e)>=this._content.height-this._maskGraphics.height&&(e=-(this._content.height-this._maskGraphics.height)),xt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){xt.to(this._content,{y:this._content.y+this._velocity*250,duration:.5,ease:"power1.out",onUpdate:this._limitScrollRange.bind(this)})}_limitScrollRange(){if(this._content.y>0)xt.to(this._content,{duration:.75,y:0,ease:"elastic.out"});else if(Math.abs(this._content.y)>=this._content.height-this._maskGraphics.height)if(this._content.height>this._maskGraphics.height){const t=-(this._content.height-this._maskGraphics.height);xt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else xt.to(this._content,{duration:.25,y:0})}}class dI extends Ao{constructor(t){const{width:e,height:s,content:i,slideCallback:n,scrollCallback:a,pageNum:h,pageHeight:o}=t;super(e,s),this._currentIndex=0,this._scrollHeight=0,this._slideHeight=0,this._startY=0,this._offsetY=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1;const l=new hs;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=o,this._slideArea=i,this._slideCallback=n,this._scrollCallback=a,this._pageNum=h-1,this.addChild(this._slideArea),this._slideArea.x=e/2,this._slideArea.y=this._scrollHeight/2,this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}updatePosition(t,e){this._slideArea.y=t,this._currentIndex=e}slideTo(t){var e;t<0?(xt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var s;(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var s;(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:.1,onUpdate:()=>{var s;(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}})),(e=this._slideCallback)==null||e.call(this,this._currentIndex)}setDepth(t,e,s=0){const i=e-s,n=Math.floor(Math.abs(i)/this._slideHeight),a=Math.abs(i)%this._slideHeight/this._slideHeight,h=n-1,o=n+1,l=n+2,u=t[n];if(u.alpha=this.lerp(.5,1,1-a),u.scale.y=this.lerp(.85,1,1-a),o<t.length){const c=t[o];c.alpha=this.lerp(.5,1,a),c.scale.y=this.lerp(.85,1,a)}if(l<t.length){const c=t[l];c.alpha=this.lerp(.1,.5,a)}if(h>=0){const c=t[h];c.alpha=this.lerp(.1,.5,1-a)}}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var a;if(!this._isDragging)return;const e=t.pageY-this._startY;let s=this._offsetY+e;const i=this._scrollHeight/2,n=-this._pageNum*this._slideHeight+this._scrollHeight/2;s>i&&(s=i),s<n&&(s=n),this._slideArea.y=s,(a=this._scrollCallback)==null||a.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startY-t.pageY,i=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||i>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}lerp(t,e,s){return t*(1-s)+e*s}}const L0=r=>{const t=new hs;return t.beginFill(16777215),t.drawRect(0,0,r.width,r.height),t.endFill(),r.addChild(t),r.mask=t,t};class fI extends Ao{constructor(t){const{width:e,height:s,slideList:i,slideCallback:n,enableDepth:a=!1,depthAlpha:h=.5,depthScale:o=.5}=t;super(e,s),this._currentIndex=0,this._slideWidth=0,this._slideHeight=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,L0(this),this._slideArea=new It,this._slideWidth=e,this._slideHeight=s,this._slideList=i,this._enableDepth=a,this._depthAlpha=h,this._depthScale=o,this.slideCallback=n,this._pageNum=i.length-1,this._slideList.forEach((l,u)=>{this._slideArea.addChild(l),l.x=u*e+this._slideWidth/2,l.y=this._slideHeight/2,l.pivot.set(this._slideWidth/2,this._slideHeight/2)}),this.addChild(this._slideArea),this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}prev(){this._slideTo(this._currentIndex-1)}next(){this._slideTo(this._currentIndex+1)}_slideTo(t){t<0?(xt.to(this._slideArea,{x:0,duration:.25,onUpdate:()=>{this._setDepth()}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5,onUpdate:()=>{this._setDepth()}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25,onUpdate:()=>{this._setDepth()}})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){if(!this._isDragging)return;const e=t.pageX-this._startX;this._slideArea.x=this._offsetX+e,this._setDepth()}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,i=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||i>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}_setDepth(){if(!this._enableDepth)return;const t=this._slideArea.x,e=Math.floor(Math.abs(t)/this._slideWidth),s=Math.abs(t)%this._slideWidth/this._slideWidth,i=e-1,n=e+1,a=this._slideList[e];if(a.alpha=this.lerp(this._depthAlpha,1,1-s),a.scale.set(this.lerp(this._depthScale,1,1-s)),n<this._slideList.length){const h=this._slideList[n];h.alpha=this.lerp(this._depthAlpha,1,s),h.scale.set(this.lerp(this._depthScale,1,s))}if(i>=0){const h=this._slideList[i];h.alpha=this.lerp(this._depthAlpha,1,1-s),h.scale.set(this.lerp(this._depthScale,1,1-s))}}lerp(t,e,s){return t*(1-s)+e*s}}class pI{constructor(t,e){this._currentIndex=0,this._numsLength=0,this._isDown=!1,this._onChange=e,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}class mI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:i,onDisabled:n}=t;this._onAmountIndex=i,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new pI(s,a=>{this._onAmountIndex(a),this.minMaxUpdateIndex(a)}),this.minMaxUpdateIndex(e),this._baseNumSteper.updateIndex(e)}min(){this.minMaxUpdateIndex(0),this._onAmountIndex(0)}max(){const t=this._betAmountListLength-1;this.minMaxUpdateIndex(t),this._onAmountIndex(t)}sub(){this._baseNumSteper.down("sub")}add(){this._baseNumSteper.down("add")}minMaxUpdateIndex(t){t===0?this._onDisabled("min"):t===this._betAmountListLength-1?this._onDisabled("max"):this._onDisabled(),this._baseNumSteper.updateIndex(t)}}const N0=(r,t,e)=>{const s=t/r.width*r.scale.x,i=e?e/r.height*r.scale.y:s,n=Math.min(s,i);r.scale.set(n>1?1:n)};class gI extends It{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:i=100,fontColor:n="#fff",firstColumnFontColor:a="#fff",fontSize:h=30,lineWidth:o=2,lineColor:l="#5b5b5b",outsideBorder:u=!0,fontBold:c=!0}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=i,this._fontColor=n,this._fontSize=h,this._lineWidth=o,this._lineColor=l,this._outsideBorder=u,this._fontBold=c,this._firstColumnFontColor=a,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new hs;s.lineStyle(this._lineWidth,this._lineColor),this._outsideBorder&&s.drawRect(0,0,t,e);for(let i=1;i<this._rows;i++)s.moveTo(0,i*this._cellHeight),s.lineTo(t,i*this._cellHeight);for(let i=1;i<this._cols;i++)s.moveTo(i*this._cellWidth,0),s.lineTo(i*this._cellWidth,e);this.addChild(s)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const s=this._data[t][e];this._createNumberText(s,e,t)}}_createNumberText(t,e,s){const i=new za(t.toString(),{_fontSize:this._fontSize,fill:e===0?this._firstColumnFontColor:this._fontColor,fontWeight:this._fontBold?"bold":"normal"}),n=e*this._cellWidth+this._cellWidth/2,a=s*this._cellHeight+this._cellHeight/2;this.addChild(i),i.anchor.set(.5),i.position.set(n,a),N0(i,this._cellWidth*.9)}}var ld={};/*!
1172
1172
  * howler.js v2.2.4
1173
1173
  * howlerjs.com
1174
1174
  *
@@ -1186,7 +1186,7 @@ Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u
1186
1186
  * goldfirestudios.com
1187
1187
  *
1188
1188
  * MIT License
1189
- */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var s=this;if(!s.ctx||!s.ctx.listener)return s;for(var i=s._howls.length-1;i>=0;i--)s._howls[i].stereo(e);return s},HowlerGlobal.prototype.pos=function(e,s,i){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(s=typeof s!="number"?n._pos[1]:s,i=typeof i!="number"?n._pos[2]:i,typeof e=="number")n._pos=[e,s,i],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]);else return n._pos;return n},HowlerGlobal.prototype.orientation=function(e,s,i,n,a,h){var o=this;if(!o.ctx||!o.ctx.listener)return o;var l=o._orientation;if(s=typeof s!="number"?l[1]:s,i=typeof i!="number"?l[2]:i,n=typeof n!="number"?l[3]:n,a=typeof a!="number"?l[4]:a,h=typeof h!="number"?l[5]:h,typeof e=="number")o._orientation=[e,s,i,n,a,h],typeof o.ctx.listener.forwardX<"u"?(o.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),o.ctx.listener.forwardY.setTargetAtTime(s,Howler.ctx.currentTime,.1),o.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),o.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),o.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),o.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):o.ctx.listener.setOrientation(e,s,i,n,a,h);else return l;return o},Howl.prototype.init=function(e){return function(s){var i=this;return i._orientation=s.orientation||[1,0,0],i._stereo=s.stereo||null,i._pos=s.pos||null,i._pannerAttr={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:360,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:360,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:0,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:"inverse",maxDistance:typeof s.maxDistance<"u"?s.maxDistance:1e4,panningModel:typeof s.panningModel<"u"?s.panningModel:"HRTF",refDistance:typeof s.refDistance<"u"?s.refDistance:1,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:1},i._onstereo=s.onstereo?[{fn:s.onstereo}]:[],i._onpos=s.onpos?[{fn:s.onpos}]:[],i._onorientation=s.onorientation?[{fn:s.onorientation}]:[],e.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,s){var i=this;if(!i._webAudio)return i;if(i._state!=="loaded")return i._queue.push({event:"stereo",action:function(){i.stereo(e,s)}}),i;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u")if(typeof e=="number")i._stereo=e,i._pos=[e,0,0];else return i._stereo;for(var a=i._getSoundIds(s),h=0;h<a.length;h++){var o=i._soundById(a[h]);if(o)if(typeof e=="number")o._stereo=e,o._pos=[e,0,0],o._node&&(o._pannerAttr.panningModel="equalpower",(!o._panner||!o._panner.pan)&&t(o,n),n==="spatial"?typeof o._panner.positionX<"u"?(o._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),o._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),o._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):o._panner.setPosition(e,0,0):o._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),i._emit("stereo",o._id);else return o._stereo}return i},Howl.prototype.pos=function(e,s,i,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"pos",action:function(){a.pos(e,s,i,n)}}),a;if(s=typeof s!="number"?0:s,i=typeof i!="number"?-.5:i,typeof n>"u")if(typeof e=="number")a._pos=[e,s,i];else return a._pos;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._pos=[e,s,i],l._node&&((!l._panner||l._panner.pan)&&t(l,"spatial"),typeof l._panner.positionX<"u"?(l._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(i,Howler.ctx.currentTime)):l._panner.setPosition(e,s,i)),a._emit("pos",l._id);else return l._pos}return a},Howl.prototype.orientation=function(e,s,i,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"orientation",action:function(){a.orientation(e,s,i,n)}}),a;if(s=typeof s!="number"?a._orientation[1]:s,i=typeof i!="number"?a._orientation[2]:i,typeof n>"u")if(typeof e=="number")a._orientation=[e,s,i];else return a._orientation;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._orientation=[e,s,i],l._node&&(l._panner||(l._pos||(l._pos=a._pos||[0,0,-.5]),t(l,"spatial")),typeof l._panner.orientationX<"u"?(l._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.orientationY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.orientationZ.setValueAtTime(i,Howler.ctx.currentTime)):l._panner.setOrientation(e,s,i)),a._emit("orientation",l._id);else return l._orientation}return a},Howl.prototype.pannerAttr=function(){var e=this,s=arguments,i,n,a;if(!e._webAudio)return e;if(s.length===0)return e._pannerAttr;if(s.length===1)if(typeof s[0]=="object")i=s[0],typeof n>"u"&&(i.pannerAttr||(i.pannerAttr={coneInnerAngle:i.coneInnerAngle,coneOuterAngle:i.coneOuterAngle,coneOuterGain:i.coneOuterGain,distanceModel:i.distanceModel,maxDistance:i.maxDistance,refDistance:i.refDistance,rolloffFactor:i.rolloffFactor,panningModel:i.panningModel}),e._pannerAttr={coneInnerAngle:typeof i.pannerAttr.coneInnerAngle<"u"?i.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof i.pannerAttr.coneOuterAngle<"u"?i.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof i.pannerAttr.coneOuterGain<"u"?i.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof i.pannerAttr.distanceModel<"u"?i.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof i.pannerAttr.maxDistance<"u"?i.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof i.pannerAttr.refDistance<"u"?i.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof i.pannerAttr.rolloffFactor<"u"?i.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof i.pannerAttr.panningModel<"u"?i.pannerAttr.panningModel:e._panningModel});else return a=e._soundById(parseInt(s[0],10)),a?a._pannerAttr:e._pannerAttr;else s.length===2&&(i=s[0],n=parseInt(s[1],10));for(var h=e._getSoundIds(n),o=0;o<h.length;o++)if(a=e._soundById(h[o]),a){var l=a._pannerAttr;l={coneInnerAngle:typeof i.coneInnerAngle<"u"?i.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:typeof i.coneOuterAngle<"u"?i.coneOuterAngle:l.coneOuterAngle,coneOuterGain:typeof i.coneOuterGain<"u"?i.coneOuterGain:l.coneOuterGain,distanceModel:typeof i.distanceModel<"u"?i.distanceModel:l.distanceModel,maxDistance:typeof i.maxDistance<"u"?i.maxDistance:l.maxDistance,refDistance:typeof i.refDistance<"u"?i.refDistance:l.refDistance,rolloffFactor:typeof i.rolloffFactor<"u"?i.rolloffFactor:l.rolloffFactor,panningModel:typeof i.panningModel<"u"?i.panningModel:l.panningModel};var u=a._panner;u||(a._pos||(a._pos=e._pos||[0,0,-.5]),t(a,"spatial"),u=a._panner),u.coneInnerAngle=l.coneInnerAngle,u.coneOuterAngle=l.coneOuterAngle,u.coneOuterGain=l.coneOuterGain,u.distanceModel=l.distanceModel,u.maxDistance=l.maxDistance,u.refDistance=l.refDistance,u.rolloffFactor=l.rolloffFactor,u.panningModel=l.panningModel}return e},Sound.prototype.init=function(e){return function(){var s=this,i=s._parent;s._orientation=i._orientation,s._stereo=i._stereo,s._pos=i._pos,s._pannerAttr=i._pannerAttr,e.call(this),s._stereo?i.stereo(s._stereo):s._pos&&i.pos(s._pos[0],s._pos[1],s._pos[2],s._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var s=this,i=s._parent;return s._orientation=i._orientation,s._stereo=i._stereo,s._pos=i._pos,s._pannerAttr=i._pannerAttr,s._stereo?i.stereo(s._stereo):s._pos?i.pos(s._pos[0],s._pos[1],s._pos[2],s._id):s._panner&&(s._panner.disconnect(0),s._panner=void 0,i._refreshBuffer(s)),e.call(this)}}(Sound.prototype.reset);var t=function(e,s){s=s||"spatial",s==="spatial"?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,typeof e._panner.positionX<"u"?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),typeof e._panner.orientationX<"u"?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}})()})(ud);let H0;function mI(r){return H0=r,r}function ko(){return H0}let gI=0;const dd=class extends Xs{constructor(r){super(),this.id=gI++,this.init(r)}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(r){this._playing=!1,this._duration=r.source.duration;const t=this._source=r.source.cloneNode(!1);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh()}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh()}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh()}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters")}refresh(){const r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=r.volume*(r.muted?0:1),s=t.volume*(t.muted?0:1),i=this._volume*(this._muted?0:1);this._source.volume=i*e*s,this._source.playbackRate=this._speed*r.speed*t.speed}refreshPaused(){const r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(r){const{start:t,end:e,speed:s,loop:i,volume:n,muted:a}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=n,this._loop=!!i,this._muted=a,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-dd.PADDING),this._end=Math.min(this._end+dd.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),wt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){wt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){wt.shared.remove(this._onUpdate,this),this.removeAllListeners();const r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let Y0=dd;Y0.PADDING=.1;class _I extends Xs{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new Y0(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,s=this.parent;if(e.readyState===4){s.isLoaded=!0;const o=s.autoPlayStart();t&&setTimeout(()=>{t(null,s,o)},0);return}if(!s.url){t(new Error("sound.url or sound.source must be set"));return}e.src=s.url;const i=()=>{h(),s.isLoaded=!0;const o=s.autoPlayStart();t&&t(null,s,o)},n=()=>{h(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{h();const o=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(o)):console.error(o)},h=()=>{e.removeEventListener("canplaythrough",i),e.removeEventListener("load",i),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",i,!1),e.addEventListener("load",i,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class yI{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const bl=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],xI=["audio/mpeg","audio/ogg"],wl={};function vI(r){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...r||{}},e=document.createElement("audio"),s={},i=/^no$/;bl.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(i,""),h=t[n]?e.canPlayType(t[n]).replace(i,""):"";s[n]=!!a||!!h}),Object.assign(wl,s)}vI();class fd{static setParamValue(t,e){if(t.setValueAtTime){const s=ko().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}let bI=0;class wI extends Xs{constructor(t){super(),this.id=bI++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(s=>s).forEach(s=>s.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const s=t.volume*(t.muted?0:1),i=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);fd.setParamValue(this._gain.gain,n*i*s),fd.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(s=>{e.connect(s.destination),e=s}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,s=this._paused||e.paused||t.paused;s!==this._pausedReal&&(this._pausedReal=s,s?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",s))}play(t){const{start:e,end:s,speed:i,loop:n,volume:a,muted:h,filters:o}=t;s&&console.assert(s>e,"End time is before start time"),this._paused=!1;const{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=i,this._volume=a,this._loop=!!n,this._muted=h,this._filters=o,this.refresh();const c=this._source.buffer.duration;this._duration=c,this._end=s,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=s,this._source.loopStart=e,this._source.start(0,e)):s?this._source.start(0,e,s-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){wt.shared.remove(this._updateListener,this),t&&wt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),s=e-this._lastUpdate;if(s>0||t){const i=this._source.playbackRate.value;this._elapsed+=s*i,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const h=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%h)/n}else a=this._elapsed%n/n;this._progress=a,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class W0{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(s=>{e===null?this._input.connect(s.destination):e.connect(s.destination),e=s}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const z0=class extends W0{constructor(r){const t=r.audioContext,e=t.createBufferSource(),s=t.createGain(),i=t.createAnalyser();e.connect(i),i.connect(s),s.connect(r.destination),super(i,s),this.context=r,this.bufferSource=e,this.gain=s,this.analyser=i}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(z0.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,fd.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let j0=z0;j0.BUFFER_SIZE=0;class EI{init(t){this.parent=t,this._nodes=new j0(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new wI(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,s=await z.ADAPTER.fetch(e);this._decode(await s.arrayBuffer(),t)}_decode(t,e){const s=(i,n)=>{if(i)e&&e(i);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?s(null,t):this.parent.context.decode(t,s)}}const Fn=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=ko().useLegacy?new _I:new EI;return new Fn(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(r){const[t]=r.map(e=>({url:e,ext:bt.extname(e).slice(1)})).filter(({ext:e})=>wl[e]).sort((e,s)=>bl.indexOf(e.ext)-bl.indexOf(s.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return ko().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused()}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh()}get filters(){return this.media.filters}set filters(r){this.media.filters=r}addSprites(r,t){if(typeof r=="object"){const s={};for(const i in r)s[i]=this.addSprites(i,r[i]);return s}console.assert(!this._sprites[r],`Alias ${r} is already taken`);const e=new yI(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(r){if(r){const t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const i=e.sprite;console.assert(!!this._sprites[i],`Alias ${i} is not available`);const n=this._sprites[i];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(i=>{this._preloadQueue.push(()=>{i(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((i,n)=>{this._preload((a,h,o)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,h,o),i(o))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const s=this._createInstance();return this._instances.push(s),this.isPlaying=!0,s.once("end",()=>{e.complete&&e.complete(this),this._onComplete(s)}),s.once("stop",()=>{this._onComplete(s)}),s.play(e),s}refresh(){const r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh()}refreshPaused(){const r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh()}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh()}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh()}_preload(r){this.media.load(r)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0}_onComplete(r){if(this._instances){const t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(r)}_createInstance(){if(Fn._pool.length>0){const r=Fn._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Fn._pool.indexOf(r)<0&&Fn._pool.push(r)}};let El=Fn;El._pool=[];class TI extends Xs{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}class Bo extends W0{constructor(){const t=window,e=new Bo.AudioContext,s=e.createDynamicsCompressor(),i=e.createAnalyser();i.connect(s),s.connect(e.destination),super(i,s),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Bo.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=s,this.analyser=i,this.events=new Xs,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const s=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},i=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},s);i&&i.catch(s)}}class AI{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Bo),this._htmlAudioContext=new TI,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Bo.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const h=this._getOptions(t[a],e);n[a]=this.add(a,h)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof El)return this._sounds[t]=e,e;const s=this._getOptions(e),i=El.from(s);return this._sounds[t]=i,i}_getOptions(t,e){let s;return typeof t=="string"?s={url:t}:Array.isArray(t)?s={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?s={source:t}:s=t,s={...s,...e||{}},s}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const s=!!this._sounds[t];return e&&console.assert(s,`No sound matching alias '${t}'.`),s}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const s=this.find(t);return e!==void 0&&(s.volume=e),s.volume}speed(t,e){const s=this.find(t);return e!==void 0&&(s.speed=e),s.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const q0=r=>{var e;const t=r.src;return((e=r==null?void 0:r.alias)==null?void 0:e[0])??bt.basename(t,bt.extname(t))},SI={extension:H.Asset,detection:{test:async()=>!0,add:async r=>[...r,...bl.filter(t=>wl[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{extension:{type:[H.LoadParser],priority:Ne.High},test(r){const t=bt.extname(r).slice(1);return!!wl[t]||xI.some(e=>r.startsWith(`data:${e}`))},async load(r,t){const e=await new Promise((s,i)=>El.from({...t.data,url:r,preload:!0,loaded(n,a){var h,o;n?i(n):s(a),(o=(h=t.data)==null?void 0:h.loaded)==null||o.call(h,n,a)}}));return ko().add(q0(t),e),e},async unload(r,t){ko().remove(q0(t))}}};K.add(SI),mI(new AI);class CI{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,s;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(s=this._musicPlayer)==null||s.pause(),this._playingList.forEach(i=>{t?i.audio.play():i.audio.pause()})},document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(s=>{const i=Math.random(),n=Gi.get(t).url,a=new ud.Howl({src:n,mute:this._isBackground||!this.effectEnabled});if(a.play(),a.on("end",()=>{this._playingList=this._playingList.filter(h=>h.id!==i),s()}),e){const o=a.duration()-e;a.seek(o)}this._playingList.push({id:i,audio:a,url:n})})}async playMusic(t){const e=Gi.get(t).url;this._musicPlayer&&(xt.killTweensOf(this._musicPlayer),await xt.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),this._musicPlayer.stop()),this._musicPlayer=new ud.Howl({src:e,loop:!0,volume:0,mute:this._isBackground||!this.musicEnabled}),this._musicPlayer.play(),this._isMusicPaused=!1,xt.killTweensOf(this._musicPlayer),xt.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t,e;this._isMusicPaused=!1,!((t=this._musicPlayer)!=null&&t.playing())&&((e=this._musicPlayer)==null||e.play())}stopEffect(t){const e=Gi.get(t).url;this._playingList.forEach(s=>{s.url===e&&s.audio.stop()}),this._playingList=this._playingList.filter(s=>s.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){var e;(e=this._musicPlayer)==null||e.mute(t||!this.musicEnabled)}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.mute(t||!this.effectEnabled)})}}const II=r=>{const{texture:t,dotWidth:e,width:s,height:i}=r;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new RT(t,n[0],n[1],n[2],n[3]);return a.width=s,a.height=i,a},PI=(r,t,e=0)=>parseFloat((Math.random()*(t-r)+r).toFixed(e)),RI=(r,t)=>{let e=0;const s=new wt,i=n=>{e+=n*s.deltaMS;let a=0;Array.isArray(t)?a=PI(t[0],t[1],2):a=t,e>=a&&(r(),e=0)};return s.add(i),s.start(),()=>{s.remove(i),s.stop()}},MI=(r,t,e)=>{const s=i=>{const n=t.getBounds().contains(i.clientX,i.clientY),a=r.getBounds().contains(i.clientX,i.clientY);!n&&!a&&r.visible&&(e(),window.removeEventListener("pointerdown",s))};return window.addEventListener("pointerdown",s),()=>{window.removeEventListener("pointerdown",s)}},FI=(r=1,t)=>new Promise(e=>{let s=0;const i=new wt,n=()=>{s+=i.deltaMS,s>=r&&(t==null||t(),i.destroy(),e())};i.add(n),i.start()}),kI=(r,t)=>{let e;if(r==="brightness")e=new hn,e.brightness(t,!1);else if(r==="blur")e=new dm;else if(r==="desaturate")e=new hn,e.desaturate();else if(r==="contrast")e=new hn,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var BI=`attribute vec2 aVertexPosition;
1189
+ */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var s=this;if(!s.ctx||!s.ctx.listener)return s;for(var i=s._howls.length-1;i>=0;i--)s._howls[i].stereo(e);return s},HowlerGlobal.prototype.pos=function(e,s,i){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(s=typeof s!="number"?n._pos[1]:s,i=typeof i!="number"?n._pos[2]:i,typeof e=="number")n._pos=[e,s,i],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]);else return n._pos;return n},HowlerGlobal.prototype.orientation=function(e,s,i,n,a,h){var o=this;if(!o.ctx||!o.ctx.listener)return o;var l=o._orientation;if(s=typeof s!="number"?l[1]:s,i=typeof i!="number"?l[2]:i,n=typeof n!="number"?l[3]:n,a=typeof a!="number"?l[4]:a,h=typeof h!="number"?l[5]:h,typeof e=="number")o._orientation=[e,s,i,n,a,h],typeof o.ctx.listener.forwardX<"u"?(o.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),o.ctx.listener.forwardY.setTargetAtTime(s,Howler.ctx.currentTime,.1),o.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),o.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),o.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),o.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):o.ctx.listener.setOrientation(e,s,i,n,a,h);else return l;return o},Howl.prototype.init=function(e){return function(s){var i=this;return i._orientation=s.orientation||[1,0,0],i._stereo=s.stereo||null,i._pos=s.pos||null,i._pannerAttr={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:360,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:360,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:0,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:"inverse",maxDistance:typeof s.maxDistance<"u"?s.maxDistance:1e4,panningModel:typeof s.panningModel<"u"?s.panningModel:"HRTF",refDistance:typeof s.refDistance<"u"?s.refDistance:1,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:1},i._onstereo=s.onstereo?[{fn:s.onstereo}]:[],i._onpos=s.onpos?[{fn:s.onpos}]:[],i._onorientation=s.onorientation?[{fn:s.onorientation}]:[],e.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,s){var i=this;if(!i._webAudio)return i;if(i._state!=="loaded")return i._queue.push({event:"stereo",action:function(){i.stereo(e,s)}}),i;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u")if(typeof e=="number")i._stereo=e,i._pos=[e,0,0];else return i._stereo;for(var a=i._getSoundIds(s),h=0;h<a.length;h++){var o=i._soundById(a[h]);if(o)if(typeof e=="number")o._stereo=e,o._pos=[e,0,0],o._node&&(o._pannerAttr.panningModel="equalpower",(!o._panner||!o._panner.pan)&&t(o,n),n==="spatial"?typeof o._panner.positionX<"u"?(o._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),o._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),o._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):o._panner.setPosition(e,0,0):o._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),i._emit("stereo",o._id);else return o._stereo}return i},Howl.prototype.pos=function(e,s,i,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"pos",action:function(){a.pos(e,s,i,n)}}),a;if(s=typeof s!="number"?0:s,i=typeof i!="number"?-.5:i,typeof n>"u")if(typeof e=="number")a._pos=[e,s,i];else return a._pos;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._pos=[e,s,i],l._node&&((!l._panner||l._panner.pan)&&t(l,"spatial"),typeof l._panner.positionX<"u"?(l._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(i,Howler.ctx.currentTime)):l._panner.setPosition(e,s,i)),a._emit("pos",l._id);else return l._pos}return a},Howl.prototype.orientation=function(e,s,i,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"orientation",action:function(){a.orientation(e,s,i,n)}}),a;if(s=typeof s!="number"?a._orientation[1]:s,i=typeof i!="number"?a._orientation[2]:i,typeof n>"u")if(typeof e=="number")a._orientation=[e,s,i];else return a._orientation;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._orientation=[e,s,i],l._node&&(l._panner||(l._pos||(l._pos=a._pos||[0,0,-.5]),t(l,"spatial")),typeof l._panner.orientationX<"u"?(l._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.orientationY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.orientationZ.setValueAtTime(i,Howler.ctx.currentTime)):l._panner.setOrientation(e,s,i)),a._emit("orientation",l._id);else return l._orientation}return a},Howl.prototype.pannerAttr=function(){var e=this,s=arguments,i,n,a;if(!e._webAudio)return e;if(s.length===0)return e._pannerAttr;if(s.length===1)if(typeof s[0]=="object")i=s[0],typeof n>"u"&&(i.pannerAttr||(i.pannerAttr={coneInnerAngle:i.coneInnerAngle,coneOuterAngle:i.coneOuterAngle,coneOuterGain:i.coneOuterGain,distanceModel:i.distanceModel,maxDistance:i.maxDistance,refDistance:i.refDistance,rolloffFactor:i.rolloffFactor,panningModel:i.panningModel}),e._pannerAttr={coneInnerAngle:typeof i.pannerAttr.coneInnerAngle<"u"?i.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof i.pannerAttr.coneOuterAngle<"u"?i.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof i.pannerAttr.coneOuterGain<"u"?i.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof i.pannerAttr.distanceModel<"u"?i.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof i.pannerAttr.maxDistance<"u"?i.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof i.pannerAttr.refDistance<"u"?i.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof i.pannerAttr.rolloffFactor<"u"?i.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof i.pannerAttr.panningModel<"u"?i.pannerAttr.panningModel:e._panningModel});else return a=e._soundById(parseInt(s[0],10)),a?a._pannerAttr:e._pannerAttr;else s.length===2&&(i=s[0],n=parseInt(s[1],10));for(var h=e._getSoundIds(n),o=0;o<h.length;o++)if(a=e._soundById(h[o]),a){var l=a._pannerAttr;l={coneInnerAngle:typeof i.coneInnerAngle<"u"?i.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:typeof i.coneOuterAngle<"u"?i.coneOuterAngle:l.coneOuterAngle,coneOuterGain:typeof i.coneOuterGain<"u"?i.coneOuterGain:l.coneOuterGain,distanceModel:typeof i.distanceModel<"u"?i.distanceModel:l.distanceModel,maxDistance:typeof i.maxDistance<"u"?i.maxDistance:l.maxDistance,refDistance:typeof i.refDistance<"u"?i.refDistance:l.refDistance,rolloffFactor:typeof i.rolloffFactor<"u"?i.rolloffFactor:l.rolloffFactor,panningModel:typeof i.panningModel<"u"?i.panningModel:l.panningModel};var u=a._panner;u||(a._pos||(a._pos=e._pos||[0,0,-.5]),t(a,"spatial"),u=a._panner),u.coneInnerAngle=l.coneInnerAngle,u.coneOuterAngle=l.coneOuterAngle,u.coneOuterGain=l.coneOuterGain,u.distanceModel=l.distanceModel,u.maxDistance=l.maxDistance,u.refDistance=l.refDistance,u.rolloffFactor=l.rolloffFactor,u.panningModel=l.panningModel}return e},Sound.prototype.init=function(e){return function(){var s=this,i=s._parent;s._orientation=i._orientation,s._stereo=i._stereo,s._pos=i._pos,s._pannerAttr=i._pannerAttr,e.call(this),s._stereo?i.stereo(s._stereo):s._pos&&i.pos(s._pos[0],s._pos[1],s._pos[2],s._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var s=this,i=s._parent;return s._orientation=i._orientation,s._stereo=i._stereo,s._pos=i._pos,s._pannerAttr=i._pannerAttr,s._stereo?i.stereo(s._stereo):s._pos?i.pos(s._pos[0],s._pos[1],s._pos[2],s._id):s._panner&&(s._panner.disconnect(0),s._panner=void 0,i._refreshBuffer(s)),e.call(this)}}(Sound.prototype.reset);var t=function(e,s){s=s||"spatial",s==="spatial"?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,typeof e._panner.positionX<"u"?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),typeof e._panner.orientationX<"u"?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}})()})(ld);let V0;function _I(r){return V0=r,r}function ko(){return V0}let yI=0;const hd=class extends Xs{constructor(r){super(),this.id=yI++,this.init(r)}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(r){this._playing=!1,this._duration=r.source.duration;const t=this._source=r.source.cloneNode(!1);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh()}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh()}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh()}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters")}refresh(){const r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=r.volume*(r.muted?0:1),s=t.volume*(t.muted?0:1),i=this._volume*(this._muted?0:1);this._source.volume=i*e*s,this._source.playbackRate=this._speed*r.speed*t.speed}refreshPaused(){const r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(r){const{start:t,end:e,speed:s,loop:i,volume:n,muted:a}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=n,this._loop=!!i,this._muted=a,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-hd.PADDING),this._end=Math.min(this._end+hd.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),wt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){wt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){wt.shared.remove(this._onUpdate,this),this.removeAllListeners();const r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let U0=hd;U0.PADDING=.1;class xI extends Xs{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new U0(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,s=this.parent;if(e.readyState===4){s.isLoaded=!0;const o=s.autoPlayStart();t&&setTimeout(()=>{t(null,s,o)},0);return}if(!s.url){t(new Error("sound.url or sound.source must be set"));return}e.src=s.url;const i=()=>{h(),s.isLoaded=!0;const o=s.autoPlayStart();t&&t(null,s,o)},n=()=>{h(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{h();const o=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(o)):console.error(o)},h=()=>{e.removeEventListener("canplaythrough",i),e.removeEventListener("load",i),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",i,!1),e.addEventListener("load",i,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class vI{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const bl=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],bI=["audio/mpeg","audio/ogg"],wl={};function wI(r){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...r||{}},e=document.createElement("audio"),s={},i=/^no$/;bl.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(i,""),h=t[n]?e.canPlayType(t[n]).replace(i,""):"";s[n]=!!a||!!h}),Object.assign(wl,s)}wI();class cd{static setParamValue(t,e){if(t.setValueAtTime){const s=ko().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}let EI=0;class TI extends Xs{constructor(t){super(),this.id=EI++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(s=>s).forEach(s=>s.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const s=t.volume*(t.muted?0:1),i=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);cd.setParamValue(this._gain.gain,n*i*s),cd.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(s=>{e.connect(s.destination),e=s}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,s=this._paused||e.paused||t.paused;s!==this._pausedReal&&(this._pausedReal=s,s?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",s))}play(t){const{start:e,end:s,speed:i,loop:n,volume:a,muted:h,filters:o}=t;s&&console.assert(s>e,"End time is before start time"),this._paused=!1;const{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=i,this._volume=a,this._loop=!!n,this._muted=h,this._filters=o,this.refresh();const c=this._source.buffer.duration;this._duration=c,this._end=s,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=s,this._source.loopStart=e,this._source.start(0,e)):s?this._source.start(0,e,s-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){wt.shared.remove(this._updateListener,this),t&&wt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),s=e-this._lastUpdate;if(s>0||t){const i=this._source.playbackRate.value;this._elapsed+=s*i,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const h=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%h)/n}else a=this._elapsed%n/n;this._progress=a,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class G0{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(s=>{e===null?this._input.connect(s.destination):e.connect(s.destination),e=s}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const X0=class extends G0{constructor(r){const t=r.audioContext,e=t.createBufferSource(),s=t.createGain(),i=t.createAnalyser();e.connect(i),i.connect(s),s.connect(r.destination),super(i,s),this.context=r,this.bufferSource=e,this.gain=s,this.analyser=i}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(X0.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,cd.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let $0=X0;$0.BUFFER_SIZE=0;class AI{init(t){this.parent=t,this._nodes=new $0(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new TI(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,s=await z.ADAPTER.fetch(e);this._decode(await s.arrayBuffer(),t)}_decode(t,e){const s=(i,n)=>{if(i)e&&e(i);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?s(null,t):this.parent.context.decode(t,s)}}const Fn=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=ko().useLegacy?new xI:new AI;return new Fn(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(r){const[t]=r.map(e=>({url:e,ext:bt.extname(e).slice(1)})).filter(({ext:e})=>wl[e]).sort((e,s)=>bl.indexOf(e.ext)-bl.indexOf(s.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return ko().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused()}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh()}get filters(){return this.media.filters}set filters(r){this.media.filters=r}addSprites(r,t){if(typeof r=="object"){const s={};for(const i in r)s[i]=this.addSprites(i,r[i]);return s}console.assert(!this._sprites[r],`Alias ${r} is already taken`);const e=new vI(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(r){if(r){const t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const i=e.sprite;console.assert(!!this._sprites[i],`Alias ${i} is not available`);const n=this._sprites[i];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(i=>{this._preloadQueue.push(()=>{i(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((i,n)=>{this._preload((a,h,o)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,h,o),i(o))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const s=this._createInstance();return this._instances.push(s),this.isPlaying=!0,s.once("end",()=>{e.complete&&e.complete(this),this._onComplete(s)}),s.once("stop",()=>{this._onComplete(s)}),s.play(e),s}refresh(){const r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh()}refreshPaused(){const r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh()}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh()}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh()}_preload(r){this.media.load(r)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0}_onComplete(r){if(this._instances){const t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(r)}_createInstance(){if(Fn._pool.length>0){const r=Fn._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Fn._pool.indexOf(r)<0&&Fn._pool.push(r)}};let El=Fn;El._pool=[];class SI extends Xs{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}class Bo extends G0{constructor(){const t=window,e=new Bo.AudioContext,s=e.createDynamicsCompressor(),i=e.createAnalyser();i.connect(s),s.connect(e.destination),super(i,s),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Bo.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=s,this.analyser=i,this.events=new Xs,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const s=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},i=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},s);i&&i.catch(s)}}class CI{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Bo),this._htmlAudioContext=new SI,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Bo.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const h=this._getOptions(t[a],e);n[a]=this.add(a,h)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof El)return this._sounds[t]=e,e;const s=this._getOptions(e),i=El.from(s);return this._sounds[t]=i,i}_getOptions(t,e){let s;return typeof t=="string"?s={url:t}:Array.isArray(t)?s={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?s={source:t}:s=t,s={...s,...e||{}},s}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const s=!!this._sounds[t];return e&&console.assert(s,`No sound matching alias '${t}'.`),s}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const s=this.find(t);return e!==void 0&&(s.volume=e),s.volume}speed(t,e){const s=this.find(t);return e!==void 0&&(s.speed=e),s.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const H0=r=>{var e;const t=r.src;return((e=r==null?void 0:r.alias)==null?void 0:e[0])??bt.basename(t,bt.extname(t))},II={extension:H.Asset,detection:{test:async()=>!0,add:async r=>[...r,...bl.filter(t=>wl[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{extension:{type:[H.LoadParser],priority:Ne.High},test(r){const t=bt.extname(r).slice(1);return!!wl[t]||bI.some(e=>r.startsWith(`data:${e}`))},async load(r,t){const e=await new Promise((s,i)=>El.from({...t.data,url:r,preload:!0,loaded(n,a){var h,o;n?i(n):s(a),(o=(h=t.data)==null?void 0:h.loaded)==null||o.call(h,n,a)}}));return ko().add(H0(t),e),e},async unload(r,t){ko().remove(H0(t))}}};K.add(II),_I(new CI);class PI{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,s;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(s=this._musicPlayer)==null||s.pause(),this._playingList.forEach(i=>{t?i.audio.play():i.audio.pause()})},document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(s=>{const i=Math.random(),n=Gi.get(t).url,a=new ld.Howl({src:n,mute:this._isBackground||!this.effectEnabled});if(a.play(),a.on("end",()=>{this._playingList=this._playingList.filter(h=>h.id!==i),s()}),e){const o=a.duration()-e;a.seek(o)}this._playingList.push({id:i,audio:a,url:n})})}async playMusic(t){const e=Gi.get(t).url;this._musicPlayer&&(xt.killTweensOf(this._musicPlayer),await xt.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),this._musicPlayer.stop()),this._musicPlayer=new ld.Howl({src:e,loop:!0,volume:0,mute:this._isBackground||!this.musicEnabled}),this._musicPlayer.play(),this._isMusicPaused=!1,xt.killTweensOf(this._musicPlayer),xt.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t,e;this._isMusicPaused=!1,!((t=this._musicPlayer)!=null&&t.playing())&&((e=this._musicPlayer)==null||e.play())}stopEffect(t){const e=Gi.get(t).url;this._playingList.forEach(s=>{s.url===e&&s.audio.stop()}),this._playingList=this._playingList.filter(s=>s.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){var e;(e=this._musicPlayer)==null||e.mute(t||!this.musicEnabled)}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.mute(t||!this.effectEnabled)})}}const RI=r=>{const{texture:t,dotWidth:e,width:s,height:i}=r;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new FT(t,n[0],n[1],n[2],n[3]);return a.width=s,a.height=i,a},MI=(r,t,e=0)=>parseFloat((Math.random()*(t-r)+r).toFixed(e)),FI=(r,t)=>{let e=0;const s=new wt,i=n=>{e+=n*s.deltaMS;let a=0;Array.isArray(t)?a=MI(t[0],t[1],2):a=t,e>=a&&(r(),e=0)};return s.add(i),s.start(),()=>{s.remove(i),s.stop()}},kI=(r,t,e)=>{const s=i=>{const n=t.getBounds().contains(i.clientX,i.clientY),a=r.getBounds().contains(i.clientX,i.clientY);!n&&!a&&r.visible&&(e(),window.removeEventListener("pointerdown",s))};return window.addEventListener("pointerdown",s),()=>{window.removeEventListener("pointerdown",s)}},BI=(r=1,t)=>new Promise(e=>{let s=0;const i=new wt,n=()=>{s+=i.deltaMS,s>=r&&(t==null||t(),i.destroy(),e())};i.add(n),i.start()}),DI=(r,t)=>{let e;if(r==="brightness")e=new hn,e.brightness(t,!1);else if(r==="blur")e=new am;else if(r==="desaturate")e=new hn,e.desaturate();else if(r==="contrast")e=new hn,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var OI=`attribute vec2 aVertexPosition;
1190
1190
  attribute vec2 aTextureCoord;
1191
1191
 
1192
1192
  uniform mat3 projectionMatrix;
@@ -1197,7 +1197,7 @@ void main(void)
1197
1197
  {
1198
1198
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1199
1199
  vTextureCoord = aTextureCoord;
1200
- }`,DI=`
1200
+ }`,LI=`
1201
1201
  varying vec2 vTextureCoord;
1202
1202
  uniform sampler2D uSampler;
1203
1203
 
@@ -1223,7 +1223,7 @@ void main(void)
1223
1223
  color *= 0.25;
1224
1224
 
1225
1225
  gl_FragColor = color;
1226
- }`,OI=`
1226
+ }`,NI=`
1227
1227
  varying vec2 vTextureCoord;
1228
1228
  uniform sampler2D uSampler;
1229
1229
 
@@ -1251,7 +1251,7 @@ void main(void)
1251
1251
 
1252
1252
  gl_FragColor = color;
1253
1253
  }
1254
- `;let Z0=class extends pe{constructor(t=4,e=3,s=!1){super(BI,s?OI:DI),this._kernels=[],this._blur=4,this._quality=3,this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new st,this.pixelSize=1,this._clamp=s,Array.isArray(t)?this.kernels=t:(this._blur=t,this.quality=e)}apply(t,e,s,i){const n=this._pixelSize.x/e._frame.width,a=this._pixelSize.y/e._frame.height;let h;if(this._quality===1||this._blur===0)h=this._kernels[0]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,e,s,i);else{const o=t.getFilterTexture();let l=e,u=o,c;const d=this._quality-1;for(let f=0;f<d;f++)h=this._kernels[f]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,l,u,1),c=l,l=u,u=c;h=this._kernels[d]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,l,s,i),t.returnFilterTexture(o)}}_updatePadding(){this.padding=Math.ceil(this._kernels.reduce((t,e)=>t+e+.5,0))}_generateKernels(){const t=this._blur,e=this._quality,s=[t];if(t>0){let i=t;const n=t/e;for(let a=1;a<e;a++)i-=n,s.push(i)}this._kernels=s,this._updatePadding()}get kernels(){return this._kernels}set kernels(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max(...t)):(this._kernels=[0],this._quality=1)}get clamp(){return this._clamp}set pixelSize(t){typeof t=="number"?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof st?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)}get pixelSize(){return this._pixelSize}get quality(){return this._quality}set quality(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()}get blur(){return this._blur}set blur(t){this._blur=t,this._generateKernels()}};var LI=`attribute vec2 aVertexPosition;
1254
+ `;let Y0=class extends pe{constructor(t=4,e=3,s=!1){super(OI,s?NI:LI),this._kernels=[],this._blur=4,this._quality=3,this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new st,this.pixelSize=1,this._clamp=s,Array.isArray(t)?this.kernels=t:(this._blur=t,this.quality=e)}apply(t,e,s,i){const n=this._pixelSize.x/e._frame.width,a=this._pixelSize.y/e._frame.height;let h;if(this._quality===1||this._blur===0)h=this._kernels[0]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,e,s,i);else{const o=t.getFilterTexture();let l=e,u=o,c;const d=this._quality-1;for(let f=0;f<d;f++)h=this._kernels[f]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,l,u,1),c=l,l=u,u=c;h=this._kernels[d]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,l,s,i),t.returnFilterTexture(o)}}_updatePadding(){this.padding=Math.ceil(this._kernels.reduce((t,e)=>t+e+.5,0))}_generateKernels(){const t=this._blur,e=this._quality,s=[t];if(t>0){let i=t;const n=t/e;for(let a=1;a<e;a++)i-=n,s.push(i)}this._kernels=s,this._updatePadding()}get kernels(){return this._kernels}set kernels(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max(...t)):(this._kernels=[0],this._quality=1)}get clamp(){return this._clamp}set pixelSize(t){typeof t=="number"?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof st?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)}get pixelSize(){return this._pixelSize}get quality(){return this._quality}set quality(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()}get blur(){return this._blur}set blur(t){this._blur=t,this._generateKernels()}};var VI=`attribute vec2 aVertexPosition;
1255
1255
  attribute vec2 aTextureCoord;
1256
1256
 
1257
1257
  uniform mat3 projectionMatrix;
@@ -1262,7 +1262,7 @@ void main(void)
1262
1262
  {
1263
1263
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1264
1264
  vTextureCoord = aTextureCoord;
1265
- }`,NI=`varying vec2 vTextureCoord;
1265
+ }`,UI=`varying vec2 vTextureCoord;
1266
1266
  uniform sampler2D uSampler;
1267
1267
  uniform float alpha;
1268
1268
  uniform vec3 color;
@@ -1280,4 +1280,4 @@ void main(void){
1280
1280
  sample *= alpha;
1281
1281
 
1282
1282
  gl_FragColor = sample;
1283
- }`,VI=Object.defineProperty,K0=Object.getOwnPropertySymbols,UI=Object.prototype.hasOwnProperty,GI=Object.prototype.propertyIsEnumerable,Q0=(r,t,e)=>t in r?VI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,J0=(r,t)=>{for(var e in t||(t={}))UI.call(t,e)&&Q0(r,e,t[e]);if(K0)for(var e of K0(t))GI.call(t,e)&&Q0(r,e,t[e]);return r};const pd=class extends pe{constructor(r){super(),this.angle=45,this._distance=5,this._resolution=z.FILTER_RESOLUTION;const t=r?J0(J0({},pd.defaults),r):pd.defaults,{kernels:e,blur:s,quality:i,pixelSize:n,resolution:a}=t;this._offset=new qs(this._updatePadding,this),this._tintFilter=new pe(LI,NI),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=this._offset,this._tintFilter.resolution=a,this._blurFilter=e?new Z0(e):new Z0(s,i),this.pixelSize=n,this.resolution=a;const{shadowOnly:h,rotation:o,distance:l,offset:u,alpha:c,color:d}=t;this.shadowOnly=h,o!==void 0&&l!==void 0?(this.rotation=o,this.distance=l):this.offset=u,this.alpha=c,this.color=d}apply(r,t,e,s){const i=r.getFilterTexture();this._tintFilter.apply(r,t,i,1),this._blurFilter.apply(r,i,e,s),this.shadowOnly!==!0&&r.applyFilter(this,t,e,0),r.returnFilterTexture(i)}_updatePadding(){const r=Math.max(Math.abs(this._offset.x),Math.abs(this._offset.y));this.padding=r+this.blur*2}_updateShift(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))}set offset(r){this._offset.copyFrom(r),this._updatePadding()}get offset(){return this._offset}get resolution(){return this._resolution}set resolution(r){this._resolution=r,this._tintFilter&&(this._tintFilter.resolution=r),this._blurFilter&&(this._blurFilter.resolution=r)}get distance(){return this._distance}set distance(r){ot("5.3.0","DropShadowFilter distance is deprecated, use offset"),this._distance=r,this._updatePadding(),this._updateShift()}get rotation(){return this.angle/Nh}set rotation(r){ot("5.3.0","DropShadowFilter rotation is deprecated, use offset"),this.angle=r*Nh,this._updateShift()}get alpha(){return this._tintFilter.uniforms.alpha}set alpha(r){this._tintFilter.uniforms.alpha=r}get color(){return eo(this._tintFilter.uniforms.color)}set color(r){ip(r,this._tintFilter.uniforms.color)}get kernels(){return this._blurFilter.kernels}set kernels(r){this._blurFilter.kernels=r}get blur(){return this._blurFilter.blur}set blur(r){this._blurFilter.blur=r,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(r){this._blurFilter.quality=r}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(r){this._blurFilter.pixelSize=r}};let ty=pd;ty.defaults={offset:{x:4,y:4},color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:z.FILTER_RESOLUTION};const XI=(r,t)=>{const{color:e="#000",alpha:s=.25,blur:i=1,distance:n=0,offset:a={x:0,y:0}}=t||{},h=new ty({color:e,alpha:s,blur:i,distance:n,offset:a});h.resolution=window.devicePixelRatio||1,r.filters=[h]},$I=(r,t=1)=>{let e=0;const s=new wt,i=()=>{if(e+=s.deltaMS,e>=t){r==null||r();try{s.destroy()}catch{}}};return s.add(i),s.start(),()=>{try{s.destroy()}catch{}}};class HI{constructor(t){this._isDragging=!1,this._moveX=0,this._lastMoveX=0,this._progress=0;const{app:e,clickArea:s,maxMoveDistance:i,onChange:n,onDown:a,onUp:h,sideArea:o}=t;this._app=e,this._maxMoveDistance=i,this._onChange=n,this._onDown=a,this._onUp=h,this._sideArea=o,s.forEach(l=>{Mi(l,"pointerdown",this._onDragStart.bind(this))}),Mi(o,"pointerdown",this._onDragMove.bind(this)),e.stage.on("pointermove",this._onDragMove.bind(this)),e.stage.on("pointerup",this._onDragEnd.bind(this))}setValue(t){this._progress=t,this._lastMoveX=this._maxMoveDistance*t,this._onChange(this._lastMoveX,t)}_onDragStart(){var t;this._app.stage.eventMode="static",this._isDragging=!0,(t=this._onDown)==null||t.call(this)}_onDragMove(t){const e=t.getLocalPosition(this._sideArea);this._isDragging&&(this._moveX=Math.max(0,Math.min(e.x,this._maxMoveDistance)),this._progress=Number((this._moveX/this._maxMoveDistance).toFixed(2)),this._onChange(this._moveX,this._progress))}_onDragEnd(){var t;this._app.stage.eventMode="auto",this._isDragging=!1,this._lastMoveX=this._moveX,(t=this._onUp)==null||t.call(this)}}class YI{constructor(){this.instances=new Map}setInstance(t,e){this.instances.has(t)&&this.instances.delete(t),this.instances.set(t,e)}getInstance(t){return this.instances.get(t)}}class WI{constructor(t,e={}){this._drawing=!1,this._points=[],this._startPoint=[],this._realPoints=[],this._pointElements=[],this._app=t,this._params={outFormat:"number",dotRadius:2,dotColor:"#fff",polygonColor:"#68CCFF",polygonAlpha:.5,...e},this._app.stage.sortableChildren=!0,this._polygon=new hs,this._app.stage.addChild(this._polygon),this._polygon.zIndex=999999,this._setupListeners()}_setupListeners(){window.addEventListener("keydown",t=>{t.code==="Space"?this.toggleDrawing():t.code==="Backspace"&&(this._points.pop(),this._realPoints.pop(),this._drawPolygon())}),this._app.stage.eventMode="static",this._app.stage.on("pointerdown",t=>{this._drawing&&this._addPoint(t)})}toggleDrawing(){this._drawing?(alert("绘制结束"),this._points.push({x:0,y:0}),this._params.outFormat==="object"?console.log(this._points):console.log(this._points.map(t=>[t.x,t.y]).flat())):(alert("开始绘制"),this._startPoint=[],this._points=[],this._realPoints=[],this._polygon.clear(),this._pointElements.forEach(t=>t.destroy()),this._pointElements=[]),this._drawing=!this._drawing}_addPoint(t){const e=Number(t.clientX.toFixed(0)),s=Number(t.clientY.toFixed(0));if(this._realPoints.push({x:e,y:s}),this._startPoint.length===0)this._startPoint=[{x:e,y:s}],this._points.push({x:0,y:0});else{const i=e-this._startPoint[0].x,n=s-this._startPoint[0].y;this._points.push({x:Number(i.toFixed(0)),y:Number(n.toFixed(0))})}this._drawPolygon()}_drawPolygon(){this._polygon.clear(),this._polygon.beginFill(this._params.polygonColor),this._polygon.drawPolygon(this._realPoints),this._polygon.endFill(),this._polygon.alpha=this._params.polygonAlpha,this._pointElements.forEach(t=>t.destroy()),this._pointElements=[],this._realPoints.forEach(t=>{this._pointElements.push(this._drawDot(t.x,t.y))})}_drawDot(t,e){const s=new hs;return s.beginFill(this._params.dotColor),s.drawCircle(t,e,this._params.dotRadius||2),s.endFill(),this._app.stage.addChild(s),s.zIndex=999999,s}}const zI=Object.freeze(Object.defineProperty({__proto__:null,Components:{Base:{LibPixiBitText:hA,LibPixiContainer:Ao,LibPixiParticleMove:BS,LibPixiRectBgColor:fl,LibPixiSpine:sI,LibPixiText:_l},Custom:{LibPixiButtonHover:rI,LibPixiCloseBtn:nI,LibPixiDrawer:oI,LibPixiPerforMon:aI,LibPixiProgress:lI,LibPixiScrollContainer:hI,LibPixiScrollNum:cI,LibPixiSlider:uI,LibPixiSubAddMinMax:fI,LibPixiTable:pI}},Utils:{LibPixiAudio:CI,libPixiCreateNineGrid:II,libPixiEvent:Mi,libPixiFilter:kI,libPixiIntervalTrigger:RI,libPixiOutsideClick:MI,libPixiOverflowHidden:X0,libPixiPromiseTickerTimeout:FI,libPixiScaleContainer:$0,libPixiShadow:XI,libPixiTickerTimeout:$I,LibPixiSlideInput:HI,LibPixiGlobalUpdater:YI,LibPixiPolygonDrawTool:WI}},Symbol.toStringTag,{value:"Module"}));window.LibPixiJs=zI});
1283
+ }`,GI=Object.defineProperty,W0=Object.getOwnPropertySymbols,XI=Object.prototype.hasOwnProperty,$I=Object.prototype.propertyIsEnumerable,z0=(r,t,e)=>t in r?GI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,j0=(r,t)=>{for(var e in t||(t={}))XI.call(t,e)&&z0(r,e,t[e]);if(W0)for(var e of W0(t))$I.call(t,e)&&z0(r,e,t[e]);return r};const ud=class extends pe{constructor(r){super(),this.angle=45,this._distance=5,this._resolution=z.FILTER_RESOLUTION;const t=r?j0(j0({},ud.defaults),r):ud.defaults,{kernels:e,blur:s,quality:i,pixelSize:n,resolution:a}=t;this._offset=new qs(this._updatePadding,this),this._tintFilter=new pe(VI,UI),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=this._offset,this._tintFilter.resolution=a,this._blurFilter=e?new Y0(e):new Y0(s,i),this.pixelSize=n,this.resolution=a;const{shadowOnly:h,rotation:o,distance:l,offset:u,alpha:c,color:d}=t;this.shadowOnly=h,o!==void 0&&l!==void 0?(this.rotation=o,this.distance=l):this.offset=u,this.alpha=c,this.color=d}apply(r,t,e,s){const i=r.getFilterTexture();this._tintFilter.apply(r,t,i,1),this._blurFilter.apply(r,i,e,s),this.shadowOnly!==!0&&r.applyFilter(this,t,e,0),r.returnFilterTexture(i)}_updatePadding(){const r=Math.max(Math.abs(this._offset.x),Math.abs(this._offset.y));this.padding=r+this.blur*2}_updateShift(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))}set offset(r){this._offset.copyFrom(r),this._updatePadding()}get offset(){return this._offset}get resolution(){return this._resolution}set resolution(r){this._resolution=r,this._tintFilter&&(this._tintFilter.resolution=r),this._blurFilter&&(this._blurFilter.resolution=r)}get distance(){return this._distance}set distance(r){ot("5.3.0","DropShadowFilter distance is deprecated, use offset"),this._distance=r,this._updatePadding(),this._updateShift()}get rotation(){return this.angle/Dh}set rotation(r){ot("5.3.0","DropShadowFilter rotation is deprecated, use offset"),this.angle=r*Dh,this._updateShift()}get alpha(){return this._tintFilter.uniforms.alpha}set alpha(r){this._tintFilter.uniforms.alpha=r}get color(){return eo(this._tintFilter.uniforms.color)}set color(r){Qf(r,this._tintFilter.uniforms.color)}get kernels(){return this._blurFilter.kernels}set kernels(r){this._blurFilter.kernels=r}get blur(){return this._blurFilter.blur}set blur(r){this._blurFilter.blur=r,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(r){this._blurFilter.quality=r}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(r){this._blurFilter.pixelSize=r}};let q0=ud;q0.defaults={offset:{x:4,y:4},color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:z.FILTER_RESOLUTION};const HI=(r,t)=>{const{color:e="#000",alpha:s=.25,blur:i=1,distance:n=0,offset:a={x:0,y:0}}=t||{},h=new q0({color:e,alpha:s,blur:i,distance:n,offset:a});h.resolution=window.devicePixelRatio||1,r.filters=[h]},YI=(r,t=1)=>{let e=0;const s=new wt,i=()=>{if(e+=s.deltaMS,e>=t){r==null||r();try{s.destroy()}catch{}}};return s.add(i),s.start(),()=>{try{s.destroy()}catch{}}};class WI{constructor(t){this._isDragging=!1,this._moveX=0,this._lastMoveX=0,this._progress=0;const{app:e,clickArea:s,maxMoveDistance:i,onChange:n,onDown:a,onUp:h,sideArea:o}=t;this._app=e,this._maxMoveDistance=i,this._onChange=n,this._onDown=a,this._onUp=h,this._sideArea=o,s.forEach(l=>{Mi(l,"pointerdown",this._onDragStart.bind(this))}),Mi(o,"pointerdown",this._onDragMove.bind(this)),e.stage.on("pointermove",this._onDragMove.bind(this)),e.stage.on("pointerup",this._onDragEnd.bind(this))}setValue(t){this._progress=t,this._lastMoveX=this._maxMoveDistance*t,this._onChange(this._lastMoveX,t)}_onDragStart(){var t;this._app.stage.eventMode="static",this._isDragging=!0,(t=this._onDown)==null||t.call(this)}_onDragMove(t){const e=t.getLocalPosition(this._sideArea);this._isDragging&&(this._moveX=Math.max(0,Math.min(e.x,this._maxMoveDistance)),this._progress=Number((this._moveX/this._maxMoveDistance).toFixed(2)),this._onChange(this._moveX,this._progress))}_onDragEnd(){var t;this._app.stage.eventMode="auto",this._isDragging=!1,this._lastMoveX=this._moveX,(t=this._onUp)==null||t.call(this)}}class zI{constructor(){this.instances=new Map}setInstance(t,e){this.instances.has(t)&&this.instances.delete(t),this.instances.set(t,e)}getInstance(t){return this.instances.get(t)}}class jI{constructor(t,e={}){this._drawing=!1,this._points=[],this._startPoint=[],this._realPoints=[],this._pointElements=[],this._app=t,this._params={outFormat:"number",dotRadius:2,dotColor:"#fff",polygonColor:"#68CCFF",polygonAlpha:.5,...e},this._app.stage.sortableChildren=!0,this._polygon=new hs,this._app.stage.addChild(this._polygon),this._polygon.zIndex=999999,this._setupListeners()}_setupListeners(){window.addEventListener("keydown",t=>{t.code==="Space"?this.toggleDrawing():t.code==="Backspace"&&(this._points.pop(),this._realPoints.pop(),this._drawPolygon())}),this._app.stage.eventMode="static",this._app.stage.on("pointerdown",t=>{this._drawing&&this._addPoint(t)})}toggleDrawing(){this._drawing?(alert("绘制结束"),this._points.push({x:0,y:0}),this._params.outFormat==="object"?console.log(this._points):console.log(this._points.map(t=>[t.x,t.y]).flat())):(alert("开始绘制"),this._startPoint=[],this._points=[],this._realPoints=[],this._polygon.clear(),this._pointElements.forEach(t=>t.destroy()),this._pointElements=[]),this._drawing=!this._drawing}_addPoint(t){const e=Number(t.clientX.toFixed(0)),s=Number(t.clientY.toFixed(0));if(this._realPoints.push({x:e,y:s}),this._startPoint.length===0)this._startPoint=[{x:e,y:s}],this._points.push({x:0,y:0});else{const i=e-this._startPoint[0].x,n=s-this._startPoint[0].y;this._points.push({x:Number(i.toFixed(0)),y:Number(n.toFixed(0))})}this._drawPolygon()}_drawPolygon(){this._polygon.clear(),this._polygon.beginFill(this._params.polygonColor),this._polygon.drawPolygon(this._realPoints),this._polygon.endFill(),this._polygon.alpha=this._params.polygonAlpha,this._pointElements.forEach(t=>t.destroy()),this._pointElements=[],this._realPoints.forEach(t=>{this._pointElements.push(this._drawDot(t.x,t.y))})}_drawDot(t,e){const s=new hs;return s.beginFill(this._params.dotColor),s.drawCircle(t,e,this._params.dotRadius||2),s.endFill(),this._app.stage.addChild(s),s.zIndex=999999,s}}const qI=Object.freeze(Object.defineProperty({__proto__:null,Components:{Base:{LibPixiBitText:uA,LibPixiContainer:Ao,LibPixiParticleMove:OS,LibPixiRectBgColor:fl,LibPixiSpine:rI,LibPixiText:_l},Custom:{LibPixiButtonHover:oI,LibPixiCloseBtn:aI,LibPixiDrawer:lI,LibPixiPerforMon:hI,LibPixiProgress:cI,LibPixiScrollContainer:uI,LibPixiScrollNum:dI,LibPixiSlider:fI,LibPixiSubAddMinMax:mI,LibPixiTable:gI}},Utils:{LibPixiAudio:PI,libPixiCreateNineGrid:RI,libPixiEvent:Mi,libPixiFilter:DI,libPixiIntervalTrigger:FI,libPixiOutsideClick:kI,libPixiOverflowHidden:L0,libPixiPromiseTickerTimeout:BI,libPixiScaleContainer:N0,libPixiShadow:HI,libPixiTickerTimeout:YI,LibPixiSlideInput:WI,LibPixiGlobalUpdater:zI,LibPixiPolygonDrawTool:jI}},Symbol.toStringTag,{value:"Module"}));window.LibPixiJs=qI});