lyb-pixi-js 1.3.9 → 1.3.10
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/Components/Base/LibPixiSpine.d.ts +1 -0
- package/Components/Base/LibPixiSpine.js +1 -0
- package/lyb-pixi.js +145 -143
- package/package.json +1 -1
package/lyb-pixi.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
(function(qe){typeof define=="function"&&define.amd?define(qe):qe()})(function(){"use strict";var qe=(s=>(s[s.WEBGL_LEGACY=0]="WEBGL_LEGACY",s[s.WEBGL=1]="WEBGL",s[s.WEBGL2=2]="WEBGL2",s))(qe||{}),tc=(s=>(s[s.UNKNOWN=0]="UNKNOWN",s[s.WEBGL=1]="WEBGL",s[s.CANVAS=2]="CANVAS",s))(tc||{}),Eo=(s=>(s[s.COLOR=16384]="COLOR",s[s.DEPTH=256]="DEPTH",s[s.STENCIL=1024]="STENCIL",s))(Eo||{}),K=(s=>(s[s.NORMAL=0]="NORMAL",s[s.ADD=1]="ADD",s[s.MULTIPLY=2]="MULTIPLY",s[s.SCREEN=3]="SCREEN",s[s.OVERLAY=4]="OVERLAY",s[s.DARKEN=5]="DARKEN",s[s.LIGHTEN=6]="LIGHTEN",s[s.COLOR_DODGE=7]="COLOR_DODGE",s[s.COLOR_BURN=8]="COLOR_BURN",s[s.HARD_LIGHT=9]="HARD_LIGHT",s[s.SOFT_LIGHT=10]="SOFT_LIGHT",s[s.DIFFERENCE=11]="DIFFERENCE",s[s.EXCLUSION=12]="EXCLUSION",s[s.HUE=13]="HUE",s[s.SATURATION=14]="SATURATION",s[s.COLOR=15]="COLOR",s[s.LUMINOSITY=16]="LUMINOSITY",s[s.NORMAL_NPM=17]="NORMAL_NPM",s[s.ADD_NPM=18]="ADD_NPM",s[s.SCREEN_NPM=19]="SCREEN_NPM",s[s.NONE=20]="NONE",s[s.SRC_OVER=0]="SRC_OVER",s[s.SRC_IN=21]="SRC_IN",s[s.SRC_OUT=22]="SRC_OUT",s[s.SRC_ATOP=23]="SRC_ATOP",s[s.DST_OVER=24]="DST_OVER",s[s.DST_IN=25]="DST_IN",s[s.DST_OUT=26]="DST_OUT",s[s.DST_ATOP=27]="DST_ATOP",s[s.ERASE=26]="ERASE",s[s.SUBTRACT=28]="SUBTRACT",s[s.XOR=29]="XOR",s))(K||{}),Ue=(s=>(s[s.POINTS=0]="POINTS",s[s.LINES=1]="LINES",s[s.LINE_LOOP=2]="LINE_LOOP",s[s.LINE_STRIP=3]="LINE_STRIP",s[s.TRIANGLES=4]="TRIANGLES",s[s.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",s[s.TRIANGLE_FAN=6]="TRIANGLE_FAN",s))(Ue||{}),O=(s=>(s[s.RGBA=6408]="RGBA",s[s.RGB=6407]="RGB",s[s.RG=33319]="RG",s[s.RED=6403]="RED",s[s.RGBA_INTEGER=36249]="RGBA_INTEGER",s[s.RGB_INTEGER=36248]="RGB_INTEGER",s[s.RG_INTEGER=33320]="RG_INTEGER",s[s.RED_INTEGER=36244]="RED_INTEGER",s[s.ALPHA=6406]="ALPHA",s[s.LUMINANCE=6409]="LUMINANCE",s[s.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",s[s.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",s[s.DEPTH_STENCIL=34041]="DEPTH_STENCIL",s))(O||{}),$s=(s=>(s[s.TEXTURE_2D=3553]="TEXTURE_2D",s[s.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",s[s.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",s[s.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",s[s.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",s[s.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",s[s.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",s))($s||{}),Z=(s=>(s[s.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",s[s.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",s[s.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",s[s.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",s[s.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",s[s.UNSIGNED_INT=5125]="UNSIGNED_INT",s[s.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",s[s.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",s[s.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",s[s.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",s[s.BYTE=5120]="BYTE",s[s.SHORT=5122]="SHORT",s[s.INT=5124]="INT",s[s.FLOAT=5126]="FLOAT",s[s.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",s[s.HALF_FLOAT=36193]="HALF_FLOAT",s))(Z||{}),V=(s=>(s[s.FLOAT=0]="FLOAT",s[s.INT=1]="INT",s[s.UINT=2]="UINT",s))(V||{}),wi=(s=>(s[s.NEAREST=0]="NEAREST",s[s.LINEAR=1]="LINEAR",s))(wi||{}),Hi=(s=>(s[s.CLAMP=33071]="CLAMP",s[s.REPEAT=10497]="REPEAT",s[s.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",s))(Hi||{}),Ke=(s=>(s[s.OFF=0]="OFF",s[s.POW2=1]="POW2",s[s.ON=2]="ON",s[s.ON_MANUAL=3]="ON_MANUAL",s))(Ke||{}),he=(s=>(s[s.NPM=0]="NPM",s[s.UNPACK=1]="UNPACK",s[s.PMA=2]="PMA",s[s.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",s[s.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",s[s.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",s))(he||{}),Ze=(s=>(s[s.NO=0]="NO",s[s.YES=1]="YES",s[s.AUTO=2]="AUTO",s[s.BLEND=0]="BLEND",s[s.CLEAR=1]="CLEAR",s[s.BLIT=2]="BLIT",s))(Ze||{}),Ao=(s=>(s[s.AUTO=0]="AUTO",s[s.MANUAL=1]="MANUAL",s))(Ao||{}),Ce=(s=>(s.LOW="lowp",s.MEDIUM="mediump",s.HIGH="highp",s))(Ce||{}),Xt=(s=>(s[s.NONE=0]="NONE",s[s.SCISSOR=1]="SCISSOR",s[s.STENCIL=2]="STENCIL",s[s.SPRITE=3]="SPRITE",s[s.COLOR=4]="COLOR",s))(Xt||{}),Ht=(s=>(s[s.NONE=0]="NONE",s[s.LOW=2]="LOW",s[s.MEDIUM=4]="MEDIUM",s[s.HIGH=8]="HIGH",s))(Ht||{}),Qe=(s=>(s[s.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",s[s.ARRAY_BUFFER=34962]="ARRAY_BUFFER",s[s.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",s))(Qe||{});const H={ADAPTER:{createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var So=/iPhone/i,ec=/iPod/i,ic=/iPad/i,sc=/\biOS-universal(?:.+)Mac\b/i,Co=/\bAndroid(?:.+)Mobile\b/i,rc=/Android/i,zs=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Fn=/Silk/i,Ei=/Windows Phone/i,nc=/\bWindows(?:.+)ARM\b/i,ac=/BlackBerry/i,oc=/BB10/i,hc=/Opera Mini/i,lc=/\b(CriOS|Chrome)(?:.+)Mobile/i,uc=/Mobile(?:.+)Firefox\b/i,cc=function(s){return typeof s<"u"&&s.platform==="MacIntel"&&typeof s.maxTouchPoints=="number"&&s.maxTouchPoints>1&&typeof MSStream>"u"};function I_(s){return function(t){return t.test(s)}}function dc(s){var t={userAgent:"",platform:"",maxTouchPoints:0};!s&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof s=="string"?t.userAgent=s:s&&s.userAgent&&(t={userAgent:s.userAgent,platform:s.platform,maxTouchPoints:s.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var r=I_(e),n={apple:{phone:r(So)&&!r(Ei),ipod:r(ec),tablet:!r(So)&&(r(ic)||cc(t))&&!r(Ei),universal:r(sc),device:(r(So)||r(ec)||r(ic)||r(sc)||cc(t))&&!r(Ei)},amazon:{phone:r(zs),tablet:!r(zs)&&r(Fn),device:r(zs)||r(Fn)},android:{phone:!r(Ei)&&r(zs)||!r(Ei)&&r(Co),tablet:!r(Ei)&&!r(zs)&&!r(Co)&&(r(Fn)||r(rc)),device:!r(Ei)&&(r(zs)||r(Fn)||r(Co)||r(rc))||r(/\bokhttp\b/i)},windows:{phone:r(Ei),tablet:r(nc),device:r(Ei)||r(nc)},other:{blackberry:r(ac),blackberry10:r(oc),opera:r(hc),firefox:r(uc),chrome:r(lc),device:r(ac)||r(oc)||r(hc)||r(uc)||r(lc)},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 R_=dc.default??dc,Ai=R_(globalThis.navigator);H.RETINA_PREFIX=/@([0-9\.]+)x/,H.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Je=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function M_(s){if(s.__esModule)return s;var t=s.default;if(typeof t=="function"){var e=function i(){return this instanceof i?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(s).forEach(function(i){var r=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return s[i]}})}),e}var pc={exports:{}};(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(h,u,d){this.fn=h,this.context=u,this.once=d||!1}function n(h,u,d,l,c){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new r(d,l||h,c),p=e?e+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],d,l;if(this._eventsCount===0)return u;for(l in d=this._events)t.call(d,l)&&u.push(e?l.slice(1):l);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},o.prototype.listeners=function(u){var d=e?e+u:u,l=this._events[d];if(!l)return[];if(l.fn)return[l.fn];for(var c=0,f=l.length,p=new Array(f);c<f;c++)p[c]=l[c].fn;return p},o.prototype.listenerCount=function(u){var d=e?e+u:u,l=this._events[d];return l?l.fn?1:l.length:0},o.prototype.emit=function(u,d,l,c,f,p){var m=e?e+u:u;if(!this._events[m])return!1;var _=this._events[m],g=arguments.length,x,y;if(_.fn){switch(_.once&&this.removeListener(u,_.fn,void 0,!0),g){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,l),!0;case 4:return _.fn.call(_.context,d,l,c),!0;case 5:return _.fn.call(_.context,d,l,c,f),!0;case 6:return _.fn.call(_.context,d,l,c,f,p),!0}for(y=1,x=new Array(g-1);y<g;y++)x[y-1]=arguments[y];_.fn.apply(_.context,x)}else{var v=_.length,b;for(y=0;y<v;y++)switch(_[y].once&&this.removeListener(u,_[y].fn,void 0,!0),g){case 1:_[y].fn.call(_[y].context);break;case 2:_[y].fn.call(_[y].context,d);break;case 3:_[y].fn.call(_[y].context,d,l);break;case 4:_[y].fn.call(_[y].context,d,l,c);break;default:if(!x)for(b=1,x=new Array(g-1);b<g;b++)x[b-1]=arguments[b];_[y].fn.apply(_[y].context,x)}}return!0},o.prototype.on=function(u,d,l){return n(this,u,d,l,!1)},o.prototype.once=function(u,d,l){return n(this,u,d,l,!0)},o.prototype.removeListener=function(u,d,l,c){var f=e?e+u:u;if(!this._events[f])return this;if(!d)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===d&&(!c||p.once)&&(!l||p.context===l)&&a(this,f);else{for(var m=0,_=[],g=p.length;m<g;m++)(p[m].fn!==d||c&&!p[m].once||l&&p[m].context!==l)&&_.push(p[m]);_.length?this._events[f]=_.length===1?_[0]:_:a(this,f)}return this},o.prototype.removeAllListeners=function(u){var d;return u?(d=e?e+u:u,this._events[d]&&a(this,d)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,s.exports=o})(pc);var D_=pc.exports;const ti=fc(D_);var Po={exports:{}};Po.exports=kn,Po.exports.default=kn;function kn(s,t,e){e=e||2;var i=t&&t.length,r=i?t[0]*e:s.length,n=mc(s,0,r,e,!0),a=[];if(!n||n.next===n.prev)return a;var o,h,u,d,l,c,f;if(i&&(n=L_(s,t,n,e)),s.length>80*e){o=u=s[0],h=d=s[1];for(var p=e;p<r;p+=e)l=s[p],c=s[p+1],l<o&&(o=l),c<h&&(h=c),l>u&&(u=l),c>d&&(d=c);f=Math.max(u-o,d-h),f=f!==0?32767/f:0}return Ur(n,a,e,o,h,f,0),a}function mc(s,t,e,i,r){var n,a;if(r===Mo(s,t,e,i)>0)for(n=t;n<e;n+=i)a=yc(n,s[n],s[n+1],a);else for(n=e-i;n>=t;n-=i)a=yc(n,s[n],s[n+1],a);return a&&Ln(a,a.next)&&(Hr(a),a=a.next),a}function ps(s,t){if(!s)return s;t||(t=s);var e=s,i;do if(i=!1,!e.steiner&&(Ln(e,e.next)||Et(e.prev,e,e.next)===0)){if(Hr(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Ur(s,t,e,i,r,n,a){if(s){!a&&n&&V_(s,i,r,n);for(var o=s,h,u;s.prev!==s.next;){if(h=s.prev,u=s.next,n?O_(s,i,r,n):B_(s)){t.push(h.i/e|0),t.push(s.i/e|0),t.push(u.i/e|0),Hr(s),s=u.next,o=u.next;continue}if(s=u,s===o){a?a===1?(s=F_(ps(s),t,e),Ur(s,t,e,i,r,n,2)):a===2&&k_(s,t,e,i,r,n):Ur(ps(s),t,e,i,r,n,1);break}}}}function B_(s){var t=s.prev,e=s,i=s.next;if(Et(t,e,i)>=0)return!1;for(var r=t.x,n=e.x,a=i.x,o=t.y,h=e.y,u=i.y,d=r<n?r<a?r:a:n<a?n:a,l=o<h?o<u?o:u:h<u?h:u,c=r>n?r>a?r:a:n>a?n:a,f=o>h?o>u?o:u:h>u?h:u,p=i.next;p!==t;){if(p.x>=d&&p.x<=c&&p.y>=l&&p.y<=f&&Ys(r,o,n,h,a,u,p.x,p.y)&&Et(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function O_(s,t,e,i){var r=s.prev,n=s,a=s.next;if(Et(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,u=a.x,d=r.y,l=n.y,c=a.y,f=o<h?o<u?o:u:h<u?h:u,p=d<l?d<c?d:c:l<c?l:c,m=o>h?o>u?o:u:h>u?h:u,_=d>l?d>c?d:c:l>c?l:c,g=Io(f,p,t,e,i),x=Io(m,_,t,e,i),y=s.prevZ,v=s.nextZ;y&&y.z>=g&&v&&v.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=_&&y!==r&&y!==a&&Ys(o,d,h,l,u,c,y.x,y.y)&&Et(y.prev,y,y.next)>=0||(y=y.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=_&&v!==r&&v!==a&&Ys(o,d,h,l,u,c,v.x,v.y)&&Et(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;y&&y.z>=g;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=_&&y!==r&&y!==a&&Ys(o,d,h,l,u,c,y.x,y.y)&&Et(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<=_&&v!==r&&v!==a&&Ys(o,d,h,l,u,c,v.x,v.y)&&Et(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function F_(s,t,e){var i=s;do{var r=i.prev,n=i.next.next;!Ln(r,n)&&_c(r,i,i.next,n)&&Gr(r,n)&&Gr(n,r)&&(t.push(r.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Hr(i),Hr(i.next),i=s=n),i=i.next}while(i!==s);return ps(i)}function k_(s,t,e,i,r,n){var a=s;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&$_(a,o)){var h=gc(a,o);a=ps(a,a.next),h=ps(h,h.next),Ur(a,t,e,i,r,n,0),Ur(h,t,e,i,r,n,0);return}o=o.next}a=a.next}while(a!==s)}function L_(s,t,e,i){var r=[],n,a,o,h,u;for(n=0,a=t.length;n<a;n++)o=t[n]*i,h=n<a-1?t[n+1]*i:s.length,u=mc(s,o,h,i,!1),u===u.next&&(u.steiner=!0),r.push(W_(u));for(r.sort(N_),n=0;n<r.length;n++)e=U_(r[n],e);return e}function N_(s,t){return s.x-t.x}function U_(s,t){var e=G_(s,t);if(!e)return t;var i=gc(e,s);return ps(i,i.next),ps(e,e.next)}function G_(s,t){var e=t,i=s.x,r=s.y,n=-1/0,a;do{if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){var o=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=i&&o>n&&(n=o,a=e.x<e.next.x?e:e.next,o===i))return a}e=e.next}while(e!==t);if(!a)return null;var h=a,u=a.x,d=a.y,l=1/0,c;e=a;do i>=e.x&&e.x>=u&&i!==e.x&&Ys(r<d?i:n,r,u,d,r<d?n:i,r,e.x,e.y)&&(c=Math.abs(r-e.y)/(i-e.x),Gr(e,s)&&(c<l||c===l&&(e.x>a.x||e.x===a.x&&H_(a,e)))&&(a=e,l=c)),e=e.next;while(e!==h);return a}function H_(s,t){return Et(s.prev,s,t.prev)<0&&Et(t.next,s,s.next)<0}function V_(s,t,e,i){var r=s;do r.z===0&&(r.z=Io(r.x,r.y,t,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==s);r.prevZ.nextZ=null,r.prevZ=null,X_(r)}function X_(s){var t,e,i,r,n,a,o,h,u=1;do{for(e=s,s=null,n=null,a=0;e;){for(a++,i=e,o=0,t=0;t<u&&(o++,i=i.nextZ,!!i);t++);for(h=u;o>0||h>0&&i;)o!==0&&(h===0||!i||e.z<=i.z)?(r=e,e=e.nextZ,o--):(r=i,i=i.nextZ,h--),n?n.nextZ=r:s=r,r.prevZ=n,n=r;e=i}n.nextZ=null,u*=2}while(a>1);return s}function Io(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function W_(s){var t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function Ys(s,t,e,i,r,n,a,o){return(r-a)*(t-o)>=(s-a)*(n-o)&&(s-a)*(i-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(r-a)*(i-o)}function $_(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!z_(s,t)&&(Gr(s,t)&&Gr(t,s)&&Y_(s,t)&&(Et(s.prev,s,t.prev)||Et(s,t.prev,t))||Ln(s,t)&&Et(s.prev,s,s.next)>0&&Et(t.prev,t,t.next)>0)}function Et(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function Ln(s,t){return s.x===t.x&&s.y===t.y}function _c(s,t,e,i){var r=Un(Et(s,t,e)),n=Un(Et(s,t,i)),a=Un(Et(e,i,s)),o=Un(Et(e,i,t));return!!(r!==n&&a!==o||r===0&&Nn(s,e,t)||n===0&&Nn(s,i,t)||a===0&&Nn(e,s,i)||o===0&&Nn(e,t,i))}function Nn(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function Un(s){return s>0?1:s<0?-1:0}function z_(s,t){var e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&_c(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function Gr(s,t){return Et(s.prev,s,s.next)<0?Et(s,t,s.next)>=0&&Et(s,s.prev,t)>=0:Et(s,t,s.prev)<0||Et(s,s.next,t)<0}function Y_(s,t){var e=s,i=!1,r=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function gc(s,t){var e=new Ro(s.i,s.x,s.y),i=new Ro(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function yc(s,t,e,i){var r=new Ro(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Hr(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Ro(s,t,e){this.i=s,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}kn.deviation=function(s,t,e,i){var r=t&&t.length,n=r?t[0]*e:s.length,a=Math.abs(Mo(s,0,n,e));if(r)for(var o=0,h=t.length;o<h;o++){var u=t[o]*e,d=o<h-1?t[o+1]*e:s.length;a-=Math.abs(Mo(s,u,d,e))}var l=0;for(o=0;o<i.length;o+=3){var c=i[o]*e,f=i[o+1]*e,p=i[o+2]*e;l+=Math.abs((s[c]-s[p])*(s[f+1]-s[c+1])-(s[c]-s[f])*(s[p+1]-s[c+1]))}return a===0&&l===0?0:Math.abs((l-a)/a)};function Mo(s,t,e,i){for(var r=0,n=t,a=e-i;n<e;n+=i)r+=(s[a]-s[n])*(s[n+1]+s[a+1]),a=n;return r}kn.flatten=function(s){for(var t=s[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,r=0;r<s.length;r++){for(var n=0;n<s[r].length;n++)for(var a=0;a<t;a++)e.vertices.push(s[r][n][a]);r>0&&(i+=s[r-1].length,e.holes.push(i))}return e};var j_=Po.exports;const q_=fc(j_);var Gn={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Gn.exports,function(s,t){(function(e){var i=t&&!t.nodeType&&t,r=s&&!s.nodeType&&s,n=typeof Je=="object"&&Je;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,o=2147483647,h=36,u=1,d=26,l=38,c=700,f=72,p=128,m="-",_=/^xn--/,g=/[^\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=h-u,b=Math.floor,E=String.fromCharCode,w;function A(M){throw new RangeError(y[M])}function T(M,D){for(var $=M.length,Y=[];$--;)Y[$]=D(M[$]);return Y}function P(M,D){var $=M.split("@"),Y="";$.length>1&&(Y=$[0]+"@",M=$[1]),M=M.replace(x,".");var U=M.split("."),rt=T(U,D).join(".");return Y+rt}function k(M){for(var D=[],$=0,Y=M.length,U,rt;$<Y;)U=M.charCodeAt($++),U>=55296&&U<=56319&&$<Y?(rt=M.charCodeAt($++),(rt&64512)==56320?D.push(((U&1023)<<10)+(rt&1023)+65536):(D.push(U),$--)):D.push(U);return D}function R(M){return T(M,function(D){var $="";return D>65535&&(D-=65536,$+=E(D>>>10&1023|55296),D=56320|D&1023),$+=E(D),$}).join("")}function S(M){return M-48<10?M-22:M-65<26?M-65:M-97<26?M-97:h}function C(M,D){return M+22+75*(M<26)-((D!=0)<<5)}function I(M,D,$){var Y=0;for(M=$?b(M/c):M>>1,M+=b(M/D);M>v*d>>1;Y+=h)M=b(M/v);return b(Y+(v+1)*M/(M+l))}function N(M){var D=[],$=M.length,Y,U=0,rt=p,ft=f,lt,vt,Dt,Lt,_t,Bt,wt,me,Ae;for(lt=M.lastIndexOf(m),lt<0&&(lt=0),vt=0;vt<lt;++vt)M.charCodeAt(vt)>=128&&A("not-basic"),D.push(M.charCodeAt(vt));for(Dt=lt>0?lt+1:0;Dt<$;){for(Lt=U,_t=1,Bt=h;Dt>=$&&A("invalid-input"),wt=S(M.charCodeAt(Dt++)),(wt>=h||wt>b((o-U)/_t))&&A("overflow"),U+=wt*_t,me=Bt<=ft?u:Bt>=ft+d?d:Bt-ft,!(wt<me);Bt+=h)Ae=h-me,_t>b(o/Ae)&&A("overflow"),_t*=Ae;Y=D.length+1,ft=I(U-Lt,Y,Lt==0),b(U/Y)>o-rt&&A("overflow"),rt+=b(U/Y),U%=Y,D.splice(U++,0,rt)}return R(D)}function F(M){var D,$,Y,U,rt,ft,lt,vt,Dt,Lt,_t,Bt=[],wt,me,Ae,ds;for(M=k(M),wt=M.length,D=p,$=0,rt=f,ft=0;ft<wt;++ft)_t=M[ft],_t<128&&Bt.push(E(_t));for(Y=U=Bt.length,U&&Bt.push(m);Y<wt;){for(lt=o,ft=0;ft<wt;++ft)_t=M[ft],_t>=D&&_t<lt&&(lt=_t);for(me=Y+1,lt-D>b((o-$)/me)&&A("overflow"),$+=(lt-D)*me,D=lt,ft=0;ft<wt;++ft)if(_t=M[ft],_t<D&&++$>o&&A("overflow"),_t==D){for(vt=$,Dt=h;Lt=Dt<=rt?u:Dt>=rt+d?d:Dt-rt,!(vt<Lt);Dt+=h)ds=vt-Lt,Ae=h-Lt,Bt.push(E(C(Lt+ds%Ae,0))),vt=b(ds/Ae);Bt.push(E(C(vt,0))),rt=I($,me,Y==U),$=0,++Y}++$,++D}return Bt.join("")}function B(M){return P(M,function(D){return _.test(D)?N(D.slice(4).toLowerCase()):D})}function X(M){return P(M,function(D){return g.test(D)?"xn--"+F(D):D})}if(a={version:"1.4.1",ucs2:{decode:k,encode:R},decode:N,encode:F,toASCII:X,toUnicode:B},i&&r)if(s.exports==i)r.exports=a;else for(w in a)a.hasOwnProperty(w)&&(i[w]=a[w]);else e.punycode=a})(Je)}(Gn,Gn.exports);var K_=Gn.exports,js=TypeError;const Z_=M_(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Do=typeof Map=="function"&&Map.prototype,Bo=Object.getOwnPropertyDescriptor&&Do?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Hn=Do&&Bo&&typeof Bo.get=="function"?Bo.get:null,xc=Do&&Map.prototype.forEach,Oo=typeof Set=="function"&&Set.prototype,Fo=Object.getOwnPropertyDescriptor&&Oo?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Vn=Oo&&Fo&&typeof Fo.get=="function"?Fo.get:null,vc=Oo&&Set.prototype.forEach,Q_=typeof WeakMap=="function"&&WeakMap.prototype,Vr=Q_?WeakMap.prototype.has:null,J_=typeof WeakSet=="function"&&WeakSet.prototype,Xr=J_?WeakSet.prototype.has:null,tg=typeof WeakRef=="function"&&WeakRef.prototype,bc=tg?WeakRef.prototype.deref:null,eg=Boolean.prototype.valueOf,ig=Object.prototype.toString,sg=Function.prototype.toString,rg=String.prototype.match,ko=String.prototype.slice,Vi=String.prototype.replace,ng=String.prototype.toUpperCase,Tc=String.prototype.toLowerCase,wc=RegExp.prototype.test,Ec=Array.prototype.concat,ei=Array.prototype.join,ag=Array.prototype.slice,Ac=Math.floor,Lo=typeof BigInt=="function"?BigInt.prototype.valueOf:null,No=Object.getOwnPropertySymbols,Uo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,qs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Jt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===qs||"symbol")?Symbol.toStringTag:null,Sc=Object.prototype.propertyIsEnumerable,Cc=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(s){return s.__proto__}:null);function Pc(s,t){if(s===1/0||s===-1/0||s!==s||s&&s>-1e3&&s<1e3||wc.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof s=="number"){var i=s<0?-Ac(-s):Ac(s);if(i!==s){var r=String(i),n=ko.call(t,r.length+1);return Vi.call(r,e,"$&_")+"."+Vi.call(Vi.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Vi.call(t,e,"$&_")}var Go=Z_,Ic=Go.custom,Rc=Oc(Ic)?Ic:null,Mc={__proto__:null,double:'"',single:"'"},og={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Xn=function s(t,e,i,r){var n=e||{};if(Si(n,"quoteStyle")&&!Si(Mc,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Si(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=Si(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(Si(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(Si(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=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 kc(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return o?Pc(t,h):h}if(typeof t=="bigint"){var u=String(t)+"n";return o?Pc(t,u):u}var d=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=d&&d>0&&typeof t=="object")return Ho(t)?"[Array]":"[Object]";var l=Ag(n,i);if(typeof r>"u")r=[];else if(Fc(r,t)>=0)return"[Circular]";function c(S,C,I){if(C&&(r=ag.call(r),r.push(C)),I){var N={depth:n.depth};return Si(n,"quoteStyle")&&(N.quoteStyle=n.quoteStyle),s(S,N,i+1,r)}return s(S,n,i+1,r)}if(typeof t=="function"&&!Bc(t)){var f=_g(t),p=Wn(t,c);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+ei.call(p,", ")+" }":"")}if(Oc(t)){var m=qs?Vi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Uo.call(t);return typeof t=="object"&&!qs?Wr(m):m}if(Tg(t)){for(var _="<"+Tc.call(String(t.nodeName)),g=t.attributes||[],x=0;x<g.length;x++)_+=" "+g[x].name+"="+Dc(hg(g[x].value),"double",n);return _+=">",t.childNodes&&t.childNodes.length&&(_+="..."),_+="</"+Tc.call(String(t.nodeName))+">",_}if(Ho(t)){if(t.length===0)return"[]";var y=Wn(t,c);return l&&!Eg(y)?"["+Xo(y,l)+"]":"[ "+ei.call(y,", ")+" ]"}if(ug(t)){var v=Wn(t,c);return!("cause"in Error.prototype)&&"cause"in t&&!Sc.call(t,"cause")?"{ ["+String(t)+"] "+ei.call(Ec.call("[cause]: "+c(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+ei.call(v,", ")+" }"}if(typeof t=="object"&&a){if(Rc&&typeof t[Rc]=="function"&&Go)return Go(t,{depth:d-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(gg(t)){var b=[];return xc&&xc.call(t,function(S,C){b.push(c(C,t,!0)+" => "+c(S,t))}),Lc("Map",Hn.call(t),b,l)}if(vg(t)){var E=[];return vc&&vc.call(t,function(S){E.push(c(S,t))}),Lc("Set",Vn.call(t),E,l)}if(yg(t))return Vo("WeakMap");if(bg(t))return Vo("WeakSet");if(xg(t))return Vo("WeakRef");if(dg(t))return Wr(c(Number(t)));if(pg(t))return Wr(c(Lo.call(t)));if(fg(t))return Wr(eg.call(t));if(cg(t))return Wr(c(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Je<"u"&&t===Je)return"{ [object globalThis] }";if(!lg(t)&&!Bc(t)){var w=Wn(t,c),A=Cc?Cc(t)===Object.prototype:t instanceof Object||t.constructor===Object,T=t instanceof Object?"":"null prototype",P=!A&&Jt&&Object(t)===t&&Jt in t?ko.call(Xi(t),8,-1):T?"Object":"",k=A||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",R=k+(P||T?"["+ei.call(Ec.call([],P||[],T||[]),": ")+"] ":"");return w.length===0?R+"{}":l?R+"{"+Xo(w,l)+"}":R+"{ "+ei.call(w,", ")+" }"}return String(t)};function Dc(s,t,e){var i=e.quoteStyle||t,r=Mc[i];return r+s+r}function hg(s){return Vi.call(String(s),/"/g,""")}function Ho(s){return Xi(s)==="[object Array]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function lg(s){return Xi(s)==="[object Date]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function Bc(s){return Xi(s)==="[object RegExp]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function ug(s){return Xi(s)==="[object Error]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function cg(s){return Xi(s)==="[object String]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function dg(s){return Xi(s)==="[object Number]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function fg(s){return Xi(s)==="[object Boolean]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function Oc(s){if(qs)return s&&typeof s=="object"&&s instanceof Symbol;if(typeof s=="symbol")return!0;if(!s||typeof s!="object"||!Uo)return!1;try{return Uo.call(s),!0}catch{}return!1}function pg(s){if(!s||typeof s!="object"||!Lo)return!1;try{return Lo.call(s),!0}catch{}return!1}var mg=Object.prototype.hasOwnProperty||function(s){return s in this};function Si(s,t){return mg.call(s,t)}function Xi(s){return ig.call(s)}function _g(s){if(s.name)return s.name;var t=rg.call(sg.call(s),/^function\s*([\w$]+)/);return t?t[1]:null}function Fc(s,t){if(s.indexOf)return s.indexOf(t);for(var e=0,i=s.length;e<i;e++)if(s[e]===t)return e;return-1}function gg(s){if(!Hn||!s||typeof s!="object")return!1;try{Hn.call(s);try{Vn.call(s)}catch{return!0}return s instanceof Map}catch{}return!1}function yg(s){if(!Vr||!s||typeof s!="object")return!1;try{Vr.call(s,Vr);try{Xr.call(s,Xr)}catch{return!0}return s instanceof WeakMap}catch{}return!1}function xg(s){if(!bc||!s||typeof s!="object")return!1;try{return bc.call(s),!0}catch{}return!1}function vg(s){if(!Vn||!s||typeof s!="object")return!1;try{Vn.call(s);try{Hn.call(s)}catch{return!0}return s instanceof Set}catch{}return!1}function bg(s){if(!Xr||!s||typeof s!="object")return!1;try{Xr.call(s,Xr);try{Vr.call(s,Vr)}catch{return!0}return s instanceof WeakSet}catch{}return!1}function Tg(s){return!s||typeof s!="object"?!1:typeof HTMLElement<"u"&&s instanceof HTMLElement?!0:typeof s.nodeName=="string"&&typeof s.getAttribute=="function"}function kc(s,t){if(s.length>t.maxStringLength){var e=s.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return kc(ko.call(s,0,t.maxStringLength),t)+i}var r=og[t.quoteStyle||"single"];r.lastIndex=0;var n=Vi.call(Vi.call(s,r,"\\$1"),/[\x00-\x1f]/g,wg);return Dc(n,"single",t)}function wg(s){var t=s.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+ng.call(t.toString(16))}function Wr(s){return"Object("+s+")"}function Vo(s){return s+" { ? }"}function Lc(s,t,e,i){var r=i?Xo(e,i):ei.call(e,", ");return s+" ("+t+") {"+r+"}"}function Eg(s){for(var t=0;t<s.length;t++)if(Fc(s[t],`
|
|
2
|
-
`)>=0)return!1;return!0}function
|
|
3
|
-
`+t.prev+t.base;return e+
|
|
4
|
-
`+t.prev}function Wn(s,t){var e=Ho(s),i=[];if(e){i.length=s.length;for(var r=0;r<s.length;r++)i[r]=Si(s,r)?t(s[r],s):""}var n=typeof No=="function"?No(s):[],a;if(qs){a={};for(var o=0;o<n.length;o++)a["$"+n[o]]=n[o]}for(var h in s)Si(s,h)&&(e&&String(Number(h))===h&&h<s.length||qs&&a["$"+h]instanceof Symbol||(wc.call(/[^\w$]/,h)?i.push(t(h,s)+": "+t(s[h],s)):i.push(h+": "+t(s[h],s))));if(typeof No=="function")for(var u=0;u<n.length;u++)Sc.call(s,n[u])&&i.push("["+t(n[u])+"]: "+t(s[n[u]],s));return i}var Sg=Xn,Cg=js,$n=function(s,t,e){for(var i=s,r;(r=i.next)!=null;i=r)if(r.key===t)return i.next=r.next,e||(r.next=s.next,s.next=r),r},Pg=function(s,t){if(s){var e=$n(s,t);return e&&e.value}},Ig=function(s,t,e){var i=$n(s,t);i?i.value=e:s.next={key:t,next:s.next,value:e}},Rg=function(s,t){return s?!!$n(s,t):!1},Mg=function(s,t){if(s)return $n(s,t,!0)},Dg=function(){var t,e={assert:function(i){if(!e.has(i))throw new Cg("Side channel does not contain "+Sg(i))},delete:function(i){var r=t&&t.next,n=Mg(t,i);return n&&r&&r===n&&(t=void 0),!!n},get:function(i){return Pg(t,i)},has:function(i){return Rg(t,i)},set:function(i,r){t||(t={next:void 0}),Ig(t,i,r)}};return e},Nc=Object,Bg=Error,Og=EvalError,Fg=RangeError,kg=ReferenceError,Lg=SyntaxError,Ng=URIError,Ug=Math.abs,Gg=Math.floor,Hg=Math.max,Vg=Math.min,Xg=Math.pow,Wg=Math.round,$g=Number.isNaN||function(t){return t!==t},zg=$g,Yg=function(t){return zg(t)||t===0?t:t<0?-1:1},jg=Object.getOwnPropertyDescriptor,zn=jg;if(zn)try{zn([],"length")}catch{zn=null}var Uc=zn,Yn=Object.defineProperty||!1;if(Yn)try{Yn({},"a",{value:1})}catch{Yn=!1}var qg=Yn,Wo,Gc;function Kg(){return Gc||(Gc=1,Wo=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var r=42;t[e]=r;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 o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==r||o.enumerable!==!0)return!1}return!0}),Wo}var $o,Hc;function Zg(){if(Hc)return $o;Hc=1;var s=typeof Symbol<"u"&&Symbol,t=Kg();return $o=function(){return typeof s!="function"||typeof Symbol!="function"||typeof s("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},$o}var zo,Vc;function Xc(){return Vc||(Vc=1,zo=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),zo}var Yo,Wc;function $c(){if(Wc)return Yo;Wc=1;var s=Nc;return Yo=s.getPrototypeOf||null,Yo}var jo,zc;function Qg(){if(zc)return jo;zc=1;var s="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,i="[object Function]",r=function(h,u){for(var d=[],l=0;l<h.length;l+=1)d[l]=h[l];for(var c=0;c<u.length;c+=1)d[c+h.length]=u[c];return d},n=function(h,u){for(var d=[],l=u||0,c=0;l<h.length;l+=1,c+=1)d[c]=h[l];return d},a=function(o,h){for(var u="",d=0;d<o.length;d+=1)u+=o[d],d+1<o.length&&(u+=h);return u};return jo=function(h){var u=this;if(typeof u!="function"||t.apply(u)!==i)throw new TypeError(s+u);for(var d=n(arguments,1),l,c=function(){if(this instanceof l){var g=u.apply(this,r(d,arguments));return Object(g)===g?g:this}return u.apply(h,r(d,arguments))},f=e(0,u.length-d.length),p=[],m=0;m<f;m++)p[m]="$"+m;if(l=Function("binder","return function ("+a(p,",")+"){ return binder.apply(this,arguments); }")(c),u.prototype){var _=function(){};_.prototype=u.prototype,l.prototype=new _,_.prototype=null}return l},jo}var qo,Yc;function jn(){if(Yc)return qo;Yc=1;var s=Qg();return qo=Function.prototype.bind||s,qo}var Ko,jc;function Zo(){return jc||(jc=1,Ko=Function.prototype.call),Ko}var Qo,qc;function Kc(){return qc||(qc=1,Qo=Function.prototype.apply),Qo}var Jg=typeof Reflect<"u"&&Reflect&&Reflect.apply,t0=jn(),e0=Kc(),i0=Zo(),s0=Jg,r0=s0||t0.call(i0,e0),n0=jn(),a0=js,o0=Zo(),h0=r0,Zc=function(t){if(t.length<1||typeof t[0]!="function")throw new a0("a function is required");return h0(n0,o0,t)},Jo,Qc;function l0(){if(Qc)return Jo;Qc=1;var s=Zc,t=Uc,e;try{e=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var i=!!e&&t&&t(Object.prototype,"__proto__"),r=Object,n=r.getPrototypeOf;return Jo=i&&typeof i.get=="function"?s([i.get]):typeof n=="function"?function(o){return n(o==null?o:r(o))}:!1,Jo}var th,Jc;function u0(){if(Jc)return th;Jc=1;var s=Xc(),t=$c(),e=l0();return th=s?function(r){return s(r)}:t?function(r){if(!r||typeof r!="object"&&typeof r!="function")throw new TypeError("getProto: not an object");return t(r)}:e?function(r){return e(r)}:null,th}var eh,td;function c0(){if(td)return eh;td=1;var s=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=jn();return eh=e.call(s,t),eh}var nt,d0=Nc,f0=Bg,p0=Og,m0=Fg,_0=kg,Ks=Lg,Zs=js,g0=Ng,y0=Ug,x0=Gg,v0=Hg,b0=Vg,T0=Xg,w0=Wg,E0=Yg,ed=Function,ih=function(s){try{return ed('"use strict"; return ('+s+").constructor;")()}catch{}},$r=Uc,A0=qg,sh=function(){throw new Zs},S0=$r?function(){try{return arguments.callee,sh}catch{try{return $r(arguments,"callee").get}catch{return sh}}}():sh,Qs=Zg()(),$t=u0(),C0=$c(),P0=Xc(),id=Kc(),zr=Zo(),Js={},I0=typeof Uint8Array>"u"||!$t?nt:$t(Uint8Array),ms={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?nt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?nt:ArrayBuffer,"%ArrayIteratorPrototype%":Qs&&$t?$t([][Symbol.iterator]()):nt,"%AsyncFromSyncIteratorPrototype%":nt,"%AsyncFunction%":Js,"%AsyncGenerator%":Js,"%AsyncGeneratorFunction%":Js,"%AsyncIteratorPrototype%":Js,"%Atomics%":typeof Atomics>"u"?nt:Atomics,"%BigInt%":typeof BigInt>"u"?nt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?nt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?nt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?nt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":f0,"%eval%":eval,"%EvalError%":p0,"%Float32Array%":typeof Float32Array>"u"?nt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?nt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?nt:FinalizationRegistry,"%Function%":ed,"%GeneratorFunction%":Js,"%Int8Array%":typeof Int8Array>"u"?nt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?nt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?nt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qs&&$t?$t($t([][Symbol.iterator]())):nt,"%JSON%":typeof JSON=="object"?JSON:nt,"%Map%":typeof Map>"u"?nt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qs||!$t?nt:$t(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":d0,"%Object.getOwnPropertyDescriptor%":$r,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?nt:Promise,"%Proxy%":typeof Proxy>"u"?nt:Proxy,"%RangeError%":m0,"%ReferenceError%":_0,"%Reflect%":typeof Reflect>"u"?nt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?nt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qs||!$t?nt:$t(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?nt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qs&&$t?$t(""[Symbol.iterator]()):nt,"%Symbol%":Qs?Symbol:nt,"%SyntaxError%":Ks,"%ThrowTypeError%":S0,"%TypedArray%":I0,"%TypeError%":Zs,"%Uint8Array%":typeof Uint8Array>"u"?nt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?nt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?nt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?nt:Uint32Array,"%URIError%":g0,"%WeakMap%":typeof WeakMap>"u"?nt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?nt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?nt:WeakSet,"%Function.prototype.call%":zr,"%Function.prototype.apply%":id,"%Object.defineProperty%":A0,"%Object.getPrototypeOf%":C0,"%Math.abs%":y0,"%Math.floor%":x0,"%Math.max%":v0,"%Math.min%":b0,"%Math.pow%":T0,"%Math.round%":w0,"%Math.sign%":E0,"%Reflect.getPrototypeOf%":P0};if($t)try{null.error}catch(s){var R0=$t($t(s));ms["%Error.prototype%"]=R0}var M0=function s(t){var e;if(t==="%AsyncFunction%")e=ih("async function () {}");else if(t==="%GeneratorFunction%")e=ih("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ih("async function* () {}");else if(t==="%AsyncGenerator%"){var i=s("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var r=s("%AsyncGenerator%");r&&$t&&(e=$t(r.prototype))}return ms[t]=e,e},sd={__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"]},Yr=jn(),qn=c0(),D0=Yr.call(zr,Array.prototype.concat),B0=Yr.call(id,Array.prototype.splice),rd=Yr.call(zr,String.prototype.replace),Kn=Yr.call(zr,String.prototype.slice),O0=Yr.call(zr,RegExp.prototype.exec),F0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,k0=/\\(\\)?/g,L0=function(t){var e=Kn(t,0,1),i=Kn(t,-1);if(e==="%"&&i!=="%")throw new Ks("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ks("invalid intrinsic syntax, expected opening `%`");var r=[];return rd(t,F0,function(n,a,o,h){r[r.length]=o?rd(h,k0,"$1"):a||n}),r},N0=function(t,e){var i=t,r;if(qn(sd,i)&&(r=sd[i],i="%"+r[0]+"%"),qn(ms,i)){var n=ms[i];if(n===Js&&(n=M0(i)),typeof n>"u"&&!e)throw new Zs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new Ks("intrinsic "+t+" does not exist!")},rh=function(t,e){if(typeof t!="string"||t.length===0)throw new Zs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Zs('"allowMissing" argument must be a boolean');if(O0(/^%?[^%]*%?$/,t)===null)throw new Ks("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=L0(t),r=i.length>0?i[0]:"",n=N0("%"+r+"%",e),a=n.name,o=n.value,h=!1,u=n.alias;u&&(r=u[0],B0(i,D0([0,1],u)));for(var d=1,l=!0;d<i.length;d+=1){var c=i[d],f=Kn(c,0,1),p=Kn(c,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ks("property names with quotes must have matching quotes");if((c==="constructor"||!l)&&(h=!0),r+="."+c,a="%"+r+"%",qn(ms,a))o=ms[a];else if(o!=null){if(!(c in o)){if(!e)throw new Zs("base intrinsic for "+t+" exists, but the property is not available.");return}if($r&&d+1>=i.length){var m=$r(o,c);l=!!m,l&&"get"in m&&!("originalValue"in m.get)?o=m.get:o=o[c]}else l=qn(o,c),o=o[c];l&&!h&&(ms[a]=o)}}return o},nd=rh,ad=Zc,U0=ad([nd("%String.prototype.indexOf%")]),od=function(t,e){var i=nd(t,!!e);return typeof i=="function"&&U0(t,".prototype.")>-1?ad([i]):i},G0=rh,jr=od,H0=Xn,V0=js,hd=G0("%Map%",!0),X0=jr("Map.prototype.get",!0),W0=jr("Map.prototype.set",!0),$0=jr("Map.prototype.has",!0),z0=jr("Map.prototype.delete",!0),Y0=jr("Map.prototype.size",!0),ld=!!hd&&function(){var t,e={assert:function(i){if(!e.has(i))throw new V0("Side channel does not contain "+H0(i))},delete:function(i){if(t){var r=z0(t,i);return Y0(t)===0&&(t=void 0),r}return!1},get:function(i){if(t)return X0(t,i)},has:function(i){return t?$0(t,i):!1},set:function(i,r){t||(t=new hd),W0(t,i,r)}};return e},j0=rh,Zn=od,q0=Xn,Qn=ld,K0=js,tr=j0("%WeakMap%",!0),Z0=Zn("WeakMap.prototype.get",!0),Q0=Zn("WeakMap.prototype.set",!0),J0=Zn("WeakMap.prototype.has",!0),ty=Zn("WeakMap.prototype.delete",!0),ey=tr?function(){var t,e,i={assert:function(r){if(!i.has(r))throw new K0("Side channel does not contain "+q0(r))},delete:function(r){if(tr&&r&&(typeof r=="object"||typeof r=="function")){if(t)return ty(t,r)}else if(Qn&&e)return e.delete(r);return!1},get:function(r){return tr&&r&&(typeof r=="object"||typeof r=="function")&&t?Z0(t,r):e&&e.get(r)},has:function(r){return tr&&r&&(typeof r=="object"||typeof r=="function")&&t?J0(t,r):!!e&&e.has(r)},set:function(r,n){tr&&r&&(typeof r=="object"||typeof r=="function")?(t||(t=new tr),Q0(t,r,n)):Qn&&(e||(e=Qn()),e.set(r,n))}};return i}:Qn,iy=js,sy=Xn,ry=Dg,ny=ld,ay=ey,oy=ay||ny||ry,hy=function(){var t,e={assert:function(i){if(!e.has(i))throw new iy("Side channel does not contain "+sy(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,r){t||(t=oy()),t.set(i,r)}};return e},ly=String.prototype.replace,uy=/%20/g,nh={RFC1738:"RFC1738",RFC3986:"RFC3986"},ah={default:nh.RFC3986,formatters:{RFC1738:function(s){return ly.call(s,uy,"+")},RFC3986:function(s){return String(s)}},RFC1738:nh.RFC1738,RFC3986:nh.RFC3986},cy=ah,oh=Object.prototype.hasOwnProperty,_s=Array.isArray,ii=function(){for(var s=[],t=0;t<256;++t)s.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return s}(),dy=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(_s(i)){for(var r=[],n=0;n<i.length;++n)typeof i[n]<"u"&&r.push(i[n]);e.obj[e.prop]=r}}},ud=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},r=0;r<t.length;++r)typeof t[r]<"u"&&(i[r]=t[r]);return i},fy=function s(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(_s(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!oh.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var r=t;return _s(t)&&!_s(e)&&(r=ud(t,i)),_s(t)&&_s(e)?(e.forEach(function(n,a){if(oh.call(t,a)){var o=t[a];o&&typeof o=="object"&&n&&typeof n=="object"?t[a]=s(o,n,i):t.push(n)}else t[a]=n}),t):Object.keys(e).reduce(function(n,a){var o=e[a];return oh.call(n,a)?n[a]=s(n[a],o,i):n[a]=o,n},r)},py=function(t,e){return Object.keys(e).reduce(function(i,r){return i[r]=e[r],i},t)},my=function(s,t,e){var i=s.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},hh=1024,_y=function(t,e,i,r,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)),i==="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 o="",h=0;h<a.length;h+=hh){for(var u=a.length>=hh?a.slice(h,h+hh):a,d=[],l=0;l<u.length;++l){var c=u.charCodeAt(l);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||n===cy.RFC1738&&(c===40||c===41)){d[d.length]=u.charAt(l);continue}if(c<128){d[d.length]=ii[c];continue}if(c<2048){d[d.length]=ii[192|c>>6]+ii[128|c&63];continue}if(c<55296||c>=57344){d[d.length]=ii[224|c>>12]+ii[128|c>>6&63]+ii[128|c&63];continue}l+=1,c=65536+((c&1023)<<10|u.charCodeAt(l)&1023),d[d.length]=ii[240|c>>18]+ii[128|c>>12&63]+ii[128|c>>6&63]+ii[128|c&63]}o+=d.join("")}return o},gy=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],r=0;r<e.length;++r)for(var n=e[r],a=n.obj[n.prop],o=Object.keys(a),h=0;h<o.length;++h){var u=o[h],d=a[u];typeof d=="object"&&d!==null&&i.indexOf(d)===-1&&(e.push({obj:a,prop:u}),i.push(d))}return dy(e),t},yy=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},xy=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},vy=function(t,e){return[].concat(t,e)},by=function(t,e){if(_s(t)){for(var i=[],r=0;r<t.length;r+=1)i.push(e(t[r]));return i}return e(t)},cd={arrayToObject:ud,assign:py,combine:vy,compact:gy,decode:my,encode:_y,isBuffer:xy,isRegExp:yy,maybeMap:by,merge:fy},dd=hy,Jn=cd,qr=ah,Ty=Object.prototype.hasOwnProperty,fd={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},si=Array.isArray,wy=Array.prototype.push,pd=function(s,t){wy.apply(s,si(t)?t:[t])},Ey=Date.prototype.toISOString,md=qr.default,Wt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Jn.encode,encodeValuesOnly:!1,filter:void 0,format:md,formatter:qr.formatters[md],indices:!1,serializeDate:function(t){return Ey.call(t)},skipNulls:!1,strictNullHandling:!1},Ay=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},lh={},Sy=function s(t,e,i,r,n,a,o,h,u,d,l,c,f,p,m,_,g,x){for(var y=t,v=x,b=0,E=!1;(v=v.get(lh))!==void 0&&!E;){var w=v.get(t);if(b+=1,typeof w<"u"){if(w===b)throw new RangeError("Cyclic object value");E=!0}typeof v.get(lh)>"u"&&(b=0)}if(typeof d=="function"?y=d(e,y):y instanceof Date?y=f(y):i==="comma"&&si(y)&&(y=Jn.maybeMap(y,function(M){return M instanceof Date?f(M):M})),y===null){if(a)return u&&!_?u(e,Wt.encoder,g,"key",p):e;y=""}if(Ay(y)||Jn.isBuffer(y)){if(u){var A=_?e:u(e,Wt.encoder,g,"key",p);return[m(A)+"="+m(u(y,Wt.encoder,g,"value",p))]}return[m(e)+"="+m(String(y))]}var T=[];if(typeof y>"u")return T;var P;if(i==="comma"&&si(y))_&&u&&(y=Jn.maybeMap(y,u)),P=[{value:y.length>0?y.join(",")||null:void 0}];else if(si(d))P=d;else{var k=Object.keys(y);P=l?k.sort(l):k}var R=h?String(e).replace(/\./g,"%2E"):String(e),S=r&&si(y)&&y.length===1?R+"[]":R;if(n&&si(y)&&y.length===0)return S+"[]";for(var C=0;C<P.length;++C){var I=P[C],N=typeof I=="object"&&I&&typeof I.value<"u"?I.value:y[I];if(!(o&&N===null)){var F=c&&h?String(I).replace(/\./g,"%2E"):String(I),B=si(y)?typeof i=="function"?i(S,F):S:S+(c?"."+F:"["+F+"]");x.set(t,b);var X=dd();X.set(lh,x),pd(T,s(N,B,i,r,n,a,o,h,i==="comma"&&_&&si(y)?null:u,d,l,c,f,p,m,_,g,X))}}return T},Cy=function(t){if(!t)return Wt;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||Wt.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 i=qr.default;if(typeof t.format<"u"){if(!Ty.call(qr.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var r=qr.formatters[i],n=Wt.filter;(typeof t.filter=="function"||si(t.filter))&&(n=t.filter);var a;if(t.arrayFormat in fd?a=t.arrayFormat:"indices"in t?a=t.indices?"indices":"repeat":a=Wt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var o=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:Wt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Wt.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Wt.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Wt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Wt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Wt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Wt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Wt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Wt.encodeValuesOnly,filter:n,format:i,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Wt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Wt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Wt.strictNullHandling}},Py=function(s,t){var e=s,i=Cy(t),r,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):si(i.filter)&&(n=i.filter,r=n);var a=[];if(typeof e!="object"||e===null)return"";var o=fd[i.arrayFormat],h=o==="comma"&&i.commaRoundTrip;r||(r=Object.keys(e)),i.sort&&r.sort(i.sort);for(var u=dd(),d=0;d<r.length;++d){var l=r[d],c=e[l];i.skipNulls&&c===null||pd(a,Sy(c,l,o,h,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,u))}var f=a.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},gs=cd,uh=Object.prototype.hasOwnProperty,_d=Array.isArray,Ot={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:gs.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},Iy=function(s){return s.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},gd=function(s,t,e){if(s&&typeof s=="string"&&t.comma&&s.indexOf(",")>-1)return s.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 s},Ry="utf8=%26%2310003%3B",My="utf8=%E2%9C%93",Dy=function(t,e){var i={__proto__:null},r=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;r=r.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,a=r.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 o=-1,h,u=e.charset;if(e.charsetSentinel)for(h=0;h<a.length;++h)a[h].indexOf("utf8=")===0&&(a[h]===My?u="utf-8":a[h]===Ry&&(u="iso-8859-1"),o=h,h=a.length);for(h=0;h<a.length;++h)if(h!==o){var d=a[h],l=d.indexOf("]="),c=l===-1?d.indexOf("="):l+1,f,p;c===-1?(f=e.decoder(d,Ot.decoder,u,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(d.slice(0,c),Ot.decoder,u,"key"),p=gs.maybeMap(gd(d.slice(c+1),e,_d(i[f])?i[f].length:0),function(_){return e.decoder(_,Ot.decoder,u,"value")})),p&&e.interpretNumericEntities&&u==="iso-8859-1"&&(p=Iy(String(p))),d.indexOf("[]=")>-1&&(p=_d(p)?[p]:p);var m=uh.call(i,f);m&&e.duplicates==="combine"?i[f]=gs.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},By=function(s,t,e,i){var r=0;if(s.length>0&&s[s.length-1]==="[]"){var n=s.slice(0,-1).join("");r=Array.isArray(t)&&t[n]?t[n].length:0}for(var a=i?t:gd(t,e,r),o=s.length-1;o>=0;--o){var h,u=s[o];if(u==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(a===""||e.strictNullHandling&&a===null)?[]:gs.combine([],a);else{h=e.plainObjects?{__proto__:null}:{};var d=u.charAt(0)==="["&&u.charAt(u.length-1)==="]"?u.slice(1,-1):u,l=e.decodeDotInKeys?d.replace(/%2E/g,"."):d,c=parseInt(l,10);!e.parseArrays&&l===""?h={0:a}:!isNaN(c)&&u!==l&&String(c)===l&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(h=[],h[c]=a):l!=="__proto__"&&(h[l]=a)}a=h}return a},Oy=function(t,e,i,r){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,o=/(\[[^[\]]*])/g,h=i.depth>0&&a.exec(n),u=h?n.slice(0,h.index):n,d=[];if(u){if(!i.plainObjects&&uh.call(Object.prototype,u)&&!i.allowPrototypes)return;d.push(u)}for(var l=0;i.depth>0&&(h=o.exec(n))!==null&&l<i.depth;){if(l+=1,!i.plainObjects&&uh.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;d.push(h[1])}if(h){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");d.push("["+n.slice(h.index)+"]")}return By(d,e,i,r)}},Fy=function(t){if(!t)return Ot;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"?Ot.charset:t.charset,i=typeof t.duplicates>"u"?Ot.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var r=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Ot.allowDots:!!t.allowDots;return{allowDots:r,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ot.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Ot.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Ot.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Ot.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ot.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Ot.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Ot.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Ot.decoder,delimiter:typeof t.delimiter=="string"||gs.isRegExp(t.delimiter)?t.delimiter:Ot.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Ot.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Ot.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Ot.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Ot.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Ot.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ot.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}},ky=function(s,t){var e=Fy(t);if(s===""||s===null||typeof s>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof s=="string"?Dy(s,e):s,r=e.plainObjects?{__proto__:null}:{},n=Object.keys(i),a=0;a<n.length;++a){var o=n[a],h=Oy(o,i[o],e,typeof s=="string");r=gs.merge(r,h,e)}return e.allowSparse===!0?r:gs.compact(r)},Ly=Py,Ny=ky,Uy=ah,Gy={formats:Uy,parse:Ny,stringify:Ly},Hy=K_;function Ci(){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 Vy=/^([a-z0-9.+-]+:)/i,Xy=/:[0-9]*$/,Wy=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,$y=["<",">",'"',"`"," ","\r",`
|
|
5
|
-
`," "],
|
|
6
|
-
Deprecated since v${
|
|
1
|
+
(function(Ls){typeof define=="function"&&define.amd?define(Ls):Ls()})(function(){"use strict";var Ls=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(Ls||{}),Ed=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Ed||{}),Cl=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(Cl||{}),W=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(W||{}),ys=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(ys||{}),G=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(G||{}),Wi=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(Wi||{}),tt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(tt||{}),j=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(j||{}),je=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(je||{}),Fr=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(Fr||{}),xs=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(xs||{}),Re=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(Re||{}),Ns=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ns||{}),Il=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(Il||{}),os=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(os||{}),ce=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(ce||{}),re=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(re||{}),Vs=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Vs||{});const z={ADAPTER:{createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Pl=/iPhone/i,Td=/iPod/i,Ad=/iPad/i,Sd=/\biOS-universal(?:.+)Mac\b/i,Rl=/\bAndroid(?:.+)Mobile\b/i,Cd=/Android/i,zi=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Uo=/Silk/i,dr=/Windows Phone/i,Id=/\bWindows(?:.+)ARM\b/i,Pd=/BlackBerry/i,Rd=/BB10/i,Md=/Opera Mini/i,Fd=/\b(CriOS|Chrome)(?:.+)Mobile/i,kd=/Mobile(?:.+)Firefox\b/i,Bd=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function uy(i){return function(t){return t.test(i)}}function Dd(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]<"u"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]<"u"&&(e=s[0]);var r=uy(e),n={apple:{phone:r(Pl)&&!r(dr),ipod:r(Td),tablet:!r(Pl)&&(r(Ad)||Bd(t))&&!r(dr),universal:r(Sd),device:(r(Pl)||r(Td)||r(Ad)||r(Sd)||Bd(t))&&!r(dr)},amazon:{phone:r(zi),tablet:!r(zi)&&r(Uo),device:r(zi)||r(Uo)},android:{phone:!r(dr)&&r(zi)||!r(dr)&&r(Rl),tablet:!r(dr)&&!r(zi)&&!r(Rl)&&(r(Uo)||r(Cd)),device:!r(dr)&&(r(zi)||r(Uo)||r(Rl)||r(Cd))||r(/\bokhttp\b/i)},windows:{phone:r(dr),tablet:r(Id),device:r(dr)||r(Id)},other:{blackberry:r(Pd),blackberry10:r(Rd),opera:r(Md),firefox:r(kd),chrome:r(Fd),device:r(Pd)||r(Rd)||r(Md)||r(kd)||r(Fd)},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 dy=Dd.default??Dd,fr=dy(globalThis.navigator);z.RETINA_PREFIX=/@([0-9\.]+)x/,z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Us=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Od(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function fy(i){if(i.__esModule)return i;var t=i.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(i).forEach(function(s){var r=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:function(){return i[s]}})}),e}var Ld={exports:{}};(function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(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 r(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,i.exports=h})(Ld);var py=Ld.exports;const Gs=Od(py);var Ml={exports:{}};Ml.exports=Go,Ml.exports.default=Go;function Go(i,t,e){e=e||2;var s=t&&t.length,r=s?t[0]*e:i.length,n=Nd(i,0,r,e,!0),a=[];if(!n||n.next===n.prev)return a;var h,o,l,u,c,d,f;if(s&&(n=xy(i,t,n,e)),i.length>80*e){h=l=i[0],o=u=i[1];for(var p=e;p<r;p+=e)c=i[p],d=i[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 Nd(i,t,e,s,r){var n,a;if(r===Bl(i,t,e,s)>0)for(n=t;n<e;n+=s)a=Gd(n,i[n],i[n+1],a);else for(n=e-s;n>=t;n-=s)a=Gd(n,i[n],i[n+1],a);return a&&Xo(a,a.next)&&(Yn(a),a=a.next),a}function di(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(Xo(e,e.next)||Lt(e.prev,e,e.next)===0)){if(Yn(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function Xn(i,t,e,s,r,n,a){if(i){!a&&n&&Ty(i,s,r,n);for(var h=i,o,l;i.prev!==i.next;){if(o=i.prev,l=i.next,n?gy(i,s,r,n):my(i)){t.push(o.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Yn(i),i=l.next,h=l.next;continue}if(i=l,i===h){a?a===1?(i=_y(di(i),t,e),Xn(i,t,e,s,r,n,2)):a===2&&yy(i,t,e,s,r,n):Xn(di(i),t,e,s,r,n,1);break}}}}function my(i){var t=i.prev,e=i,s=i.next;if(Lt(t,e,s)>=0)return!1;for(var r=t.x,n=e.x,a=s.x,h=t.y,o=e.y,l=s.y,u=r<n?r<a?r:a:n<a?n:a,c=h<o?h<l?h:l:o<l?o:l,d=r>n?r>a?r: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&&ji(r,h,n,o,a,l,p.x,p.y)&&Lt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function gy(i,t,e,s){var r=i.prev,n=i,a=i.next;if(Lt(r,n,a)>=0)return!1;for(var h=r.x,o=n.x,l=a.x,u=r.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,_=Fl(f,p,t,e,s),x=Fl(m,g,t,e,s),y=i.prevZ,v=i.nextZ;y&&y.z>=_&&v&&v.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&ji(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!==r&&v!==a&&ji(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!==r&&y!==a&&ji(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!==r&&v!==a&&ji(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 _y(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!Xo(r,n)&&Vd(r,s,s.next,n)&&$n(r,n)&&$n(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),Yn(s),Yn(s.next),s=i=n),s=s.next}while(s!==i);return di(s)}function yy(i,t,e,s,r,n){var a=i;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&Cy(a,h)){var o=Ud(a,h);a=di(a,a.next),o=di(o,o.next),Xn(a,t,e,s,r,n,0),Xn(o,t,e,s,r,n,0);return}h=h.next}a=a.next}while(a!==i)}function xy(i,t,e,s){var r=[],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:i.length,l=Nd(i,h,o,s,!1),l===l.next&&(l.steiner=!0),r.push(Sy(l));for(r.sort(vy),n=0;n<r.length;n++)e=by(r[n],e);return e}function vy(i,t){return i.x-t.x}function by(i,t){var e=wy(i,t);if(!e)return t;var s=Ud(e,i);return di(s,s.next),di(e,e.next)}function wy(i,t){var e=t,s=i.x,r=i.y,n=-1/0,a;do{if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){var h=e.x+(r-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&&ji(r<u?s:n,r,l,u,r<u?n:s,r,e.x,e.y)&&(d=Math.abs(r-e.y)/(s-e.x),$n(e,i)&&(d<c||d===c&&(e.x>a.x||e.x===a.x&&Ey(a,e)))&&(a=e,c=d)),e=e.next;while(e!==o);return a}function Ey(i,t){return Lt(i.prev,i,t.prev)<0&&Lt(t.next,i,i.next)<0}function Ty(i,t,e,s){var r=i;do r.z===0&&(r.z=Fl(r.x,r.y,t,e,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,Ay(r)}function Ay(i){var t,e,s,r,n,a,h,o,l=1;do{for(e=i,i=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)?(r=e,e=e.nextZ,h--):(r=s,s=s.nextZ,o--),n?n.nextZ=r:i=r,r.prevZ=n,n=r;e=s}n.nextZ=null,l*=2}while(a>1);return i}function Fl(i,t,e,s,r){return i=(i-e)*r|0,t=(t-s)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function Sy(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function ji(i,t,e,s,r,n,a,h){return(r-a)*(t-h)>=(i-a)*(n-h)&&(i-a)*(s-h)>=(e-a)*(t-h)&&(e-a)*(n-h)>=(r-a)*(s-h)}function Cy(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!Iy(i,t)&&($n(i,t)&&$n(t,i)&&Py(i,t)&&(Lt(i.prev,i,t.prev)||Lt(i,t.prev,t))||Xo(i,t)&&Lt(i.prev,i,i.next)>0&&Lt(t.prev,t,t.next)>0)}function Lt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Xo(i,t){return i.x===t.x&&i.y===t.y}function Vd(i,t,e,s){var r=Yo(Lt(i,t,e)),n=Yo(Lt(i,t,s)),a=Yo(Lt(e,s,i)),h=Yo(Lt(e,s,t));return!!(r!==n&&a!==h||r===0&&$o(i,e,t)||n===0&&$o(i,s,t)||a===0&&$o(e,i,s)||h===0&&$o(e,t,s))}function $o(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Yo(i){return i>0?1:i<0?-1:0}function Iy(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Vd(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function $n(i,t){return Lt(i.prev,i,i.next)<0?Lt(i,t,i.next)>=0&&Lt(i,i.prev,t)>=0:Lt(i,t,i.prev)<0||Lt(i,i.next,t)<0}function Py(i,t){var e=i,s=!1,r=(i.x+t.x)/2,n=(i.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==i);return s}function Ud(i,t){var e=new kl(i.i,i.x,i.y),s=new kl(t.i,t.x,t.y),r=i.next,n=t.prev;return i.next=t,t.prev=i,e.next=r,r.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Gd(i,t,e,s){var r=new kl(i,t,e);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function Yn(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function kl(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Go.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,a=Math.abs(Bl(i,0,n,e));if(r)for(var h=0,o=t.length;h<o;h++){var l=t[h]*e,u=h<o-1?t[h+1]*e:i.length;a-=Math.abs(Bl(i,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((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return a===0&&c===0?0:Math.abs((c-a)/a)};function Bl(i,t,e,s){for(var r=0,n=t,a=e-s;n<e;n+=s)r+=(i[a]-i[n])*(i[n+1]+i[a+1]),a=n;return r}Go.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},s=0,r=0;r<i.length;r++){for(var n=0;n<i[r].length;n++)for(var a=0;a<t;a++)e.vertices.push(i[r][n][a]);r>0&&(s+=i[r-1].length,e.holes.push(s))}return e};var Ry=Ml.exports;const My=Od(Ry);var Ho={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Ho.exports,function(i,t){(function(e){var s=t&&!t.nodeType&&t,r=i&&!i.nodeType&&i,n=typeof Us=="object"&&Us;(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 H=O.split("."),lt=A(H,N).join(".");return Q+lt}function M(O){for(var N=[],Z=0,Q=O.length,H,lt;Z<Q;)H=O.charCodeAt(Z++),H>=55296&&H<=56319&&Z<Q?(lt=O.charCodeAt(Z++),(lt&64512)==56320?N.push(((H&1023)<<10)+(lt&1023)+65536):(N.push(H),Z--)):N.push(H);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,H=0,lt=p,Tt=f,_t,kt,zt,Qt,Pt,jt,Ot,ze,is;for(_t=O.lastIndexOf(m),_t<0&&(_t=0),kt=0;kt<_t;++kt)O.charCodeAt(kt)>=128&&T("not-basic"),N.push(O.charCodeAt(kt));for(zt=_t>0?_t+1:0;zt<Z;){for(Qt=H,Pt=1,jt=o;zt>=Z&&T("invalid-input"),Ot=C(O.charCodeAt(zt++)),(Ot>=o||Ot>b((h-H)/Pt))&&T("overflow"),H+=Ot*Pt,ze=jt<=Tt?l:jt>=Tt+u?u:jt-Tt,!(Ot<ze);jt+=o)is=o-ze,Pt>b(h/is)&&T("overflow"),Pt*=is;Q=N.length+1,Tt=k(H-Qt,Q,Qt==0),b(H/Q)>h-lt&&T("overflow"),lt+=b(H/Q),H%=Q,N.splice(H++,0,lt)}return R(N)}function V(O){var N,Z,Q,H,lt,Tt,_t,kt,zt,Qt,Pt,jt=[],Ot,ze,is,li;for(O=M(O),Ot=O.length,N=p,Z=0,lt=f,Tt=0;Tt<Ot;++Tt)Pt=O[Tt],Pt<128&&jt.push(w(Pt));for(Q=H=jt.length,H&&jt.push(m);Q<Ot;){for(_t=h,Tt=0;Tt<Ot;++Tt)Pt=O[Tt],Pt>=N&&Pt<_t&&(_t=Pt);for(ze=Q+1,_t-N>b((h-Z)/ze)&&T("overflow"),Z+=(_t-N)*ze,N=_t,Tt=0;Tt<Ot;++Tt)if(Pt=O[Tt],Pt<N&&++Z>h&&T("overflow"),Pt==N){for(kt=Z,zt=o;Qt=zt<=lt?l:zt>=lt+u?u:zt-lt,!(kt<Qt);zt+=o)li=kt-Qt,is=o-Qt,jt.push(w(P(Qt+li%is,0))),kt=b(li/is);jt.push(w(P(kt,0))),lt=k(Z,ze,Q==H),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&&r)if(i.exports==s)r.exports=a;else for(E in a)a.hasOwnProperty(E)&&(s[E]=a[E]);else e.punycode=a})(Us)}(Ho,Ho.exports);var Fy=Ho.exports,qi=TypeError;const ky=fy(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Dl=typeof Map=="function"&&Map.prototype,Ol=Object.getOwnPropertyDescriptor&&Dl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Wo=Dl&&Ol&&typeof Ol.get=="function"?Ol.get:null,Xd=Dl&&Map.prototype.forEach,Ll=typeof Set=="function"&&Set.prototype,Nl=Object.getOwnPropertyDescriptor&&Ll?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,zo=Ll&&Nl&&typeof Nl.get=="function"?Nl.get:null,$d=Ll&&Set.prototype.forEach,By=typeof WeakMap=="function"&&WeakMap.prototype,Hn=By?WeakMap.prototype.has:null,Dy=typeof WeakSet=="function"&&WeakSet.prototype,Wn=Dy?WeakSet.prototype.has:null,Oy=typeof WeakRef=="function"&&WeakRef.prototype,Yd=Oy?WeakRef.prototype.deref:null,Ly=Boolean.prototype.valueOf,Ny=Object.prototype.toString,Vy=Function.prototype.toString,Uy=String.prototype.match,Vl=String.prototype.slice,kr=String.prototype.replace,Gy=String.prototype.toUpperCase,Hd=String.prototype.toLowerCase,Wd=RegExp.prototype.test,zd=Array.prototype.concat,Xs=Array.prototype.join,Xy=Array.prototype.slice,jd=Math.floor,Ul=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Gl=Object.getOwnPropertySymbols,Xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Zi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Zi||"symbol")?Symbol.toStringTag:null,qd=Object.prototype.propertyIsEnumerable,Zd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function Kd(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||Wd.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var s=i<0?-jd(-i):jd(i);if(s!==i){var r=String(s),n=Vl.call(t,r.length+1);return kr.call(r,e,"$&_")+"."+kr.call(kr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return kr.call(t,e,"$&_")}var $l=ky,Qd=$l.custom,Jd=rf(Qd)?Qd:null,tf={__proto__:null,double:'"',single:"'"},$y={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},jo=function i(t,e,s,r){var n=e||{};if(pr(n,"quoteStyle")&&!pr(tf,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pr(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=pr(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(pr(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(pr(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 of(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var o=String(t);return h?Kd(t,o):o}if(typeof t=="bigint"){var l=String(t)+"n";return h?Kd(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 Yl(t)?"[Array]":"[Object]";var c=ax(n,s);if(typeof r>"u")r=[];else if(nf(r,t)>=0)return"[Circular]";function d(C,P,k){if(P&&(r=Xy.call(r),r.push(P)),k){var U={depth:n.depth};return pr(n,"quoteStyle")&&(U.quoteStyle=n.quoteStyle),i(C,U,s+1,r)}return i(C,n,s+1,r)}if(typeof t=="function"&&!sf(t)){var f=Qy(t),p=qo(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Xs.call(p,", ")+" }":"")}if(rf(t)){var m=Zi?kr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Xl.call(t);return typeof t=="object"&&!Zi?zn(m):m}if(ix(t)){for(var g="<"+Hd.call(String(t.nodeName)),_=t.attributes||[],x=0;x<_.length;x++)g+=" "+_[x].name+"="+ef(Yy(_[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+Hd.call(String(t.nodeName))+">",g}if(Yl(t)){if(t.length===0)return"[]";var y=qo(t,d);return c&&!ox(y)?"["+Wl(y,c)+"]":"[ "+Xs.call(y,", ")+" ]"}if(Wy(t)){var v=qo(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!qd.call(t,"cause")?"{ ["+String(t)+"] "+Xs.call(zd.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Xs.call(v,", ")+" }"}if(typeof t=="object"&&a){if(Jd&&typeof t[Jd]=="function"&&$l)return $l(t,{depth:u-s});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Jy(t)){var b=[];return Xd&&Xd.call(t,function(C,P){b.push(d(P,t,!0)+" => "+d(C,t))}),af("Map",Wo.call(t),b,c)}if(sx(t)){var w=[];return $d&&$d.call(t,function(C){w.push(d(C,t))}),af("Set",zo.call(t),w,c)}if(tx(t))return Hl("WeakMap");if(rx(t))return Hl("WeakSet");if(ex(t))return Hl("WeakRef");if(jy(t))return zn(d(Number(t)));if(Zy(t))return zn(d(Ul.call(t)));if(qy(t))return zn(Ly.call(t));if(zy(t))return zn(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Us<"u"&&t===Us)return"{ [object globalThis] }";if(!Hy(t)&&!sf(t)){var E=qo(t,d),T=Zd?Zd(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",I=!T&&Te&&Object(t)===t&&Te in t?Vl.call(Br(t),8,-1):A?"Object":"",M=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",R=M+(I||A?"["+Xs.call(zd.call([],I||[],A||[]),": ")+"] ":"");return E.length===0?R+"{}":c?R+"{"+Wl(E,c)+"}":R+"{ "+Xs.call(E,", ")+" }"}return String(t)};function ef(i,t,e){var s=e.quoteStyle||t,r=tf[s];return r+i+r}function Yy(i){return kr.call(String(i),/"/g,""")}function Yl(i){return Br(i)==="[object Array]"&&(!Te||!(typeof i=="object"&&Te in i))}function Hy(i){return Br(i)==="[object Date]"&&(!Te||!(typeof i=="object"&&Te in i))}function sf(i){return Br(i)==="[object RegExp]"&&(!Te||!(typeof i=="object"&&Te in i))}function Wy(i){return Br(i)==="[object Error]"&&(!Te||!(typeof i=="object"&&Te in i))}function zy(i){return Br(i)==="[object String]"&&(!Te||!(typeof i=="object"&&Te in i))}function jy(i){return Br(i)==="[object Number]"&&(!Te||!(typeof i=="object"&&Te in i))}function qy(i){return Br(i)==="[object Boolean]"&&(!Te||!(typeof i=="object"&&Te in i))}function rf(i){if(Zi)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Xl)return!1;try{return Xl.call(i),!0}catch{}return!1}function Zy(i){if(!i||typeof i!="object"||!Ul)return!1;try{return Ul.call(i),!0}catch{}return!1}var Ky=Object.prototype.hasOwnProperty||function(i){return i in this};function pr(i,t){return Ky.call(i,t)}function Br(i){return Ny.call(i)}function Qy(i){if(i.name)return i.name;var t=Uy.call(Vy.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function nf(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,s=i.length;e<s;e++)if(i[e]===t)return e;return-1}function Jy(i){if(!Wo||!i||typeof i!="object")return!1;try{Wo.call(i);try{zo.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function tx(i){if(!Hn||!i||typeof i!="object")return!1;try{Hn.call(i,Hn);try{Wn.call(i,Wn)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function ex(i){if(!Yd||!i||typeof i!="object")return!1;try{return Yd.call(i),!0}catch{}return!1}function sx(i){if(!zo||!i||typeof i!="object")return!1;try{zo.call(i);try{Wo.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function rx(i){if(!Wn||!i||typeof i!="object")return!1;try{Wn.call(i,Wn);try{Hn.call(i,Hn)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function ix(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function of(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,s="... "+e+" more character"+(e>1?"s":"");return of(Vl.call(i,0,t.maxStringLength),t)+s}var r=$y[t.quoteStyle||"single"];r.lastIndex=0;var n=kr.call(kr.call(i,r,"\\$1"),/[\x00-\x1f]/g,nx);return ef(n,"single",t)}function nx(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Gy.call(t.toString(16))}function zn(i){return"Object("+i+")"}function Hl(i){return i+" { ? }"}function af(i,t,e,s){var r=s?Wl(e,s):Xs.call(e,", ");return i+" ("+t+") {"+r+"}"}function ox(i){for(var t=0;t<i.length;t++)if(nf(i[t],`
|
|
2
|
+
`)>=0)return!1;return!0}function ax(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=Xs.call(Array(i.indent+1)," ");else return null;return{base:e,prev:Xs.call(Array(t+1),e)}}function Wl(i,t){if(i.length===0)return"";var e=`
|
|
3
|
+
`+t.prev+t.base;return e+Xs.call(i,","+e)+`
|
|
4
|
+
`+t.prev}function qo(i,t){var e=Yl(i),s=[];if(e){s.length=i.length;for(var r=0;r<i.length;r++)s[r]=pr(i,r)?t(i[r],i):""}var n=typeof Gl=="function"?Gl(i):[],a;if(Zi){a={};for(var h=0;h<n.length;h++)a["$"+n[h]]=n[h]}for(var o in i)pr(i,o)&&(e&&String(Number(o))===o&&o<i.length||Zi&&a["$"+o]instanceof Symbol||(Wd.call(/[^\w$]/,o)?s.push(t(o,i)+": "+t(i[o],i)):s.push(o+": "+t(i[o],i))));if(typeof Gl=="function")for(var l=0;l<n.length;l++)qd.call(i,n[l])&&s.push("["+t(n[l])+"]: "+t(i[n[l]],i));return s}var lx=jo,hx=qi,Zo=function(i,t,e){for(var s=i,r;(r=s.next)!=null;s=r)if(r.key===t)return s.next=r.next,e||(r.next=i.next,i.next=r),r},cx=function(i,t){if(i){var e=Zo(i,t);return e&&e.value}},ux=function(i,t,e){var s=Zo(i,t);s?s.value=e:i.next={key:t,next:i.next,value:e}},dx=function(i,t){return i?!!Zo(i,t):!1},fx=function(i,t){if(i)return Zo(i,t,!0)},px=function(){var t,e={assert:function(s){if(!e.has(s))throw new hx("Side channel does not contain "+lx(s))},delete:function(s){var r=t&&t.next,n=fx(t,s);return n&&r&&r===n&&(t=void 0),!!n},get:function(s){return cx(t,s)},has:function(s){return dx(t,s)},set:function(s,r){t||(t={next:void 0}),ux(t,s,r)}};return e},lf=Object,mx=Error,gx=EvalError,_x=RangeError,yx=ReferenceError,xx=SyntaxError,vx=URIError,bx=Math.abs,wx=Math.floor,Ex=Math.max,Tx=Math.min,Ax=Math.pow,Sx=Math.round,Cx=Number.isNaN||function(t){return t!==t},Ix=Cx,Px=function(t){return Ix(t)||t===0?t:t<0?-1:1},Rx=Object.getOwnPropertyDescriptor,Ko=Rx;if(Ko)try{Ko([],"length")}catch{Ko=null}var hf=Ko,Qo=Object.defineProperty||!1;if(Qo)try{Qo({},"a",{value:1})}catch{Qo=!1}var Mx=Qo,zl,cf;function Fx(){return cf||(cf=1,zl=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 r=42;t[e]=r;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!==r||h.enumerable!==!0)return!1}return!0}),zl}var jl,uf;function kx(){if(uf)return jl;uf=1;var i=typeof Symbol<"u"&&Symbol,t=Fx();return jl=function(){return typeof i!="function"||typeof Symbol!="function"||typeof i("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},jl}var ql,df;function ff(){return df||(df=1,ql=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),ql}var Zl,pf;function mf(){if(pf)return Zl;pf=1;var i=lf;return Zl=i.getPrototypeOf||null,Zl}var Kl,gf;function Bx(){if(gf)return Kl;gf=1;var i="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,s="[object Function]",r=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 Kl=function(o){var l=this;if(typeof l!="function"||t.apply(l)!==s)throw new TypeError(i+l);for(var u=n(arguments,1),c,d=function(){if(this instanceof c){var _=l.apply(this,r(u,arguments));return Object(_)===_?_:this}return l.apply(o,r(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},Kl}var Ql,_f;function Jo(){if(_f)return Ql;_f=1;var i=Bx();return Ql=Function.prototype.bind||i,Ql}var Jl,yf;function th(){return yf||(yf=1,Jl=Function.prototype.call),Jl}var eh,xf;function vf(){return xf||(xf=1,eh=Function.prototype.apply),eh}var Dx=typeof Reflect<"u"&&Reflect&&Reflect.apply,Ox=Jo(),Lx=vf(),Nx=th(),Vx=Dx,Ux=Vx||Ox.call(Nx,Lx),Gx=Jo(),Xx=qi,$x=th(),Yx=Ux,bf=function(t){if(t.length<1||typeof t[0]!="function")throw new Xx("a function is required");return Yx(Gx,$x,t)},sh,wf;function Hx(){if(wf)return sh;wf=1;var i=bf,t=hf,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__"),r=Object,n=r.getPrototypeOf;return sh=s&&typeof s.get=="function"?i([s.get]):typeof n=="function"?function(h){return n(h==null?h:r(h))}:!1,sh}var rh,Ef;function Wx(){if(Ef)return rh;Ef=1;var i=ff(),t=mf(),e=Hx();return rh=i?function(r){return i(r)}:t?function(r){if(!r||typeof r!="object"&&typeof r!="function")throw new TypeError("getProto: not an object");return t(r)}:e?function(r){return e(r)}:null,rh}var ih,Tf;function zx(){if(Tf)return ih;Tf=1;var i=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=Jo();return ih=e.call(i,t),ih}var ht,jx=lf,qx=mx,Zx=gx,Kx=_x,Qx=yx,Ki=xx,Qi=qi,Jx=vx,tv=bx,ev=wx,sv=Ex,rv=Tx,iv=Ax,nv=Sx,ov=Px,Af=Function,nh=function(i){try{return Af('"use strict"; return ('+i+").constructor;")()}catch{}},jn=hf,av=Mx,oh=function(){throw new Qi},lv=jn?function(){try{return arguments.callee,oh}catch{try{return jn(arguments,"callee").get}catch{return oh}}}():oh,Ji=kx()(),de=Wx(),hv=mf(),cv=ff(),Sf=vf(),qn=th(),tn={},uv=typeof Uint8Array>"u"||!de?ht:de(Uint8Array),fi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ht:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ht:ArrayBuffer,"%ArrayIteratorPrototype%":Ji&&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%":Zx,"%Float32Array%":typeof Float32Array>"u"?ht:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ht:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ht:FinalizationRegistry,"%Function%":Af,"%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%":Ji&&de?de(de([][Symbol.iterator]())):ht,"%JSON%":typeof JSON=="object"?JSON:ht,"%Map%":typeof Map>"u"?ht:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ji||!de?ht:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":jx,"%Object.getOwnPropertyDescriptor%":jn,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ht:Promise,"%Proxy%":typeof Proxy>"u"?ht:Proxy,"%RangeError%":Kx,"%ReferenceError%":Qx,"%Reflect%":typeof Reflect>"u"?ht:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ht:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ji||!de?ht:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ht:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ji&&de?de(""[Symbol.iterator]()):ht,"%Symbol%":Ji?Symbol:ht,"%SyntaxError%":Ki,"%ThrowTypeError%":lv,"%TypedArray%":uv,"%TypeError%":Qi,"%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%":Jx,"%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%":Sf,"%Object.defineProperty%":av,"%Object.getPrototypeOf%":hv,"%Math.abs%":tv,"%Math.floor%":ev,"%Math.max%":sv,"%Math.min%":rv,"%Math.pow%":iv,"%Math.round%":nv,"%Math.sign%":ov,"%Reflect.getPrototypeOf%":cv};if(de)try{null.error}catch(i){var dv=de(de(i));fi["%Error.prototype%"]=dv}var fv=function i(t){var e;if(t==="%AsyncFunction%")e=nh("async function () {}");else if(t==="%GeneratorFunction%")e=nh("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=nh("async function* () {}");else if(t==="%AsyncGenerator%"){var s=i("%AsyncGeneratorFunction%");s&&(e=s.prototype)}else if(t==="%AsyncIteratorPrototype%"){var r=i("%AsyncGenerator%");r&&de&&(e=de(r.prototype))}return fi[t]=e,e},Cf={__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(),pv=Zn.call(qn,Array.prototype.concat),mv=Zn.call(Sf,Array.prototype.splice),If=Zn.call(qn,String.prototype.replace),ea=Zn.call(qn,String.prototype.slice),gv=Zn.call(qn,RegExp.prototype.exec),_v=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yv=/\\(\\)?/g,xv=function(t){var e=ea(t,0,1),s=ea(t,-1);if(e==="%"&&s!=="%")throw new Ki("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&e!=="%")throw new Ki("invalid intrinsic syntax, expected opening `%`");var r=[];return If(t,_v,function(n,a,h,o){r[r.length]=h?If(o,yv,"$1"):a||n}),r},vv=function(t,e){var s=t,r;if(ta(Cf,s)&&(r=Cf[s],s="%"+r[0]+"%"),ta(fi,s)){var n=fi[s];if(n===tn&&(n=fv(s)),typeof n>"u"&&!e)throw new Qi("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:s,value:n}}throw new Ki("intrinsic "+t+" does not exist!")},ah=function(t,e){if(typeof t!="string"||t.length===0)throw new Qi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Qi('"allowMissing" argument must be a boolean');if(gv(/^%?[^%]*%?$/,t)===null)throw new Ki("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=xv(t),r=s.length>0?s[0]:"",n=vv("%"+r+"%",e),a=n.name,h=n.value,o=!1,l=n.alias;l&&(r=l[0],mv(s,pv([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 Ki("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(o=!0),r+="."+d,a="%"+r+"%",ta(fi,a))h=fi[a];else if(h!=null){if(!(d in h)){if(!e)throw new Qi("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&&(fi[a]=h)}}return h},Pf=ah,Rf=bf,bv=Rf([Pf("%String.prototype.indexOf%")]),Mf=function(t,e){var s=Pf(t,!!e);return typeof s=="function"&&bv(t,".prototype.")>-1?Rf([s]):s},wv=ah,Kn=Mf,Ev=jo,Tv=qi,Ff=wv("%Map%",!0),Av=Kn("Map.prototype.get",!0),Sv=Kn("Map.prototype.set",!0),Cv=Kn("Map.prototype.has",!0),Iv=Kn("Map.prototype.delete",!0),Pv=Kn("Map.prototype.size",!0),kf=!!Ff&&function(){var t,e={assert:function(s){if(!e.has(s))throw new Tv("Side channel does not contain "+Ev(s))},delete:function(s){if(t){var r=Iv(t,s);return Pv(t)===0&&(t=void 0),r}return!1},get:function(s){if(t)return Av(t,s)},has:function(s){return t?Cv(t,s):!1},set:function(s,r){t||(t=new Ff),Sv(t,s,r)}};return e},Rv=ah,sa=Mf,Mv=jo,ra=kf,Fv=qi,en=Rv("%WeakMap%",!0),kv=sa("WeakMap.prototype.get",!0),Bv=sa("WeakMap.prototype.set",!0),Dv=sa("WeakMap.prototype.has",!0),Ov=sa("WeakMap.prototype.delete",!0),Lv=en?function(){var t,e,s={assert:function(r){if(!s.has(r))throw new Fv("Side channel does not contain "+Mv(r))},delete:function(r){if(en&&r&&(typeof r=="object"||typeof r=="function")){if(t)return Ov(t,r)}else if(ra&&e)return e.delete(r);return!1},get:function(r){return en&&r&&(typeof r=="object"||typeof r=="function")&&t?kv(t,r):e&&e.get(r)},has:function(r){return en&&r&&(typeof r=="object"||typeof r=="function")&&t?Dv(t,r):!!e&&e.has(r)},set:function(r,n){en&&r&&(typeof r=="object"||typeof r=="function")?(t||(t=new en),Bv(t,r,n)):ra&&(e||(e=ra()),e.set(r,n))}};return s}:ra,Nv=qi,Vv=jo,Uv=px,Gv=kf,Xv=Lv,$v=Xv||Gv||Uv,Yv=function(){var t,e={assert:function(s){if(!e.has(s))throw new Nv("Side channel does not contain "+Vv(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,r){t||(t=$v()),t.set(s,r)}};return e},Hv=String.prototype.replace,Wv=/%20/g,lh={RFC1738:"RFC1738",RFC3986:"RFC3986"},hh={default:lh.RFC3986,formatters:{RFC1738:function(i){return Hv.call(i,Wv,"+")},RFC3986:function(i){return String(i)}},RFC1738:lh.RFC1738,RFC3986:lh.RFC3986},zv=hh,ch=Object.prototype.hasOwnProperty,pi=Array.isArray,$s=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),jv=function(t){for(;t.length>1;){var e=t.pop(),s=e.obj[e.prop];if(pi(s)){for(var r=[],n=0;n<s.length;++n)typeof s[n]<"u"&&r.push(s[n]);e.obj[e.prop]=r}}},Bf=function(t,e){for(var s=e&&e.plainObjects?{__proto__:null}:{},r=0;r<t.length;++r)typeof t[r]<"u"&&(s[r]=t[r]);return s},qv=function i(t,e,s){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(pi(t))t.push(e);else if(t&&typeof t=="object")(s&&(s.plainObjects||s.allowPrototypes)||!ch.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var r=t;return pi(t)&&!pi(e)&&(r=Bf(t,s)),pi(t)&&pi(e)?(e.forEach(function(n,a){if(ch.call(t,a)){var h=t[a];h&&typeof h=="object"&&n&&typeof n=="object"?t[a]=i(h,n,s):t.push(n)}else t[a]=n}),t):Object.keys(e).reduce(function(n,a){var h=e[a];return ch.call(n,a)?n[a]=i(n[a],h,s):n[a]=h,n},r)},Zv=function(t,e){return Object.keys(e).reduce(function(s,r){return s[r]=e[r],s},t)},Kv=function(i,t,e){var s=i.replace(/\+/g," ");if(e==="iso-8859-1")return s.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(s)}catch{return s}},uh=1024,Qv=function(t,e,s,r,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+=uh){for(var l=a.length>=uh?a.slice(o,o+uh):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]=$s[d];continue}if(d<2048){u[u.length]=$s[192|d>>6]+$s[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=$s[224|d>>12]+$s[128|d>>6&63]+$s[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|l.charCodeAt(c)&1023),u[u.length]=$s[240|d>>18]+$s[128|d>>12&63]+$s[128|d>>6&63]+$s[128|d&63]}h+=u.join("")}return h},Jv=function(t){for(var e=[{obj:{o:t},prop:"o"}],s=[],r=0;r<e.length;++r)for(var n=e[r],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 jv(e),t},tb=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},eb=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},sb=function(t,e){return[].concat(t,e)},rb=function(t,e){if(pi(t)){for(var s=[],r=0;r<t.length;r+=1)s.push(e(t[r]));return s}return e(t)},Df={arrayToObject:Bf,assign:Zv,combine:sb,compact:Jv,decode:Kv,encode:Qv,isBuffer:eb,isRegExp:tb,maybeMap:rb,merge:qv},Of=Yv,ia=Df,Qn=hh,ib=Object.prototype.hasOwnProperty,Lf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ys=Array.isArray,nb=Array.prototype.push,Nf=function(i,t){nb.apply(i,Ys(t)?t:[t])},ob=Date.prototype.toISOString,Vf=Qn.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ia.encode,encodeValuesOnly:!1,filter:void 0,format:Vf,formatter:Qn.formatters[Vf],indices:!1,serializeDate:function(t){return ob.call(t)},skipNulls:!1,strictNullHandling:!1},ab=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},dh={},lb=function i(t,e,s,r,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(dh))!==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(dh)>"u"&&(b=0)}if(typeof u=="function"?y=u(e,y):y instanceof Date?y=f(y):s==="comma"&&Ys(y)&&(y=ia.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(ab(y)||ia.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=ia.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=r&&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 $=Of();$.set(dh,x),Nf(A,i(U,L,s,r,n,a,h,o,s==="comma"&&g&&Ys(y)?null:l,u,c,d,f,p,m,g,_,$))}}return A},hb=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(!ib.call(Qn.formatters,t.format))throw new TypeError("Unknown format option provided.");s=t.format}var r=Qn.formatters[s],n=ue.filter;(typeof t.filter=="function"||Ys(t.filter))&&(n=t.filter);var a;if(t.arrayFormat in Lf?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:r,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}},cb=function(i,t){var e=i,s=hb(t),r,n;typeof s.filter=="function"?(n=s.filter,e=n("",e)):Ys(s.filter)&&(n=s.filter,r=n);var a=[];if(typeof e!="object"||e===null)return"";var h=Lf[s.arrayFormat],o=h==="comma"&&s.commaRoundTrip;r||(r=Object.keys(e)),s.sort&&r.sort(s.sort);for(var l=Of(),u=0;u<r.length;++u){var c=r[u],d=e[c];s.skipNulls&&d===null||Nf(a,lb(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:""},mi=Df,fh=Object.prototype.hasOwnProperty,Uf=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:mi.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},ub=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Gf=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.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 i},db="utf8=%26%2310003%3B",fb="utf8=%E2%9C%93",pb=function(t,e){var s={__proto__:null},r=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;r=r.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,a=r.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]===fb?l="utf-8":a[o]===db&&(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=mi.maybeMap(Gf(u.slice(d+1),e,Uf(s[f])?s[f].length:0),function(g){return e.decoder(g,qt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=ub(String(p))),u.indexOf("[]=")>-1&&(p=Uf(p)?[p]:p);var m=fh.call(s,f);m&&e.duplicates==="combine"?s[f]=mi.combine(s[f],p):(!m||e.duplicates==="last")&&(s[f]=p)}return s},mb=function(i,t,e,s){var r=0;if(i.length>0&&i[i.length-1]==="[]"){var n=i.slice(0,-1).join("");r=Array.isArray(t)&&t[n]?t[n].length:0}for(var a=s?t:Gf(t,e,r),h=i.length-1;h>=0;--h){var o,l=i[h];if(l==="[]"&&e.parseArrays)o=e.allowEmptyArrays&&(a===""||e.strictNullHandling&&a===null)?[]:mi.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},gb=function(t,e,s,r){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&&fh.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&&fh.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 mb(u,e,s,r)}},_b=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 r=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:r,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"||mi.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}},yb=function(i,t){var e=_b(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var s=typeof i=="string"?pb(i,e):i,r=e.plainObjects?{__proto__:null}:{},n=Object.keys(s),a=0;a<n.length;++a){var h=n[a],o=gb(h,s[h],e,typeof i=="string");r=mi.merge(r,o,e)}return e.allowSparse===!0?r:mi.compact(r)},xb=cb,vb=yb,bb=hh,wb={formats:bb,parse:vb,stringify:xb},Eb=Fy;function mr(){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 Tb=/^([a-z0-9.+-]+:)/i,Ab=/:[0-9]*$/,Sb=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Cb=["<",">",'"',"`"," ","\r",`
|
|
5
|
+
`," "],Ib=["{","}","|","\\","^","`"].concat(Cb),ph=["'"].concat(Ib),Xf=["%","/","?",";","#"].concat(ph),$f=["/","?","#"],Pb=255,Yf=/^[+a-z0-9A-Z_-]{0,63}$/,Rb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Mb={javascript:!0,"javascript:":!0},mh={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},gh=wb;function Fb(i,t,e){if(i&&typeof i=="object"&&i instanceof mr)return i;var s=new mr;return s.parse(i,t,e),s}mr.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var s=i.indexOf("?"),r=s!==-1&&s<i.indexOf("#")?"?":"#",n=i.split(r),a=/\\/g;n[0]=n[0].replace(a,"/"),i=n.join(r);var h=i;if(h=h.trim(),!e&&i.split("#").length===1){var o=Sb.exec(h);if(o)return this.path=h,this.href=h,this.pathname=o[1],o[2]?(this.search=o[2],t?this.query=gh.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=Tb.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&&mh[l])&&(h=h.substr(2),this.slashes=!0)}if(!mh[l]&&(c||l&&!sn[l])){for(var d=-1,f=0;f<$f.length;f++){var p=h.indexOf($f[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<Xf.length;f++){var p=h.indexOf(Xf[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(Rb);I&&(T.push(I[1]),A.unshift(I[2])),A.length&&(h="/"+A.join(".")+h),this.hostname=T.join(".");break}}}this.hostname.length>Pb?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=Eb.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(!Mb[u])for(var f=0,y=ph.length;f<y;f++){var C=ph[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=gh.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},mr.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",s=this.hash||"",r=!1,n="";this.host?r=i+this.host:this.hostname&&(r=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=gh.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||sn[t])&&r!==!1?(r="//"+(r||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):r||(r=""),s&&s.charAt(0)!=="#"&&(s="#"+s),a&&a.charAt(0)!=="?"&&(a="?"+a),e=e.replace(/[?#]/g,function(h){return encodeURIComponent(h)}),a=a.replace("#","%23"),t+r+e+a+s},mr.prototype.resolve=function(i){return this.resolveObject(Fb(i,!1,!0)).format()},mr.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new mr;t.parse(i,!1,!0),i=t}for(var e=new mr,s=Object.keys(this),r=0;r<s.length;r++){var n=s[r];e[n]=this[n]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var a=Object.keys(i),h=0;h<a.length;h++){var o=a[h];o!=="protocol"&&(e[o]=i[o])}return sn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!sn[i.protocol]){for(var l=Object.keys(i),u=0;u<l.length;u++){var c=l[u];e[c]=i[c]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!mh[i.protocol]){for(var y=(i.pathname||"").split("/");y.length&&!(i.host=y.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",g=m||p||e.host&&i.pathname,_=g,x=e.pathname&&e.pathname.split("/")||[],y=i.pathname&&i.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="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(y[0]===""?y[0]=i.host:y.unshift(i.host)),i.host=null),g=g&&(y[0]===""||x[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,x=y;else if(y.length)x||(x=[]),x.pop(),x=x.concat(y),e.search=i.search,e.query=i.query;else if(i.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=i.search,e.query=i.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||i.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=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e},mr.prototype.parseHost=function(){var i=this.host,t=Ab.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};const Hf={};function ot(i,t,e=3){if(Hf[t])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
+
Deprecated since v${i}`):(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
|
-
Deprecated since v${
|
|
10
|
-
Deprecated since v${s}`),console.warn(i))),bd[t]=!0}function Ge(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function Kr(s){return s.split("?")[0].split("#")[0]}function Zy(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qy(s,t,e){return s.replace(new RegExp(Zy(t),"g"),e)}function Jy(s,t){let e="",i=0,r=-1,n=0,a=-1;for(let o=0;o<=s.length;++o){if(o<s.length)a=s.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||n===1))if(r!==o-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${s.slice(r+1,o)}`:e=s.slice(r+1,o),i=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const Ft={toPosix(s){return Qy(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){Ge(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(Ge(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=Kr(this.toPosix(t??H.ADAPTER.getBaseUrl())),r=Kr(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?Ft.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(Ge(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=Jy(s,!1),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return Ge(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e<s.length;++e){const i=s[e];if(Ge(i),i.length>0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(Ge(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),a=s;s=s.slice(n.length);for(let o=s.length-1;o>=1;--o)if(t=s.charCodeAt(o),t===47){if(!r){i=o;break}}else r=!1;return i===-1?e?"/":this.isUrl(a)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){Ge(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){Ge(s),t&&Ge(t),s=Kr(this.toPosix(s));let e=0,i=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let a=t.length-1,o=-1;for(n=s.length-1;n>=0;--n){const h=s.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(i=n):(a=-1,i=o))}return e===i?i=o:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){Ge(s),s=Kr(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let a=s.length-1;a>=0;--a){const o=s.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}i===-1&&(r=!1,i=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){Ge(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=Kr(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,a=0,o=-1,h=!0,u=s.length-1,d=0;for(;u>=r;--u){if(e=s.charCodeAt(u),e===47){if(!h){a=u+1;break}continue}o===-1&&(h=!1,o=u+1),e===46?n===-1?n=u:d!==1&&(d=1):n!==-1&&(d=-1)}return n===-1||o===-1||d===0||d===1&&n===o-1&&n===a+1?o!==-1&&(a===0&&i?t.base=t.name=s.slice(1,o):t.base=t.name=s.slice(a,o)):(a===0&&i?(t.name=s.slice(1,n),t.base=s.slice(1,o)):(t.name=s.slice(a,n),t.base=s.slice(a,o)),t.ext=s.slice(n,o)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let ph;async function tx(){return ph??(ph=(async()=>{var n;const s=document.createElement("canvas").getContext("webgl");if(!s)return he.UNPACK;const t=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!t)return he.UNPACK;const e=s.createTexture();s.bindTexture(s.TEXTURE_2D,e);const i=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,i),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e,0),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.NONE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t);const r=new Uint8Array(4);return s.readPixels(0,0,1,1,s.RGBA,s.UNSIGNED_BYTE,r),s.deleteFramebuffer(i),s.deleteTexture(e),(n=s.getExtension("WEBGL_lose_context"))==null||n.loseContext(),r[0]<=r[3]?he.PMA:he.UNPACK})()),ph}let mh;function ex(){return typeof mh>"u"&&(mh=function(){var t;const s={stencil:!0,failIfMajorPerformanceCaveat:H.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!H.ADAPTER.getWebGLRenderingContext())return!1;const e=H.ADAPTER.createCanvas();let i=e.getContext("webgl",s)||e.getContext("experimental-webgl",s);const r=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch{return!1}}()),mh}var ix={grad:.9,turn:360,rad:360/(2*Math.PI)},Pi=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},zt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},Pe=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},Td=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},wd=function(s){return{r:Pe(s.r,0,255),g:Pe(s.g,0,255),b:Pe(s.b,0,255),a:Pe(s.a)}},_h=function(s){return{r:zt(s.r),g:zt(s.g),b:zt(s.b),a:zt(s.a,3)}},sx=/^#([0-9a-f]{3,8})$/i,ta=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Ed=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),a=n-Math.min(t,e,i),o=a?n===t?(e-i)/a:n===e?2+(i-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},Ad=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),a=i*(1-e),o=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),u=n%6;return{r:255*[i,o,a,a,h,i][u],g:255*[h,i,i,o,a,a][u],b:255*[a,a,h,i,i,o][u],a:r}},Sd=function(s){return{h:Td(s.h),s:Pe(s.s,0,100),l:Pe(s.l,0,100),a:Pe(s.a)}},Cd=function(s){return{h:zt(s.h),s:zt(s.s),l:zt(s.l),a:zt(s.a,3)}},Pd=function(s){return Ad((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Zr=function(s){return{h:(t=Ed(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},rx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,nx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ax=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ox=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gh={string:[[function(s){var t=sx.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?zt(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?zt(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=ax.exec(s)||ox.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:wd({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(s){var t=rx.exec(s)||nx.exec(s);if(!t)return null;var e,i,r=Sd({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(ix[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Pd(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return Pi(t)&&Pi(e)&&Pi(i)?wd({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!Pi(t)||!Pi(e)||!Pi(i))return null;var a=Sd({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Pd(a)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!Pi(t)||!Pi(e)||!Pi(i))return null;var a=function(o){return{h:Td(o.h),s:Pe(o.s,0,100),v:Pe(o.v,0,100),a:Pe(o.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Ad(a)},"hsv"]]},Id=function(s,t){for(var e=0;e<t.length;e++){var i=t[e][0](s);if(i)return[i,t[e][1]]}return[null,void 0]},hx=function(s){return typeof s=="string"?Id(s.trim(),gh.string):typeof s=="object"&&s!==null?Id(s,gh.object):[null,void 0]},yh=function(s,t){var e=Zr(s);return{h:e.h,s:Pe(e.s+100*t,0,100),l:e.l,a:e.a}},xh=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},Rd=function(s,t){var e=Zr(s);return{h:e.h,s:e.s,l:Pe(e.l+100*t,0,100),a:e.a}},vh=function(){function s(t){this.parsed=hx(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return zt(xh(this.rgba),2)},s.prototype.isDark=function(){return xh(this.rgba)<.5},s.prototype.isLight=function(){return xh(this.rgba)>=.5},s.prototype.toHex=function(){return t=_h(this.rgba),e=t.r,i=t.g,r=t.b,a=(n=t.a)<1?ta(zt(255*n)):"","#"+ta(e)+ta(i)+ta(r)+a;var t,e,i,r,n,a},s.prototype.toRgb=function(){return _h(this.rgba)},s.prototype.toRgbString=function(){return t=_h(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return Cd(Zr(this.rgba))},s.prototype.toHslString=function(){return t=Cd(Zr(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=Ed(this.rgba),{h:zt(t.h),s:zt(t.s),v:zt(t.v),a:zt(t.a,3)};var t},s.prototype.invert=function(){return ri({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),ri(yh(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),ri(yh(this.rgba,-t))},s.prototype.grayscale=function(){return ri(yh(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),ri(Rd(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),ri(Rd(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?ri({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):zt(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=Zr(this.rgba);return typeof t=="number"?ri({h:t,s:e.s,l:e.l,a:e.a}):zt(e.h)},s.prototype.isEqual=function(t){return this.toHex()===ri(t).toHex()},s}(),ri=function(s){return s instanceof vh?s:new vh(s)},Md=[],lx=function(s){s.forEach(function(t){Md.indexOf(t)<0&&(t(vh,gh),Md.push(t))})};function ux(s,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"},i={};for(var r in e)i[e[r]]=r;var n={};s.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,u=i[this.toHex()];if(u)return u;if(a!=null&&a.closest){var d=this.toRgb(),l=1/0,c="black";if(!n.length)for(var f in e)n[f]=new s(e[f]).toRgb();for(var p in e){var m=(o=d,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));m<l&&(l=m,c=p)}return c}},t.string.push([function(a){var o=a.toLowerCase(),h=o==="transparent"?"#0000":e[o];return h?new s(h).toRgb():null},"name"])}lx([ux]);const ir=class xo{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 xo)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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t??[];const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,r,n]=xo.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,i,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,i=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=xo.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=ri(t);a.isValid()&&({r:e,g:i,b:r,a:n}=a.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}};ir.shared=new ir,ir.temp=new ir,ir.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let pt=ir;function Dd(s,t=[]){return it("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),pt.shared.setValue(s).toRgbArray(t)}function cx(s){return it("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),pt.shared.setValue(s).toHex()}function Qr(s){return it("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),pt.shared.setValue(s).toNumber()}function dx(){const s=[],t=[];for(let i=0;i<32;i++)s[i]=i,t[i]=i;s[K.NORMAL_NPM]=K.NORMAL,s[K.ADD_NPM]=K.ADD,s[K.SCREEN_NPM]=K.SCREEN,t[K.NORMAL]=K.NORMAL_NPM,t[K.ADD]=K.ADD_NPM,t[K.SCREEN]=K.SCREEN_NPM;const e=[];return e.push(t),e.push(s),e}const Bd=dx();function Od(s,t){return Bd[t?1:0][s]}function fx(s,t=null){const e=s*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 i=0,r=0;i<e;i+=6,r+=4)t[i+0]=r+0,t[i+1]=r+1,t[i+2]=r+2,t[i+3]=r+0,t[i+4]=r+2,t[i+5]=r+3;return t}function Fd(s){if(s.BYTES_PER_ELEMENT===4)return s instanceof Float32Array?"Float32Array":s instanceof Uint32Array?"Uint32Array":"Int32Array";if(s.BYTES_PER_ELEMENT===2){if(s instanceof Uint16Array)return"Uint16Array"}else if(s.BYTES_PER_ELEMENT===1&&s instanceof Uint8Array)return"Uint8Array";return null}function ea(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function kd(s){return!(s&s-1)&&!!s}function Ld(s){let t=(s>65535?1:0)<<4;s>>>=t;let e=(s>255?1:0)<<3;return s>>>=e,t|=e,e=(s>15?1:0)<<2,s>>>=e,t|=e,e=(s>3?1:0)<<1,s>>>=e,t|=e,t|s>>1}function sr(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r<n;++r)s[r]=s[r+e];s.length=n}function Wi(s){return s===0?0:s<0?-1:1}let px=0;function ys(){return++px}const bh=class{constructor(s,t,e,i){this.left=s,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};bh.EMPTY=new bh(0,0,0,0);let Nd=bh;const Ud={},ni=Object.create(null),$i=Object.create(null);class mx{constructor(t,e,i){this._canvas=H.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||H.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 Gd(s,t,e){for(let i=0,r=4*e*t;i<t;++i,r+=4)if(s[r+3]!==0)return!1;return!0}function Hd(s,t,e,i,r){const n=4*t;for(let a=i,o=i*n+4*e;a<=r;++a,o+=n)if(s[o+3]!==0)return!1;return!0}function _x(s){const{width:t,height:e}=s,i=s.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const r=i.getImageData(0,0,t,e).data;let n=0,a=0,o=t-1,h=e-1;for(;a<e&&Gd(r,t,a);)++a;if(a===e)return Nd.EMPTY;for(;Gd(r,t,h);)--h;for(;Hd(r,t,n,a,h);)++n;for(;Hd(r,t,o,a,h);)--o;return++o,++h,new Nd(n,a,o,h)}function gx(s){const t=_x(s),{width:e,height:i}=t;let r=null;if(!t.isEmpty()){const n=s.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:r}}function yx(s,t=globalThis.location){if(s.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Ii(s,t=1){var i;const e=(i=H.RETINA_PREFIX)==null?void 0:i.exec(s);return e?parseFloat(e[1]):t}var G=(s=>(s.Renderer="renderer",s.Application="application",s.RendererSystem="renderer-webgl-system",s.RendererPlugin="renderer-webgl-plugin",s.CanvasRendererSystem="renderer-canvas-system",s.CanvasRendererPlugin="renderer-canvas-plugin",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s))(G||{});const Th=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},Vd=(s,t)=>Th(s).priority??t,z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(Th).forEach(t=>{t.type.forEach(e=>{var i,r;return(r=(i=this._removeHandlers)[e])==null?void 0:r.call(i,t)})}),this},add(...s){return s.map(Th).forEach(t=>{t.type.forEach(e=>{var n,a;const i=this._addHandlers,r=this._queue;i[e]?(n=i[e])==null||n.call(i,t):(r[e]=r[e]||[],(a=r[e])==null||a.push(t))})}),this},handle(s,t,e){var a;const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&((a=n[s])==null||a.forEach(o=>t(o)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>Vd(n,e)-Vd(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})}};class wh{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 xx=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
-
`);function
|
|
12
|
-
else `),e<s-1&&(t+=`if(test == ${e}.0){}`);return t}function bx(s,t){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=xx.replace(/%forloop%/gi,vx(s));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))s=s/2|0;else break}return s}const Eh=0,Ah=1,Sh=2,Ch=3,Ph=4,Ih=5;class ai{constructor(){this.data=0,this.blendMode=K.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Eh)}set blend(t){!!(this.data&1<<Eh)!==t&&(this.data^=1<<Eh)}get offsets(){return!!(this.data&1<<Ah)}set offsets(t){!!(this.data&1<<Ah)!==t&&(this.data^=1<<Ah)}get culling(){return!!(this.data&1<<Sh)}set culling(t){!!(this.data&1<<Sh)!==t&&(this.data^=1<<Sh)}get depthTest(){return!!(this.data&1<<Ch)}set depthTest(t){!!(this.data&1<<Ch)!==t&&(this.data^=1<<Ch)}get depthMask(){return!!(this.data&1<<Ih)}set depthMask(t){!!(this.data&1<<Ih)!==t&&(this.data^=1<<Ih)}get clockwiseFrontFace(){return!!(this.data&1<<Ph)}set clockwiseFrontFace(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==K.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new ai;return t.depthTest=!1,t.blend=!0,t}}ai.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Rh=[];function Xd(s,t){if(!s)return null;let e="";if(typeof s=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(s);i&&(e=i[1].toLowerCase())}for(let i=Rh.length-1;i>=0;--i){const r=Rh[i];if(r.test&&r.test(s,e))return new r(s,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class He{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,r,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:u,items:d}=this;this._aliasCount++;for(let l=0,c=d.length;l<c;l++)d[l][u](t,e,i,r,n,a,o,h);return d===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(He.prototype,{dispatch:{value:He.prototype.emit},run:{value:He.prototype.emit}});class Jr{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new He("setRealSize"),this.onUpdate=new He("update"),this.onError=new He("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,i){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 ia extends Jr{constructor(t,e){const{width:i,height:r}=e||{};if(!i||!r)throw new Error("BufferResource width or height invalid");super(i,r),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===he.UNPACK);const n=e.realWidth,a=e.realHeight;return i.width===n&&i.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,i.type,this.data):(i.width=n,i.height=a,r.texImage2D(e.target,0,i.internalFormat,n,a,0,e.format,i.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 Tx={scaleMode:wi.NEAREST,alphaMode:he.NPM},Mh=class Fr extends ti{constructor(t=null,e=null){super(),e=Object.assign({},Fr.defaultOptions,e);const{alphaMode:i,mipmap:r,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:u,format:d,type:l,target:c,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Jr)&&(t=Xd(t,p),t.internal=!0),this.resolution=f||H.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=u,this._scaleMode=a,this.format=d,this.type=l,this.target=c,this.alphaMode=i,this.uid=ys(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=kd(this.realWidth)&&kd(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 $i[this.cacheId],delete ni[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Fr.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,i=H.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${ys()}`}n=t._pixiId}let a=$i[n];if(r&&i&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new Fr(t,e),a.cacheId=n,Fr.addToCache(a,n)),a}static fromBuffer(t,e,i,r){t=t||new Float32Array(e*i*4);const n=new ia(t,{width:e,height:i,...r==null?void 0:r.resourceOptions});let a,o;return t instanceof Float32Array?(a=O.RGBA,o=Z.FLOAT):t instanceof Int32Array?(a=O.RGBA_INTEGER,o=Z.INT):t instanceof Uint32Array?(a=O.RGBA_INTEGER,o=Z.UNSIGNED_INT):t instanceof Int16Array?(a=O.RGBA_INTEGER,o=Z.SHORT):t instanceof Uint16Array?(a=O.RGBA_INTEGER,o=Z.UNSIGNED_SHORT):t instanceof Int8Array?(a=O.RGBA,o=Z.BYTE):(a=O.RGBA,o=Z.UNSIGNED_BYTE),n.internal=!0,new Fr(n,Object.assign({},Tx,{type:o,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),$i[e]&&$i[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),$i[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=$i[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete $i[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete $i[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Mh.defaultOptions={mipmap:Ke.POW2,anisotropicLevel:0,scaleMode:wi.LINEAR,wrapMode:Hi.CLAMP,alphaMode:he.UNPACK,target:$s.TEXTURE_2D,format:O.RGBA,type:Z.UNSIGNED_BYTE},Mh._globalBatch=0;let J=Mh;class Dh{constructor(){this.texArray=null,this.blend=0,this.type=Ue.TRIANGLES,this.start=0,this.size=0,this.data=null}}let wx=0;class Nt{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=wx++,this.disposeRunner=new He("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?Qe.ELEMENT_ARRAY_BUFFER:Qe.ARRAY_BUFFER}get index(){return this.type===Qe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Nt(t)}}class sa{constructor(t,e=0,i=!1,r=Z.FLOAT,n,a,o,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=r,this.stride=n,this.start=a,this.instance=o,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,r,n){return new sa(t,e,i,r,n)}}const Ex={Float32Array,Uint32Array,Int32Array,Uint8Array};function Ax(s,t){let e=0,i=0;const r={};for(let h=0;h<s.length;h++)i+=t[h],e+=s[h].length;const n=new ArrayBuffer(e*4);let a=null,o=0;for(let h=0;h<s.length;h++){const u=t[h],d=s[h],l=Fd(d);r[l]||(r[l]=new Ex[l](n)),a=r[l];for(let c=0;c<d.length;c++){const f=(c/u|0)*i+o,p=c%u;a[f+p]=d[c]}o+=u}return new Float32Array(n)}const Wd={5126:4,5123:2,5121:1};let Sx=0;const Cx={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class zi{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Sx++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new He("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,r=!1,n,a,o,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Nt||(e instanceof Array&&(e=new Float32Array(e)),e=new Nt(e));const u=t.split("|");if(u.length>1){for(let l=0;l<u.length;l++)this.addAttribute(u[l],e,i,r,n);return this}let d=this.buffers.indexOf(e);return d===-1&&(this.buffers.push(e),d=this.buffers.length-1),this.attributes[t]=new sa(d,i,r,n,a,o,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Nt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Nt(t)),t.type=Qe.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=[],i=new Nt;let r;for(r in this.attributes){const n=this.attributes[r],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*Wd[n.type]/4),n.buffer=0}for(i.data=Ax(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[i],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 zi;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Nt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new sa(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Qe.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new zi,i=[],r=[],n=[];let a;for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)r[h]=r[h]||0,r[h]+=a.buffers[h].data.length,n[h]=0}for(let o=0;o<a.buffers.length;o++)i[o]=new Cx[Fd(a.buffers[o].data)](r[o]),e.buffers[o]=new Nt(i[o]);for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)i[h].set(a.buffers[h].data,n[h]),n[h]+=a.buffers[h].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Qe.ELEMENT_ARRAY_BUFFER;let o=0,h=0,u=0,d=0;for(let l=0;l<a.buffers.length;l++)if(a.buffers[l]!==a.indexBuffer){d=l;break}for(const l in a.attributes){const c=a.attributes[l];(c.buffer|0)===d&&(h+=c.size*Wd[c.type]/4)}for(let l=0;l<t.length;l++){const c=t[l].indexBuffer.data;for(let f=0;f<c.length;f++)e.indexBuffer.data[f+u]+=o;o+=t[l].buffers[d].data.length/h,u+=c.length}}return e}}class $d extends zi{constructor(t=!1){super(),this._buffer=new Nt(null,t,!1),this._indexBuffer=new Nt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Z.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Z.FLOAT).addAttribute("aColor",this._buffer,4,!0,Z.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Z.FLOAT).addIndex(this._indexBuffer)}}const ra=Math.PI*2,Px=180/Math.PI,Bh=Math.PI/180;var Zt=(s=>(s[s.POLY=0]="POLY",s[s.RECT=1]="RECT",s[s.CIRC=2]="CIRC",s[s.ELIP=3]="ELIP",s[s.RREC=4]="RREC",s))(Zt||{});class tt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new tt(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}}tt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const na=[new tt,new tt,new tt,new tt];let st=class zu{constructor(t=0,e=0,i=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=Zt.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 zu(0,0,0,0)}clone(){return new zu(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 A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;const T=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>T}const i=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=i||a<=n)return!1;const o=na[0].set(t.left,t.top),h=na[1].set(t.left,t.bottom),u=na[2].set(t.right,t.top),d=na[3].set(t.right,t.bottom);if(u.x<=o.x||h.y<=o.y)return!1;const l=Math.sign(e.a*e.d-e.b*e.c);if(l===0||(e.apply(o,o),e.apply(h,h),e.apply(u,u),e.apply(d,d),Math.max(o.x,h.x,u.x,d.x)<=i||Math.min(o.x,h.x,u.x,d.x)>=r||Math.max(o.y,h.y,u.y,d.y)<=n||Math.min(o.y,h.y,u.y,d.y)>=a))return!1;const c=l*(h.y-o.y),f=l*(o.x-h.x),p=c*i+f*n,m=c*r+f*n,_=c*i+f*a,g=c*r+f*a;if(Math.max(p,m,_,g)<=c*o.x+f*o.y||Math.min(p,m,_,g)>=c*d.x+f*d.y)return!1;const x=l*(o.y-u.y),y=l*(u.x-o.x),v=x*i+y*n,b=x*r+y*n,E=x*i+y*a,w=x*r+y*a;return!(Math.max(v,b,E,w)<=x*o.x+y*o.y||Math.min(v,b,E,w)>=x*d.x+y*d.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),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}};st.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class aa{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=Zt.CIRC}clone(){return new aa(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}getBounds(){return new st(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}aa.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class oa{constructor(t=0,e=0,i=0,r=0){this.x=t,this.y=e,this.width=i,this.height=r,this.type=Zt.ELIP}clone(){return new oa(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,i+r<=1}getBounds(){return new st(this.x-this.width,this.y-this.height,this.width,this.height)}}oa.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Yi{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;r<n;r++)i.push(e[r].x,e[r].y);e=i}this.points=e,this.type=Zt.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Yi(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const r=this.points.length/2;for(let n=0,a=r-1;n<r;a=n++){const o=this.points[n*2],h=this.points[n*2+1],u=this.points[a*2],d=this.points[a*2+1];h>e!=d>e&&t<(u-o)*((e-h)/(d-h))+o&&(i=!i)}return i}}Yi.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((s,t)=>`${s}, ${t}`,"")}]`};class ha{constructor(t=0,e=0,i=0,r=0,n=20){this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n,this.type=Zt.RREC}clone(){return new ha(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),n=e-(this.y+i);const a=i*i;if(r*r+n*n<=a||(r=t-(this.x+this.width-i),r*r+n*n<=a)||(n=e-(this.y+this.height-i),r*r+n*n<=a)||(r=t-(this.x+i),r*r+n*n<=a))return!0}return!1}}ha.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class gt{constructor(t=1,e=0,i=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,r,n,a){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new tt;const i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e}applyInverse(t,e){e=e||new tt;const i=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*i*r+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=a*e-this.ty*i,this.ty=a*i+this.ty*e,this}append(t){const e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,r,n,a,o,h,u){return this.a=Math.cos(o+u)*n,this.b=Math.sin(o+u)*n,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,r=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-r,n),h=Math.atan2(i,e),u=Math.abs(o+h);return u<1e-5||Math.abs(ra-u)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(a.x*e+a.y*r),t.position.y=this.ty+(a.x*i+a.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,a=t*r-e*i;return this.a=r/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new gt;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 gt}static get TEMP_MATRIX(){return new gt}}gt.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 xs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],vs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],bs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ts=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Oh=[],zd=[],la=Math.sign;function Ix(){for(let s=0;s<16;s++){const t=[];Oh.push(t);for(let e=0;e<16;e++){const i=la(xs[s]*xs[e]+bs[s]*vs[e]),r=la(vs[s]*xs[e]+Ts[s]*vs[e]),n=la(xs[s]*bs[e]+bs[s]*Ts[e]),a=la(vs[s]*bs[e]+Ts[s]*Ts[e]);for(let o=0;o<16;o++)if(xs[o]===i&&vs[o]===r&&bs[o]===n&&Ts[o]===a){t.push(o);break}}}for(let s=0;s<16;s++){const t=new gt;t.set(xs[s],vs[s],bs[s],Ts[s],0,0),zd.push(t)}}Ix();const At={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:s=>xs[s],uY:s=>vs[s],vX:s=>bs[s],vY:s=>Ts[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>Oh[s][t],sub:(s,t)=>Oh[s][At.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?At.S:At.N:Math.abs(t)*2<=Math.abs(s)?s>0?At.E:At.W:t>0?s>0?At.SE:At.SW:s>0?At.NE:At.NW,matrixAppendRotationInv:(s,t,e=0,i=0)=>{const r=zd[At.inv(t)];r.tx=e,r.ty=i,s.append(r)}};class oi{constructor(t,e,i=0,r=0){this._x=i,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new oi(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))}}oi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Fh=class{constructor(){this.worldTransform=new gt,this.localTransform=new gt,this.position=new oi(this.onChange,this,0,0),this.scale=new oi(this.onChange,this,1,1),this.pivot=new oi(this.onChange,this,0,0),this.skew=new oi(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 s=this.localTransform;this._localID!==this._currentLocalID&&(s.a=this._cx*this.scale.x,s.b=this._sx*this.scale.x,s.c=this._cy*this.scale.y,s.d=this._sy*this.scale.y,s.tx=this.position.x-(this.pivot.x*s.a+this.pivot.y*s.c),s.ty=this.position.y-(this.pivot.x*s.b+this.pivot.y*s.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(s){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!==s._worldID){const e=s.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=s._worldID,this._worldID++}}setFromMatrix(s){s.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(s){this._rotation!==s&&(this._rotation=s,this.updateSkew())}};Fh.IDENTITY=new Fh;let ua=Fh;ua.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 Rx=`varying vec2 vTextureCoord;
|
|
9
|
+
Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
10
|
+
Deprecated since v${i}`),console.warn(s))),Hf[t]=!0}function vs(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Jn(i){return i.split("?")[0].split("#")[0]}function kb(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bb(i,t,e){return i.replace(new RegExp(kb(t),"g"),e)}function Db(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let h=0;h<=i.length;++h){if(h<i.length)a=i.charCodeAt(h);else{if(a===47)break;a=47}if(a===47){if(!(r===h-1||n===1))if(r!==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("/")),r=h,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=h,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,h)}`:e=i.slice(r+1,h),s=h-r-1;r=h,n=0}else a===46&&n!==-1?++n:n=-1}return e}const bt={toPosix(i){return Bb(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){vs(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(vs(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=Jn(this.toPosix(t??z.ADAPTER.getBaseUrl())),r=Jn(this.toPosix(e??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?bt.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(vs(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=Db(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return vs(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){const s=i[e];if(vs(s),s.length>0)if(t===void 0)t=s;else{const r=i[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(vs(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let h=i.length-1;h>=1;--h)if(t=i.charCodeAt(h),t===47){if(!r){s=h;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){vs(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){vs(i),t&&vs(t),i=Jn(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let a=t.length-1,h=-1;for(n=i.length-1;n>=0;--n){const o=i.charCodeAt(n);if(o===47){if(!r){e=n+1;break}}else h===-1&&(r=!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=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){vs(i),i=Jn(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const h=i.charCodeAt(a);if(h===47){if(!r){e=a+1;break}continue}s===-1&&(r=!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?"":i.slice(t,s)},parse(i){vs(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Jn(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let n=-1,a=0,h=-1,o=!0,l=i.length-1,u=0;for(;l>=r;--l){if(e=i.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=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&s?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let _h;async function Ob(){return _h??(_h=(async()=>{var n;const i=document.createElement("canvas").getContext("webgl");if(!i)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=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);const s=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,s),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t);const r=new Uint8Array(4);return i.readPixels(0,0,1,1,i.RGBA,i.UNSIGNED_BYTE,r),i.deleteFramebuffer(s),i.deleteTexture(e),(n=i.getExtension("WEBGL_lose_context"))==null||n.loseContext(),r[0]<=r[3]?Re.PMA:Re.UNPACK})()),_h}let yh;function Lb(){return typeof yh>"u"&&(yh=function(){var t;const i={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",i)||e.getContext("experimental-webgl",i);const r=!!((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,r}catch{return!1}}()),yh}var Nb={grad:.9,turn:360,rad:360/(2*Math.PI)},gr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},fe=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},as=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Wf=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},zf=function(i){return{r:as(i.r,0,255),g:as(i.g,0,255),b:as(i.b,0,255),a:as(i.a)}},xh=function(i){return{r:fe(i.r),g:fe(i.g),b:fe(i.b),a:fe(i.a,3)}},Vb=/^#([0-9a-f]{3,8})$/i,na=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},jf=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),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:r}},qf=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),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:r}},Zf=function(i){return{h:Wf(i.h),s:as(i.s,0,100),l:as(i.l,0,100),a:as(i.a)}},Kf=function(i){return{h:fe(i.h),s:fe(i.s),l:fe(i.l),a:fe(i.a,3)}},Qf=function(i){return qf((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},to=function(i){return{h:(t=jf(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},Ub=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Gb=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$b=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vh={string:[[function(i){var t=Vb.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?fe(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?fe(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Xb.exec(i)||$b.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:zf({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Ub.exec(i)||Gb.exec(i);if(!t)return null;var e,s,r=Zf({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Nb[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Qf(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return gr(t)&&gr(e)&&gr(s)?zf({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!gr(t)||!gr(e)||!gr(s))return null;var a=Zf({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Qf(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!gr(t)||!gr(e)||!gr(s))return null;var a=function(h){return{h:Wf(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 qf(a)},"hsv"]]},Jf=function(i,t){for(var e=0;e<t.length;e++){var s=t[e][0](i);if(s)return[s,t[e][1]]}return[null,void 0]},Yb=function(i){return typeof i=="string"?Jf(i.trim(),vh.string):typeof i=="object"&&i!==null?Jf(i,vh.object):[null,void 0]},bh=function(i,t){var e=to(i);return{h:e.h,s:as(e.s+100*t,0,100),l:e.l,a:e.a}},wh=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},tp=function(i,t){var e=to(i);return{h:e.h,s:e.s,l:as(e.l+100*t,0,100),a:e.a}},Eh=function(){function i(t){this.parsed=Yb(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return fe(wh(this.rgba),2)},i.prototype.isDark=function(){return wh(this.rgba)<.5},i.prototype.isLight=function(){return wh(this.rgba)>=.5},i.prototype.toHex=function(){return t=xh(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?na(fe(255*n)):"","#"+na(e)+na(s)+na(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return xh(this.rgba)},i.prototype.toRgbString=function(){return t=xh(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return Kf(to(this.rgba))},i.prototype.toHslString=function(){return t=Kf(to(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=jf(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},i.prototype.invert=function(){return Hs({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Hs(bh(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Hs(bh(this.rgba,-t))},i.prototype.grayscale=function(){return Hs(bh(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Hs(tp(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Hs(tp(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Hs({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=to(this.rgba);return typeof t=="number"?Hs({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Hs(t).toHex()},i}(),Hs=function(i){return i instanceof Eh?i:new Eh(i)},ep=[],Hb=function(i){i.forEach(function(t){ep.indexOf(t)<0&&(t(Eh,vh),ep.push(t))})};function Wb(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var 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 i(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 i(o).toRgb():null},"name"])}Hb([Wb]);const rn=class wl{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 wl)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((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t??[];const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=wl.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const h=wl.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}const a=Hs(t);a.isValid()&&({r:e,g:s,b:r,a:n}=a.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}};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 sp(i,t=[]){return ot("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),Ct.shared.setValue(i).toRgbArray(t)}function zb(i){return ot("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ct.shared.setValue(i).toHex()}function eo(i){return ot("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ct.shared.setValue(i).toNumber()}function jb(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[W.NORMAL_NPM]=W.NORMAL,i[W.ADD_NPM]=W.ADD,i[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(i),e}const rp=jb();function ip(i,t){return rp[t?1:0][i]}function qb(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,r=0;s<e;s+=6,r+=4)t[s+0]=r+0,t[s+1]=r+1,t[s+2]=r+2,t[s+3]=r+0,t[s+4]=r+2,t[s+5]=r+3;return t}function np(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function oa(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function op(i){return!(i&i-1)&&!!i}function ap(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function nn(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;r<n;++r)i[r]=i[r+e];i.length=n}function Dr(i){return i===0?0:i<0?-1:1}let Zb=0;function gi(){return++Zb}const Th=class{constructor(i,t,e,s){this.left=i,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}};Th.EMPTY=new Th(0,0,0,0);let lp=Th;const hp={},Ws=Object.create(null),Or=Object.create(null);class Kb{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 cp(i,t,e){for(let s=0,r=4*e*t;s<t;++s,r+=4)if(i[r+3]!==0)return!1;return!0}function up(i,t,e,s,r){const n=4*t;for(let a=s,h=s*n+4*e;a<=r;++a,h+=n)if(i[h+3]!==0)return!1;return!0}function Qb(i){const{width:t,height:e}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const r=s.getImageData(0,0,t,e).data;let n=0,a=0,h=t-1,o=e-1;for(;a<e&&cp(r,t,a);)++a;if(a===e)return lp.EMPTY;for(;cp(r,t,o);)--o;for(;up(r,t,n,a,o);)++n;for(;up(r,t,h,a,o);)--h;return++h,++o,new lp(n,a,h,o)}function Jb(i){const t=Qb(i),{width:e,height:s}=t;let r=null;if(!t.isEmpty()){const n=i.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(t.left,t.top,e,s)}return{width:e,height:s,data:r}}function t1(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function _r(i,t=1){var s;const e=(s=z.RETINA_PREFIX)==null?void 0:s.exec(i);return e?parseFloat(e[1]):t}var Y=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(Y||{});const Ah=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},dp=(i,t)=>Ah(i).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ah).forEach(t=>{t.type.forEach(e=>{var s,r;return(r=(s=this._removeHandlers)[e])==null?void 0:r.call(s,t)})}),this},add(...i){return i.map(Ah).forEach(t=>{t.type.forEach(e=>{var n,a;const s=this._addHandlers,r=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(r[e]=r[e]||[],(a=r[e])==null||a.push(t))})}),this},handle(i,t,e){var a;const s=this._addHandlers,r=this._removeHandlers;if(s[i]||r[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=t,r[i]=e;const n=this._queue;return n[i]&&((a=n[i])==null||a.forEach(h=>t(h)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>dp(n,e)-dp(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Sh{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 e1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
+
`);function s1(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
12
|
+
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function r1(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=e1.replace(/%forloop%/gi,s1(i));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}const Ch=0,Ih=1,Ph=2,Rh=3,Mh=4,Fh=5;class zs{constructor(){this.data=0,this.blendMode=W.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ch)}set blend(t){!!(this.data&1<<Ch)!==t&&(this.data^=1<<Ch)}get offsets(){return!!(this.data&1<<Ih)}set offsets(t){!!(this.data&1<<Ih)!==t&&(this.data^=1<<Ih)}get culling(){return!!(this.data&1<<Ph)}set culling(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph)}get depthTest(){return!!(this.data&1<<Rh)}set depthTest(t){!!(this.data&1<<Rh)!==t&&(this.data^=1<<Rh)}get depthMask(){return!!(this.data&1<<Fh)}set depthMask(t){!!(this.data&1<<Fh)!==t&&(this.data^=1<<Fh)}get clockwiseFrontFace(){return!!(this.data&1<<Mh)}set clockwiseFrontFace(t){!!(this.data&1<<Mh)!==t&&(this.data^=1<<Mh)}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 zs;return t.depthTest=!1,t.blend=!0,t}}zs.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const kh=[];function fp(i,t){if(!i)return null;let e="";if(typeof i=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);s&&(e=s[1].toLowerCase())}for(let s=kh.length-1;s>=0;--s){const r=kh[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class bs{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,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,r,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(bs.prototype,{dispatch:{value:bs.prototype.emit},run:{value:bs.prototype.emit}});class so{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new bs("setRealSize"),this.onUpdate=new bs("update"),this.onError=new bs("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:r}=e||{};if(!s||!r)throw new Error("BufferResource width or height invalid");super(s,r),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,s){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,r.texImage2D(e.target,0,s.internalFormat,n,a,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const i1={scaleMode:je.NEAREST,alphaMode:Re.NPM},Bh=class On extends Gs{constructor(t=null,e=null){super(),e=Object.assign({},On.defaultOptions,e);const{alphaMode:s,mipmap:r,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=fp(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=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=gi(),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=op(this.realWidth)&&op(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 Or[this.cacheId],delete Ws[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 r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gi()}`}n=t._pixiId}let a=Or[n];if(r&&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,r){t=t||new Float32Array(e*s*4);const n=new aa(t,{width:e,height:s,...r==null?void 0:r.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({},i1,{type:h,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Or[e]&&Or[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Or[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Or[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Or[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Or[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Bh.defaultOptions={mipmap:xs.POW2,anisotropicLevel:0,scaleMode:je.LINEAR,wrapMode:Fr.CLAMP,alphaMode:Re.UNPACK,target:Wi.TEXTURE_2D,format:G.RGBA,type:tt.UNSIGNED_BYTE},Bh._globalBatch=0;let et=Bh;class Dh{constructor(){this.texArray=null,this.blend=0,this.type=ys.TRIANGLES,this.start=0,this.size=0,this.data=null}}let n1=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=n1++,this.disposeRunner=new bs("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?Vs.ELEMENT_ARRAY_BUFFER:Vs.ARRAY_BUFFER}get index(){return this.type===Vs.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,r=tt.FLOAT,n,a,h,o=1){this.buffer=t,this.size=e,this.normalized=s,this.type=r,this.stride=n,this.start=a,this.instance=h,this.divisor=o}destroy(){this.buffer=null}static from(t,e,s,r,n){return new la(t,e,s,r,n)}}const o1={Float32Array,Uint32Array,Int32Array,Uint8Array};function a1(i,t){let e=0,s=0;const r={};for(let o=0;o<i.length;o++)s+=t[o],e+=i[o].length;const n=new ArrayBuffer(e*4);let a=null,h=0;for(let o=0;o<i.length;o++){const l=t[o],u=i[o],c=np(u);r[c]||(r[c]=new o1[c](n)),a=r[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 pp={5126:4,5123:2,5121:1};let l1=0;const h1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Lr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=l1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new bs("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,r=!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,r,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,r,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=Vs.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 r;for(r in this.attributes){const n=this.attributes[r],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*pp[n.type]/4),n.buffer=0}for(s.data=a1(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].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 Lr;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=Vs.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Lr,s=[],r=[],n=[];let a;for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)r[o]=r[o]||0,r[o]+=a.buffers[o].data.length,n[o]=0}for(let h=0;h<a.buffers.length;h++)s[h]=new h1[np(a.buffers[h].data)](r[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=Vs.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*pp[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 mp extends Lr{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,c1=180/Math.PI,Oh=Math.PI/180;var xe=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(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 rt=class pd{constructor(t=0,e=0,s=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(r),this.type=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 pd(0,0,0,0)}clone(){return new pd(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,r=this.right,n=this.top,a=this.bottom;if(r<=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)>=r||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*r+f*n,g=d*s+f*a,_=d*r+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*r+y*n,w=x*s+y*a,E=x*r+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),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}};rt.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 r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=s}getBounds(){return new rt(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,r=0){this.x=t,this.y=e,this.width=s,this.height=r,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,r=(e-this.y)/this.height;return s*=s,r*=r,s+r<=1}getBounds(){return new rt(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 Nr{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let r=0,n=e.length;r<n;r++)s.push(e[r].x,e[r].y);e=s}this.points=e,this.type=xe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Nr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let s=!1;const r=this.points.length/2;for(let n=0,a=r-1;n<r;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}}Nr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};class fa{constructor(t=0,e=0,s=0,r=0,n=20){this.x=t,this.y=e,this.width=s,this.height=r,this.radius=n,this.type=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 r=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(r*r+n*n<=a||(r=t-(this.x+this.width-s),r*r+n*n<=a)||(n=e-(this.y+this.height-s),r*r+n*n<=a)||(r=t-(this.x+s),r*r+n*n<=a))return!0}return!1}}fa.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Rt{constructor(t=1,e=0,s=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,r,n,a){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new st;const s=t.x,r=t.y;return e.x=this.a*s+this.c*r+this.tx,e.y=this.b*s+this.d*r+this.ty,e}applyInverse(t,e){e=e||new st;const s=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*s*r+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*r+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*s,this.b=r*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=a*e-this.ty*s,this.ty=a*s+this.ty*e,this}append(t){const e=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,r,n,a,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+r*this.c),this.ty=e-(s*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,r=this.c,n=this.d,a=t.pivot,h=-Math.atan2(-r,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(r*r+n*n),t.position.x=this.tx+(a.x*e+a.y*r),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,a=t*r-e*s;return this.a=r/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new Rt;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 Rt}static get TEMP_MATRIX(){return new Rt}}Rt.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 _i=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],yi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Lh=[],gp=[],pa=Math.sign;function u1(){for(let i=0;i<16;i++){const t=[];Lh.push(t);for(let e=0;e<16;e++){const s=pa(_i[i]*_i[e]+xi[i]*yi[e]),r=pa(yi[i]*_i[e]+vi[i]*yi[e]),n=pa(_i[i]*xi[e]+xi[i]*vi[e]),a=pa(yi[i]*xi[e]+vi[i]*vi[e]);for(let h=0;h<16;h++)if(_i[h]===s&&yi[h]===r&&xi[h]===n&&vi[h]===a){t.push(h);break}}}for(let i=0;i<16;i++){const t=new Rt;t.set(_i[i],yi[i],xi[i],vi[i],0,0),gp.push(t)}}u1();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:i=>_i[i],uY:i=>yi[i],vX:i=>xi[i],vY:i=>vi[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Lh[i][t],sub:(i,t)=>Lh[i][Nt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Nt.S:Nt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Nt.E:Nt.W:t>0?i>0?Nt.SE:Nt.SW:i>0?Nt.NE:Nt.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=gp[Nt.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class js{constructor(t,e,s=0,r=0){this._x=s,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new js(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))}}js.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Nh=class{constructor(){this.worldTransform=new Rt,this.localTransform=new Rt,this.position=new js(this.onChange,this,0,0),this.scale=new js(this.onChange,this,1,1),this.pivot=new js(this.onChange,this,0,0),this.skew=new js(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 i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){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!==i._worldID){const e=i.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=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Nh.IDENTITY=new Nh;let ma=Nh;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 d1=`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
|
-
}`,
|
|
18
|
+
}`,f1=`attribute vec2 aVertexPosition;
|
|
19
19
|
attribute vec2 aTextureCoord;
|
|
20
20
|
|
|
21
21
|
uniform mat3 projectionMatrix;
|
|
@@ -26,64 +26,64 @@ 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
|
|
30
|
-
if(uv["${
|
|
29
|
+
`;function _p(i,t,e){const s=i.createShader(t);return i.shaderSource(s,e),i.compileShader(s),s}function Vh(i){const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function yp(i,t){switch(i){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 Vh(2*t);case"bvec3":return Vh(3*t);case"bvec4":return Vh(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:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
|
|
30
|
+
if(uv["${i}"] !== ud["${i}"].value)
|
|
31
31
|
{
|
|
32
|
-
ud["${
|
|
33
|
-
gl.uniform1f(ud["${
|
|
32
|
+
ud["${i}"].value = uv["${i}"]
|
|
33
|
+
gl.uniform1f(ud["${i}"].location, uv["${i}"])
|
|
34
34
|
}
|
|
35
|
-
`},{test:(
|
|
35
|
+
`},{test:(i,t)=>(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(t==null||t.castToBaseTexture!==void 0),code:i=>`t = syncData.textureCount++;
|
|
36
36
|
|
|
37
|
-
renderer.texture.bind(uv["${
|
|
37
|
+
renderer.texture.bind(uv["${i}"], t);
|
|
38
38
|
|
|
39
|
-
if(ud["${
|
|
39
|
+
if(ud["${i}"].value !== t)
|
|
40
40
|
{
|
|
41
|
-
ud["${
|
|
42
|
-
gl.uniform1i(ud["${
|
|
41
|
+
ud["${i}"].value = t;
|
|
42
|
+
gl.uniform1i(ud["${i}"].location, t);
|
|
43
43
|
; // eslint-disable-line max-len
|
|
44
|
-
}`},{test:(
|
|
45
|
-
gl.uniformMatrix3fv(ud["${
|
|
46
|
-
`,codeUbo:
|
|
47
|
-
var ${
|
|
48
|
-
|
|
49
|
-
data[offset] = ${
|
|
50
|
-
data[offset+1] = ${
|
|
51
|
-
data[offset+2] = ${
|
|
44
|
+
}`},{test:(i,t)=>i.type==="mat3"&&i.size===1&&!i.isArray&&t.a!==void 0,code:i=>`
|
|
45
|
+
gl.uniformMatrix3fv(ud["${i}"].location, false, uv["${i}"].toArray(true));
|
|
46
|
+
`,codeUbo:i=>`
|
|
47
|
+
var ${i}_matrix = uv.${i}.toArray(true);
|
|
48
|
+
|
|
49
|
+
data[offset] = ${i}_matrix[0];
|
|
50
|
+
data[offset+1] = ${i}_matrix[1];
|
|
51
|
+
data[offset+2] = ${i}_matrix[2];
|
|
52
52
|
|
|
53
|
-
data[offset + 4] = ${
|
|
54
|
-
data[offset + 5] = ${
|
|
55
|
-
data[offset + 6] = ${
|
|
53
|
+
data[offset + 4] = ${i}_matrix[3];
|
|
54
|
+
data[offset + 5] = ${i}_matrix[4];
|
|
55
|
+
data[offset + 6] = ${i}_matrix[5];
|
|
56
56
|
|
|
57
|
-
data[offset + 8] = ${
|
|
58
|
-
data[offset + 9] = ${
|
|
59
|
-
data[offset + 10] = ${
|
|
60
|
-
`},{test:(
|
|
61
|
-
cv = ud["${
|
|
62
|
-
v = uv["${
|
|
57
|
+
data[offset + 8] = ${i}_matrix[6];
|
|
58
|
+
data[offset + 9] = ${i}_matrix[7];
|
|
59
|
+
data[offset + 10] = ${i}_matrix[8];
|
|
60
|
+
`},{test:(i,t)=>i.type==="vec2"&&i.size===1&&!i.isArray&&t.x!==void 0,code:i=>`
|
|
61
|
+
cv = ud["${i}"].value;
|
|
62
|
+
v = uv["${i}"];
|
|
63
63
|
|
|
64
64
|
if(cv[0] !== v.x || cv[1] !== v.y)
|
|
65
65
|
{
|
|
66
66
|
cv[0] = v.x;
|
|
67
67
|
cv[1] = v.y;
|
|
68
|
-
gl.uniform2f(ud["${
|
|
69
|
-
}`,codeUbo:
|
|
70
|
-
v = uv.${
|
|
68
|
+
gl.uniform2f(ud["${i}"].location, v.x, v.y);
|
|
69
|
+
}`,codeUbo:i=>`
|
|
70
|
+
v = uv.${i};
|
|
71
71
|
|
|
72
72
|
data[offset] = v.x;
|
|
73
73
|
data[offset+1] = v.y;
|
|
74
|
-
`},{test:
|
|
75
|
-
cv = ud["${
|
|
76
|
-
v = uv["${
|
|
74
|
+
`},{test:i=>i.type==="vec2"&&i.size===1&&!i.isArray,code:i=>`
|
|
75
|
+
cv = ud["${i}"].value;
|
|
76
|
+
v = uv["${i}"];
|
|
77
77
|
|
|
78
78
|
if(cv[0] !== v[0] || cv[1] !== v[1])
|
|
79
79
|
{
|
|
80
80
|
cv[0] = v[0];
|
|
81
81
|
cv[1] = v[1];
|
|
82
|
-
gl.uniform2f(ud["${
|
|
82
|
+
gl.uniform2f(ud["${i}"].location, v[0], v[1]);
|
|
83
83
|
}
|
|
84
|
-
`},{test:(
|
|
85
|
-
cv = ud["${
|
|
86
|
-
v = uv["${
|
|
84
|
+
`},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.width!==void 0,code:i=>`
|
|
85
|
+
cv = ud["${i}"].value;
|
|
86
|
+
v = uv["${i}"];
|
|
87
87
|
|
|
88
88
|
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
|
89
89
|
{
|
|
@@ -91,17 +91,17 @@ void main(void){
|
|
|
91
91
|
cv[1] = v.y;
|
|
92
92
|
cv[2] = v.width;
|
|
93
93
|
cv[3] = v.height;
|
|
94
|
-
gl.uniform4f(ud["${
|
|
95
|
-
}`,codeUbo:
|
|
96
|
-
v = uv.${
|
|
94
|
+
gl.uniform4f(ud["${i}"].location, v.x, v.y, v.width, v.height)
|
|
95
|
+
}`,codeUbo:i=>`
|
|
96
|
+
v = uv.${i};
|
|
97
97
|
|
|
98
98
|
data[offset] = v.x;
|
|
99
99
|
data[offset+1] = v.y;
|
|
100
100
|
data[offset+2] = v.width;
|
|
101
101
|
data[offset+3] = v.height;
|
|
102
|
-
`},{test:(
|
|
103
|
-
cv = ud["${
|
|
104
|
-
v = uv["${
|
|
102
|
+
`},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>`
|
|
103
|
+
cv = ud["${i}"].value;
|
|
104
|
+
v = uv["${i}"];
|
|
105
105
|
|
|
106
106
|
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
|
|
107
107
|
{
|
|
@@ -109,17 +109,17 @@ void main(void){
|
|
|
109
109
|
cv[1] = v.green;
|
|
110
110
|
cv[2] = v.blue;
|
|
111
111
|
cv[3] = v.alpha;
|
|
112
|
-
gl.uniform4f(ud["${
|
|
113
|
-
}`,codeUbo:
|
|
114
|
-
v = uv.${
|
|
112
|
+
gl.uniform4f(ud["${i}"].location, v.red, v.green, v.blue, v.alpha)
|
|
113
|
+
}`,codeUbo:i=>`
|
|
114
|
+
v = uv.${i};
|
|
115
115
|
|
|
116
116
|
data[offset] = v.red;
|
|
117
117
|
data[offset+1] = v.green;
|
|
118
118
|
data[offset+2] = v.blue;
|
|
119
119
|
data[offset+3] = v.alpha;
|
|
120
|
-
`},{test:(
|
|
121
|
-
cv = ud["${
|
|
122
|
-
v = uv["${
|
|
120
|
+
`},{test:(i,t)=>i.type==="vec3"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>`
|
|
121
|
+
cv = ud["${i}"].value;
|
|
122
|
+
v = uv["${i}"];
|
|
123
123
|
|
|
124
124
|
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
|
|
125
125
|
{
|
|
@@ -127,16 +127,16 @@ void main(void){
|
|
|
127
127
|
cv[1] = v.green;
|
|
128
128
|
cv[2] = v.blue;
|
|
129
129
|
|
|
130
|
-
gl.uniform3f(ud["${
|
|
131
|
-
}`,codeUbo:
|
|
132
|
-
v = uv.${
|
|
130
|
+
gl.uniform3f(ud["${i}"].location, v.red, v.green, v.blue)
|
|
131
|
+
}`,codeUbo:i=>`
|
|
132
|
+
v = uv.${i};
|
|
133
133
|
|
|
134
134
|
data[offset] = v.red;
|
|
135
135
|
data[offset+1] = v.green;
|
|
136
136
|
data[offset+2] = v.blue;
|
|
137
|
-
`},{test:
|
|
138
|
-
cv = ud["${
|
|
139
|
-
v = uv["${
|
|
137
|
+
`},{test:i=>i.type==="vec4"&&i.size===1&&!i.isArray,code:i=>`
|
|
138
|
+
cv = ud["${i}"].value;
|
|
139
|
+
v = uv["${i}"];
|
|
140
140
|
|
|
141
141
|
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
142
142
|
{
|
|
@@ -145,8 +145,8 @@ void main(void){
|
|
|
145
145
|
cv[2] = v[2];
|
|
146
146
|
cv[3] = v[3];
|
|
147
147
|
|
|
148
|
-
gl.uniform4f(ud["${
|
|
149
|
-
}`}],
|
|
148
|
+
gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3])
|
|
149
|
+
}`}],p1={float:`
|
|
150
150
|
if (cv !== v)
|
|
151
151
|
{
|
|
152
152
|
cu.value = v;
|
|
@@ -282,36 +282,36 @@ void main(void){
|
|
|
282
282
|
cu.value = v;
|
|
283
283
|
|
|
284
284
|
gl.uniform1i(location, v);
|
|
285
|
-
}`},
|
|
285
|
+
}`},m1={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 g1(i,t){var s;const e=[`
|
|
286
286
|
var v = null;
|
|
287
287
|
var cv = null;
|
|
288
288
|
var cu = null;
|
|
289
289
|
var t = 0;
|
|
290
290
|
var gl = renderer.gl;
|
|
291
|
-
`];for(const r in
|
|
291
|
+
`];for(const r in i.uniforms){const n=t[r];if(!n){((s=i.uniforms[r])==null?void 0:s.group)===!0&&(i.uniforms[r].ubo?e.push(`
|
|
292
292
|
renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');
|
|
293
293
|
`):e.push(`
|
|
294
294
|
renderer.shader.syncUniformGroup(uv.${r}, syncData);
|
|
295
|
-
`));continue}const a=
|
|
295
|
+
`));continue}const a=i.uniforms[r];let h=!1;for(let o=0;o<on.length;o++)if(on[o].test(n,a)){e.push(on[o].code(r,a)),h=!0;break}if(!h){const o=(n.size===1&&!n.isArray?p1:m1)[n.type].replace("location",`ud["${r}"].location`);e.push(`
|
|
296
296
|
cu = ud["${r}"];
|
|
297
297
|
cv = cu.value;
|
|
298
298
|
v = uv["${r}"];
|
|
299
|
-
${
|
|
300
|
-
`))}const
|
|
301
|
-
`).map((u
|
|
302
|
-
`),n={},a=r.map(
|
|
303
|
-
`);
|
|
304
|
-
${
|
|
305
|
-
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${
|
|
306
|
-
${this.fragmentSrc}`,this.vertexSrc=
|
|
299
|
+
${o};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
300
|
+
`))}const xp={};let an=xp;function _1(){if(an===xp||an!=null&&an.isContextLost()){const i=z.ADAPTER.createCanvas();let t;z.PREFER_ENV>=Ls.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),an=t}return an}let ga;function y1(){if(!ga){ga=os.MEDIUM;const i=_1();if(i&&i.getShaderPrecisionFormat){const t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(ga=t.precision?os.HIGH:os.MEDIUM)}}return ga}function vp(i,t){const e=i.getShaderSource(t).split(`
|
|
301
|
+
`).map((l,u)=>`${u}: ${l}`),s=i.getShaderInfoLog(t),r=s.split(`
|
|
302
|
+
`),n={},a=r.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 x1(i,t,e,s){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||vp(i,e),i.getShaderParameter(s,i.COMPILE_STATUS)||vp(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}const v1={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 bp(i){return v1[i]}let _a=null;const wp={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 Ep(i,t){if(!_a){const e=Object.keys(wp);_a={};for(let s=0;s<e.length;++s){const r=e[s];_a[i[r]]=wp[r]}}return _a[t]}function Tp(i,t,e){if(i.substring(0,9)!=="precision"){let s=t;return t===os.HIGH&&e!==os.HIGH&&(s=os.MEDIUM),`precision ${s} float;
|
|
304
|
+
${i}`}else if(e!==os.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}let ro;function b1(){if(typeof ro=="boolean")return ro;try{ro=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ro=!1}return ro}let w1=0;const ya={},Uh=class Ln{constructor(t,e,s="pixi-shader",r={}){this.extra={},this.id=w1++,this.vertexSrc=t||Ln.defaultVertexSrc,this.fragmentSrc=e||Ln.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=r,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
|
+
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${s}
|
|
306
|
+
${this.fragmentSrc}`,this.vertexSrc=Tp(this.vertexSrc,Ln.defaultVertexPrecision,os.HIGH),this.fragmentSrc=Tp(this.fragmentSrc,Ln.defaultFragmentPrecision,y1())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return f1}static get defaultFragmentSrc(){return d1}static from(t,e,s){const r=t+e;let n=hp[r];return n||(hp[r]=n=new Ln(t,e,s)),n}};Uh.defaultVertexPrecision=os.HIGH,Uh.defaultFragmentPrecision=fr.apple.device?os.HIGH:os.MEDIUM;let yr=Uh,E1=0;class ws{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=E1++,this.static=!!e,this.ubo=!!s,t instanceof Jt?(this.buffer=t,this.buffer.type=Vs.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Jt(new Float32Array(1)),this.buffer.type=Vs.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 ws(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 ws(t,e,s)}static uboFrom(t,e){return new ws(t,e??!0,!0)}}class qs{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof ws?this.uniformGroup=e:this.uniformGroup=new ws(e):this.uniformGroup=new ws({}),this.disposeRunner=new bs("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const r=e.uniforms[s];if(r.group===!0&&this.checkUniformExists(t,r))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 r=yr.from(t,e);return new qs(r,s)}}class T1{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]=ws.from({uSamplers:s},!0);let r=this.fragTemplate;r=r.replace(/%count%/gi,`${t}`),r=r.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new yr(this.vertexSrc,r)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:this.defaultGroupCache[t]};return new qs(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
307
307
|
`,e+=`
|
|
308
|
-
`;for(let
|
|
309
|
-
else `),
|
|
308
|
+
`;for(let s=0;s<t;s++)s>0&&(e+=`
|
|
309
|
+
else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
|
|
310
310
|
{`,e+=`
|
|
311
|
-
color = texture2D(uSamplers[${
|
|
311
|
+
color = texture2D(uSamplers[${s}], vTextureCoord);`,e+=`
|
|
312
312
|
}`;return e+=`
|
|
313
313
|
`,e+=`
|
|
314
|
-
`,e}}class
|
|
314
|
+
`,e}}class Gh{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 A1(){return!fr.apple.device}function S1(i){let t=!0;const e=z.ADAPTER.getNavigator();if(fr.tablet||fr.phone){if(fr.apple.device){const s=e.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(t=!1)}if(fr.android.device){const s=e.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(t=!1)}}return t?i:4}class xa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var C1=`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
|
-
`,
|
|
324
|
+
`,I1=`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
|
|
345
|
+
`;const io=class Fs extends xa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=mp,this.vertexSize=6,this.state=zs.for2d(),this.size=Fs.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??S1(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??A1(),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 I1}static get defaultFragmentTemplate(){return C1}setShaderGenerator({vertex:t=Fs.defaultVertexSrc,fragment:e=Fs.defaultFragmentTemplate}={}){this.shaderGenerator=new T1(t,e)}contextChange(){const t=this.renderer.gl;z.PREFER_ENV===Ls.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Fs.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}=Fs,s=this.size/4,r=Math.floor(s/this.maxTextures)+1;for(;t.length<s;)t.push(new Dh);for(;e.length<r;)e.push(new Gh);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=Fs._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let h=++et._globalBatch,o=0,l=s[0],u=0;r.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==h&&(l.count>=e&&(r.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&&(r.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:r,_attributeBuffer:n,_indexBuffer:a,vertexSize:h}=this,o=Fs._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=r[f],m=p._texture.baseTexture,g=rp[m.alphaMode?1:0][p.blendMode];r[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;Fs.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,r=Fs._drawCallPool;let n=null;for(let a=0;a<t;a++){const{texArray:h,type:o,size:l,start:u,blend:c}=r[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),Fs.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=ap(e),r=e*8;this._aBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._aBuffers[r];return n||(this._aBuffers[r]=n=new Sh(r*this.vertexSize*4)),n}getIndexBuffer(t){const e=oa(Math.ceil(t/12)),s=ap(e),r=e*12;this._iBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._iBuffers[s];return n||(this._iBuffers[s]=n=new Uint16Array(r)),n}packInterleavedGeometry(t,e,s,r,n){const{uint32View:a,float32View:h}=e,o=r/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[r++]=c[m],h[r++]=c[m+1],h[r++]=l[m],h[r++]=l[m+1],a[r++]=p,h[r++]=d;for(let m=0;m<u.length;m++)s[n++]=o+u[m]}};io.defaultBatchSize=4096,io.extension={name:"batch",type:Y.RendererPlugin},io._drawCallPool=[],io._textureArrayPool=[];let bi=io;K.add(bi);var P1=`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
|
-
`,
|
|
352
|
+
`,R1=`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 Uh=class Rn extends hi{constructor(t,e,i){const r=Ri.from(t||Rn.defaultVertexSrc,e||Rn.defaultFragmentSrc);super(r,i),this.padding=0,this.resolution=Rn.defaultResolution,this.multisample=Rn.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new ai}apply(t,e,i,r,n){t.applyFilter(this,e,i,r)}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 jx}static get defaultFragmentSrc(){return Yx}};Uh.defaultResolution=1,Uh.defaultMultisample=Ht.NONE;let Yt=Uh;class ma{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new pt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:r}=t,n=i??e;n!==void 0&&(this.color=n),this.alpha=r}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(){}}ma.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ma.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"background"},z.add(ma);class ef{constructor(t){this.renderer=t,this.emptyRenderer=new pa(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:i}=this.renderer.texture;for(let r=e-1;r>=0;--r)t[r]=i[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,i,r){const{elements:n,ids:a,count:o}=t;let h=0;for(let u=0;u<o;u++){const d=n[u],l=d._batchLocation;if(l>=0&&l<r&&e[l]===d){a[u]=l;continue}for(;h<r;){const c=e[h];if(c&&c._batchEnabled===i&&c._batchLocation===h){h++;continue}a[u]=h,d._batchLocation=h,e[h]=d;break}}}destroy(){this.renderer=null}}ef.extension={type:G.RendererSystem,name:"batch"},z.add(ef);let sf=0;class _a{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=sf++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,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=sf++,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 i;if(H.PREFER_ENV>=qe.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,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(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}_a.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},_a.extension={type:G.RendererSystem,name:"context"},z.add(_a);class Gh{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 He("disposeFramebuffer"),this.multisample=Ht.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new J(null,{scaleMode:wi.NEAREST,resolution:1,mipmap:Ke.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new J(null,{scaleMode:wi.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ke.OFF,format:O.DEPTH_COMPONENT,type:Z.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 i=0;i<this.colorTextures.length;i++){const r=this.colorTextures[i],n=r.resolution;r.setSize(t/n,e/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class rf extends J{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],r=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:r,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Ht.NONE),super(null,t),this.mipmap=Ke.OFF,this.valid=!0,this._clear=new pt([0,0,0,0]),this.framebuffer=new Gh(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 Mi extends Jr{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,r=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,r),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=yx(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,r){const n=t.gl,a=e.realWidth,o=e.realHeight;if(r=r||this.source,typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement){if(!r.complete||r.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===he.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===a&&i.height===o?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,r):(i.width=a,i.height=o,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,r)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class nf extends Mi{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Mi.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}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??H.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,i)=>{const r=this.source;this.url=r.src;const n=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};r.complete&&r.src?n():(r.onload=n,r.onerror=a=>{i(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,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===he.UNPACK?"premultiply":"none"})).then(r=>this.destroyed?Promise.reject():(this.bitmap=r,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==i&&o.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Hh{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,i){const r=e.width,n=e.height;if(i){const a=t.width/2/r,o=t.height/2/n,h=t.x/r+a,u=t.y/n+o;i=At.add(i,At.NW),this.x0=h+a*At.uX(i),this.y0=u+o*At.uY(i),i=At.add(i,2),this.x1=h+a*At.uX(i),this.y1=u+o*At.uY(i),i=At.add(i,2),this.x2=h+a*At.uX(i),this.y2=u+o*At.uY(i),i=At.add(i,2),this.x3=h+a*At.uX(i),this.y3=u+o*At.uY(i)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}Hh.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 af=new Hh;function ga(s){s.destroy=function(){},s.on=function(){},s.once=function(){},s.emit=function(){}}class W extends ti{constructor(t,e,i,r,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new st(0,0,1,1)),t instanceof W&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=af,this.uvMatrix=null,this.orig=i||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 tt(a.x,a.y):new tt(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&ni[e.url]&&W.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,W.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var r;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new W(this.baseTexture,!this.noFrame&&t,e,(r=this.trim)==null?void 0:r.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===af&&(this._uvs=new Hh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=H.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof J){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${ys()}`,J.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${ys()}`}n=t._pixiId}let a=ni[n];if(r&&i&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof J)?(e.resolution||(e.resolution=Ii(t)),a=new W(new J(t,e)),a.baseTexture.cacheId=n,J.addToCache(a.baseTexture,n),W.addToCache(a,n)):!a&&t instanceof J&&(a=new W(t),W.addToCache(a,n)),a}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=W.from(t,Object.assign({resourceOptions:i},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,i,r){return new W(J.fromBuffer(t,e,i,r))}static fromLoader(t,e,i,r){const n=new J(t,Object.assign({scaleMode:J.defaultOptions.scaleMode,resolution:Ii(e)},r)),{resource:a}=n;a instanceof nf&&(a.url=e);const o=new W(n);return i||(i=e),J.addToCache(o.baseTexture,i),W.addToCache(o,i),i!==e&&(J.addToCache(o.baseTexture,e),W.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),ni[e]&&ni[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),ni[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=ni[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete ni[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)ni[t.textureCacheIds[e]]===t&&delete ni[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:i,width:r,height:n}=t,a=e+r>this.baseTexture.width,o=i+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",u=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,d=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${u} ${h} ${d}`)}this.valid=r&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return W._EMPTY||(W._EMPTY=new W(new J),ga(W._EMPTY),ga(W._EMPTY.baseTexture)),W._EMPTY}static get WHITE(){if(!W._WHITE){const t=H.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),W._WHITE=new W(J.from(t)),ga(W._WHITE),ga(W._WHITE.baseTexture)}return W._WHITE}}class Es extends W{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,i=!0){const r=this.baseTexture.resolution,n=Math.round(t*r)/r,a=Math.round(e*r)/r;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,i&&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 Es(new rf(t))}}class of{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Ht.NONE){const r=new rf(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Es(r)}getOptimalTexture(t,e,i=1,r=Ht.NONE){let n;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=ea(t),e=ea(e),n=((t&65535)<<16|e&65535)>>>0,r>1&&(n+=r*4294967296)):n=r>1?-r:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,r)),a.filterPoolKey=n,a.setResolution(i),a}getFilterTexture(t,e,i){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Ht.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const i=this.texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].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 i=this.texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}of.SCREEN_KEY=-1;class qx extends zi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class hf extends zi{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 Nt(this.vertices),this.uvBuffer=new Nt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,r=0;return this.uvs[0]=i,this.uvs[1]=r,this.uvs[2]=i+e.width/t.width,this.uvs[3]=r,this.uvs[4]=i+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=i,this.uvs[7]=r+e.height/t.height,i=e.x,r=e.y,this.vertices[0]=i,this.vertices[1]=r,this.vertices[2]=i+e.width,this.vertices[3]=r,this.vertices[4]=i+e.width,this.vertices[5]=r+e.height,this.vertices[6]=i,this.vertices[7]=r+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class Kx{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ht.NONE,this.sourceFrame=new st,this.destinationFrame=new st,this.bindingSourceFrame=new st,this.bindingDestinationFrame=new st,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const ya=[new tt,new tt,new tt,new tt],Vh=new gt;class lf{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new of,this.statePool=[],this.quad=new qx,this.quadUv=new hf,this.tempRect=new st,this.activeState={},this.globalUniforms=new Ve({outputFrame:new st,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 i=this.renderer,r=this.defaultFilterStack,n=this.statePool.pop()||new Kx,a=i.renderTexture;let o,h;if(a.current){const _=a.current;o=_.resolution,h=_.multisample}else o=i.resolution,h=i.multisample;let u=e[0].resolution||o,d=e[0].multisample??h,l=e[0].padding,c=e[0].autoFit,f=e[0].legacy??!0;for(let _=1;_<e.length;_++){const g=e[_];u=Math.min(u,g.resolution||o),d=Math.min(d,g.multisample??h),l=this.useMaxPadding?Math.max(l,g.padding):l+g.padding,c=c&&g.autoFit,f=f||(g.legacy??!0)}r.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),r.push(n),n.resolution=u,n.multisample=d,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(l);const p=this.tempRect.copyFrom(a.sourceFrame);i.projection.transform&&this.transformAABB(Vh.copyFrom(i.projection.transform).invert(),p),c?(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:i.resolution,a.sourceFrame,a.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,u,d),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=i.projection.transform,i.projection.transform=null,a.bind(n.renderTexture,n.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;const n=r.inputSize,a=r.inputPixel,o=r.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],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=e.sourceFrame.width*n[2]-.5*a[2],o[3]=e.sourceFrame.height*n[3]-.5*a[3],e.legacy){const u=r.filterArea;u[0]=e.destinationFrame.width,u[1]=e.destinationFrame.height,u[2]=e.sourceFrame.x,u[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,h.renderTexture,Ze.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let u=e.renderTexture,d=this.getOptimalFilterTexture(u.width,u.height,e.resolution);d.filterFrame=u.filterFrame;let l=0;for(l=0;l<i.length-1;++l){l===1&&e.multisample>1&&(d=this.getOptimalFilterTexture(u.width,u.height,e.resolution),d.filterFrame=u.filterFrame),i[l].apply(this,u,d,Ze.CLEAR,e);const c=u;u=d,d=c}i[l].apply(this,u,h.renderTexture,Ze.BLEND,e),l>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(u),this.returnFilterTexture(d)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ze.CLEAR){const{renderTexture:i,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0:t.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,i.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=r.stateId&1||this.forceClear;(e===Ze.CLEAR||e===Ze.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Ue.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Ue.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:r}=this.activeState,{orig:n}=e._texture,a=t.set(r.width,0,0,r.height,i.x,i.y),o=e.worldTransform.copyTo(gt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(e.anchor.x,e.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,r=Ht.NONE){return this.texturePool.getOptimalTexture(t,e,i,r)}getFilterTexture(t,e,i){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Ht.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=ya[0],r=ya[1],n=ya[2],a=ya[3];i.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(i,i),t.apply(r,r),t.apply(n,n),t.apply(a,a);const o=Math.min(i.x,r.x,n.x,a.x),h=Math.min(i.y,r.y,n.y,a.y),u=Math.max(i.x,r.x,n.x,a.x),d=Math.max(i.y,r.y,n.y,a.y);e.x=o,e.y=h,e.width=u-o,e.height=d-h}roundFrame(t,e,i,r,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a,b:o,c:h,d:u}=n;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(u)>1e-4))return}n=n?Vh.copyFrom(n):Vh.identity(),n.translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}lf.extension={type:G.RendererSystem,name:"filter"},z.add(lf);class Zx{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ht.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Qx=new st;class uf{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Gh(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 st,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;H.PREFER_ENV===qe.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){const{gl:r}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a<t.colorTextures.length;a++){const o=t.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const a=e.width>>i,o=e.height>>i,h=a/e.width;this.setViewport(e.x*h,e.y*h,a,o)}else{const a=t.width>>i,o=t.height>>i;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),(n.width!==i||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=r,this.gl.viewport(t,e,i,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,r,n=Eo.COLOR|Eo.DEPTH){const{gl:a}=this;a.clearColor(t,e,i,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new Zx(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.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,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){const o=r[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0),a===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,h._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:i}=this,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let a=n.length;i.drawBuffers||(a=Math.min(a,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||i.createRenderbuffer():r.msaaBuffer&&(i.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const o=[];for(let h=0;h<a;h++){const u=n[h],d=u.parentTextureArray||u;this.renderer.texture.bind(d,0),h===0&&r.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,r.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,d._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,u.target,d._glTextures[this.CONTEXT_UID].texture,e),o.push(i.COLOR_ATTACHMENT0+h))}if(o.length>1&&i.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||i.createRenderbuffer();let h,u;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,u=i.DEPTH_STENCIL):t.depth&&t.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,u=i.DEPTH24_STENCIL8):t.depth?(h=i.DEPTH_ATTACHMENT,u=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,u=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,r.stencil),r.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,u,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,u,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,r.stencil)}else r.stencil&&(i.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=Ht.NONE;if(t<=1||e===null)return i;for(let r=0;r<e.length;r++)if(e[r]<=t){i=e[r];break}return i===1&&(i=Ht.NONE),i}blit(t,e,i){const{current:r,renderer:n,gl:a,CONTEXT_UID:o}=this;if(n.context.webGLVersion!==2||!r)return;const h=r.glFramebuffers[o];if(!h)return;if(!t){if(!h.msaaBuffer)return;const d=r.colorTextures[0];if(!d)return;h.blitFramebuffer||(h.blitFramebuffer=new Gh(r.width,r.height),h.blitFramebuffer.addColorTexture(0,d)),t=h.blitFramebuffer,t.colorTextures[0]!==d&&(t.colorTextures[0]=d,t.dirtyId++,t.dirtyFormat++),(t.width!==r.width||t.height!==r.height)&&(t.width=r.width,t.height=r.height,t.dirtyId++,t.dirtySize++)}e||(e=Qx,e.width=r.width,e.height=r.height),i||(i=e);const u=e.width===i.width&&e.height===i.height;this.bind(t),a.bindFramebuffer(a.READ_FRAMEBUFFER,h.framebuffer),a.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,a.COLOR_BUFFER_BIT,u?a.NEAREST:a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const i=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(!i)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||(r.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&r.deleteRenderbuffer(i.msaaBuffer),i.stencil&&r.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],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 i=t.width,r=t.height,n=this.gl,a=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,a);let o,h;this.renderer.context.webGLVersion===1?(o=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(o=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(o=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,i,r):n.renderbufferStorage(n.RENDERBUFFER,h,i,r),n.framebufferRenderbuffer(n.FRAMEBUFFER,o,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new st}destroy(){this.renderer=null}}uf.extension={type:G.RendererSystem,name:"framebuffer"},z.add(uf);const Xh={5126:4,5123:2,5121:1};class cf{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 i=this.renderer.context.extensions.vertexArrayObject;H.PREFER_ENV===qe.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=r=>i.bindVertexArrayOES(r),t.deleteVertexArray=r=>i.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(r,n)=>i.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,a,o,h)=>i.drawElementsInstancedANGLE(r,n,a,o,h),t.drawArraysInstanced=(r,n,a,o)=>i.drawArraysInstancedANGLE(r,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=this;let r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);const a=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?i.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const r=t.buffers[i];e.update(r)}}checkCompatibility(t,e){const i=t.attributes,r=e.attributeData;for(const n in r)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,r=e.attributeData,n=["g",t.id];for(const a in i)r[a]&&n.push(a,r[a].location);return n.join("-")}initGeometryVao(t,e,i=!0){const r=this.gl,n=this.CONTEXT_UID,a=this.renderer.buffer,o=e.program;o.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);const h=this.getSignature(t,o),u=t.glVertexArrayObjects[this.CONTEXT_UID];let d=u[h];if(d)return u[o.id]=d,d;const l=t.buffers,c=t.attributes,f={},p={};for(const m in l)f[m]=0,p[m]=0;for(const m in c)!c[m].size&&o.attributeData[m]?c[m].size=o.attributeData[m].size:c[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[c[m].buffer]+=c[m].size*Xh[c[m].type];for(const m in c){const _=c[m],g=_.size;_.stride===void 0&&(f[_.buffer]===g*Xh[_.type]?_.stride=0:_.stride=f[_.buffer]),_.start===void 0&&(_.start=p[_.buffer],p[_.buffer]+=g*Xh[_.type])}d=r.createVertexArray(),r.bindVertexArray(d);for(let m=0;m<l.length;m++){const _=l[m];a.bind(_),i&&_._glBuffers[n].refCount++}return this.activateVao(t,o),u[o.id]=d,u[h]=d,r.bindVertexArray(null),a.unbind(Qe.ARRAY_BUFFER),d}disposeGeometry(t,e){var o;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],r=this.gl,n=t.buffers,a=(o=this.renderer)==null?void 0:o.buffer;if(t.disposeRunner.remove(this),!!i){if(a)for(let h=0;h<n.length;h++){const u=n[h]._glBuffers[this.CONTEXT_UID];u&&(u.refCount--,u.refCount===0&&!e&&a.dispose(n[h],e))}if(!e){for(const h in i)if(h[0]==="g"){const u=i[h];this._activeVao===u&&this.unbind(),r.deleteVertexArray(u)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,a=t.buffers,o=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const u in o){const d=o[u],l=a[d.buffer],c=l._glBuffers[r];if(e.attributeData[u]){h!==c&&(n.bind(l),h=c);const f=e.attributeData[u].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,d.size,d.type||i.FLOAT,d.normalized,d.stride,d.start),d.instance)if(this.hasInstance)i.vertexAttribDivisor(f,d.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,r){const{gl:n}=this,a=this._activeGeometry;if(a.indexBuffer){const o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?n.drawElementsInstanced(t,e||a.indexBuffer.data.length,h,(i||0)*o,r||1):n.drawElements(t,e||a.indexBuffer.data.length,h,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?n.drawArraysInstanced(t,i,e||a.getSize(),r||1):n.drawArrays(t,i,e||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}cf.extension={type:G.RendererSystem,name:"geometry"},z.add(cf);const df=new gt;class ff{constructor(t,e){this._texture=t,this.mapCoord=new gt,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 i=this.mapCoord;for(let r=0;r<t.length;r+=2){const n=t[r],a=t[r+1];e[r]=n*i.a+a*i.c+i.tx,e[r+1]=n*i.b+a*i.d+i.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 i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const r=e.orig,n=e.trim;n&&(df.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(df));const a=e.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,u=this.clampOffset;return o[0]=(e._frame.x+h+u)/a.width,o[1]=(e._frame.y+h+u)/a.height,o[2]=(e._frame.x+e._frame.width-h+u)/a.width,o[3]=(e._frame.y+e._frame.height-h+u)/a.height,this.uClampOffset[0]=u/a.realWidth,this.uClampOffset[1]=u/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0}}var Jx=`varying vec2 vMaskCoord;
|
|
378
|
+
`;const Xh=class Do extends qs{constructor(t,e,s){const r=yr.from(t||Do.defaultVertexSrc,e||Do.defaultFragmentSrc);super(r,s),this.padding=0,this.resolution=Do.defaultResolution,this.multisample=Do.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new zs}apply(t,e,s,r,n){t.applyFilter(this,e,s,r)}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 R1}static get defaultFragmentSrc(){return P1}};Xh.defaultResolution=1,Xh.defaultMultisample=re.NONE;let pe=Xh;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:r}=t,n=s??e;n!==void 0&&(this.color=n),this.alpha=r}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:[Y.RendererSystem,Y.CanvasRendererSystem],name:"background"},K.add(va);class Ap{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 r=e-1;r>=0;--r)t[r]=s[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,s,r){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<r&&e[c]===u){a[l]=c;continue}for(;o<r;){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}}Ap.extension={type:Y.RendererSystem,name:"batch"},K.add(Ap);let Sp=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=Sp++}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=Sp++,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>=Ls.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ba.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ba.extension={type:Y.RendererSystem,name:"context"},K.add(ba);class $h{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 bs("disposeFramebuffer"),this.multisample=re.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:xs.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:xs.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 r=this.colorTextures[s],n=r.resolution;r.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 Cp extends et{constructor(t={}){if(typeof t=="number"){const e=arguments[0],s=arguments[1],r=arguments[2],n=arguments[3];t={width:e,height:s,scaleMode:r,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=re.NONE),super(null,t),this.mipmap=xs.OFF,this.valid=!0,this._clear=new Ct([0,0,0,0]),this.framebuffer=new $h(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 xr extends so{constructor(t){const e=t,s=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,r=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(s,r),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){s===void 0&&!e.startsWith("data:")?t.crossOrigin=t1(e):s!==!1&&(t.crossOrigin=typeof s=="string"?s:"anonymous")}upload(t,e,s,r){const n=t.gl,a=e.realWidth,h=e.realHeight;if(r=r||this.source,typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement){if(!r.complete||r.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement&&r.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,r):(s.width=a,s.height=h,n.texImage2D(e.target,0,s.internalFormat,e.format,s.type,r)),!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 Ip extends xr{constructor(t,e){if(e=e||{},typeof t=="string"){const s=new Image;xr.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 r=this.source;this.url=r.src;const n=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};r.complete&&r.src?n():(r.onload=n,r.onerror=a=>{s(a),this.onError.emit(a)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Re.UNPACK?"premultiply":"none"})).then(r=>this.destroyed?Promise.reject():(this.bitmap=r,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,s){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const a in n){const h=n[a];if(h!==s&&h.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Yh{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const r=e.width,n=e.height;if(s){const a=t.width/2/r,h=t.height/2/n,o=t.x/r+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/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}Yh.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 Pp=new Yh;function wa(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class q extends Gs{constructor(t,e,s,r,n,a,h){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new rt(0,0,1,1)),t instanceof q&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=Pp,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&&Ws[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 r;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),s=new q(this.baseTexture,!this.noFrame&&t,e,(r=this.trim)==null?void 0:r.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=t),s}updateUvs(){this._uvs===Pp&&(this._uvs=new Yh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=z.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof et){if(!t.cacheId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${h}-${gi()}`,et.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gi()}`}n=t._pixiId}let a=Ws[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof et)?(e.resolution||(e.resolution=_r(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),r=q.from(t,Object.assign({resourceOptions:s},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,s,r){return new q(et.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new et(t,Object.assign({scaleMode:et.defaultOptions.scaleMode,resolution:_r(e)},r)),{resource:a}=n;a instanceof Ip&&(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),Ws[e]&&Ws[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Ws[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ws[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Ws[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Ws[t.textureCacheIds[e]]===t&&delete Ws[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:r,height:n}=t,a=e+r>this.baseTexture.width,h=s+n>this.baseTexture.height;if(a||h){const o=a&&h?"and":"or",l=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,u=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${o} ${u}`)}this.valid=r&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return 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 wi 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 r=this.baseTexture.resolution,n=Math.round(t*r)/r,a=Math.round(e*r)/r;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,s&&this.baseTexture.resize(n,a),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new wi(new Cp(t))}}class Rp{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=re.NONE){const r=new Cp(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new wi(r)}getOptimalTexture(t,e,s=1,r=re.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,r>1&&(n+=r*4294967296)):n=r>1?-r:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,r)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||re.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let r=0;r<s.length;r++)s[r].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 r=0;r<s.length;r++)s[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}Rp.SCREEN_KEY=-1;class M1 extends Lr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Mp extends Lr{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,r=0;return this.uvs[0]=s,this.uvs[1]=r,this.uvs[2]=s+e.width/t.width,this.uvs[3]=r,this.uvs[4]=s+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=s,this.uvs[7]=r+e.height/t.height,s=e.x,r=e.y,this.vertices[0]=s,this.vertices[1]=r,this.vertices[2]=s+e.width,this.vertices[3]=r,this.vertices[4]=s+e.width,this.vertices[5]=r+e.height,this.vertices[6]=s,this.vertices[7]=r+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class F1{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=re.NONE,this.sourceFrame=new rt,this.destinationFrame=new rt,this.bindingSourceFrame=new rt,this.bindingDestinationFrame=new rt,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 Rt;class Fp{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Rp,this.statePool=[],this.quad=new M1,this.quadUv=new Mp,this.tempRect=new rt,this.activeState={},this.globalUniforms=new ws({outputFrame:new rt,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,r=this.defaultFilterStack,n=this.statePool.pop()||new F1,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)}r.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),r.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 r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;const n=r.inputSize,a=r.inputPixel,h=r.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=r.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,r.filterClamp=r.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,Ns.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,Ns.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,o.renderTexture,Ns.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=Ns.CLEAR){const{renderTexture:s,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?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=r.stateId&1||this.forceClear;(e===Ns.CLEAR||e===Ns.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(ys.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(ys.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:r}=this.activeState,{orig:n}=e._texture,a=t.set(r.width,0,0,r.height,s.x,s.y),h=e.worldTransform.copyTo(Rt.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,r=re.NONE){return this.texturePool.getOptimalTexture(t,e,s,r)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||re.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Ea[0],r=Ea[1],n=Ea[2],a=Ea[3];s.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(r,r),t.apply(n,n),t.apply(a,a);const h=Math.min(s.x,r.x,n.x,a.x),o=Math.min(s.y,r.y,n.y,a.y),l=Math.max(s.x,r.x,n.x,a.x),u=Math.max(s.y,r.y,n.y,a.y);e.x=h,e.y=o,e.width=l-h,e.height=u-o}roundFrame(t,e,s,r,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(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Fp.extension={type:Y.RendererSystem,name:"filter"},K.add(Fp);class k1{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=re.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const B1=new rt;class kp{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new $h(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 rt,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===Ls.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:r}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=s),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a<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,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),r=Math.round(r),(n.width!==s||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=r,this.gl.viewport(t,e,s,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,r,n=Cl.COLOR|Cl.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new k1(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){e.bindRenderbuffer(e.RENDERBUFFER,s.stencil);let a;this.renderer.context.webGLVersion===1?a=e.DEPTH_STENCIL:t.depth&&t.stencil?a=e.DEPTH24_STENCIL8:t.depth?a=e.DEPTH_COMPONENT24:a=e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){const h=r[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,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let a=n.length;s.drawBuffers||(a=Math.min(a,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||s.createRenderbuffer():r.msaaBuffer&&(s.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const h=[];for(let o=0;o<a;o++){const l=n[o],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),o===0&&r.msaaBuffer?(s.bindRenderbuffer(s.RENDERBUFFER,r.msaaBuffer),s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,r.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)){r.stencil=r.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,r.stencil),r.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,o,s.RENDERBUFFER,r.stencil)}else r.stencil&&(s.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=re.NONE;if(t<=1||e===null)return s;for(let r=0;r<e.length;r++)if(e[r]<=t){s=e[r];break}return s===1&&(s=re.NONE),s}blit(t,e,s){const{current:r,renderer:n,gl:a,CONTEXT_UID:h}=this;if(n.context.webGLVersion!==2||!r)return;const o=r.glFramebuffers[h];if(!o)return;if(!t){if(!o.msaaBuffer)return;const u=r.colorTextures[0];if(!u)return;o.blitFramebuffer||(o.blitFramebuffer=new $h(r.width,r.height),o.blitFramebuffer.addColorTexture(0,u)),t=o.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==r.width||t.height!==r.height)&&(t.width=r.width,t.height=r.height,t.dirtyId++,t.dirtySize++)}e||(e=B1,e.width=r.width,e.height=r.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],r=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||(r.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&r.deleteRenderbuffer(s.msaaBuffer),s.stencil&&r.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;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,r=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,r):n.renderbufferStorage(n.RENDERBUFFER,o,s,r),n.framebufferRenderbuffer(n.FRAMEBUFFER,h,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new rt}destroy(){this.renderer=null}}kp.extension={type:Y.RendererSystem,name:"framebuffer"},K.add(kp);const Wh={5126:4,5123:2,5121:1};class Bp{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===Ls.WEBGL_LEGACY&&(s=null),s?(t.createVertexArray=()=>s.createVertexArrayOES(),t.bindVertexArray=r=>s.bindVertexArrayOES(r),t.deleteVertexArray=r=>s.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const s=t.getExtension("ANGLE_instanced_arrays");s?(t.vertexAttribDivisor=(r,n)=>s.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,a,h,o)=>s.drawElementsInstancedANGLE(r,n,a,h,o),t.drawArraysInstanced=(r,n,a,h)=>s.drawArraysInstancedANGLE(r,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 r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);const a=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s<t.buffers.length;s++){const r=t.buffers[s];e.update(r)}}checkCompatibility(t,e){const s=t.attributes,r=e.attributeData;for(const n in r)if(!s[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const s=t.attributes,r=e.attributeData,n=["g",t.id];for(const a in s)r[a]&&n.push(a,r[a].location);return n.join("-")}initGeometryVao(t,e,s=!0){const r=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*Wh[d[m].type];for(const m in d){const g=d[m],_=g.size;g.stride===void 0&&(f[g.buffer]===_*Wh[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=_*Wh[g.type])}u=r.createVertexArray(),r.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,r.bindVertexArray(null),a.unbind(Vs.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],r=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(),r.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,r=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[r];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,r){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,r||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(),r||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}}Bp.extension={type:Y.RendererSystem,name:"geometry"},K.add(Bp);const Dp=new Rt;class Op{constructor(t,e){this._texture=t,this.mapCoord=new Rt,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 r=0;r<t.length;r+=2){const n=t[r],a=t[r+1];e[r]=n*s.a+a*s.c+s.tx,e[r+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 r=e.orig,n=e.trim;n&&(Dp.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Dp));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 D1=`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
|
-
`,
|
|
403
|
+
`,O1=`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 ev extends Yt{constructor(t,e,i){let r=null;typeof t!="string"&&e===void 0&&i===void 0&&(r=t,t=void 0,e=void 0,i=void 0),super(t||tv,e||Jx,i),this.maskSprite=r,this.maskMatrix=new gt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,r){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new ff(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,i,r))}}class iv{constructor(t=null){this.type=Xt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Yt.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=Xt.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 pf{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 i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new iv;n.pooled=!0,n.maskObject=e,i=n}const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(r),i._colorMask=r?r._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==Xt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Xt.SCISSOR:this.renderer.scissor.push(i);break;case Xt.STENCIL:this.renderer.stencil.push(i);break;case Xt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Xt.COLOR:this.pushColorMask(i);break}i.type===Xt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Xt.SCISSOR:this.renderer.scissor.pop(e);break;case Xt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Xt.SPRITE:this.popSpriteMask(e);break;case Xt.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===Xt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=Xt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Xt.SCISSOR:t.type=Xt.STENCIL:t.type=Xt.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let r=t._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex],r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new ev])),r[0].resolution=t.resolution,r[0].multisample=t.multisample,r[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,r),i.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,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}pf.extension={type:G.RendererSystem,name:"mask"},z.add(pf);class mf{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==i&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const _f=new gt,gf=[],yf=class vo extends mf{constructor(t){super(t),this.glConst=H.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:i}=t,{renderer:r}=this,n=r.renderTexture,a=i.getBounds(!0,gf.pop()??new st);this.roundFrameToPixels(a,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),e&&a.fit(e),t._scissorRectLocal=a}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:r,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||vo.isMatrixRotated(e.worldTransform)||vo.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,r,n){vo.isMatrixRotated(n)||(n=n?_f.copyFrom(n):_f.identity(),n.translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,t),t.fit(r),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&gf.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)}};yf.extension={type:G.RendererSystem,name:"scissor"};let sv=yf;z.add(sv);class xf extends mf{constructor(t){super(t),this.glConst=H.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:i}=this.renderer,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,r,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.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 i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=i?i._colorMask:15;r!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(i._colorMask=r,e.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}xf.extension={type:G.RendererSystem,name:"stencil"},z.add(xf);class vf{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return it("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return it("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return it("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}}vf.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"_plugin"},z.add(vf);class bf{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new gt,this.transform=null}update(t,e,i,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,r),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,i,r){const n=this.projectionMatrix,a=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=a*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-a-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}bf.extension={type:G.RendererSystem,name:"projection"},z.add(bf);const rv=new ua,Tf=new st;class wf{constructor(t){this.renderer=t,this._tempMatrix=new gt}generateTexture(t,e){const{region:i,...r}=e||{},n=(i==null?void 0:i.copyTo(Tf))||t.getLocalBounds(Tf,!0),a=r.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a),r.width=n.width,r.height=n.height,r.resolution=a,r.multisample??(r.multisample=this.renderer.multisample);const o=Es.create(r);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=rv,this.renderer.render(t,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,o}destroy(){}}wf.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"textureGenerator"},z.add(wf);const As=new st,sn=new st;class Ef{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new st,this.destinationFrame=new st,this.viewportFrame=new st}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,i){const r=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(As.width=t.frame.width,As.height=t.frame.height,e=As),i||(sn.x=t.frame.x,sn.y=t.frame.y,sn.width=e.width,sn.height=e.height,i=sn),a=n.framebuffer):(o=r.resolution,e||(As.width=r._view.screen.width,As.height=r._view.screen.height,e=As),i||(i=As,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*o,h.y=i.y*o,h.width=i.width*o,h.height=i.height*o,t||(h.y=r.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(i,e,o,!a),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=pt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:h,y:u,width:d,height:l}=this.viewportFrame;h=Math.round(h),u=Math.round(u),d=Math.round(d),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,u,d,l)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Ef.extension={type:G.RendererSystem,name:"renderTexture"},z.add(Ef);class nv{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 av(s,t){const e={},i=t.getProgramParameter(s,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const n=t.getActiveAttrib(s,r);if(n.name.startsWith("gl_"))continue;const a=Jd(t,n.type),o={type:a,name:n.name,size:Zd(a),location:t.getAttribLocation(s,n.name)};e[n.name]=o}return e}function ov(s,t){const e={},i=t.getProgramParameter(s,t.ACTIVE_UNIFORMS);for(let r=0;r<i;r++){const n=t.getActiveUniform(s,r),a=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),h=Jd(t,n.type);e[a]={name:a,index:r,type:h,size:n.size,isArray:o,value:jd(h,n.size)}}return e}function hv(s,t){var o;const e=Yd(s,s.VERTEX_SHADER,t.vertexSrc),i=Yd(s,s.FRAGMENT_SHADER,t.fragmentSrc),r=s.createProgram();s.attachShader(r,e),s.attachShader(r,i);const n=(o=t.extra)==null?void 0:o.transformFeedbackVaryings;if(n&&(typeof s.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):s.transformFeedbackVaryings(r,n.names,n.bufferMode==="separate"?s.SEPARATE_ATTRIBS:s.INTERLEAVED_ATTRIBS)),s.linkProgram(r),s.getProgramParameter(r,s.LINK_STATUS)||Lx(s,r,e,i),t.attributeData=av(r,s),t.uniformData=ov(r,s),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((u,d)=>u>d?1:-1);for(let u=0;u<h.length;u++)t.attributeData[h[u]].location=u,s.bindAttribLocation(r,u,h[u]);s.linkProgram(r)}s.deleteShader(e),s.deleteShader(i);const a={};for(const h in t.uniformData){const u=t.uniformData[h];a[h]={location:s.getUniformLocation(r,h),value:jd(u.type,u.size)}}return new nv(r,a)}function lv(s,t,e,i,r){e.buffer.update(r)}const uv={float:`
|
|
419
|
+
`;class L1 extends pe{constructor(t,e,s){let r=null;typeof t!="string"&&e===void 0&&s===void 0&&(r=t,t=void 0,e=void 0,s=void 0),super(t||O1,e||D1,s),this.maskSprite=r,this.maskMatrix=new Rt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,s,r){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new Op(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,r))}}class N1{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 Lp{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 N1;n.pooled=!0,n.maskObject=e,s=n}const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(s.copyCountersOrReset(r),s._colorMask=r?r._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 r=t._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex],r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new L1])),r[0].resolution=t.resolution,r[0].multisample=t.multisample,r[0].maskSprite=e;const n=s.filterArea;s.filterArea=e.getBounds(!0),this.renderer.filter.push(s,r),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}}Lp.extension={type:Y.RendererSystem,name:"mask"},K.add(Lp);class Np{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==s&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Vp=new Rt,Up=[],Gp=class El extends Np{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:r}=this,n=r.renderTexture,a=s.getBounds(!0,Up.pop()??new rt);this.roundFrameToPixels(a,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),e&&a.fit(e),t._scissorRectLocal=a}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:r,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||El.isMatrixRotated(e.worldTransform)||El.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,r,n){El.isMatrixRotated(n)||(n=n?Vp.copyFrom(n):Vp.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,t),t.fit(r),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&Up.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)}};Gp.extension={type:Y.RendererSystem,name:"scissor"};let V1=Gp;K.add(V1);class Xp extends Np{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,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,r,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,s.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=s?s._colorMask:15;r!==0&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(s._colorMask=r,e.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Xp.extension={type:Y.RendererSystem,name:"stencil"},K.add(Xp);class $p{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}}$p.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"_plugin"},K.add($p);class Yp{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Rt,this.transform=null}update(t,e,s,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,r),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,s,r){const n=this.projectionMatrix,a=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=a*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-a-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Yp.extension={type:Y.RendererSystem,name:"projection"},K.add(Yp);const U1=new ma,Hp=new rt;class Wp{constructor(t){this.renderer=t,this._tempMatrix=new Rt}generateTexture(t,e){const{region:s,...r}=e||{},n=(s==null?void 0:s.copyTo(Hp))||t.getLocalBounds(Hp,!0),a=r.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a),r.width=n.width,r.height=n.height,r.resolution=a,r.multisample??(r.multisample=this.renderer.multisample);const h=wi.create(r);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=t.transform;return t.transform=U1,this.renderer.render(t,{renderTexture:h,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,h}destroy(){}}Wp.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"textureGenerator"},K.add(Wp);const Ei=new rt,no=new rt;class zp{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new rt,this.destinationFrame=new rt,this.viewportFrame=new rt}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 r=this.renderer;this.current=t;let n,a,h;t?(n=t.baseTexture,h=n.resolution,e||(Ei.width=t.frame.width,Ei.height=t.frame.height,e=Ei),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=r.resolution,e||(Ei.width=r._view.screen.width,Ei.height=r._view.screen.height,e=Ei),s||(s=Ei,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=r.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,r=Ct.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,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(r.red,r.green,r.blue,r.alpha,e),h&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}zp.extension={type:Y.RendererSystem,name:"renderTexture"},K.add(zp);class G1{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 X1(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let r=0;r<s;r++){const n=t.getActiveAttrib(i,r);if(n.name.startsWith("gl_"))continue;const a=Ep(t,n.type),h={type:a,name:n.name,size:bp(a),location:t.getAttribLocation(i,n.name)};e[n.name]=h}return e}function $1(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let r=0;r<s;r++){const n=t.getActiveUniform(i,r),a=n.name.replace(/\[.*?\]$/,""),h=!!n.name.match(/\[.*?\]$/),o=Ep(t,n.type);e[a]={name:a,index:r,type:o,size:n.size,isArray:h,value:yp(o,n.size)}}return e}function Y1(i,t){var h;const e=_p(i,i.VERTEX_SHADER,t.vertexSrc),s=_p(i,i.FRAGMENT_SHADER,t.fragmentSrc),r=i.createProgram();i.attachShader(r,e),i.attachShader(r,s);const n=(h=t.extra)==null?void 0:h.transformFeedbackVaryings;if(n&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(r,n.names,n.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||x1(i,r,e,s),t.attributeData=X1(r,i),t.uniformData=$1(r,i),!/^[ \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,i.bindAttribLocation(r,l,o[l]);i.linkProgram(r)}i.deleteShader(e),i.deleteShader(s);const a={};for(const o in t.uniformData){const l=t.uniformData[o];a[o]={location:i.getUniformLocation(r,o),value:yp(l.type,l.size)}}return new G1(r,a)}function H1(i,t,e,s,r){e.buffer.update(r)}const W1={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
|
-
`},
|
|
457
|
+
`},jp={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(i){const t=i.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,r=0;for(let n=0;n<t.length;n++){const a=t[n];if(e=jp[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,r+=h}s+e>16?(r=Math.ceil(r/16)*16,a.offset=r,r+=e,s=e):(a.offset=r,s+=e,r+=e)}return r=Math.ceil(r/16)*16,{uboElements:t,size:r}}function j1(i,t){const e=[];for(const s in i)t[s]&&e.push(t[s]);return e.sort((s,r)=>s.index-r.index),e}function q1(i,t){if(!i.autoManage)return{size:0,syncFunc:H1};const e=j1(i.uniforms,t),{uboElements:s,size:r}=z1(e),n=[`
|
|
458
458
|
var v = null;
|
|
459
459
|
var v2 = null;
|
|
460
460
|
var cv = null;
|
|
@@ -462,14 +462,14 @@ 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<
|
|
466
|
-
cv = ud.${
|
|
467
|
-
v = uv.${
|
|
468
|
-
offset = ${
|
|
465
|
+
`];for(let a=0;a<s.length;a++){const h=s[a],o=i.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=bp(h.data.type),d=Math.max(jp[h.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(`
|
|
466
|
+
cv = ud.${l}.value;
|
|
467
|
+
v = uv.${l};
|
|
468
|
+
offset = ${h.offset/4};
|
|
469
469
|
|
|
470
470
|
t = 0;
|
|
471
471
|
|
|
472
|
-
for(var i=0; i < ${
|
|
472
|
+
for(var i=0; i < ${h.data.size*d}; i++)
|
|
473
473
|
{
|
|
474
474
|
for(var j = 0; j < ${f}; j++)
|
|
475
475
|
{
|
|
@@ -478,15 +478,15 @@ void main(void)
|
|
|
478
478
|
offset += ${p};
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
`)}else{const
|
|
482
|
-
cv = ud.${
|
|
483
|
-
v = uv.${
|
|
484
|
-
offset = ${
|
|
485
|
-
${
|
|
481
|
+
`)}else{const c=W1[h.data.type];n.push(`
|
|
482
|
+
cv = ud.${l}.value;
|
|
483
|
+
v = uv.${l};
|
|
484
|
+
offset = ${h.offset/4};
|
|
485
|
+
${c};
|
|
486
486
|
`)}}return n.push(`
|
|
487
487
|
renderer.buffer.update(buffer);
|
|
488
488
|
`),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
|
|
489
|
-
`))}}let pv=0;const xa={textureCount:0,uboCount:0};class Sf{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=pv++}systemCheck(){if(!Ux())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 i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),e||(xa.textureCount=0,xa.uboCount=0,this.syncUniformGroup(t.uniformGroup,xa)),r}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Ox(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,xa,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=fv(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const r=t.uniforms,n=[`${i}-`];for(const a in r)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,r=hv(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Sf.extension={type:G.RendererSystem,name:"shader"},z.add(Sf);class va{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(){}}va.defaultOptions={hello:!1},va.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"startup"},z.add(va);function mv(s,t=[]){return t[K.NORMAL]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.ADD]=[s.ONE,s.ONE],t[K.MULTIPLY]=[s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.SCREEN]=[s.ONE,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.OVERLAY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.DARKEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.LIGHTEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.COLOR_DODGE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.COLOR_BURN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.HARD_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.SOFT_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.DIFFERENCE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.EXCLUSION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.HUE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.SATURATION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.COLOR]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.LUMINOSITY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.NONE]=[0,0],t[K.NORMAL_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.ADD_NPM]=[s.SRC_ALPHA,s.ONE,s.ONE,s.ONE],t[K.SCREEN_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.SRC_IN]=[s.DST_ALPHA,s.ZERO],t[K.SRC_OUT]=[s.ONE_MINUS_DST_ALPHA,s.ZERO],t[K.SRC_ATOP]=[s.DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],t[K.DST_OVER]=[s.ONE_MINUS_DST_ALPHA,s.ONE],t[K.DST_IN]=[s.ZERO,s.SRC_ALPHA],t[K.DST_OUT]=[s.ZERO,s.ONE_MINUS_SRC_ALPHA],t[K.DST_ATOP]=[s.ONE_MINUS_DST_ALPHA,s.SRC_ALPHA],t[K.XOR]=[s.ONE_MINUS_DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],t[K.SUBTRACT]=[s.ONE,s.ONE,s.ONE,s.ONE,s.FUNC_REVERSE_SUBTRACT,s.FUNC_ADD],t}const _v=0,gv=1,yv=2,xv=3,vv=4,bv=5,Cf=class Yu{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=K.NONE,this._blendEq=!1,this.map=[],this.map[_v]=this.setBlend,this.map[gv]=this.setOffset,this.map[yv]=this.setCullFace,this.map[xv]=this.setDepthTest,this.map[vv]=this.setFrontFace,this.map[bv]=this.setDepthMask,this.checks=[],this.defaultState=new ai,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=mv(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(Yu.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Yu.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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Cf.extension={type:G.RendererSystem,name:"state"};let Tv=Cf;z.add(Tv);class wv extends ti{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(r=>t.systems[r]),i=[...e,...Object.keys(t.systems).filter(r=>!e.includes(r))];for(const r of i)this.addSystem(t.systems[r],r)}addRunners(...t){t.forEach(e=>{this.runners[e]=new He(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const r in this.runners)this.runners[r].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=i.find(a=>this._systemsHash[a]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const rn=class bo{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=bo.defaultMaxIdle,this.checkCountMax=bo.defaultCheckCountMax,this.mode=bo.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Ao.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let r=0;r<e.length;r++){const n=e[r];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,i=!0)}if(i){let r=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[r++]=e[n]);e.length=r}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let r=t.children.length-1;r>=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};rn.defaultMode=Ao.AUTO,rn.defaultMaxIdle=60*60,rn.defaultCheckCountMax=60*10,rn.extension={type:G.RendererSystem,name:"textureGC"};let Ss=rn;z.add(Ss);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=Z.UNSIGNED_BYTE,this.internalFormat=O.RGBA,this.samplerType=0}}function Ev(s){let t;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?t={[s.RGB]:V.FLOAT,[s.RGBA]:V.FLOAT,[s.ALPHA]:V.FLOAT,[s.LUMINANCE]:V.FLOAT,[s.LUMINANCE_ALPHA]:V.FLOAT,[s.R8]:V.FLOAT,[s.R8_SNORM]:V.FLOAT,[s.RG8]:V.FLOAT,[s.RG8_SNORM]:V.FLOAT,[s.RGB8]:V.FLOAT,[s.RGB8_SNORM]:V.FLOAT,[s.RGB565]:V.FLOAT,[s.RGBA4]:V.FLOAT,[s.RGB5_A1]:V.FLOAT,[s.RGBA8]:V.FLOAT,[s.RGBA8_SNORM]:V.FLOAT,[s.RGB10_A2]:V.FLOAT,[s.RGB10_A2UI]:V.FLOAT,[s.SRGB8]:V.FLOAT,[s.SRGB8_ALPHA8]:V.FLOAT,[s.R16F]:V.FLOAT,[s.RG16F]:V.FLOAT,[s.RGB16F]:V.FLOAT,[s.RGBA16F]:V.FLOAT,[s.R32F]:V.FLOAT,[s.RG32F]:V.FLOAT,[s.RGB32F]:V.FLOAT,[s.RGBA32F]:V.FLOAT,[s.R11F_G11F_B10F]:V.FLOAT,[s.RGB9_E5]:V.FLOAT,[s.R8I]:V.INT,[s.R8UI]:V.UINT,[s.R16I]:V.INT,[s.R16UI]:V.UINT,[s.R32I]:V.INT,[s.R32UI]:V.UINT,[s.RG8I]:V.INT,[s.RG8UI]:V.UINT,[s.RG16I]:V.INT,[s.RG16UI]:V.UINT,[s.RG32I]:V.INT,[s.RG32UI]:V.UINT,[s.RGB8I]:V.INT,[s.RGB8UI]:V.UINT,[s.RGB16I]:V.INT,[s.RGB16UI]:V.UINT,[s.RGB32I]:V.INT,[s.RGB32UI]:V.UINT,[s.RGBA8I]:V.INT,[s.RGBA8UI]:V.UINT,[s.RGBA16I]:V.INT,[s.RGBA16UI]:V.UINT,[s.RGBA32I]:V.INT,[s.RGBA32UI]:V.UINT,[s.DEPTH_COMPONENT16]:V.FLOAT,[s.DEPTH_COMPONENT24]:V.FLOAT,[s.DEPTH_COMPONENT32F]:V.FLOAT,[s.DEPTH_STENCIL]:V.FLOAT,[s.DEPTH24_STENCIL8]:V.FLOAT,[s.DEPTH32F_STENCIL8]:V.FLOAT}:t={[s.RGB]:V.FLOAT,[s.RGBA]:V.FLOAT,[s.ALPHA]:V.FLOAT,[s.LUMINANCE]:V.FLOAT,[s.LUMINANCE_ALPHA]:V.FLOAT,[s.DEPTH_STENCIL]:V.FLOAT},t}function Av(s){let t;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?t={[Z.UNSIGNED_BYTE]:{[O.RGBA]:s.RGBA8,[O.RGB]:s.RGB8,[O.RG]:s.RG8,[O.RED]:s.R8,[O.RGBA_INTEGER]:s.RGBA8UI,[O.RGB_INTEGER]:s.RGB8UI,[O.RG_INTEGER]:s.RG8UI,[O.RED_INTEGER]:s.R8UI,[O.ALPHA]:s.ALPHA,[O.LUMINANCE]:s.LUMINANCE,[O.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[Z.BYTE]:{[O.RGBA]:s.RGBA8_SNORM,[O.RGB]:s.RGB8_SNORM,[O.RG]:s.RG8_SNORM,[O.RED]:s.R8_SNORM,[O.RGBA_INTEGER]:s.RGBA8I,[O.RGB_INTEGER]:s.RGB8I,[O.RG_INTEGER]:s.RG8I,[O.RED_INTEGER]:s.R8I},[Z.UNSIGNED_SHORT]:{[O.RGBA_INTEGER]:s.RGBA16UI,[O.RGB_INTEGER]:s.RGB16UI,[O.RG_INTEGER]:s.RG16UI,[O.RED_INTEGER]:s.R16UI,[O.DEPTH_COMPONENT]:s.DEPTH_COMPONENT16},[Z.SHORT]:{[O.RGBA_INTEGER]:s.RGBA16I,[O.RGB_INTEGER]:s.RGB16I,[O.RG_INTEGER]:s.RG16I,[O.RED_INTEGER]:s.R16I},[Z.UNSIGNED_INT]:{[O.RGBA_INTEGER]:s.RGBA32UI,[O.RGB_INTEGER]:s.RGB32UI,[O.RG_INTEGER]:s.RG32UI,[O.RED_INTEGER]:s.R32UI,[O.DEPTH_COMPONENT]:s.DEPTH_COMPONENT24},[Z.INT]:{[O.RGBA_INTEGER]:s.RGBA32I,[O.RGB_INTEGER]:s.RGB32I,[O.RG_INTEGER]:s.RG32I,[O.RED_INTEGER]:s.R32I},[Z.FLOAT]:{[O.RGBA]:s.RGBA32F,[O.RGB]:s.RGB32F,[O.RG]:s.RG32F,[O.RED]:s.R32F,[O.DEPTH_COMPONENT]:s.DEPTH_COMPONENT32F},[Z.HALF_FLOAT]:{[O.RGBA]:s.RGBA16F,[O.RGB]:s.RGB16F,[O.RG]:s.RG16F,[O.RED]:s.R16F},[Z.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:s.RGB565},[Z.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:s.RGBA4},[Z.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:s.RGB5_A1},[Z.UNSIGNED_INT_2_10_10_10_REV]:{[O.RGBA]:s.RGB10_A2,[O.RGBA_INTEGER]:s.RGB10_A2UI},[Z.UNSIGNED_INT_10F_11F_11F_REV]:{[O.RGB]:s.R11F_G11F_B10F},[Z.UNSIGNED_INT_5_9_9_9_REV]:{[O.RGB]:s.RGB9_E5},[Z.UNSIGNED_INT_24_8]:{[O.DEPTH_STENCIL]:s.DEPTH24_STENCIL8},[Z.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[O.DEPTH_STENCIL]:s.DEPTH32F_STENCIL8}}:t={[Z.UNSIGNED_BYTE]:{[O.RGBA]:s.RGBA,[O.RGB]:s.RGB,[O.ALPHA]:s.ALPHA,[O.LUMINANCE]:s.LUMINANCE,[O.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[Z.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:s.RGB},[Z.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:s.RGBA},[Z.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:s.RGBA}},t}class Pf{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new J,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=Av(t),this.samplerTypes=Ev(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let r=0;r<e;r++)this.boundTextures[r]=null;this.emptyTextures={};const i=new Wh(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.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]=i,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 r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,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 r=0;r<this.boundTextures.length;r++)this.bind(null,r)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.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:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(let r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:r}=this;if(i)for(let n=t-1;n>=0;--n){const a=e[n];a&&a._glTextures[r].samplerType!==V.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 i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??V.FLOAT,this.webGLVersion===2&&t.type===Z.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var r;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(r=t.resource)==null?void 0:r.upload(i,t,e))e.samplerType!==V.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,o=i.gl;(e.width!==n||e.height!==a||e.dirtyId<0)&&(e.width=n,e.height=a,o.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:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const r=this.managedTextures.indexOf(t);r!==-1&&sr(this.managedTextures,r,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ke.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Hi.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==Ke.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===wi.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===wi.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===wi.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===wi.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Pf.extension={type:G.RendererSystem,name:"texture"},z.add(Pf);class If{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:i}=this,r=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:r}=this;e&&r.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;a<t.buffers.length;a++){const o=t.buffers[a];o&&(i.buffer.update(o),o._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,o._glBuffers[r].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let a=0;a<t.buffers.length;a++){const o=t.buffers[a];if(!o)continue;const h=o._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o,e))}i&&(e||r.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}If.extension={type:G.RendererSystem,name:"transformFeedback"},z.add(If);class ba{constructor(t){this.renderer=t}init(t){this.screen=new st(0,0,t.width,t.height),this.element=t.view||H.ADAPTER.createCanvas(),this.resolution=t.resolution||H.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 i=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",i,r),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}}ba.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ba.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"_view"},z.add(ba),H.PREFER_ENV=qe.WEBGL2,H.STRICT_TEXTURE_CACHE=!1,H.RENDER_OPTIONS={..._a.defaultOptions,...ma.defaultOptions,...ba.defaultOptions,...va.defaultOptions},Object.defineProperties(H,{WRAP_MODE:{get(){return J.defaultOptions.wrapMode},set(s){it("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),J.defaultOptions.wrapMode=s}},SCALE_MODE:{get(){return J.defaultOptions.scaleMode},set(s){it("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),J.defaultOptions.scaleMode=s}},MIPMAP_TEXTURES:{get(){return J.defaultOptions.mipmap},set(s){it("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),J.defaultOptions.mipmap=s}},ANISOTROPIC_LEVEL:{get(){return J.defaultOptions.anisotropicLevel},set(s){it("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),J.defaultOptions.anisotropicLevel=s}},FILTER_RESOLUTION:{get(){return it("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Yt.defaultResolution},set(s){Yt.defaultResolution=s}},FILTER_MULTISAMPLE:{get(){return it("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Yt.defaultMultisample},set(s){Yt.defaultMultisample=s}},SPRITE_MAX_TEXTURES:{get(){return ws.defaultMaxTextures},set(s){it("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ws.defaultMaxTextures=s}},SPRITE_BATCH_SIZE:{get(){return ws.defaultBatchSize},set(s){it("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ws.defaultBatchSize=s}},CAN_UPLOAD_SAME_BUFFER:{get(){return ws.canUploadSameBuffer},set(s){it("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ws.canUploadSameBuffer=s}},GC_MODE:{get(){return Ss.defaultMode},set(s){it("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Ss.defaultMode=s}},GC_MAX_IDLE:{get(){return Ss.defaultMaxIdle},set(s){it("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Ss.defaultMaxIdle=s}},GC_MAX_CHECK_COUNT:{get(){return Ss.defaultCheckCountMax},set(s){it("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Ss.defaultCheckCountMax=s}},PRECISION_VERTEX:{get(){return Ri.defaultVertexPrecision},set(s){it("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Ri.defaultVertexPrecision=s}},PRECISION_FRAGMENT:{get(){return Ri.defaultFragmentPrecision},set(s){it("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Ri.defaultFragmentPrecision=s}}});var ji=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(ji||{});class $h{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=r}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Rf=class Se{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 $h(null,null,1/0),this.deltaMS=1/Se.targetFPMS,this.elapsedMS=1/Se.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,i=ji.NORMAL){return this._addListener(new $h(t,e,i))}addOnce(t,e,i=ji.NORMAL){return this._addListener(new $h(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.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*Se.targetFPMS;const i=this._head;let r=i.next;for(;r;)r=r.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,Se.targetFPMS);this._maxElapsedMS=1/i}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(!Se._shared){const t=Se._shared=new Se;t.autoStart=!0,t._protected=!0}return Se._shared}static get system(){if(!Se._system){const t=Se._system=new Se;t.autoStart=!0,t._protected=!0}return Se._system}};Rf.targetFPMS=.06;let ct=Rf;Object.defineProperties(H,{TARGET_FPMS:{get(){return ct.targetFPMS},set(s){it("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ct.targetFPMS=s}}});class Mf{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,ji.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ct.shared:new ct,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Mf.extension=G.Application,z.add(Mf);const Df=[];z.handleByList(G.Renderer,Df);function Sv(s){for(const t of Df)if(t.test(s))return new t(s);throw new Error("Unable to auto-detect a suitable renderer.")}var Cv=`attribute vec2 aVertexPosition;
|
|
489
|
+
`))}}let Z1=0;const Ta={textureCount:0,uboCount:0};class qp{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=Z1++}systemCheck(){if(!b1())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,r=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(r.program)),e||(Ta.textureCount=0,Ta.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ta)),r}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=g1(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const r=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),r(s.uniformData,t.uniforms,this.renderer,Ta,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let 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 r=t.uniforms,n=[`${s}-`];for(const a in r)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,r=Y1(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}qp.extension={type:Y.RendererSystem,name:"shader"},K.add(qp);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:[Y.RendererSystem,Y.CanvasRendererSystem],name:"startup"},K.add(Aa);function K1(i,t=[]){return t[W.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.ADD]=[i.ONE,i.ONE],t[W.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.NONE]=[0,0],t[W.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[W.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[W.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[W.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[W.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[W.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[W.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[W.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[W.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[W.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const Q1=0,J1=1,tw=2,ew=3,sw=4,rw=5,Zp=class md{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=W.NONE,this._blendEq=!1,this.map=[],this.map[Q1]=this.setBlend,this.map[J1]=this.setOffset,this.map[tw]=this.setCullFace,this.map[ew]=this.setDepthTest,this.map[sw]=this.setFrontFace,this.map[rw]=this.setDepthMask,this.checks=[],this.defaultState=new zs,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=K1(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(md.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(md.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}};Zp.extension={type:Y.RendererSystem,name:"state"};let iw=Zp;K.add(iw);class nw extends Gs{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(r=>t.systems[r]),s=[...e,...Object.keys(t.systems).filter(r=>!e.includes(r))];for(const r of s)this.addSystem(t.systems[r],r)}addRunners(...t){t.forEach(e=>{this.runners[e]=new bs(e)})}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const r in this.runners)this.runners[r].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=s.find(a=>this._systemsHash[a]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const oo=class Tl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Tl.defaultMaxIdle,this.checkCountMax=Tl.defaultCheckCountMax,this.mode=Tl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Il.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let r=0;r<e.length;r++){const n=e[r];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,s=!0)}if(s){let r=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[r++]=e[n]);e.length=r}}unload(t){const e=this.renderer.texture,s=t._texture;s&&!s.framebuffer&&e.destroyTexture(s);for(let r=t.children.length-1;r>=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};oo.defaultMode=Il.AUTO,oo.defaultMaxIdle=60*60,oo.defaultCheckCountMax=60*10,oo.extension={type:Y.RendererSystem,name:"textureGC"};let Ti=oo;K.add(Ti);class zh{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 ow(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:j.FLOAT,[i.RGBA]:j.FLOAT,[i.ALPHA]:j.FLOAT,[i.LUMINANCE]:j.FLOAT,[i.LUMINANCE_ALPHA]:j.FLOAT,[i.R8]:j.FLOAT,[i.R8_SNORM]:j.FLOAT,[i.RG8]:j.FLOAT,[i.RG8_SNORM]:j.FLOAT,[i.RGB8]:j.FLOAT,[i.RGB8_SNORM]:j.FLOAT,[i.RGB565]:j.FLOAT,[i.RGBA4]:j.FLOAT,[i.RGB5_A1]:j.FLOAT,[i.RGBA8]:j.FLOAT,[i.RGBA8_SNORM]:j.FLOAT,[i.RGB10_A2]:j.FLOAT,[i.RGB10_A2UI]:j.FLOAT,[i.SRGB8]:j.FLOAT,[i.SRGB8_ALPHA8]:j.FLOAT,[i.R16F]:j.FLOAT,[i.RG16F]:j.FLOAT,[i.RGB16F]:j.FLOAT,[i.RGBA16F]:j.FLOAT,[i.R32F]:j.FLOAT,[i.RG32F]:j.FLOAT,[i.RGB32F]:j.FLOAT,[i.RGBA32F]:j.FLOAT,[i.R11F_G11F_B10F]:j.FLOAT,[i.RGB9_E5]:j.FLOAT,[i.R8I]:j.INT,[i.R8UI]:j.UINT,[i.R16I]:j.INT,[i.R16UI]:j.UINT,[i.R32I]:j.INT,[i.R32UI]:j.UINT,[i.RG8I]:j.INT,[i.RG8UI]:j.UINT,[i.RG16I]:j.INT,[i.RG16UI]:j.UINT,[i.RG32I]:j.INT,[i.RG32UI]:j.UINT,[i.RGB8I]:j.INT,[i.RGB8UI]:j.UINT,[i.RGB16I]:j.INT,[i.RGB16UI]:j.UINT,[i.RGB32I]:j.INT,[i.RGB32UI]:j.UINT,[i.RGBA8I]:j.INT,[i.RGBA8UI]:j.UINT,[i.RGBA16I]:j.INT,[i.RGBA16UI]:j.UINT,[i.RGBA32I]:j.INT,[i.RGBA32UI]:j.UINT,[i.DEPTH_COMPONENT16]:j.FLOAT,[i.DEPTH_COMPONENT24]:j.FLOAT,[i.DEPTH_COMPONENT32F]:j.FLOAT,[i.DEPTH_STENCIL]:j.FLOAT,[i.DEPTH24_STENCIL8]:j.FLOAT,[i.DEPTH32F_STENCIL8]:j.FLOAT}:t={[i.RGB]:j.FLOAT,[i.RGBA]:j.FLOAT,[i.ALPHA]:j.FLOAT,[i.LUMINANCE]:j.FLOAT,[i.LUMINANCE_ALPHA]:j.FLOAT,[i.DEPTH_STENCIL]:j.FLOAT},t}function aw(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA8,[G.RGB]:i.RGB8,[G.RG]:i.RG8,[G.RED]:i.R8,[G.RGBA_INTEGER]:i.RGBA8UI,[G.RGB_INTEGER]:i.RGB8UI,[G.RG_INTEGER]:i.RG8UI,[G.RED_INTEGER]:i.R8UI,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[tt.BYTE]:{[G.RGBA]:i.RGBA8_SNORM,[G.RGB]:i.RGB8_SNORM,[G.RG]:i.RG8_SNORM,[G.RED]:i.R8_SNORM,[G.RGBA_INTEGER]:i.RGBA8I,[G.RGB_INTEGER]:i.RGB8I,[G.RG_INTEGER]:i.RG8I,[G.RED_INTEGER]:i.R8I},[tt.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:i.RGBA16UI,[G.RGB_INTEGER]:i.RGB16UI,[G.RG_INTEGER]:i.RG16UI,[G.RED_INTEGER]:i.R16UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[tt.SHORT]:{[G.RGBA_INTEGER]:i.RGBA16I,[G.RGB_INTEGER]:i.RGB16I,[G.RG_INTEGER]:i.RG16I,[G.RED_INTEGER]:i.R16I},[tt.UNSIGNED_INT]:{[G.RGBA_INTEGER]:i.RGBA32UI,[G.RGB_INTEGER]:i.RGB32UI,[G.RG_INTEGER]:i.RG32UI,[G.RED_INTEGER]:i.R32UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[tt.INT]:{[G.RGBA_INTEGER]:i.RGBA32I,[G.RGB_INTEGER]:i.RGB32I,[G.RG_INTEGER]:i.RG32I,[G.RED_INTEGER]:i.R32I},[tt.FLOAT]:{[G.RGBA]:i.RGBA32F,[G.RGB]:i.RGB32F,[G.RG]:i.RG32F,[G.RED]:i.R32F,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[tt.HALF_FLOAT]:{[G.RGBA]:i.RGBA16F,[G.RGB]:i.RGB16F,[G.RG]:i.RG16F,[G.RED]:i.R16F},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB565},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA4},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGB5_A1},[tt.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:i.RGB10_A2,[G.RGBA_INTEGER]:i.RGB10_A2UI},[tt.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:i.R11F_G11F_B10F},[tt.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:i.RGB9_E5},[tt.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[tt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA,[G.RGB]:i.RGB,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGBA}},t}class Kp{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=aw(t),this.samplerTypes=ow(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let r=0;r<e;r++)this.boundTextures[r]=null;this.emptyTextures={};const s=new zh(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 zh(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,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 r=0;r<this.boundTextures.length;r++)this.bind(null,r)}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 r=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,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),this.updateTexture(t)):r.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 r=0;r<s.length;r++)s[r]===this.unknownTexture&&this.bind(null,r)}for(let r=0;r<s.length;r++)s[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),s[r]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:s,CONTEXT_UID:r}=this;if(s)for(let n=t-1;n>=0;--n){const a=e[n];a&&a._glTextures[r].samplerType!==j.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new zh(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 r;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const s=this.renderer;if(this.initTextureType(t,e),(r=t.resource)==null?void 0:r.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 r=this.managedTextures.indexOf(t);r!==-1&&nn(this.managedTextures,r,1)}}updateTextureStyle(t){var s;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===xs.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Fr.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!==xs.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 r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===je.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===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}}Kp.extension={type:Y.RendererSystem,name:"texture"},K.add(Kp);class Qp{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:r}=this;e&&r.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;a<t.buffers.length;a++){const h=t.buffers[a];h&&(s.buffer.update(h),h._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,h._glBuffers[r].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const s=t._glTransformFeedbacks[this.CONTEXT_UID],r=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||r.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Qp.extension={type:Y.RendererSystem,name:"transformFeedback"},K.add(Qp);class Sa{constructor(t){this.renderer=t}init(t){this.screen=new rt(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,r=this.element.height/this.resolution;this.screen.width=s,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${s}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",s,r),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:[Y.RendererSystem,Y.CanvasRendererSystem],name:"_view"},K.add(Sa),z.PREFER_ENV=Ls.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(i){ot("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),et.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return et.defaultOptions.scaleMode},set(i){ot("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),et.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return et.defaultOptions.mipmap},set(i){ot("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),et.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return et.defaultOptions.anisotropicLevel},set(i){ot("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),et.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ot("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),pe.defaultResolution},set(i){pe.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ot("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),pe.defaultMultisample},set(i){pe.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return bi.defaultMaxTextures},set(i){ot("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),bi.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return bi.defaultBatchSize},set(i){ot("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),bi.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return bi.canUploadSameBuffer},set(i){ot("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),bi.canUploadSameBuffer=i}},GC_MODE:{get(){return Ti.defaultMode},set(i){ot("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Ti.defaultMode=i}},GC_MAX_IDLE:{get(){return Ti.defaultMaxIdle},set(i){ot("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Ti.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Ti.defaultCheckCountMax},set(i){ot("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Ti.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return yr.defaultVertexPrecision},set(i){ot("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),yr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return yr.defaultFragmentPrecision},set(i){ot("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),yr.defaultFragmentPrecision=i}}});var Vr=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Vr||{});class jh{constructor(t,e=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=r}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Jp=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 jh(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=Vr.NORMAL){return this._addListener(new jh(t,e,s))}addOnce(t,e,s=Vr.NORMAL){return this._addListener(new jh(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 r=s.next;for(;r;)r=r.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}};Jp.targetFPMS=.06;let wt=Jp;Object.defineProperties(z,{TARGET_FPMS:{get(){return wt.targetFPMS},set(i){ot("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),wt.targetFPMS=i}}});class tm{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,Vr.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()}}}tm.extension=Y.Application,K.add(tm);const em=[];K.handleByList(Y.Renderer,em);function lw(i){for(const t of em)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var hw=`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
|
-
}`,
|
|
500
|
+
}`,cw=`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 Iv=Cv,Bf=Pv;class Of{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Ht.HIGH?this.multisample=Ht.HIGH:e>=Ht.MEDIUM?this.multisample=Ht.MEDIUM:e>=Ht.LOW?this.multisample=Ht.LOW:this.multisample=Ht.NONE}destroy(){}}Of.extension={type:G.RendererSystem,name:"_multisample"},z.add(Of);class Rv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Ff{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:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:r,CONTEXT_UID:n}=this;i=i||0;const a=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,a.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(e||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new Rv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Ff.extension={type:G.RendererSystem,name:"buffer"},z.add(Ff);class kf{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let r,n,a,o;if(e&&(r=e.renderTexture,n=e.clear,a=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!r,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=a,!i.context.isLost){if(r||(this.lastObjectRendered=t),!o){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(r),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),r&&(e.blit&&i.framebuffer.blit(),r.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}kf.extension={type:G.RendererSystem,name:"objectRenderer"},z.add(kf);const Ta=class ju extends wv{constructor(t){super(),this.type=tc.WEBGL,t=Object.assign({},H.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Ve({projectionMatrix:new gt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:ju.__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&&(it("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=ju.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:ex()}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 it("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return it("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return it("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return it("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){it("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return it("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){it("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return it("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)}};Ta.extension={type:G.Renderer,priority:1},Ta.__plugins={},Ta.__systems={};let zh=Ta;z.handleByMap(G.RendererPlugin,zh.__plugins),z.handleByMap(G.RendererSystem,zh.__systems),z.add(zh);class Lf extends Jr{constructor(t,e){const{width:i,height:r}=e||{};super(i,r),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const a=new J;this.items.push(a),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof Jr?this.addResourceAt(t[i],i):this.addResourceAt(Xd(t[i],e),i))}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:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class Mv extends Lf{constructor(t,e){const{width:i,height:r}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:i,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=$s.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:r,itemDirtyIds:n,items:a}=this,{gl:o}=t;i.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,r,0,e.format,i.type,null);for(let h=0;h<r;h++){const u=a[h];n[h]<u.dirtyId&&(n[h]=u.dirtyId,u.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,h,u.resource.width,u.resource.height,1,e.format,i.type,u.resource.source))}return!0}}class Dv extends Mi{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Nf=class Mn extends Lf{constructor(t,e){const{width:i,height:r,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==Mn.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:r});for(let o=0;o<Mn.SIDES;o++)this.items[o].target=$s.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=a!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=$s.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=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=$s.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,i){const r=this.itemDirtyIds;for(let n=0;n<Mn.SIDES;n++){const a=this.items[n];(r[n]<a.dirtyId||i.dirtyId<e.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,i),r[n]=a.dirtyId):r[n]<-1&&(t.gl.texImage2D(a.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),r[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Mn.SIDES}};Nf.SIDES=6;let Bv=Nf;class ar extends Mi{constructor(t,e){e=e||{};let i,r,n;typeof t=="string"?(i=ar.EMPTY,r=t,n=!0):(i=t,r=null,n=!1),super(i),this.url=r,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 i=await H.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===he.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(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 ar._EMPTY=ar._EMPTY??H.ADAPTER.createCanvas(0,0),ar._EMPTY}}const Yh=class To extends Mi{constructor(t,e){e=e||{},super(H.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)},To.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;Mi.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,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),r=Math.round(r),n=Math.round(n);const a=this.source;a.width=r,a.height=n,a._pixiId=`canvas_${ys()}`,a.getContext("2d").drawImage(t,0,0,e,i,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=To.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}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"&&To.SVG_XML.test(t)}};Yh.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Yh.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let jh=Yh;class Ov extends Mi{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const qh=class qu extends Mi{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const r=t[0].src||t[0];Mi.crossOrigin(i,r,e.crossorigin);for(let n=0;n<t.length;++n){const a=document.createElement("source");let{src:o,mime:h}=t[n];if(o=o||t[n],o.startsWith("data:"))h=o.slice(5,o.indexOf(";"));else if(!o.startsWith("blob:")){const u=o.split("?").shift().toLowerCase(),d=u.slice(u.lastIndexOf(".")+1);h=h||qu.MIME_TYPES[d]||`video/${d}`}a.src=o,h&&(a.type=h),i.appendChild(a)}t=i}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=ct.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,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,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&&(ct.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||(ct.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ct.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||qu.TYPES.includes(e)}};qh.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],qh.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Uf=qh;Rh.push(ar,nf,Dv,Uf,Ov,jh,ia,Bv,Mv);class wa{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?st.EMPTY:(t=t||new st(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:i,b:r,c:n,d:a,tx:o,ty:h}=t,u=i*e.x+n*e.y+o,d=r*e.x+a*e.y+h;this.minX=Math.min(this.minX,u),this.maxX=Math.max(this.maxX,u),this.minY=Math.min(this.minY,d),this.maxY=Math.max(this.maxY,d)}addQuad(t){let e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,a=t[0],o=t[1];e=a<e?a:e,i=o<i?o:i,r=a>r?a:r,n=o>n?o:n,a=t[2],o=t[3],e=a<e?a:e,i=o<i?o:i,r=a>r?a:r,n=o>n?o:n,a=t[4],o=t[5],e=a<e?a:e,i=o<i?o:i,r=a>r?a:r,n=o>n?o:n,a=t[6],o=t[7],e=a<e?a:e,i=o<i?o:i,r=a>r?a:r,n=o>n?o:n,this.minX=e,this.minY=i,this.maxX=r,this.maxY=n}addFrame(t,e,i,r,n){this.addFrameMatrix(t.worldTransform,e,i,r,n)}addFrameMatrix(t,e,i,r,n){const a=t.a,o=t.b,h=t.c,u=t.d,d=t.tx,l=t.ty;let c=this.minX,f=this.minY,p=this.maxX,m=this.maxY,_=a*e+h*i+d,g=o*e+u*i+l;c=_<c?_:c,f=g<f?g:f,p=_>p?_:p,m=g>m?g:m,_=a*r+h*i+d,g=o*r+u*i+l,c=_<c?_:c,f=g<f?g:f,p=_>p?_:p,m=g>m?g:m,_=a*e+h*n+d,g=o*e+u*n+l,c=_<c?_:c,f=g<f?g:f,p=_>p?_:p,m=g>m?g:m,_=a*r+h*n+d,g=o*r+u*n+l,c=_<c?_:c,f=g<f?g:f,p=_>p?_:p,m=g>m?g:m,this.minX=c,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,i){let r=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let h=e;h<i;h+=2){const u=t[h],d=t[h+1];r=u<r?u:r,n=d<n?d:n,a=u>a?u:a,o=d>o?d:o}this.minX=r,this.minY=n,this.maxX=a,this.maxY=o}addVertices(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)}addVerticesMatrix(t,e,i,r,n=0,a=n){const o=t.a,h=t.b,u=t.c,d=t.d,l=t.tx,c=t.ty;let f=this.minX,p=this.minY,m=this.maxX,_=this.maxY;for(let g=i;g<r;g+=2){const x=e[g],y=e[g+1],v=o*x+u*y+l,b=d*y+h*x+c;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,b-a),_=Math.max(_,b+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=_}addBounds(t){const e=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,r=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(i<=n&&r<=a){const o=this.minX,h=this.minY,u=this.maxX,d=this.maxY;this.minX=i<o?i:o,this.minY=r<h?r:h,this.maxX=n>u?n:u,this.maxY=a>d?a:d}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,r=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(i<=n&&r<=a){const o=this.minX,h=this.minY,u=this.maxX,d=this.maxY;this.minX=i<o?i:o,this.minY=r<h?r:h,this.maxX=n>u?n:u,this.maxY=a>d?a:d}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,r,n,a){t-=n,e-=a,i+=n,r+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r}}class St extends ti{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ua,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 wa,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 i=0;i<e.length;++i){const r=e[i];Object.defineProperty(St.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}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 st),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new st),t=this._localBoundsRect),this._localBounds||(this._localBounds=new wa);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,a}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}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,i=1,r=1,n=0,a=0,o=0,h=0,u=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=a,this.skew.y=o,this.pivot.x=h,this.pivot.y=u,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 Fv),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*Px}set angle(t){this.transform.rotation=t*Bh}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 Fv extends St{constructor(){super(...arguments),this.sortDirty=null}}St.prototype.displayObjectUpdateTransform=St.prototype.updateTransform;const kv=new gt;function Lv(s,t){return s.zIndex===t.zIndex?s._lastSortedIndex-t._lastSortedIndex:s.zIndex-t.zIndex}const Gf=class Ku extends St{constructor(){super(),this.children=[],this.sortableChildren=Ku.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 i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t,this.onChildrenChange(i<r?i:r)}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 i=this.getChildIndex(t);sr(this.children,i,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],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,sr(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,sr(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 i=t,r=e,n=r-i;let a;if(n>0&&n<=r){a=this.children.splice(i,n);for(let o=0;o<a.length;++o)a[o].parent=null,a[o].transform&&(a[o].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let o=0;o<a.length;++o)a[o].emit("removed",this),this.emit("childRemoved",a[o],this,o);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,i=this.children.length;e<i;++e){const r=this.children[e];r._lastSortedIndex=e,!t&&r.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(Lv),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 i=this.children[t];i.visible&&i.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 i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._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 i=super.getLocalBounds(t);if(!e)for(let r=0,n=this.children.length;r<n;++r){const a=this.children[r];a.visible&&a.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,r;this.cullArea?(i=this.cullArea,r=this.worldTransform):this._render!==Ku.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=kv.copyFrom(r),r.prepend(n)):r=n),i&&e.intersects(i,r))this._render(t);else if(this.cullArea)return;for(let a=0,o=this.children.length;a<o;++a){const h=this.children[a],u=h.cullable;h.cullable=u||!this.cullArea,h.render(t),h.cullable=u}}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 i=0,r=this.children.length;i<r;++i)this.children[i].render(t)}}renderAdvanced(t){var n,a,o;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<e.length;h++)e[h].enabled&&this._enabledFilters.push(e[h])}const r=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Xt.NONE));if(r&&t.batch.flush(),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,u=this.children.length;h<u;++h)this.children[h].render(t)}r&&t.batch.flush(),i&&t.mask.pop(this),e&&((o=this._enabledFilters)!=null&&o.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,i=this.removeChildren(0,this.children.length);if(e)for(let r=0;r<i.length;++r)i[r].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}};Gf.defaultSortableChildren=!1;let bt=Gf;bt.prototype.containerUpdateTransform=bt.prototype.updateTransform,Object.defineProperties(H,{SORTABLE_CHILDREN:{get(){return bt.defaultSortableChildren},set(s){it("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),bt.defaultSortableChildren=s}}});const nn=new tt,Nv=new Uint16Array([0,1,2,0,2,3]);class _e extends bt{constructor(t){super(),this._anchor=new oi(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 pt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=K.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||W.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Nv,this.pluginName="batch",this.isSprite=!0,this._roundPixels=H.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Wi(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Wi(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,i=e.a,r=e.b,n=e.c,a=e.d,o=e.tx,h=e.ty,u=this.vertexData,d=t.trim,l=t.orig,c=this._anchor;let f=0,p=0,m=0,_=0;if(d?(p=d.x-c._x*l.width,f=p+d.width,_=d.y-c._y*l.height,m=_+d.height):(p=-c._x*l.width,f=p+l.width,_=-c._y*l.height,m=_+l.height),u[0]=i*p+n*_+o,u[1]=a*_+r*p+h,u[2]=i*f+n*_+o,u[3]=a*_+r*f+h,u[4]=i*f+n*m+o,u[5]=a*m+r*f+h,u[6]=i*p+n*m+o,u[7]=a*m+r*p+h,this._roundPixels){const g=H.RESOLUTION;for(let x=0;x<u.length;++x)u[x]=Math.round(u[x]*g)/g}}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,i=t.orig,r=this._anchor,n=this.transform.worldTransform,a=n.a,o=n.b,h=n.c,u=n.d,d=n.tx,l=n.ty,c=-r._x*i.width,f=c+i.width,p=-r._y*i.height,m=p+i.height;if(e[0]=a*c+h*p+d,e[1]=u*p+o*c+l,e[2]=a*f+h*p+d,e[3]=u*p+o*f+l,e[4]=a*f+h*m+d,e[5]=u*m+o*f+l,e[6]=a*c+h*m+d,e[7]=u*m+o*c+l,this._roundPixels){const _=H.RESOLUTION;for(let g=0;g<e.length;++g)e[g]=Math.round(e[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 wa),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 st),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,nn);const e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x;let n=0;return nn.x>=r&&nn.x<r+e&&(n=-i*this.anchor.y,nn.y>=n&&nn.y<n+i)}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 i=t instanceof W?t:W.from(t,e);return new _e(i)}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=Wi(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=Wi(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||W.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Hf=new gt;St.prototype._cacheAsBitmap=!1,St.prototype._cacheData=null,St.prototype._cacheAsBitmapResolution=null,St.prototype._cacheAsBitmapMultisample=null;class Uv{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(St.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(s){s!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(s){s!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(s){if(this._cacheAsBitmap===s)return;this._cacheAsBitmap=s;let t;s?(this._cacheData||(this._cacheData=new Uv),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)}}}),St.prototype._renderCached=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(s),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(s))},St.prototype._initCachedDisplayObject=function(s){var c,f;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.alpha;this.alpha=1,s.batch.flush();const e=this.getLocalBounds(new st,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const i=this.cacheAsBitmapResolution||s.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const r=s.renderTexture.current,n=s.renderTexture.sourceFrame.clone(),a=s.renderTexture.destinationFrame.clone(),o=s.projection.transform,h=Es.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??s.multisample}),u=`cacheAsBitmap_${ys()}`;this._cacheData.textureCacheId=u,J.addToCache(h.baseTexture,u),W.addToCache(h,u);const d=this.transform.localTransform.copyTo(Hf).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,s.render(this,{renderTexture:h,clear:!0,transform:d,skipUpdateTransform:!1}),s.framebuffer.blit(),s.projection.transform=o,s.renderTexture.bind(r,n,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const l=new _e(h);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(e.x/e.width),l.anchor.y=-(e.y/e.height),l.alpha=t,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l)},St.prototype._renderCachedCanvas=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(s),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(s))},St.prototype._initCachedDisplayObjectCanvas=function(s){var d;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.getLocalBounds(new st,!0),e=this.alpha;this.alpha=1;const i=s.canvasContext.activeContext,r=s._projTransform,n=this.cacheAsBitmapResolution||s.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const a=Es.create({width:t.width,height:t.height,resolution:n}),o=`cacheAsBitmap_${ys()}`;this._cacheData.textureCacheId=o,J.addToCache(a.baseTexture,o),W.addToCache(a,o);const h=Hf;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,s.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),s.canvasContext.activeContext=i,s._projTransform=r,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const u=new _e(a);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(t.x/t.width),u.anchor.y=-(t.y/t.height),u.alpha=e,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=s._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)},St.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},St.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},St.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,J.removeFromCache(this._cacheData.textureCacheId),W.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},St.prototype._cacheAsBitmapDestroy=function(s){this.cacheAsBitmap=!1,this.destroy(s)},St.prototype.name=null,bt.prototype.getChildByName=function(s,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===s)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const r=this.children[e];if(!r.getChildByName)continue;const n=r.getChildByName(s,!0);if(n)return n}return null},St.prototype.getGlobalPosition=function(s=new tt,t=!1){return this.parent?this.parent.toGlobal(this.position,s,t):(s.x=this.position.x,s.y=this.position.y),s};var Gv=`varying vec2 vTextureCoord;
|
|
526
|
+
`;const uw=hw,sm=cw;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>=re.HIGH?this.multisample=re.HIGH:e>=re.MEDIUM?this.multisample=re.MEDIUM:e>=re.LOW?this.multisample=re.LOW:this.multisample=re.NONE}destroy(){}}rm.extension={type:Y.RendererSystem,name:"_multisample"},K.add(rm);class dw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class im{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:r,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),s&&(e||r.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;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 dw(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}im.extension={type:Y.RendererSystem,name:"buffer"},K.add(im);class nm{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let r,n,a,h;if(e&&(r=e.renderTexture,n=e.clear,a=e.transform,h=e.skipUpdateTransform),this.renderingToScreen=!r,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=a,!s.context.isLost){if(r||(this.lastObjectRendered=t),!h){const o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}s.renderTexture.bind(r),s.batch.currentRenderer.start(),(n??s.background.clearBeforeRender)&&s.renderTexture.clear(),t.render(s),s.batch.currentRenderer.flush(),r&&(e.blit&&s.framebuffer.blit(),r.baseTexture.update()),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}nm.extension={type:Y.RendererSystem,name:"objectRenderer"},K.add(nm);const Ca=class gd extends nw{constructor(t){super(),this.type=Ed.WEBGL,t=Object.assign({},z.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ws({projectionMatrix:new Rt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:gd.__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=gd.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:Lb()}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:Y.Renderer,priority:1},Ca.__plugins={},Ca.__systems={};let qh=Ca;K.handleByMap(Y.RendererPlugin,qh.__plugins),K.handleByMap(Y.RendererSystem,qh.__systems),K.add(qh);class om extends so{constructor(t,e){const{width:s,height:r}=e||{};super(s,r),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(fp(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 fw extends om{constructor(t,e){const{width:s,height:r}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Wi.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:a}=this,{gl:h}=t;s.dirtyId<0&&h.texImage3D(h.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let o=0;o<r;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 pw extends xr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const am=class Oo extends om{constructor(t,e){const{width:s,height:r,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:r});for(let h=0;h<Oo.SIDES;h++)this.items[h].target=Wi.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=Wi.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=Wi.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const r=this.itemDirtyIds;for(let n=0;n<Oo.SIDES;n++){const a=this.items[n];(r[n]<a.dirtyId||s.dirtyId<e.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,s),r[n]=a.dirtyId):r[n]<-1&&(t.gl.texImage2D(a.target,0,s.internalFormat,e.realWidth,e.realHeight,0,e.format,s.type,null),r[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Oo.SIDES}};am.SIDES=6;let mw=am;class ln extends xr{constructor(t,e){e=e||{};let s,r,n;typeof t=="string"?(s=ln.EMPTY,r=t,n=!0):(s=t,r=null,n=!1),super(s),this.url=r,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 r=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{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 Zh=class Al extends xr{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)},Al.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;xr.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),r=Math.round(r),n=Math.round(n);const a=this.source;a.width=r,a.height=n,a._pixiId=`canvas_${gi()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Al.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"&&Al.SVG_XML.test(t)}};Zh.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Zh.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Kh=Zh;class gw extends xr{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Qh=class _d extends xr{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");e.autoLoad!==!1&&s.setAttribute("preload","auto"),e.playsinline!==!1&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),e.muted===!0&&(s.setAttribute("muted",""),s.muted=!0),e.loop===!0&&s.setAttribute("loop",""),e.autoPlay!==!1&&s.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const r=t[0].src||t[0];xr.crossOrigin(s,r,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||_d.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||_d.TYPES.includes(e)}};Qh.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Qh.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let lm=Qh;kh.push(ln,Ip,pw,lm,gw,Kh,aa,mw,fw);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?rt.EMPTY:(t=t||new rt(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:s,b:r,c:n,d:a,tx:h,ty:o}=t,l=s*e.x+n*e.y+h,u=r*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,r=this.maxX,n=this.maxY,a=t[0],h=t[1];e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[2],h=t[3],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[4],h=t[5],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[6],h=t[7],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,this.minX=e,this.minY=s,this.maxX=r,this.maxY=n}addFrame(t,e,s,r,n){this.addFrameMatrix(t.worldTransform,e,s,r,n)}addFrameMatrix(t,e,s,r,n){const a=t.a,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*r+o*s+u,_=h*r+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*r+o*n+u,_=h*r+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 r=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];r=l<r?l:r,n=u<n?u:n,a=l>a?l:a,h=u>h?u:h}this.minX=r,this.minY=n,this.maxX=a,this.maxY=h}addVertices(t,e,s,r){this.addVerticesMatrix(t.worldTransform,e,s,r)}addVerticesMatrix(t,e,s,r,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;_<r;_+=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,r=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>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,a=t.maxY<e.maxY?t.maxY:e.maxY;if(s<=n&&r<=a){const h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=r<o?r: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,r=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&&r<=a){const h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=r<o?r: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,r,n,a){t-=n,e-=a,s+=n,r+=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>r?this.maxY:r}}class Vt extends Gs{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 r=e[s];Object.defineProperty(Vt.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}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 rt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new rt),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 r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,t);return this.parent=s,this.transform=e,this._bounds=r,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,r){return e&&(t=e.toGlobal(t,s,r)),r||(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,r=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=r||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 _w),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*c1}set angle(t){this.transform.rotation=t*Oh}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 _w extends Vt{constructor(){super(...arguments),this.sortDirty=null}}Vt.prototype.displayObjectUpdateTransform=Vt.prototype.updateTransform;const yw=new Rt;function xw(i,t){return i.zIndex===t.zIndex?i._lastSortedIndex-t._lastSortedIndex:i.zIndex-t.zIndex}const hm=class yd extends Vt{constructor(){super(),this.children=[],this.sortableChildren=yd.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),r=this.getChildIndex(e);this.children[s]=e,this.children[r]=t,this.onChildrenChange(s<r?s:r)}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,r=e,n=r-s;let a;if(n>0&&n<=r){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 r=this.children[e];r._lastSortedIndex=e,!t&&r.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(xw),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 r=0,n=this.children.length;r<n;++r){const a=this.children[r];a.visible&&a.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let s,r;this.cullArea?(s=this.cullArea,r=this.worldTransform):this._render!==yd.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=yw.copyFrom(r),r.prepend(n)):r=n),s&&e.intersects(s,r))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,r=this.children.length;s<r;++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 r=e&&((n=this._enabledFilters)==null?void 0:n.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==ce.NONE));if(r&&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)}r&&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 r=0;r<s.length;++r)s[r].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}};hm.defaultSortableChildren=!1;let Bt=hm;Bt.prototype.containerUpdateTransform=Bt.prototype.updateTransform,Object.defineProperties(z,{SORTABLE_CHILDREN:{get(){return Bt.defaultSortableChildren},set(i){ot("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Bt.defaultSortableChildren=i}}});const ao=new st,vw=new Uint16Array([0,1,2,0,2,3]);class qe extends Bt{constructor(t){super(),this._anchor=new js(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=vw,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=Dr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Dr(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,r=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+r*p+o,l[2]=s*f+n*g+h,l[3]=a*g+r*f+o,l[4]=s*f+n*m+h,l[5]=a*m+r*f+o,l[6]=s*p+n*m+h,l[7]=a*m+r*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,r=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=-r._x*s.width,f=d+s.width,p=-r._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 rt),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,r=-e*this.anchor.x;let n=0;return ao.x>=r&&ao.x<r+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=Dr(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=Dr(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 cm=new Rt;Vt.prototype._cacheAsBitmap=!1,Vt.prototype._cacheData=null,Vt.prototype._cacheAsBitmapResolution=null,Vt.prototype._cacheAsBitmapMultisample=null;class bw{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(i){i!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(i){i!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(i){if(this._cacheAsBitmap===i)return;this._cacheAsBitmap=i;let t;i?(this._cacheData||(this._cacheData=new bw),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(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(i),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(i))},Vt.prototype._initCachedDisplayObject=function(i){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,i.batch.flush();const e=this.getLocalBounds(new rt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const s=this.cacheAsBitmapResolution||i.resolution;e.ceil(s),e.width=Math.max(e.width,1/s),e.height=Math.max(e.height,1/s);const r=i.renderTexture.current,n=i.renderTexture.sourceFrame.clone(),a=i.renderTexture.destinationFrame.clone(),h=i.projection.transform,o=wi.create({width:e.width,height:e.height,resolution:s,multisample:this.cacheAsBitmapMultisample??i.multisample}),l=`cacheAsBitmap_${gi()}`;this._cacheData.textureCacheId=l,et.addToCache(o.baseTexture,l),q.addToCache(o,l);const u=this.transform.localTransform.copyTo(cm).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,i.render(this,{renderTexture:o,clear:!0,transform:u,skipUpdateTransform:!1}),i.framebuffer.blit(),i.projection.transform=h,i.renderTexture.bind(r,n,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=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(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(i),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(i))},Vt.prototype._initCachedDisplayObjectCanvas=function(i){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new rt,!0),e=this.alpha;this.alpha=1;const s=i.canvasContext.activeContext,r=i._projTransform,n=this.cacheAsBitmapResolution||i.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const a=wi.create({width:t.width,height:t.height,resolution:n}),h=`cacheAsBitmap_${gi()}`;this._cacheData.textureCacheId=h,et.addToCache(a.baseTexture,h),q.addToCache(a,h);const o=cm;this.transform.localTransform.copyTo(o),o.invert(),o.tx-=t.x,o.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,i.render(this,{renderTexture:a,clear:!0,transform:o,skipUpdateTransform:!1}),i.canvasContext.activeContext=s,i._projTransform=r,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=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=i._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(i){this.cacheAsBitmap=!1,this.destroy(i)},Vt.prototype.name=null,Bt.prototype.getChildByName=function(i,t){for(let e=0,s=this.children.length;e<s;e++)if(this.children[e].name===i)return this.children[e];if(t)for(let e=0,s=this.children.length;e<s;e++){const r=this.children[e];if(!r.getChildByName)continue;const n=r.getChildByName(i,!0);if(n)return n}return null},Vt.prototype.getGlobalPosition=function(i=new st,t=!1){return this.parent?this.parent.toGlobal(this.position,i,t):(i.x=this.position.x,i.y=this.position.y),i};var ww=`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
|
|
536
|
-
`);function
|
|
537
|
-
`}return
|
|
535
|
+
`;class Ew extends pe{constructor(t=1){super(uw,ww,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Tw={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]},Aw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
536
|
+
`);function Sw(i){const t=Tw[i],e=t.length;let s=Aw,r="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let h=0;h<i;h++){let o=n.replace("%index%",h.toString());a=h,h>=e&&(a=i-h-1),o=o.replace("%value%",t[a].toString()),r+=o,r+=`
|
|
537
|
+
`}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}const Cw=`
|
|
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
|
|
568
|
-
`}return
|
|
567
|
+
}`;function Iw(i,t){const e=Math.ceil(i/2);let s=Cw,r="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a<i;a++){let h=n.replace("%index%",a.toString());h=h.replace("%sampleIndex%",`${a-(e-1)}.0`),r+=h,r+=`
|
|
568
|
+
`}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}class Jh extends pe{constructor(t,e=8,s=4,r=pe.defaultResolution,n=5){const a=Iw(n,t),h=Sw(n);super(a,h),this.horizontal=t,this.resolution=r,this._quality=0,this.quality=s,this.blur=e}apply(t,e,s,r){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,r);else{const n=t.getFilterTexture(),a=t.renderer;let h=e,o=n;this.state.blend=!1,t.applyFilter(this,h,o,Ns.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(h,Ns.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,r),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 um extends pe{constructor(t=8,e=4,s=pe.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Jh(!0,t,e,s,r),this.blurYFilter=new Jh(!1,t,e,s,r),this.resolution=s,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,s,r){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,Ns.CLEAR),this.blurYFilter.apply(t,h,s,r),t.returnFilterTexture(h)}else a?this.blurYFilter.apply(t,e,s,r):this.blurXFilter.apply(t,e,s,r)}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 Pw=`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
|
|
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(sm,Pw,t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,r,n]=Ct.shared.setValue(t).toArray(),a=[s,0,0,0,0,0,r,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),r=Math.sin(t),n=Math.sqrt,a=1/3,h=n(a),o=s+(1-s)*a,l=a*(1-s)-h*r,u=a*(1-s)+h*r,c=a*(1-s)+h*r,d=s+a*(1-s),f=a*(1-s)-h*r,p=a*(1-s)-h*r,m=a*(1-s)+h*r,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,r=-.5*(s-1),n=[s,0,0,0,r,0,s,0,0,r,0,0,s,0,r,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,r=(s-1)*-.5,n=[s,r,r,0,0,r,s,r,0,0,r,r,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,r,n){t=t||.2,e=e||.15,s=s||16770432,r=r||3375104;const a=Ct.shared,[h,o,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(r).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 Rw=`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
|
-
`,
|
|
640
|
+
`,Mw=`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
|
|
669
|
+
`;class Fw extends pe{constructor(t,e){const s=new Rt;t.renderable=!1,super(Mw,Rw,{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,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),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,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var kw=`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
|
-
`,
|
|
790
|
+
`,Bw=`
|
|
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
|
|
832
|
+
`;class Dw extends pe{constructor(){super(Bw,kw)}}var Ow=`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 eb extends Yt{constructor(t=.5,e=Math.random()){super(Bf,tb,{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 Xf={AlphaFilter:Hv,BlurFilter:Vf,BlurFilterPass:Kh,ColorMatrixFilter:or,DisplacementFilter:Kv,FXAAFilter:Jv,NoiseFilter:eb};Object.entries(Xf).forEach(([s,t])=>{Object.defineProperty(Xf,s,{get(){return it("7.1.0",`filters.${s} has moved to ${s}`),t}})});class ib{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||(ct.system.add(this.tickerUpdate,this,ji.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ct.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 qi=new ib;class an{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=an.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new tt,this.page=new tt,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,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,r,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 Ea extends an{constructor(){super(...arguments),this.client=new tt,this.movement=new tt,this.offset=new tt,this.global=new tt,this.screen=new tt}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,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,n,a,o,h,u,d,l,c,f,p,m){throw new Error("Method not implemented.")}}class Xe extends Ea{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 hr extends Ea{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}hr.DOM_DELTA_PIXEL=0,hr.DOM_DELTA_LINE=1,hr.DOM_DELTA_PAGE=2;const sb=2048,rb=new tt,Zh=new tt;class nb{constructor(t){this.dispatch=new ti,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((i,r)=>i.priority-r.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,r=e.length;i<r;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){qi.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[i](this.rootTarget,this.rootTarget.eventMode,rb.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=i.length-1;r<n;r++)if(t.currentTarget=i[r],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 r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=i[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let i=0;i<sb&&t!==this.rootTarget;i++){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,i,r,n,a=!1){let o=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(qi.pauseUpdate=!1),t.interactiveChildren&&t.children){const d=t.children;for(let l=d.length-1;l>=0;l--){const c=d[l],f=this.hitTestMoveRecursive(c,this._isInteractive(e)?e:c.eventMode,i,r,n,a||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const h=this._isInteractive(e),u=t.isInteractive();return h&&u&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:o?this._hitElements:h&&!n(t,i)&&r(t,i)?u?[t]:[]:null}hitTestRecursive(t,e,i,r,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(qi.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let u=h.length-1;u>=0;u--){const d=h[u],l=this.hitTestRecursive(d,this._isInteractive(e)?e:d.eventMode,i,r,n);if(l){if(l.length>0&&!l[l.length-1].parent)continue;const c=t.isInteractive();return(l.length>0||c)&&l.push(t),l}}}const a=this._isInteractive(e),o=t.isInteractive();return a&&r(t,i)?o?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Zh),!t.hitArea.contains(Zh.x,Zh.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((i=r.containsPoint)!=null&&i.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,a;e=e??t.type;const i=`on${e}`;(a=(n=t.currentTarget)[i])==null||a.call(n,t);const r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Xe)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var h,u;if(!(t instanceof Xe)){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 i=e.pointerType==="mouse"||e.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((h=r.overTargets)==null?void 0:h.length)>0&&n!==e.target){const d=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,d,n);if(this.dispatchEvent(l,"pointerout"),i&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(n)){const c=this.createPointerEvent(t,"pointerleave",n);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(l)}if(n!==e.target){const d=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,d);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let c=n==null?void 0:n.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===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),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(l)}const a=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),o&&a.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),o&&a.push("globaltouchmove")),i&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),o&&a.push("globalmousemove"),this.cursor=(u=e.target)==null?void 0:u.cursor),a.length>0&&this.all(e,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Xe)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(a=i.target)==null?void 0:a.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Xe)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),i&&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 Xe)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const o=i.button===2;this.dispatchEvent(i,o?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let a=n;if(n&&!i.composedPath().includes(n)){let o=n;for(;o&&!i.composedPath().includes(o);){if(i.currentTarget=o,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete r.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(i,"click");o.target=a,o.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const h=r.clicksByButton[t.button];if(h.target===o.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=o.target,h.timeStamp=e,o.detail=h.clickCount,o.pointerType==="mouse"){const u=o.button===2;this.dispatchEvent(o,u?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Xe)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let n=i;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof hr)){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 i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const r=this.allocateEvent(Xe);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=i??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}createWheelEvent(t){const e=this.allocateEvent(hr);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 i=this.allocateEvent(Xe);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Xe&&e instanceof Xe&&(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 Ea&&e instanceof Ea&&(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 i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(e,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}const ab=1,ob={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Qh=class Zu{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new nb(null),qi.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Xe(null),this.rootWheelEvent=new hr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Zu.defaultEventFeatures},{set:(e,i,r)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[i]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Zu._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 i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);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 i=0,r=e.length;i<r;i++){const n=e[i],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,qi.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,r=e.length;i<r;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);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 i=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n<a;n++){const o=this.bootstrapEvent(this.rootPointerEvent,r[n]);o.type+=i,this.rootBoundary.mapEvent(o)}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 i=0,r=e.length;i<r;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);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,qi.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;qi.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;qi.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,i){const r=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-r.left)*(this.domElement.width/r.width)*n,t.y=(i-r.top)*(this.domElement.height/r.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,r=t.changedTouches.length;i<r;i++){const n=t.changedTouches[i];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 i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=ab),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}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=ob[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}};Qh.extension={name:"events",type:[G.RendererSystem,G.CanvasRendererSystem]},Qh.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Jh=Qh;z.add(Jh);function Wf(s){return s==="dynamic"||s==="static"}const hb={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??Wf(Jh.defaultEventMode)},set interactive(s){it("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=s,this.eventMode=s?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Jh.defaultEventMode},set eventMode(s){this._internalInteractive=Wf(s),this._internalEventMode=s},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(s,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;s=i?`${s}capture`:s;const o=typeof t=="function"?t:t.handleEvent,h=this;r&&r.addEventListener("abort",()=>{h.off(s,o,a)}),n?h.once(s,o,a):h.on(s,o,a)},removeEventListener(s,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;s=i?`${s}capture`:s,t=typeof t=="function"?t:t.handleEvent,this.off(s,t,r)},dispatchEvent(s){if(!(s instanceof an))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return s.defaultPrevented=!1,s.path=null,s.target=this,s.manager.dispatchEvent(s),!s.defaultPrevented}};St.mixin(hb);const lb={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};St.mixin(lb);const ub=9,Aa=100,cb=0,db=0,$f=2,zf=1,fb=-1e3,pb=-1e3,mb=2;class Yf{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,(Ai.tablet||Ai.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Aa}px`,e.style.height=`${Aa}px`,e.style.position="absolute",e.style.top=`${cb}px`,e.style.left=`${db}px`,e.style.zIndex=$f.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=`${zf}px`,t.style.height=`${zf}px`,t.style.position="absolute",t.style.top=`${fb}px`,t.style.left=`${pb}px`,t.style.zIndex=mb.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 i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(Ai.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:i,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:o,resolution:h}=this.renderer,u=r/a*h,d=n/o*h;let l=this.div;l.style.left=`${e}px`,l.style.top=`${i}px`,l.style.width=`${a}px`,l.style.height=`${o}px`;for(let c=0;c<this.children.length;c++){const f=this.children[c];if(f.renderId!==this.renderId)f._accessibleActive=!1,sr(this.children,c,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,c--;else{l=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(l.style.left=`${(m.tx+p.x*m.a)*u}px`,l.style.top=`${(m.ty+p.y*m.d)*d}px`,l.style.width=`${p.width*m.a*u}px`,l.style.height=`${p.height*m.d*d}px`):(p=f.getBounds(),this.capHitArea(p),l.style.left=`${p.x*u}px`,l.style.top=`${p.y*d}px`,l.style.width=`${p.width*u}px`,l.style.height=`${p.height*d}px`,l.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(l.title=f.accessibleTitle),l.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&l.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==l.title||f.tabIndex!==l.tabIndex)&&(l.title=f.accessibleTitle,l.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(l))}}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:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Aa}px`,e.style.height=`${Aa}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=$f.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:i}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new an(r),{target:i});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>r.dispatchEvent(n,a))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===ub&&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}}Yf.extension={name:"accessibility",type:[G.RendererPlugin,G.CanvasRendererPlugin]},z.add(Yf);const jf=class Qu{constructor(t){this.stage=new bt,t=Object.assign({forceCanvas:!1},t),this.renderer=Sv(t),Qu._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 i=Qu._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};jf._plugins=[];let _b=jf;z.handleByList(G.Application,_b._plugins);class qf{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,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,i=n}this.renderer.resize(e,i),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}}qf.extension=G.Application,z.add(qf);const Kf={loader:G.LoadParser,resolver:G.ResolveParser,cache:G.CacheParser,detection:G.DetectionParser};z.handle(G.Asset,s=>{const t=s.ref;Object.entries(Kf).filter(([e])=>!!t[e]).forEach(([e,i])=>z.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(Kf).filter(e=>!!t[e]).forEach(e=>z.remove(t[e]))});class gb{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 i=0;i<e;i++)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 lr(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function Ki(s,t){const e=s.split("?")[0],i=Ft.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const We=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s),tl=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s};function Zf(s,t,e,i,r){const n=t[e];for(let a=0;a<n.length;a++){const o=n[a];e<t.length-1?Zf(s.replace(i[e],o),t,e+1,i,r):r.push(s.replace(i[e],o))}}function yb(s){const t=/\{(.*?)\}/g,e=s.match(t),i=[];if(e){const r=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");r.push(a)}),Zf(s,r,0,e,i)}else i.push(s);return i}const Sa=s=>!Array.isArray(s);class xb{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 i=We(t);let r;for(let o=0;o<this.parsers.length;o++){const h=this.parsers[o];if(h.test(e)){r=h.getCacheableAssets(i,e);break}}r||(r={},i.forEach(o=>{r[o]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:i};if(i.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o)!==e&&console.warn("[Cache] already has key:",o),this._cache.set(o,r[o])}),e instanceof W){const o=e;i.forEach(h=>{o.baseTexture!==W.EMPTY.baseTexture&&J.addToCache(o.baseTexture,h),W.addToCache(o,h)})}}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(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Cs=new xb;class vb{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var a,o;let r=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 h=0;h<this.parsers.length;h++){const u=this.parsers[h];if(u.load&&((a=u.test)!=null&&a.call(u,t,e,this))){n=u;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}r=await n.load(t,e,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const u=this.parsers[h];u.parse&&u.parse&&await((o=u.testParse)==null?void 0:o.call(u,r,e,this))&&(r=await u.parse(r,e,this)||r,i.parser=u)}return r})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const r={},n=Sa(t),a=We(t,u=>({alias:[u],src:u})),o=a.length,h=a.map(async u=>{const d=Ft.toAbsolute(u.src);if(!r[u.src])try{this.promiseCache[d]||(this.promiseCache[d]=this._getLoadPromiseAndParser(d,u)),r[u.src]=await this.promiseCache[d].promise,e&&e(++i/o)}catch(l){throw delete this.promiseCache[d],delete r[u.src],new Error(`[Loader.load] Failed to load ${d}.
|
|
867
|
-
${
|
|
866
|
+
`;class Lw extends pe{constructor(t=.5,e=Math.random()){super(sm,Ow,{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 dm={AlphaFilter:Ew,BlurFilter:um,BlurFilterPass:Jh,ColorMatrixFilter:hn,DisplacementFilter:Fw,FXAAFilter:Dw,NoiseFilter:Lw};Object.entries(dm).forEach(([i,t])=>{Object.defineProperty(dm,i,{get(){return ot("7.1.0",`filters.${i} has moved to ${i}`),t}})});class Nw{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,Vr.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 Ur=new Nw;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,r,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,r,n,a,h,o,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Es 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 Vw=2048,Uw=new st,tc=new st;class Gw{constructor(t){this.dispatch=new Gs,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,r)=>s.priority-r.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,r=e.length;s<r;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ur.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[s](this.rootTarget,this.rootTarget.eventMode,Uw.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=s.length-1;r<n;r++)if(t.currentTarget=s[r],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 r=s.length-2;r>=0;r--)if(t.currentTarget=s[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s<Vw&&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,r,n,a=!1){let h=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ur.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,r,n,a||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),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)&&r(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,r,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ur.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,r,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const a=this._isInteractive(e),h=t.isInteractive();return a&&r(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,tc),!t.hitArea.contains(tc.x,tc.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((s=r.containsPoint)!=null&&s.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,a;e=e??t.type;const s=`on${e}`;(a=(n=t.currentTarget)[s])==null||a.call(n,t);const r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var o,l;if(!(t instanceof Es)){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",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((o=r.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,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),r=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),r&&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),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const s=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Es)){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 r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.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 r.pressTargetsByButton[t.button],a=h}if(a){const h=this.clonePointerEvent(s,"click");h.target=a,h.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});const o=r.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 Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(s){let n=s;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof 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 r=this.allocateEvent(Es);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=s??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}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(Es);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 Es&&e instanceof Es&&(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 r=0,n=s.length;r<n&&!t.propagationImmediatelyStopped;r++)s[r].once&&t.currentTarget.removeListener(e,s[r].fn,void 0,!0),s[r].fn.call(s[r].context,t)}}const Xw=1,$w={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},ec=class xd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Gw(null),Ur.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Es(null),this.rootWheelEvent=new cn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...xd.defaultEventFeatures},{set:(e,s,r)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[s]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:s}=this.renderer;this.setTargetElement(e),this.resolution=s,xd._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,r=e.length;s<r;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,Ur.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,r=e.length;s<r;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":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n<a;n++){const h=this.bootstrapEvent(this.rootPointerEvent,r[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,r=e.length;s<r;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,Ur.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ur.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;Ur.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 r=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-r.left)*(this.domElement.width/r.width)*n,t.y=(s-r.top)*(this.domElement.height/r.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,r=t.changedTouches.length;s<r;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=Xw),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=$w[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};ec.extension={name:"events",type:[Y.RendererSystem,Y.CanvasRendererSystem]},ec.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let sc=ec;K.add(sc);function fm(i){return i==="dynamic"||i==="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??fm(sc.defaultEventMode)},set interactive(i){ot("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??sc.defaultEventMode},set eventMode(i){this._internalInteractive=fm(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;i=s?`${i}capture`:i;const h=typeof t=="function"?t:t.handleEvent,o=this;r&&r.addEventListener("abort",()=>{o.off(i,h,a)}),n?o.once(i,h,a):o.on(i,h,a)},removeEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;i=s?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,r)},dispatchEvent(i){if(!(i instanceof lo))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};Vt.mixin(Yw);const Hw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Vt.mixin(Hw);const Ww=9,Ra=100,zw=0,jw=0,pm=2,mm=1,qw=-1e3,Zw=-1e3,Kw=2;class gm{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,(fr.tablet||fr.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=`${jw}px`,e.style.zIndex=pm.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=`${mm}px`,t.style.height=`${mm}px`,t.style.position="absolute",t.style.top=`${qw}px`,t.style.left=`${Zw}px`,t.style.zIndex=Kw.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(fr.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:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:h,resolution:o}=this.renderer,l=r/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=pm.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new lo(r),{target:s});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>r.dispatchEvent(n,a))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===Ww&&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}}gm.extension={name:"accessibility",type:[Y.RendererPlugin,Y.CanvasRendererPlugin]},K.add(gm);const _m=class vd{constructor(t){this.stage=new Bt,t=Object.assign({forceCanvas:!1},t),this.renderer=lw(t),vd._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=vd._plugins.slice(0);s.reverse(),s.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};_m._plugins=[];let Qw=_m;K.handleByList(Y.Application,Qw._plugins);class ym{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,s=n}this.renderer.resize(e,s),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}ym.extension=Y.Application,K.add(ym);const xm={loader:Y.LoadParser,resolver:Y.ResolveParser,cache:Y.CacheParser,detection:Y.DetectionParser};K.handle(Y.Asset,i=>{const t=i.ref;Object.entries(xm).filter(([e])=>!!t[e]).forEach(([e,s])=>K.add(Object.assign(t[e],{extension:t[e].extension??s})))},i=>{const t=i.ref;Object.keys(xm).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});class Jw{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(i,t){if(Array.isArray(t)){for(const e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}function Le(i,t){const e=i.split("?")[0],s=bt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const Ts=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(s=>typeof s=="string"||e?t(s):s):i),rc=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function vm(i,t,e,s,r){const n=t[e];for(let a=0;a<n.length;a++){const h=n[a];e<t.length-1?vm(i.replace(s[e],h),t,e+1,s,r):r.push(i.replace(s[e],h))}}function tE(i){const t=/\{(.*?)\}/g,e=i.match(t),s=[];if(e){const r=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");r.push(a)}),vm(i,r,0,e,s)}else s.push(i);return s}const Ma=i=>!Array.isArray(i);class eE{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=Ts(t);let r;for(let h=0;h<this.parsers.length;h++){const o=this.parsers[h];if(o.test(e)){r=o.getCacheableAssets(s,e);break}}r||(r={},s.forEach(h=>{r[h]=e}));const n=Object.keys(r),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,r[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 Ai=new eE;class sE{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 r=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}r=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,r,e,this))&&(r=await l.parse(r,e,this)||r,s.parser=l)}return r})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const r={},n=Ma(t),a=Ts(t,l=>({alias:[l],src:l})),h=a.length,o=a.map(async l=>{const u=bt.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),r[l.src]=await this.promiseCache[u].promise,e&&e(++s/h)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}.
|
|
867
|
+
${c}`)}});return await Promise.all(o),n?r[a[0].src]:r}async unload(t){const e=Ts(t,s=>({alias:[s],src:s})).map(async s=>{var a,h;const r=bt.toAbsolute(s.src),n=this.promiseCache[r];if(n){const o=await n.promise;delete this.promiseCache[r],(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=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Ne||{});const rE=".json",iE="application/json",nE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadJson",test(i){return un(i,iE)||Le(i,rE)},async load(i){return await(await z.ADAPTER.fetch(i)).json()}};K.add(nE);const oE=".txt",aE="text/plain",lE={name:"loadTxt",extension:{type:Y.LoadParser,priority:Ne.Low},test(i){return un(i,aE)||Le(i,oE)},async load(i){return await(await z.ADAPTER.fetch(i)).text()}};K.add(lE);const hE=["normal","bold","100","200","300","400","500","600","700","800","900"],cE=[".ttf",".otf",".woff",".woff2"],uE=["font/ttf","font/otf","font/woff","font/woff2"],dE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function fE(i){const t=bt.extname(i),e=bt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(dE)){s=!1;break}let r=e.join(" ");return s||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const pE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function mE(i){return pE.test(i)?i:encodeURI(i)}const gE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadWebFont",test(i){return un(i,uE)||Le(i,cE)},async load(i,t){var s,r,n;const e=z.ADAPTER.getFontFaceSet();if(e){const a=[],h=((s=t.data)==null?void 0:s.family)??fE(i),o=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(u=>hE.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<o.length;u++){const c=o[u],d=new FontFace(h,`url(${mE(i)})`,{...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(i){(Array.isArray(i)?i:[i]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};K.add(gE);const _E=`(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 @@ ${l}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=We
|
|
|
881
881
|
self.postMessage(result);
|
|
882
882
|
});
|
|
883
883
|
})();
|
|
884
|
-
`;let
|
|
884
|
+
`;let dn=null,ic=class{constructor(){dn||(dn=URL.createObjectURL(new Blob([_E],{type:"application/javascript"}))),this.worker=new Worker(dn)}};ic.revokeObjectURL=function(){dn&&(URL.revokeObjectURL(dn),dn=null)};const yE=`(function() {
|
|
885
885
|
"use strict";
|
|
886
886
|
async function loadImageBitmap(url) {
|
|
887
887
|
const response = await fetch(url);
|
|
@@ -907,8 +907,8 @@ ${l}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=We
|
|
|
907
907
|
}
|
|
908
908
|
};
|
|
909
909
|
})();
|
|
910
|
-
`;let
|
|
911
|
-
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:i,format:r,loadParser:n})):Array.isArray(t)?a.push(...t):a.push(t);let o;o=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},We(a).forEach(h=>{const{src:u,srcs:d}=h;let{data:l,format:c,loadParser:f}=h;const p=We(u||d).map(g=>typeof g=="string"?yb(g):Array.isArray(g)?g:[g]),m=this.getAlias(h);Array.isArray(m)?m.forEach(o):o(m);const _=[];p.forEach(g=>{g.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 l=x.data??l,c=x.format??c,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:l,format:c,loadParser:f}),_.push(y)})}),m.forEach(g=>{this._assetMap[g]=_})})}resolveBundle(t){const e=Sa(t);t=We(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),o={};for(const h in a){const u=a[h];o[this._extractAssetIdFromBundle(r,h)]=u}i[r]=o}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=Sa(t);t=We(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const a=n[0],o=this._getPreferredOrder(n);o==null||o.priority.forEach(h=>{o.params[h].forEach(u=>{const d=n.filter(l=>l[h]?l[h]===u:!1);d.length&&(n=d)})}),this._resolverHash[r]=n[0]??a}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:r,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=Ft.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??Ft.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class jb{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Yb,this.loader=new vb,this.cache=Cs,this._backgroundLoader=new gb(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 o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,r,n){this.resolver.add(t,e,i,r,n)}async load(t,e){this._initialized||await this.init();const i=Sa(t),r=We(t).map(o=>{if(typeof o!="string"){const h=this.resolver.getAlias(o);return h.some(u=>!this.resolver.hasKey(u))&&this.add(o),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return i?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let o=0,h=0;const u=()=>{e==null||e(++o/h)},d=a.map(l=>{const c=r[l];return h+=Object.keys(c).length,this._mapLoadToResolve(c,u).then(f=>{n[l]=f})});return await Promise.all(d),i?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(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Cs.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=Cs.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const a={};return i.forEach((o,h)=>{const u=n[o.src],d=[o.src];o.alias&&d.push(...o.alias),a[r[h]]=u,Cs.set(d,u)}),a}async unload(t){this._initialized||await this.init();const e=We(t).map(r=>typeof r!="string"?r.src:r),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=We(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{Cs.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,r)=>e.indexOf(i)===r),e}get detections(){return this._detections}get preferWorkers(){return Ca.config.preferWorkers}set preferWorkers(t){it("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(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Zi=new jb;z.handleByList(G.LoadParser,Zi.loader.parsers).handleByList(G.ResolveParser,Zi.resolver.parsers).handleByList(G.CacheParser,Zi.cache.parsers).handleByList(G.DetectionParser,Zi.detections);const qb={extension:G.CacheParser,test:s=>Array.isArray(s)&&s.every(t=>t instanceof W),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((r,n)=>{e[i+(n===0?"":n+1)]=r})}),e}};z.add(qb);async function ep(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const Kb={extension:{type:G.DetectionParser,priority:1},test:async()=>ep("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")};z.add(Kb);const Zb={extension:{type:G.DetectionParser,priority:0},test:async()=>ep("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")};z.add(Zb);const ip=["png","jpg","jpeg"],Qb={extension:{type:G.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...ip],remove:async s=>s.filter(t=>!ip.includes(t))};z.add(Qb);const Jb="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function sl(s){return Jb?!1:document.createElement("video").canPlayType(s)!==""}const t1={extension:{type:G.DetectionParser,priority:0},test:async()=>sl("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")};z.add(t1);const e1={extension:{type:G.DetectionParser,priority:0},test:async()=>sl("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")};z.add(e1);const i1={extension:{type:G.DetectionParser,priority:0},test:async()=>sl("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")};z.add(i1);const s1={extension:G.ResolveParser,test:Ca.test,parse:s=>{var t;return{resolution:parseFloat(((t=H.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:Ft.extname(s).slice(1),src:s}}};z.add(s1);var Qt=(s=>(s[s.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",s[s.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",s[s.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",s[s.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",s[s.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",s[s.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",s[s.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",s[s.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",s[s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",s[s.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",s[s.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",s[s.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",s[s.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",s[s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",s[s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",s[s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",s))(Qt||{});const Pa={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 li,dr;function sp(){dr={bptc:li.getExtension("EXT_texture_compression_bptc"),astc:li.getExtension("WEBGL_compressed_texture_astc"),etc:li.getExtension("WEBGL_compressed_texture_etc"),s3tc:li.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:li.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:li.getExtension("WEBGL_compressed_texture_pvrtc")||li.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:li.getExtension("WEBGL_compressed_texture_etc1"),atc:li.getExtension("WEBGL_compressed_texture_atc")}}const r1={extension:{type:G.DetectionParser,priority:2},test:async()=>{const s=H.ADAPTER.createCanvas().getContext("webgl");return s?(li=s,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async s=>{dr||sp();const t=[];for(const e in dr)dr[e]&&t.push(e);return[...t,...s]},remove:async s=>(dr||sp(),s.filter(t=>!(t in dr)))};z.add(r1);class n1 extends ia{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,r;typeof t=="string"?(i=t,r=new Uint8Array):(i=null,r=t),super(r,e),this.origin=i,this.buffer=r?new wh(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new wh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ps extends n1{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=Ps._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ps._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const r=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n<a;n++){const{levelID:o,levelWidth:h,levelHeight:u,levelBuffer:d}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,o,this.format,h,u,0,d)}return!0}onBlobLoaded(){this._levelBuffers=Ps._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,i,r,n,a,o){const h=new Array(i);let u=t.byteOffset,d=a,l=o,c=d+r-1&~(r-1),f=l+n-1&~(n-1),p=c*f*Pa[e];for(let m=0;m<i;m++)h[m]={levelID:m,levelWidth:i>1?d:c,levelHeight:i>1?l:f,levelBuffer:new Uint8Array(t.buffer,u,p)},u+=p,d=d>>1||1,l=l>>1||1,c=d+r-1&~(r-1),f=l+n-1&~(n-1),p=c*f*Pa[e];return h}}const rl=4,Ia=124,a1=32,rp=20,o1=542327876,Ra={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},h1={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},Ma={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},l1=1,u1=2,c1=4,d1=64,f1=512,p1=131072,m1=827611204,_1=861165636,g1=894720068,y1=808540228,x1=4,v1={[m1]:Qt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[_1]:Qt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[g1]:Qt.COMPRESSED_RGBA_S3TC_DXT5_EXT},b1={70:Qt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Qt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Qt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Qt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Qt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Qt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Qt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Qt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Qt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Qt.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Qt.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Qt.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Qt.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function T1(s){const t=new Uint32Array(s);if(t[0]!==o1)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(s,0,Ia/Uint32Array.BYTES_PER_ELEMENT),i=e[Ra.HEIGHT],r=e[Ra.WIDTH],n=e[Ra.MIPMAP_COUNT],a=new Uint32Array(s,Ra.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,a1/Uint32Array.BYTES_PER_ELEMENT),o=a[l1];if(o&c1){const h=a[h1.FOURCC];if(h!==y1){const x=v1[h],y=rl+Ia,v=new Uint8Array(s,y);return[new Ps(v,{format:x,width:r,height:i,levels:n})]}const u=rl+Ia,d=new Uint32Array(t.buffer,u,rp/Uint32Array.BYTES_PER_ELEMENT),l=d[Ma.DXGI_FORMAT],c=d[Ma.RESOURCE_DIMENSION],f=d[Ma.MISC_FLAG],p=d[Ma.ARRAY_SIZE],m=b1[l];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(f===x1)throw new Error("DDSParser does not support cubemap textures");if(c===6)throw new Error("DDSParser does not supported 3D texture data");const _=new Array,g=rl+Ia+rp;if(p===1)_.push(new Uint8Array(s,g));else{const x=Pa[m];let y=0,v=r,b=i;for(let w=0;w<n;w++){const A=Math.max(1,v+3&-4),T=Math.max(1,b+3&-4),P=A*T*x;y+=P,v=v>>>1,b=b>>>1}let E=g;for(let w=0;w<p;w++)_.push(new Uint8Array(s,E,y)),E+=y}return _.map(x=>new Ps(x,{format:m,width:r,height:i,levels:n}))}throw o&d1?new Error("DDSParser does not support uncompressed texture data."):o&f1?new Error("DDSParser does not supported YUV uncompressed texture data."):o&p1?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&u1?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 np=[171,75,84,88,32,49,49,187,13,10,26,10],w1=67305985,$e={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},nl=64,ap={[Z.UNSIGNED_BYTE]:1,[Z.UNSIGNED_SHORT]:2,[Z.INT]:4,[Z.UNSIGNED_INT]:4,[Z.FLOAT]:4,[Z.HALF_FLOAT]:8},E1={[O.RGBA]:4,[O.RGB]:3,[O.RG]:2,[O.RED]:1,[O.LUMINANCE]:1,[O.LUMINANCE_ALPHA]:2,[O.ALPHA]:1},A1={[Z.UNSIGNED_SHORT_4_4_4_4]:2,[Z.UNSIGNED_SHORT_5_5_5_1]:2,[Z.UNSIGNED_SHORT_5_6_5]:2};function S1(s,t,e=!1){const i=new DataView(t);if(!C1(s,i))return null;const r=i.getUint32($e.ENDIANNESS,!0)===w1,n=i.getUint32($e.GL_TYPE,r),a=i.getUint32($e.GL_FORMAT,r),o=i.getUint32($e.GL_INTERNAL_FORMAT,r),h=i.getUint32($e.PIXEL_WIDTH,r),u=i.getUint32($e.PIXEL_HEIGHT,r)||1,d=i.getUint32($e.PIXEL_DEPTH,r)||1,l=i.getUint32($e.NUMBER_OF_ARRAY_ELEMENTS,r)||1,c=i.getUint32($e.NUMBER_OF_FACES,r),f=i.getUint32($e.NUMBER_OF_MIPMAP_LEVELS,r),p=i.getUint32($e.BYTES_OF_KEY_VALUE_DATA,r);if(u===0||d!==1)throw new Error("Only 2D textures are supported");if(c!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(l!==1)throw new Error("WebGL does not support array textures");const m=4,_=4,g=h+3&-4,x=u+3&-4,y=new Array(l);let v=h*u;n===0&&(v=g*x);let b;if(n!==0?ap[n]?b=ap[n]*E1[a]:b=A1[n]:b=Pa[o],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const E=e?I1(i,p,r):null;let w=v*b,A=h,T=u,P=g,k=x,R=nl+p;for(let S=0;S<f;S++){const C=i.getUint32(R,r);let I=R+4;for(let N=0;N<l;N++){let F=y[N];F||(F=y[N]=new Array(f)),F[S]={levelID:S,levelWidth:f>1||n!==0?A:P,levelHeight:f>1||n!==0?T:k,levelBuffer:new Uint8Array(t,I,w)},I+=w}R+=C+4,R=R%4!==0?R+4-R%4:R,A=A>>1||1,T=T>>1||1,P=A+m-1&~(m-1),k=T+_-1&~(_-1),w=P*k*b}return n!==0?{uncompressed:y.map(S=>{let C=S[0].levelBuffer,I=!1;return n===Z.FLOAT?C=new Float32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4):n===Z.UNSIGNED_INT?(I=!0,C=new Uint32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)):n===Z.INT&&(I=!0,C=new Int32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)),{resource:new ia(C,{width:S[0].levelWidth,height:S[0].levelHeight}),type:n,format:I?P1(a):a}}),kvData:E}:{compressed:y.map(S=>new Ps(null,{format:o,width:h,height:u,levels:f,levelBuffers:S})),kvData:E}}function C1(s,t){for(let e=0;e<np.length;e++)if(t.getUint8(e)!==np[e])return console.error(`${s} is not a valid *.ktx file!`),!1;return!0}function P1(s){switch(s){case O.RGBA:return O.RGBA_INTEGER;case O.RGB:return O.RGB_INTEGER;case O.RG:return O.RG_INTEGER;case O.RED:return O.RED_INTEGER;default:return s}}function I1(s,t,e){const i=new Map;let r=0;for(;r<t;){const n=s.getUint32(nl+r,e),a=nl+r+4,o=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&s.getUint8(a+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const u=new TextDecoder().decode(new Uint8Array(s.buffer,a,h)),d=new DataView(s.buffer,a+h+1,n-h-1);i.set(u,d),r+=4+n+o}return i}const R1={extension:{type:G.LoadParser,priority:Ie.High},name:"loadDDS",test(s){return Ki(s,".dds")},async load(s,t,e){const i=await(await H.ADAPTER.fetch(s)).arrayBuffer(),r=T1(i).map(n=>{const a=new J(n,{mipmap:Ke.OFF,alphaMode:he.NO_PREMULTIPLIED_ALPHA,resolution:Ii(s),...t.data});return on(a,e,s)});return r.length===1?r[0]:r},unload(s){Array.isArray(s)?s.forEach(t=>t.destroy(!0)):s.destroy(!0)}};z.add(R1);const M1={extension:{type:G.LoadParser,priority:Ie.High},name:"loadKTX",test(s){return Ki(s,".ktx")},async load(s,t,e){const i=await(await H.ADAPTER.fetch(s)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=S1(s,i),o=r??n,h={mipmap:Ke.OFF,alphaMode:he.NO_PREMULTIPLIED_ALPHA,resolution:Ii(s),...t.data},u=o.map(d=>{o===n&&Object.assign(h,{type:d.type,format:d.format});const l=d.resource??d,c=new J(l,h);return c.ktxKeyValueData=a,on(c,e,s)});return u.length===1?u[0]:u},unload(s){Array.isArray(s)?s.forEach(t=>t.destroy(!0)):s.destroy(!0)}};z.add(M1);const D1=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],B1={extension:G.ResolveParser,test:s=>{const t=Ft.extname(s).slice(1);return["basis","ktx","dds"].includes(t)},parse:s=>{var i,r;const t=s.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(D1.includes(n))return{resolution:parseFloat(((i=H.RETINA_PREFIX.exec(s))==null?void 0:i[1])??"1"),format:n,src:s}}return{resolution:parseFloat(((r=H.RETINA_PREFIX.exec(s))==null?void 0:r[1])??"1"),format:e,src:s}}};z.add(B1);const Da=new st,O1=4,op=class Dn{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,i,r){const n=new Image;return n.src=await this.base64(t,e,i,r),n}async base64(t,e,i,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>a(u.result),u.onerror=o,u.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:i});return new Promise((o,h)=>{const u=new FileReader;u.onload=()=>o(u.result),u.onerror=h,u.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);a&&Dn._flipY(i,r,n),o&&Dn._unpremultiplyAlpha(i);const h=new mx(r,n,1),u=new ImageData(new Uint8ClampedArray(i.buffer),r,n);return h.context.putImageData(u,0,0),h.canvas}pixels(t,e){const{pixels:i,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);return a&&Dn._flipY(i,r,n),o&&Dn._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let r,n=!1,a=!1,o,h=!1;t&&(t instanceof Es?o=t:(o=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Da.width=e.width,Da.height=e.height,e=Da)));const u=i.gl;if(o){if(r=o.baseTexture.resolution,e=e??o.frame,n=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===O.RGBA,!h){i.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else r=i.resolution,e||(e=Da,e.width=i.width/r,e.height=i.height/r),n=!0,a=this._rendererPremultipliedAlpha,i.renderTexture.bind();const d=Math.max(Math.round(e.width*r),1),l=Math.max(Math.round(e.height*r),1),c=new Uint8Array(O1*d*l);return u.readPixels(Math.round(e.x*r),Math.round(e.y*r),d,l,u.RGBA,u.UNSIGNED_BYTE,c),h&&(o==null||o.destroy(!0)),{pixels:c,width:d,height:l,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,i){const r=e<<2,n=i>>1,a=new Uint8Array(r);for(let o=0;o<n;o++){const h=o*r,u=(i-o-1)*r;a.set(t.subarray(h,h+r)),t.copyWithin(h,u,u+r),t.set(a,u)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const r=t[i+3];if(r!==0){const n=255.001/r;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};op.extension={name:"extract",type:G.RendererSystem};let F1=op;z.add(F1);const Ba={build(s){const t=s.points;let e,i,r,n,a,o;if(s.type===Zt.CIRC){const p=s.shape;e=p.x,i=p.y,a=o=p.radius,r=n=0}else if(s.type===Zt.ELIP){const p=s.shape;e=p.x,i=p.y,a=p.width,o=p.height,r=n=0}else{const p=s.shape,m=p.width/2,_=p.height/2;e=p.x+m,i=p.y+_,a=o=Math.max(0,Math.min(p.radius,Math.min(m,_))),r=m-a,n=_-o}if(!(a>=0&&o>=0&&r>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),u=h*8+(r?4:0)+(n?4:0);if(t.length=u,u===0)return;if(h===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n;return}let d=0,l=h*4+(r?2:0)+2,c=l,f=u;{const p=r+a,m=n,_=e+p,g=e-p,x=i+m;if(t[d++]=_,t[d++]=x,t[--l]=x,t[--l]=g,n){const y=i-m;t[c++]=g,t[c++]=y,t[--f]=y,t[--f]=_}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),_=r+Math.cos(m)*a,g=n+Math.sin(m)*o,x=e+_,y=e-_,v=i+g,b=i-g;t[d++]=x,t[d++]=v,t[--l]=v,t[--l]=y,t[c++]=y,t[c++]=b,t[--f]=b,t[--f]=x}{const p=r,m=n+o,_=e+p,g=e-p,x=i+m,y=i-m;t[d++]=_,t[d++]=x,t[--f]=y,t[--f]=_,r&&(t[d++]=g,t[d++]=x,t[--f]=y,t[--f]=g)}},triangulate(s,t){const e=s.points,i=t.points,r=t.indices;if(e.length===0)return;let n=i.length/2;const a=n;let o,h;if(s.type!==Zt.RREC){const d=s.shape;o=d.x,h=d.y}else{const d=s.shape;o=d.x+d.width/2,h=d.y+d.height/2}const u=s.matrix;i.push(s.matrix?u.a*o+u.c*h+u.tx:o,s.matrix?u.b*o+u.d*h+u.ty:h),n++,i.push(e[0],e[1]);for(let d=2;d<e.length;d+=2)i.push(e[d],e[d+1]),r.push(n++,a,n);r.push(a+1,a,n)}};function hp(s,t=!1){const e=s.length;if(e<6)return;let i=0;for(let r=0,n=s[e-2],a=s[e-1];r<e;r+=2){const o=s[r],h=s[r+1];i+=(o-n)*(h+a),n=o,a=h}if(!t&&i>0||t&&i<=0){const r=e/2;for(let n=r+r%2;n<e;n+=2){const a=e-n-2,o=e-n-1,h=n,u=n+1;[s[a],s[h]]=[s[h],s[a]],[s[o],s[u]]=[s[u],s[o]]}}}const lp={build(s){s.points=s.shape.points.slice()},triangulate(s,t){let e=s.points;const i=s.holes,r=t.points,n=t.indices;if(e.length>=6){hp(e,!1);const a=[];for(let u=0;u<i.length;u++){const d=i[u];hp(d.points,!0),a.push(e.length/2),e=e.concat(d.points)}const o=q_(e,a,2);if(!o)return;const h=r.length/2;for(let u=0;u<o.length;u+=3)n.push(o[u]+h),n.push(o[u+1]+h),n.push(o[u+2]+h);for(let u=0;u<e.length;u++)r.push(e[u])}}},k1={build(s){const t=s.shape,e=t.x,i=t.y,r=t.width,n=t.height,a=s.points;a.length=0,r>=0&&n>=0&&a.push(e,i,e+r,i,e+r,i+n,e,i+n)},triangulate(s,t){const e=s.points,i=t.points;if(e.length===0)return;const r=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},L1={build(s){Ba.build(s)},triangulate(s,t){Ba.triangulate(s,t)}};var Re=(s=>(s.MITER="miter",s.BEVEL="bevel",s.ROUND="round",s))(Re||{}),Qi=(s=>(s.BUTT="butt",s.ROUND="round",s.SQUARE="square",s))(Qi||{});const fr={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(s,t=20){if(!this.adaptive||!s||isNaN(s))return t;let e=Math.ceil(s/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class up{static curveTo(t,e,i,r,n,a){const o=a[a.length-2],h=a[a.length-1]-e,u=o-t,d=r-e,l=i-t,c=Math.abs(h*l-u*d);if(c<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=h*h+u*u,p=d*d+l*l,m=h*d+u*l,_=n*Math.sqrt(f)/c,g=n*Math.sqrt(p)/c,x=_*m/f,y=g*m/p,v=_*l+g*u,b=_*d+g*h,E=u*(g+x),w=h*(g+x),A=l*(_+y),T=d*(_+y),P=Math.atan2(w-b,E-v),k=Math.atan2(T-b,A-v);return{cx:v+t,cy:b+e,radius:n,startAngle:P,endAngle:k,anticlockwise:u*d>l*h}}static arc(t,e,i,r,n,a,o,h,u){const d=o-a,l=fr._segmentsCount(Math.abs(d)*n,Math.ceil(Math.abs(d)/ra)*40),c=d/(l*2),f=c*2,p=Math.cos(c),m=Math.sin(c),_=l-1,g=_%1/_;for(let x=0;x<=_;++x){const y=x+g*x,v=c+a+f*y,b=Math.cos(v),E=-Math.sin(v);u.push((p*b+m*E)*n+i,(p*-E+m*b)*n+r)}}}class N1{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}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 al{static curveLength(t,e,i,r,n,a,o,h){let u=0,d=0,l=0,c=0,f=0,p=0,m=0,_=0,g=0,x=0,y=0,v=t,b=e;for(let E=1;E<=10;++E)d=E/10,l=d*d,c=l*d,f=1-d,p=f*f,m=p*f,_=m*t+3*p*d*i+3*f*l*n+c*o,g=m*e+3*p*d*r+3*f*l*a+c*h,x=v-_,y=b-g,v=_,b=g,u+=Math.sqrt(x*x+y*y);return u}static curveTo(t,e,i,r,n,a,o){const h=o[o.length-2],u=o[o.length-1];o.length-=2;const d=fr._segmentsCount(al.curveLength(h,u,t,e,i,r,n,a));let l=0,c=0,f=0,p=0,m=0;o.push(h,u);for(let _=1,g=0;_<=d;++_)g=_/d,l=1-g,c=l*l,f=c*l,p=g*g,m=p*g,o.push(f*h+3*c*g*t+3*l*p*i+m*n,f*u+3*c*g*e+3*l*p*r+m*a)}}function cp(s,t,e,i,r,n,a,o){const h=s-e*r,u=t-i*r,d=s+e*n,l=t+i*n;let c,f;a?(c=i,f=-e):(c=-i,f=e);const p=h+c,m=u+f,_=d+c,g=l+f;return o.push(p,m,_,g),2}function Is(s,t,e,i,r,n,a,o){const h=e-s,u=i-t;let d=Math.atan2(h,u),l=Math.atan2(r-s,n-t);o&&d<l?d+=Math.PI*2:!o&&d>l&&(l+=Math.PI*2);let c=d;const f=l-d,p=Math.abs(f),m=Math.sqrt(h*h+u*u),_=(15*p*Math.sqrt(m)/Math.PI>>0)+1,g=f/_;if(c+=g,o){a.push(s,t,e,i);for(let x=1,y=c;x<_;x++,y+=g)a.push(s,t,s+Math.sin(y)*m,t+Math.cos(y)*m);a.push(s,t,r,n)}else{a.push(e,i,s,t);for(let x=1,y=c;x<_;x++,y+=g)a.push(s+Math.sin(y)*m,t+Math.cos(y)*m,s,t);a.push(r,n,s,t)}return _*2}function U1(s,t){const e=s.shape;let i=s.points||e.points.slice();const r=t.closePointEps;if(i.length===0)return;const n=s.lineStyle,a=new tt(i[0],i[1]),o=new tt(i[i.length-2],i[i.length-1]),h=e.type!==Zt.POLY||e.closeStroke,u=Math.abs(a.x-o.x)<r&&Math.abs(a.y-o.y)<r;if(h){i=i.slice(),u&&(i.pop(),i.pop(),o.set(i[i.length-2],i[i.length-1]));const F=(a.x+o.x)*.5,B=(o.y+a.y)*.5;i.unshift(F,B),i.push(F,B)}const d=t.points,l=i.length/2;let c=i.length;const f=d.length/2,p=n.width/2,m=p*p,_=n.miterLimit*n.miterLimit;let g=i[0],x=i[1],y=i[2],v=i[3],b=0,E=0,w=-(x-v),A=g-y,T=0,P=0,k=Math.sqrt(w*w+A*A);w/=k,A/=k,w*=p,A*=p;const R=n.alignment,S=(1-R)*2,C=R*2;h||(n.cap===Qi.ROUND?c+=Is(g-w*(S-C)*.5,x-A*(S-C)*.5,g-w*S,x-A*S,g+w*C,x+A*C,d,!0)+2:n.cap===Qi.SQUARE&&(c+=cp(g,x,w,A,S,C,!0,d))),d.push(g-w*S,x-A*S,g+w*C,x+A*C);for(let F=1;F<l-1;++F){g=i[(F-1)*2],x=i[(F-1)*2+1],y=i[F*2],v=i[F*2+1],b=i[(F+1)*2],E=i[(F+1)*2+1],w=-(x-v),A=g-y,k=Math.sqrt(w*w+A*A),w/=k,A/=k,w*=p,A*=p,T=-(v-E),P=y-b,k=Math.sqrt(T*T+P*P),T/=k,P/=k,T*=p,P*=p;const B=y-g,X=x-v,M=y-b,D=E-v,$=B*M+X*D,Y=X*M-D*B,U=Y<0;if(Math.abs(Y)<.001*Math.abs($)){d.push(y-w*S,v-A*S,y+w*C,v+A*C),$>=0&&(n.join===Re.ROUND?c+=Is(y,v,y-w*S,v-A*S,y-T*S,v-P*S,d,!1)+4:c+=2,d.push(y-T*C,v-P*C,y+T*S,v+P*S));continue}const rt=(-w+g)*(-A+v)-(-w+y)*(-A+x),ft=(-T+b)*(-P+v)-(-T+y)*(-P+E),lt=(B*ft-M*rt)/Y,vt=(D*rt-X*ft)/Y,Dt=(lt-y)*(lt-y)+(vt-v)*(vt-v),Lt=y+(lt-y)*S,_t=v+(vt-v)*S,Bt=y-(lt-y)*C,wt=v-(vt-v)*C,me=Math.min(B*B+X*X,M*M+D*D),Ae=U?S:C,ds=me+Ae*Ae*m,Dr=Dt<=ds;let fs=n.join;if(fs===Re.MITER&&Dt/m>_&&(fs=Re.BEVEL),Dr)switch(fs){case Re.MITER:{d.push(Lt,_t,Bt,wt);break}case Re.BEVEL:{U?d.push(Lt,_t,y+w*C,v+A*C,Lt,_t,y+T*C,v+P*C):d.push(y-w*S,v-A*S,Bt,wt,y-T*S,v-P*S,Bt,wt),c+=2;break}case Re.ROUND:{U?(d.push(Lt,_t,y+w*C,v+A*C),c+=Is(y,v,y+w*C,v+A*C,y+T*C,v+P*C,d,!0)+4,d.push(Lt,_t,y+T*C,v+P*C)):(d.push(y-w*S,v-A*S,Bt,wt),c+=Is(y,v,y-w*S,v-A*S,y-T*S,v-P*S,d,!1)+4,d.push(y-T*S,v-P*S,Bt,wt));break}}else{switch(d.push(y-w*S,v-A*S,y+w*C,v+A*C),fs){case Re.MITER:{U?d.push(Bt,wt,Bt,wt):d.push(Lt,_t,Lt,_t),c+=2;break}case Re.ROUND:{U?c+=Is(y,v,y+w*C,v+A*C,y+T*C,v+P*C,d,!0)+2:c+=Is(y,v,y-w*S,v-A*S,y-T*S,v-P*S,d,!1)+2;break}}d.push(y-T*S,v-P*S,y+T*C,v+P*C),c+=2}}g=i[(l-2)*2],x=i[(l-2)*2+1],y=i[(l-1)*2],v=i[(l-1)*2+1],w=-(x-v),A=g-y,k=Math.sqrt(w*w+A*A),w/=k,A/=k,w*=p,A*=p,d.push(y-w*S,v-A*S,y+w*C,v+A*C),h||(n.cap===Qi.ROUND?c+=Is(y-w*(S-C)*.5,v-A*(S-C)*.5,y-w*S,v-A*S,y+w*C,v+A*C,d,!1)+2:n.cap===Qi.SQUARE&&(c+=cp(y,v,w,A,S,C,!1,d)));const I=t.indices,N=fr.epsilon*fr.epsilon;for(let F=f;F<c+f-2;++F)g=d[F*2],x=d[F*2+1],y=d[(F+1)*2],v=d[(F+1)*2+1],b=d[(F+2)*2],E=d[(F+2)*2+1],!(Math.abs(g*(v-E)+y*(E-x)+b*(x-v))<N)&&I.push(F,F+1,F+2)}function G1(s,t){let e=0;const i=s.shape,r=s.points||i.points,n=i.type!==Zt.POLY||i.closeStroke;if(r.length===0)return;const a=t.points,o=t.indices,h=r.length/2,u=a.length/2;let d=u;for(a.push(r[0],r[1]),e=1;e<h;e++)a.push(r[e*2],r[e*2+1]),o.push(d,d+1),d++;n&&o.push(d,u)}function dp(s,t){s.lineStyle.native?G1(s,t):U1(s,t)}class ol{static curveLength(t,e,i,r,n,a){const o=t-2*i+n,h=e-2*r+a,u=2*i-2*t,d=2*r-2*e,l=4*(o*o+h*h),c=4*(o*u+h*d),f=u*u+d*d,p=2*Math.sqrt(l+c+f),m=Math.sqrt(l),_=2*l*m,g=2*Math.sqrt(f),x=c/m;return(_*p+m*c*(p-g)+(4*f*l-c*c)*Math.log((2*m+x+p)/(x+g)))/(4*_)}static curveTo(t,e,i,r,n){const a=n[n.length-2],o=n[n.length-1],h=fr._segmentsCount(ol.curveLength(a,o,t,e,i,r));let u=0,d=0;for(let l=1;l<=h;++l){const c=l/h;u=a+(t-a)*c,d=o+(e-o)*c,n.push(u+(t+(i-t)*c-u)*c,d+(e+(r-e)*c-d)*c)}}}const hl={[Zt.POLY]:lp,[Zt.CIRC]:Ba,[Zt.ELIP]:Ba,[Zt.RECT]:k1,[Zt.RREC]:L1},fp=[],Oa=[];class Fa{constructor(t,e=null,i=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new Fa(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 pr=new tt,pp=class A_ extends $d{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 wa,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(),Oa.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),fp.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,i=null,r=null){const n=new Fa(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new Fa(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),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 i=0;i<e.length;++i){const r=e[i];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,pr):pr.copyFrom(t),r.shape.contains(pr.x,pr.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.holes[a].shape.contains(pr.x,pr.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 i=null,r=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],r=i.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const u=e[h],d=u.fillStyle,l=u.lineStyle;hl[u.type].build(u),u.matrix&&this.transformPoints(u.points,u.matrix),(d.visible||l.visible)&&this.processHoles(u.holes);for(let c=0;c<2;c++){const f=c===0?d:l;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,_=this.points.length/2;p.wrapMode=Hi.REPEAT,c===0?this.processFill(u):this.processLine(u);const g=this.points.length/2-_;g!==0&&(i&&!this._compareStyles(r,f)&&(i.end(m,_),i=null),i||(i=fp.pop()||new N1,i.begin(f,m,_),this.batches.push(i),r=f),this.addUvs(this.points,t,f.texture,_,g,f.matrix))}}const n=this.indices.length,a=this.points.length/2;if(i&&i.end(n,a),this.batches.length===0){this.batchable=!0;return}const o=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.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,i=t.length;e<i;e++){const r=t[e];for(let n=0;n<r.size;n++){const a=r.start+n;this.indicesUint16[a]=this.indicesUint16[a]-r.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<A_.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++J._globalBatch;for(let l=0;l<this.drawCalls.length;l++)this.drawCalls[l].texArray.clear(),Oa.push(this.drawCalls[l]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let r=Oa.pop();r||(r=new Dh,r.texArray=new Nh),r.texArray.count=0,r.start=0,r.size=0,r.type=Ue.TRIANGLES;let n=0,a=null,o=0,h=!1,u=Ue.TRIANGLES,d=0;this.drawCalls.push(r);for(let l=0;l<this.batches.length;l++){const c=this.batches[l],f=8,p=c.style,m=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,u=h?Ue.LINES:Ue.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=Oa.pop(),r||(r=new Dh,r.texArray=new Nh),this.drawCalls.push(r)),r.start=d,r.size=0,r.texArray.count=0,r.type=u),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Hi.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=c.size,d+=c.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,c.attribSize,c.attribStart),this.addTextureIds(i,o,c.attribSize,c.attribStart)}J._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),o=new Uint32Array(n);let h=0;for(let u=0;u<t.length/2;u++)a[h++]=t[u*2],a[h++]=t[u*2+1],a[h++]=e[u*2],a[h++]=e[u*2+1],o[h++]=i[u],a[h++]=r[u];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?lp.triangulate(t,this):hl[t.type].triangulate(t,this)}processLine(t){dp(t,this);for(let e=0;e<t.holes.length;e++)dp(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];hl[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.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 i=0;i<t.length/2;i++){const r=t[i*2],n=t[i*2+1];t[i*2]=e.a*r+e.c*n+e.tx,t[i*2+1]=e.b*r+e.d*n+e.ty}}addColors(t,e,i,r,n=0){const a=pt.shared.setValue(e).toLittleEndianNumber(),o=pt.shared.setValue(a).toPremultiplied(i);t.length=Math.max(t.length,n+r);for(let h=0;h<r;h++)t[n+h]=o}addTextureIds(t,e,i,r=0){t.length=Math.max(t.length,r+i);for(let n=0;n<i;n++)t[r+n]=e}addUvs(t,e,i,r,n,a=null){let o=0;const h=e.length,u=i.frame;for(;o<n;){let l=t[(r+o)*2],c=t[(r+o)*2+1];if(a){const f=a.a*l+a.c*c+a.tx;c=a.b*l+a.d*c+a.ty,l=f}o++,e.push(l/u.width,c/u.height)}const d=i.baseTexture;(u.width<d.width||u.height<d.height)&&this.adjustUvs(e,i,h,n)}adjustUvs(t,e,i,r){const n=e.baseTexture,a=1e-6,o=i+r*2,h=e.frame,u=h.width/n.width,d=h.height/n.height;let l=h.x/h.width,c=h.y/h.height,f=Math.floor(t[i]+a),p=Math.floor(t[i+1]+a);for(let m=i+2;m<o;m+=2)f=Math.min(f,Math.floor(t[m]+a)),p=Math.min(p,Math.floor(t[m+1]+a));l-=f,c-=p;for(let m=i;m<o;m+=2)t[m]=(t[m]+l)*u,t[m+1]=(t[m+1]+c)*d}};pp.BATCHABLE_SIZE=100;let H1=pp;class ka{constructor(){this.color=16777215,this.alpha=1,this.texture=W.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new ka;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=W.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class ll extends ka{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Qi.BUTT,this.join=Re.MITER,this.miterLimit=10}clone(){const t=new ll;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=Qi.BUTT,this.join=Re.MITER,this.miterLimit=10}}const ul={},cl=class wo extends bt{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 ka,this._lineStyle=new ll,this._matrix=null,this._holeMode=!1,this.state=ai.for2d(),this._geometry=t||new H1,this._geometry.refCount++,this._transformID=-1,this._tintColor=new pt(16777215),this.blendMode=K.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new wo(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,i,r=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:W.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Qi.BUTT,join:Re.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},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 Yi,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Yi,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 i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.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,i,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),ol.curveTo(t,e,i,r,n),this}bezierCurveTo(t,e,i,r,n,a){return this._initCurve(),al.curveTo(t,e,i,r,n,a,this.currentPath.points),this}arcTo(t,e,i,r,n){this._initCurve(t,e);const a=this.currentPath.points,o=up.curveTo(t,e,i,r,n,a);if(o){const{cx:h,cy:u,radius:d,startAngle:l,endAngle:c,anticlockwise:f}=o;this.arc(h,u,d,l,c,f)}return this}arc(t,e,i,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=ra:a&&r<=n&&(r+=ra),n-r===0)return this;const o=t+Math.cos(r)*i,h=e+Math.sin(r)*i,u=this._geometry.closePointEps;let d=this.currentPath?this.currentPath.points:null;if(d){const l=Math.abs(d[d.length-2]-o),c=Math.abs(d[d.length-1]-h);l<u&&c<u||d.push(o,h)}else this.moveTo(o,h),d=this.currentPath.points;return up.arc(o,h,t,e,i,r,n,a,d),this}beginFill(t=0,e){return this.beginTextureFill({texture:W.WHITE,color:t,alpha:e})}normalizeColor(t){const e=pt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:W.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,r){return this.drawShape(new st(t,e,i,r))}drawRoundedRect(t,e,i,r,n){return this.drawShape(new ha(t,e,i,r,n))}drawCircle(t,e,i){return this.drawShape(new aa(t,e,i))}drawEllipse(t,e,i,r){return this.drawShape(new oa(t,e,i,r))}drawPolygon(...t){let e,i=!0;const r=t[0];r.points?(i=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Yi(e);return n.closeStroke=i,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===Zt.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,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let r=0;r<i;r++){const n=t.batches[r],a=n.style.color,o=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),u=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),d={vertexData:o,blendMode:e,indices:u,uvs:h,_batchRGB:pt.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=d}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,r=this.worldAlpha,n=e.uniforms,a=i.drawCalls;n.translationMatrix=this.transform.worldTransform,pt.shared.setValue(this._tintColor).premultiply(r).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let o=0,h=a.length;o<h;o++)this._renderDrawCallDirect(t,i.drawCalls[o])}_renderDrawCallDirect(t,e){const{texArray:i,type:r,size:n,start:a}=e,o=i.count;for(let h=0;h<o;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(r,n,a)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!ul[i]){const{maxTextures:r}=t.plugins[i],n=new Int32Array(r);for(let h=0;h<r;h++)n[h]=h;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new gt,default:Ve.from({uSamplers:n},!0)},o=t.plugins[i]._shader.program;ul[i]=new hi(o,a)}e=ul[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:r,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,r,n)}containsPoint(t){return this.worldTransform.applyInverse(t,wo._TEMP_POINT),this._geometry.containsPoint(wo._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=pt.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,i=e.a,r=e.b,n=e.c,a=e.d,o=e.tx,h=e.ty,u=this._geometry.points,d=this.vertexData;let l=0;for(let c=0;c<u.length;c+=2){const f=u[c],p=u[c+1];d[l++]=i*f+n*p+o,d[l++]=a*p+r*f+h}}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)}};cl.curves=fr,cl._TEMP_POINT=new tt;let ui=cl;class V1{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 dl=new tt,mp=new Yi,_p=class S_ extends bt{constructor(t,e,i,r=Ue.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||ai.for2d(),this.drawMode=r,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=H.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===Ue.TRIANGLES&&e.length<S_.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,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===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 r=this.transform.worldTransform,n=r.a,a=r.b,o=r.c,h=r.d,u=r.tx,d=r.ty,l=this.vertexData;for(let c=0;c<l.length/2;c++){const f=e[c*2],p=e[c*2+1];l[c*2]=n*f+o*p+u,l[c*2+1]=a*f+h*p+d}if(this._roundPixels){const c=H.RESOLUTION;for(let f=0;f<l.length;++f)l[f]=Math.round(l[f]*c)/c}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new V1(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,dl);const e=this.geometry.getBuffer("aVertexPosition").data,i=mp.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let o=0;o+2<n;o+=a){const h=r[o]*2,u=r[o+1]*2,d=r[o+2]*2;if(i[0]=e[h],i[1]=e[h+1],i[2]=e[u],i[3]=e[u+1],i[4]=e[d],i[5]=e[d+1],mp.contains(dl.x,dl.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}};_p.BATCHABLE_SIZE=100;let La=_p;class fl extends zi{constructor(t,e,i){super();const r=new Nt(t),n=new Nt(e,!0),a=new Nt(i,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,Z.FLOAT).addAttribute("aTextureCoord",n,2,!1,Z.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var X1=`varying vec2 vTextureCoord;
|
|
910
|
+
`;let fn=null;class bm{constructor(){fn||(fn=URL.createObjectURL(new Blob([yE],{type:"application/javascript"}))),this.worker=new Worker(fn)}}bm.revokeObjectURL=function(){fn&&(URL.revokeObjectURL(fn),fn=null)};let wm=0,nc;class xE{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(){nc===void 0&&(nc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<nc&&(this._createdWorkers++,t=new bm().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((r,n)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[wm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:wm++,id:s})}}const Em=new xE;function ho(i,t,e){i.resource.internal=!0;const s=new q(i),r=()=>{delete t.promiseCache[e],Ai.has(e)&&Ai.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),r())}),s.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),s}const vE=[".jpeg",".jpg",".png",".webp",".avif"],bE=["image/jpeg","image/png","image/webp","image/avif"];async function wE(i){const t=await z.ADAPTER.fetch(i);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Fa={name:"loadTextures",extension:{type:Y.LoadParser,priority:Ne.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return un(i,bE)||Le(i,vE)},async load(i,t,e){var h;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let r;s?this.config.preferWorkers&&await Em.isImageBitmapSupported()?r=await Em.loadImageBitmap(i):r=await wE(i):r=await new Promise((o,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=i,u.complete?o(u):(u.onload=()=>o(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=_r(i)),s&&((h=n.resourceOptions)==null?void 0:h.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const a=new et(r,n);return a.resource.src=i,ho(a,e,i)},unload(i){i.destroy(!0)}};K.add(Fa);const EE=".svg",TE="image/svg+xml",AE={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadSVG",test(i){return un(i,TE)||Le(i,EE)},async testParse(i){return Kh.test(i)},async parse(i,t,e){var n;const s=new Kh(i,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await s.load();const r=new et(s,{resolution:_r(i),...t==null?void 0:t.data});return r.resource.src=t.src,ho(r,e,t.src)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload:Fa.unload};K.add(AE);const SE=[".mp4",".m4v",".webm",".ogv"],CE=["video/mp4","video/webm","video/ogg"],IE={name:"loadVideo",extension:{type:Y.LoadParser,priority:Ne.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(i){return un(i,CE)||Le(i,SE)},async load(i,t,e){var a;let s;const r=await(await z.ADAPTER.fetch(i)).blob(),n=URL.createObjectURL(r);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 lm(n,h);await o.load();const l=new et(o,{alphaMode:await Ob(),resolution:_r(i),...t==null?void 0:t.data});l.resource.src=i,s=ho(l,e,i),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(h){throw URL.revokeObjectURL(n),h}return s},unload(i){i.destroy(!0)}};K.add(IE);class PE{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:r,srcs:n}=t;return Ts(e||s||r||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(r=>{const n=r.src??r.srcs,a=r.alias??r.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({...r,alias:h,src:n})}):Object.keys(e).forEach(r=>{const n=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:n,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:n,src:e[r]});else{const a=e[r],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,r,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:r,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`)},Ts(a).forEach(o=>{const{src:l,srcs:u}=o;let{data:c,format:d,loadParser:f}=o;const p=Ts(l||u).map(_=>typeof _=="string"?tE(_):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=Ts(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),h={};for(const o in a){const l=a[o];h[this._extractAssetIdFromBundle(r,o)]=l}s[r]=h}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const r in e)s[r]=e[r].src;return s}return e.src}resolve(t){const e=Ma(t);t=Ts(t);const s={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];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[r]=n[0]??a}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:s,data:r,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={...r||{},...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 RE{constructor(){this._detections=[],this._initialized=!1,this.resolver=new PE,this.loader=new sE,this.cache=Ai,this._backgroundLoader=new Jw(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,r=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:s}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,r,n){this.resolver.add(t,e,s,r,n)}async load(t,e){this._initialized||await this.init();const s=Ma(t),r=Ts(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(r),a=await this._mapLoadToResolve(n,e);return s?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let h=0,o=0;const l=()=>{e==null||e(++h/o)},u=a.map(c=>{const d=r[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 Ai.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ai.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),r=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[r[o]]=l,Ai.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=Ts(t).map(r=>typeof r!="string"?r.src:r),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Ts(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Ai.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,r)=>e.indexOf(s)===r),e}get detections(){return this._detections}get preferWorkers(){return 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 Gr=new RE;K.handleByList(Y.LoadParser,Gr.loader.parsers).handleByList(Y.ResolveParser,Gr.resolver.parsers).handleByList(Y.CacheParser,Gr.cache.parsers).handleByList(Y.DetectionParser,Gr.detections);const ME={extension:Y.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof q),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};K.add(ME);async function Tm(i){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const FE={extension:{type:Y.DetectionParser,priority:1},test:async()=>Tm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};K.add(FE);const kE={extension:{type:Y.DetectionParser,priority:0},test:async()=>Tm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};K.add(kE);const Am=["png","jpg","jpeg"],BE={extension:{type:Y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Am],remove:async i=>i.filter(t=>!Am.includes(t))};K.add(BE);const DE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function oc(i){return DE?!1:document.createElement("video").canPlayType(i)!==""}const OE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};K.add(OE);const LE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};K.add(LE);const NE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};K.add(NE);const VE={extension:Y.ResolveParser,test:Fa.test,parse:i=>{var t;return{resolution:parseFloat(((t=z.RETINA_PREFIX.exec(i))==null?void 0:t[1])??"1"),format:bt.extname(i).slice(1),src:i}}};K.add(VE);var ve=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i))(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 Zs,pn;function Sm(){pn={bptc:Zs.getExtension("EXT_texture_compression_bptc"),astc:Zs.getExtension("WEBGL_compressed_texture_astc"),etc:Zs.getExtension("WEBGL_compressed_texture_etc"),s3tc:Zs.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Zs.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Zs.getExtension("WEBGL_compressed_texture_pvrtc")||Zs.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Zs.getExtension("WEBGL_compressed_texture_etc1"),atc:Zs.getExtension("WEBGL_compressed_texture_atc")}}const UE={extension:{type:Y.DetectionParser,priority:2},test:async()=>{const i=z.ADAPTER.createCanvas().getContext("webgl");return i?(Zs=i,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{pn||Sm();const t=[];for(const e in pn)pn[e]&&t.push(e);return[...t,...i]},remove:async i=>(pn||Sm(),i.filter(t=>!(t in pn)))};K.add(UE);class GE extends aa{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,r;typeof t=="string"?(s=t,r=new Uint8Array):(s=null,r=t),super(r,e),this.origin=s,this.buffer=r?new Sh(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new Sh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Si extends GE{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=Si._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Si._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const r=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n<a;n++){const{levelID:h,levelWidth:o,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,h,this.format,o,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Si._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,r,n,a,h){const o=new Array(s);let l=t.byteOffset,u=a,c=h,d=u+r-1&~(r-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+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*ka[e];return o}}const ac=4,Ba=124,XE=32,Cm=20,$E=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},HE=1,WE=2,zE=4,jE=64,qE=512,ZE=131072,KE=827611204,QE=861165636,JE=894720068,tT=808540228,eT=4,sT={[KE]:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,[QE]:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,[JE]: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 iT(i){const t=new Uint32Array(i);if(t[0]!==$E)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,Ba/Uint32Array.BYTES_PER_ELEMENT),s=e[Da.HEIGHT],r=e[Da.WIDTH],n=e[Da.MIPMAP_COUNT],a=new Uint32Array(i,Da.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,XE/Uint32Array.BYTES_PER_ELEMENT),h=a[HE];if(h&zE){const o=a[YE.FOURCC];if(o!==tT){const x=sT[o],y=ac+Ba,v=new Uint8Array(i,y);return[new Si(v,{format:x,width:r,height:s,levels:n})]}const l=ac+Ba,u=new Uint32Array(t.buffer,l,Cm/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===eT)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,_=ac+Ba+Cm;if(p===1)g.push(new Uint8Array(i,_));else{const x=ka[m];let y=0,v=r,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(i,w,y)),w+=y}return g.map(x=>new Si(x,{format:m,width:r,height:s,levels:n}))}throw h&jE?new Error("DDSParser does not support uncompressed texture data."):h&qE?new Error("DDSParser does not supported YUV uncompressed texture data."):h&ZE?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&WE?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 Im=[171,75,84,88,32,49,49,187,13,10,26,10],nT=67305985,As={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},lc=64,Pm={[tt.UNSIGNED_BYTE]:1,[tt.UNSIGNED_SHORT]:2,[tt.INT]:4,[tt.UNSIGNED_INT]:4,[tt.FLOAT]:4,[tt.HALF_FLOAT]:8},oT={[G.RGBA]:4,[G.RGB]:3,[G.RG]:2,[G.RED]:1,[G.LUMINANCE]:1,[G.LUMINANCE_ALPHA]:2,[G.ALPHA]:1},aT={[tt.UNSIGNED_SHORT_4_4_4_4]:2,[tt.UNSIGNED_SHORT_5_5_5_1]:2,[tt.UNSIGNED_SHORT_5_6_5]:2};function lT(i,t,e=!1){const s=new DataView(t);if(!hT(i,s))return null;const r=s.getUint32(As.ENDIANNESS,!0)===nT,n=s.getUint32(As.GL_TYPE,r),a=s.getUint32(As.GL_FORMAT,r),h=s.getUint32(As.GL_INTERNAL_FORMAT,r),o=s.getUint32(As.PIXEL_WIDTH,r),l=s.getUint32(As.PIXEL_HEIGHT,r)||1,u=s.getUint32(As.PIXEL_DEPTH,r)||1,c=s.getUint32(As.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(As.NUMBER_OF_FACES,r),f=s.getUint32(As.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(As.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,_=o+3&-4,x=l+3&-4,y=new Array(c);let v=o*l;n===0&&(v=_*x);let b;if(n!==0?Pm[n]?b=Pm[n]*oT[a]:b=aT[n]:b=ka[h],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?uT(s,p,r):null;let E=v*b,T=o,A=l,I=_,M=x,R=lc+p;for(let C=0;C<f;C++){const P=s.getUint32(R,r);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?cT(a):a}}),kvData:w}:{compressed:y.map(C=>new Si(null,{format:h,width:o,height:l,levels:f,levelBuffers:C})),kvData:w}}function hT(i,t){for(let e=0;e<Im.length;e++)if(t.getUint8(e)!==Im[e])return console.error(`${i} is not a valid *.ktx file!`),!1;return!0}function cT(i){switch(i){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 i}}function uT(i,t,e){const s=new Map;let r=0;for(;r<t;){const n=i.getUint32(lc+r,e),a=lc+r+4,h=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let o=0;for(;o<n&&i.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(i.buffer,a,o)),u=new DataView(i.buffer,a+o+1,n-o-1);s.set(l,u),r+=4+n+h}return s}const dT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadDDS",test(i){return Le(i,".dds")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),r=iT(s).map(n=>{const a=new et(n,{mipmap:xs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data});return ho(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(dT);const fT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadKTX",test(i){return Le(i,".ktx")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=lT(i,s),h=r??n,o={mipmap:xs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...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,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(fT);const pT=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],mT={extension:Y.ResolveParser,test:i=>{const t=bt.extname(i).slice(1);return["basis","ktx","dds"].includes(t)},parse:i=>{var s,r;const t=i.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(pT.includes(n))return{resolution:parseFloat(((s=z.RETINA_PREFIX.exec(i))==null?void 0:s[1])??"1"),format:n,src:i}}return{resolution:parseFloat(((r=z.RETINA_PREFIX.exec(i))==null?void 0:r[1])??"1"),format:e,src:i}}};K.add(mT);const La=new rt,gT=4,Rm=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,r){const n=new Image;return n.src=await this.base64(t,e,s,r),n}async base64(t,e,s,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,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:r,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);a&&Lo._flipY(s,r,n),h&&Lo._unpremultiplyAlpha(s);const o=new Kb(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return o.context.putImageData(l,0,0),o.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);return a&&Lo._flipY(s,r,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 r,n=!1,a=!1,h,o=!1;t&&(t instanceof wi?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(r=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 r=s.resolution,e||(e=La,e.width=s.width/r,e.height=s.height/r),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),d=new Uint8Array(gT*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),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 r=e<<2,n=s>>1,a=new Uint8Array(r);for(let h=0;h<n;h++){const o=h*r,l=(s-h-1)*r;a.set(t.subarray(o,o+r)),t.copyWithin(o,l,l+r),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 r=t[s+3];if(r!==0){const n=255.001/r;t[s]=t[s]*n+.5,t[s+1]=t[s+1]*n+.5,t[s+2]=t[s+2]*n+.5}}}};Rm.extension={name:"extract",type:Y.RendererSystem};let _T=Rm;K.add(_T);const Na={build(i){const t=i.points;let e,s,r,n,a,h;if(i.type===xe.CIRC){const p=i.shape;e=p.x,s=p.y,a=h=p.radius,r=n=0}else if(i.type===xe.ELIP){const p=i.shape;e=p.x,s=p.y,a=p.width,h=p.height,r=n=0}else{const p=i.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))),r=m-a,n=g-h}if(!(a>=0&&h>=0&&r>=0&&n>=0)){t.length=0;return}const o=Math.ceil(2.3*Math.sqrt(a+h)),l=o*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(o===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=s+n,t[2]=t[4]=e-r,t[5]=t[7]=s-n;return}let u=0,c=o*4+(r?2:0)+2,d=c,f=l;{const p=r+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=r+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=r,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,r&&(t[u++]=_,t[u++]=x,t[--f]=y,t[--f]=_)}},triangulate(i,t){const e=i.points,s=t.points,r=t.indices;if(e.length===0)return;let n=s.length/2;const a=n;let h,o;if(i.type!==xe.RREC){const u=i.shape;h=u.x,o=u.y}else{const u=i.shape;h=u.x+u.width/2,o=u.y+u.height/2}const l=i.matrix;s.push(i.matrix?l.a*h+l.c*o+l.tx:h,i.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]),r.push(n++,a,n);r.push(a+1,a,n)}};function Mm(i,t=!1){const e=i.length;if(e<6)return;let s=0;for(let r=0,n=i[e-2],a=i[e-1];r<e;r+=2){const h=i[r],o=i[r+1];s+=(h-n)*(o+a),n=h,a=o}if(!t&&s>0||t&&s<=0){const r=e/2;for(let n=r+r%2;n<e;n+=2){const a=e-n-2,h=e-n-1,o=n,l=n+1;[i[a],i[o]]=[i[o],i[a]],[i[h],i[l]]=[i[l],i[h]]}}}const Fm={build(i){i.points=i.shape.points.slice()},triangulate(i,t){let e=i.points;const s=i.holes,r=t.points,n=t.indices;if(e.length>=6){Mm(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];Mm(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const h=My(e,a,2);if(!h)return;const o=r.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++)r.push(e[l])}}},yT={build(i){const t=i.shape,e=t.x,s=t.y,r=t.width,n=t.height,a=i.points;a.length=0,r>=0&&n>=0&&a.push(e,s,e+r,s,e+r,s+n,e,s+n)},triangulate(i,t){const e=i.points,s=t.points;if(e.length===0)return;const r=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},xT={build(i){Na.build(i)},triangulate(i,t){Na.triangulate(i,t)}};var ls=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(ls||{}),Xr=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(Xr||{});const mn={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,t=20){if(!this.adaptive||!i||isNaN(i))return t;let e=Math.ceil(i/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class km{static curveTo(t,e,s,r,n,a){const h=a[a.length-2],o=a[a.length-1]-e,l=h-t,u=r-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,r,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+r)}}}class vT{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 hc{static curveLength(t,e,s,r,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*r+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,r,n,a,h){const o=h[h.length-2],l=h[h.length-1];h.length-=2;const u=mn._segmentsCount(hc.curveLength(o,l,t,e,s,r,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*r+m*a)}}function Bm(i,t,e,s,r,n,a,h){const o=i-e*r,l=t-s*r,u=i+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=o+d,m=l+f,g=u+d,_=c+f;return h.push(p,m,g,_),2}function Ci(i,t,e,s,r,n,a,h){const o=e-i,l=s-t;let u=Math.atan2(o,l),c=Math.atan2(r-i,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(i,t,e,s);for(let x=1,y=d;x<g;x++,y+=_)a.push(i,t,i+Math.sin(y)*m,t+Math.cos(y)*m);a.push(i,t,r,n)}else{a.push(e,s,i,t);for(let x=1,y=d;x<g;x++,y+=_)a.push(i+Math.sin(y)*m,t+Math.cos(y)*m,i,t);a.push(r,n,i,t)}return g*2}function bT(i,t){const e=i.shape;let s=i.points||e.points.slice();const r=t.closePointEps;if(s.length===0)return;const n=i.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)<r&&Math.abs(a.y-h.y)<r;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===Xr.ROUND?d+=Ci(_-E*(C-P)*.5,x-T*(C-P)*.5,_-E*C,x-T*C,_+E*P,x+T*P,u,!0)+2:n.cap===Xr.SQUARE&&(d+=Bm(_,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,H=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+=Ci(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,kt=(N*lt-$*Tt)/Q,zt=(_t-y)*(_t-y)+(kt-v)*(kt-v),Qt=y+(_t-y)*C,Pt=v+(kt-v)*C,jt=y-(_t-y)*P,Ot=v-(kt-v)*P,ze=Math.min(L*L+$*$,O*O+N*N),is=H?C:P,li=ze+is*is*m,kn=zt<=li;let hi=n.join;if(hi===ls.MITER&&zt/m>g&&(hi=ls.BEVEL),kn)switch(hi){case ls.MITER:{u.push(Qt,Pt,jt,Ot);break}case ls.BEVEL:{H?u.push(Qt,Pt,y+E*P,v+T*P,Qt,Pt,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:{H?(u.push(Qt,Pt,y+E*P,v+T*P),d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+4,u.push(Qt,Pt,y+A*P,v+I*P)):(u.push(y-E*C,v-T*C,jt,Ot),d+=Ci(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),hi){case ls.MITER:{H?u.push(jt,Ot,jt,Ot):u.push(Qt,Pt,Qt,Pt),d+=2;break}case ls.ROUND:{H?d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+2:d+=Ci(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===Xr.ROUND?d+=Ci(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===Xr.SQUARE&&(d+=Bm(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 wT(i,t){let e=0;const s=i.shape,r=i.points||s.points,n=s.type!==xe.POLY||s.closeStroke;if(r.length===0)return;const a=t.points,h=t.indices,o=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),e=1;e<o;e++)a.push(r[e*2],r[e*2+1]),h.push(u,u+1),u++;n&&h.push(u,l)}function Dm(i,t){i.lineStyle.native?wT(i,t):bT(i,t)}class cc{static curveLength(t,e,s,r,n,a){const h=t-2*s+n,o=e-2*r+a,l=2*s-2*t,u=2*r-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,r,n){const a=n[n.length-2],h=n[n.length-1],o=mn._segmentsCount(cc.curveLength(a,h,t,e,s,r));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+(r-e)*d-u)*d)}}}const uc={[xe.POLY]:Fm,[xe.CIRC]:Na,[xe.ELIP]:Na,[xe.RECT]:yT,[xe.RREC]:xT},Om=[],Va=[];class Ua{constructor(t,e=null,s=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=r,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,Lm=class ry extends mp{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(),Om.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,r=null){const n=new Ua(t,e,s,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Ua(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=r.lineStyle,r.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;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 r=e[s];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,gn):gn.copyFrom(t),r.shape.contains(gn.x,gn.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.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,r=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],r=s.style);for(let o=this.shapeIndex;o<e.length;o++){this.shapeIndex++;const l=e[o],u=l.fillStyle,c=l.lineStyle;uc[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=Fr.REPEAT,d===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-g;_!==0&&(s&&!this._compareStyles(r,f)&&(s.end(m,g),s=null),s||(s=Om.pop()||new vT,s.begin(f,m,g),this.batches.push(s),r=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],r=s.fillStyle,n=s.lineStyle;if(r&&!r.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 r=t[e];for(let n=0;n<r.size;n++){const a=r.start+n;this.indicesUint16[a]=this.indicesUint16[a]-r.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 r=Va.pop();r||(r=new Dh,r.texArray=new Gh),r.texArray.count=0,r.start=0,r.size=0,r.type=ys.TRIANGLES;let n=0,a=null,h=0,o=!1,l=ys.TRIANGLES,u=0;this.drawCalls.push(r);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?ys.LINES:ys.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=Va.pop(),r||(r=new Dh,r.texArray=new Gh),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Fr.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.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,r=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++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?Fm.triangulate(t,this):uc[t.type].triangulate(t,this)}processLine(t){Dm(t,this);for(let e=0;e<t.holes.length;e++)Dm(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];uc[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 r=t[s*2],n=t[s*2+1];t[s*2]=e.a*r+e.c*n+e.tx,t[s*2+1]=e.b*r+e.d*n+e.ty}}addColors(t,e,s,r,n=0){const a=Ct.shared.setValue(e).toLittleEndianNumber(),h=Ct.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+r);for(let o=0;o<r;o++)t[n+o]=h}addTextureIds(t,e,s,r=0){t.length=Math.max(t.length,r+s);for(let n=0;n<s;n++)t[r+n]=e}addUvs(t,e,s,r,n,a=null){let h=0;const o=e.length,l=s.frame;for(;h<n;){let c=t[(r+h)*2],d=t[(r+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,r){const n=e.baseTexture,a=1e-6,h=s+r*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}};Lm.BATCHABLE_SIZE=100;let ET=Lm;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 dc extends Ga{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}clone(){const t=new dc;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=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}}const fc={},pc=class Sl extends Bt{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 dc,this._matrix=null,this._holeMode=!1,this.state=zs.for2d(),this._geometry=t||new ET,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 Sl(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,r=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:s,alignment:r,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:Xr.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 Nr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Nr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,r=s[s.length-2],n=s[s.length-1];return(r!==t||n!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),cc.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),hc.curveTo(t,e,s,r,n,a,this.currentPath.points),this}arcTo(t,e,s,r,n){this._initCurve(t,e);const a=this.currentPath.points,h=km.curveTo(t,e,s,r,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,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=ha:a&&r<=n&&(r+=ha),n-r===0)return this;const h=t+Math.cos(r)*s,o=e+Math.sin(r)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-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 km.arc(h,o,t,e,s,r,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,r){return this.drawShape(new rt(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new fa(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new ua(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new da(t,e,s,r))}drawPolygon(...t){let e,s=!0;const r=t[0];r.points?(s=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Nr(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 r=0;r<s;r++){const n=t.batches[r],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[r]=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 r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,r=this.worldAlpha,n=e.uniforms,a=s.drawCalls;n.translationMatrix=this.transform.worldTransform,Ct.shared.setValue(this._tintColor).premultiply(r).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:r,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(r,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!fc[s]){const{maxTextures:r}=t.plugins[s],n=new Int32Array(r);for(let o=0;o<r;o++)n[o]=o;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:ws.from({uSamplers:n},!0)},h=t.plugins[s]._shader.program;fc[s]=new qs(h,a)}e=fc[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:r,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,s,r,n)}containsPoint(t){return this.worldTransform.applyInverse(t,Sl._TEMP_POINT),this._geometry.containsPoint(Sl._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,r=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+r*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)}};pc.curves=mn,pc._TEMP_POINT=new st;let Ks=pc;class TT{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 mc=new st,Nm=new Nr,Vm=class iy extends Bt{constructor(t,e,s,r=ys.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||zs.for2d(),this.drawMode=r,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===ys.TRIANGLES&&e.length<iy.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 r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].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 r=this.transform.worldTransform,n=r.a,a=r.b,h=r.c,o=r.d,l=r.tx,u=r.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 TT(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,mc);const e=this.geometry.getBuffer("aVertexPosition").data,s=Nm.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let h=0;h+2<n;h+=a){const o=r[h]*2,l=r[h+1]*2,u=r[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],Nm.contains(mc.x,mc.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}};Vm.BATCHABLE_SIZE=100;let Xa=Vm;class gc extends Lr{constructor(t,e,s){super();const r=new Jt(t),n=new Jt(e,!0),a=new Jt(s,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,tt.FLOAT).addAttribute("aTextureCoord",n,2,!1,tt.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var AT=`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
|
-
`,
|
|
920
|
+
`,ST=`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
|
|
935
|
+
`;class $a extends qs{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:Rt.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||yr.from(ST,AT),s),this._colorDirty=!1,this.uvMatrix=new Op(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 CT extends gc{constructor(t=100,e=100,s=10,r=10){super(),this.segWidth=s,this.segHeight=r,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],s=[],r=[],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;r.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(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class IT extends Xa{constructor(t,e,s){const r=new CT(t.width,t.height,e,s),n=new $a(q.WHITE);super(r,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}const Ya=10;class PT extends IT{constructor(t,e,s,r,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)??Ya,this._rightWidth=r??((h=t.defaultBorders)==null?void 0:h.right)??Ya,this._topHeight=s??((o=t.defaultBorders)==null?void 0:o.top)??Ya,this._bottomHeight=n??((l=t.defaultBorders)==null?void 0:l.bottom)??Ya,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,s=this._topHeight+this._bottomHeight,r=this._height>s?1:this._height/s;return Math.min(e,r)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const s=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class RT extends Xa{constructor(t=q.EMPTY,e,s,r,n){const a=new gc(e,s,r);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 MT extends Bt{constructor(t=1500,e,s=16384,r=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=W.NORMAL,this.autoResize=r,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 Um{constructor(t,e,s){this.geometry=new Lr,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let r=0;r<t.length;++r){let n=t[r];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||tt.FLOAT,offset:n.offset},e[r]?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 r=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];h.offset=r,r+=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 r=0;r<this.dynamicProperties.length;r++){const n=this.dynamicProperties[r];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 r=0;r<this.staticProperties.length;r++){const n=this.staticProperties[r];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 FT=`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
|
-
}`,
|
|
943
|
+
}`,kT=`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
|
|
969
|
-
`:t,t}static getFromCache(t,e,i,r){let n=i[t];return typeof n!="number"&&(n=q._measureText(t,e,r)+e,i[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 i=t[e];if(!q.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:q._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:q._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let r=0;r<t.length;r++){const n=t[r],a=t[r+1];if(q.isBreakingSpace(n,a)||q.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,r,n){return!0}static wordWrapSplit(t){return q.graphemeSegmenter(t)}static measureFont(t){if(q._fonts[t])return q._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=q._canvas,r=q._context;r.font=t;const n=q.METRICS_STRING+q.BASELINE_SYMBOL,a=Math.ceil(r.measureText(n).width);let o=Math.ceil(r.measureText(q.BASELINE_SYMBOL).width);const h=Math.ceil(q.HEIGHT_MULTIPLIER*o);if(o=o*q.BASELINE_MULTIPLIER|0,a===0||h===0)return q._fonts[t]=e,e;i.width=a,i.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,o);const u=r.getImageData(0,0,a,h).data,d=u.length,l=a*4;let c=0,f=0,p=!1;for(c=0;c<o;++c){for(let m=0;m<l;m+=4)if(u[f+m]!==255){p=!0;break}if(!p)f+=l;else break}for(e.ascent=o-c,f=d-l,p=!1,c=h;c>o;--c){for(let m=0;m<l;m+=4)if(u[f+m]!==255){p=!0;break}if(!p)f-=l;else break}return e.descent=c-o,e.fontSize=e.ascent+e.descent,q._fonts[t]=e,e}static clearMetrics(t=""){t?delete q._fonts[t]:q._fonts={}}static get _canvas(){var t;if(!q.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",Ha))!=null&&t.measureText)return q.__canvas=i,i;e=H.ADAPTER.createCanvas()}catch{e=H.ADAPTER.createCanvas()}e.width=e.height=10,q.__canvas=e}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",Ha)),q.__context}};ci.METRICS_STRING="|ÉqÅ",ci.BASELINE_SYMBOL="M",ci.BASELINE_MULTIPLIER=1.4,ci.HEIGHT_MULTIPLIER=2,ci.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return t=>[...s.segment(t)].map(e=>e.segment)}return s=>[...s]})(),ci.experimentalLetterSpacing=!1,ci._fonts={},ci._newlines=[10,13],ci._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Ji=ci;const Q1=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],xp=class Bn{constructor(t){this.styleID=0,this.reset(),ml(this,t,t)}clone(){const t={};return ml(t,this,Bn.defaultStyle),new Bn(t)}reset(){ml(this,Bn.defaultStyle,Bn.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=pl(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=pl(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){J1(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=pl(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 i=e.length-1;i>=0;i--){let r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!Q1.includes(r)&&(r=`"${r}"`),e[i]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};xp.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ga.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 Di=xp;function pl(s){const t=pt.shared,e=i=>{const r=t.setValue(i);return r.alpha===1?r.toHex():r.toRgbaString()};return Array.isArray(s)?s.map(e):e(s)}function J1(s,t){if(!Array.isArray(s)||!Array.isArray(t)||s.length!==t.length)return!1;for(let e=0;e<s.length;++e)if(s[e]!==t[e])return!1;return!0}function ml(s,t,e){for(const i in e)Array.isArray(t[i])?s[i]=t[i].slice():s[i]=t[i]}const tT={texture:!0,children:!1,baseTexture:!0},vp=class Ju extends _e{constructor(t,e,i){let r=!1;i||(i=H.ADAPTER.createCanvas(),r=!0),i.width=3,i.height=3;const n=W.from(i);n.orig=new st,n.trim=new st,super(n),this._ownCanvas=r,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Ju.defaultResolution??H.RESOLUTION,this._autoResolution=Ju.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 Ji.experimentalLetterSpacing}static set experimentalLetterSpacing(t){it("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Ji.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 i=this.context,r=Ji.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=r.width,a=r.height,o=r.lines,h=r.lineHeight,u=r.lineWidths,d=r.maxLineWidth,l=r.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),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let c,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const _=e.dropShadow&&m===0,g=_?Math.ceil(Math.max(1,a)+e.padding*2):0,x=g*this._resolution;if(_){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,b=e.dropShadowBlur*this._resolution,E=e.dropShadowDistance*this._resolution;i.shadowColor=pt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=b,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*E,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*E+x}else i.fillStyle=this._generateFillStyle(e,o,r),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let y=(h-l.fontSize)/2;h-l.fontSize<0&&(y=0);for(let v=0;v<o.length;v++)c=e.strokeThickness/2,f=e.strokeThickness/2+v*h+l.ascent+y,e.align==="right"?c+=d-u[v]:e.align==="center"&&(c+=(d-u[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(o[v],c+e.padding,f+e.padding-g,!0),e.fill&&this.drawLetterSpacing(o[v],c+e.padding,f+e.padding-g)}this.updateTexture()}drawLetterSpacing(t,e,i,r=!1){const n=this._style.letterSpacing;let a=!1;if(Ji.experimentalLetterSpacingSupported&&(Ji.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||a){r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let o=e;const h=Ji.graphemeSegmenter(t);let u=this.context.measureText(t).width,d=0;for(let l=0;l<h.length;++l){const c=h[l];r?this.context.strokeText(c,o,i):this.context.fillText(c,o,i);let f="";for(let p=l+1;p<h.length;++p)f+=h[p];d=this.context.measureText(f).width,o+=u-d+n,u=d}}updateTexture(){const t=this.canvas;if(this._style.trim){const a=gx(t);a.data&&(t.width=a.width,t.height=a.height,this.context.putImageData(a.data,0,0))}const e=this._texture,i=this._style,r=i.trim?0:i.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=-r,e.trim.y=-r,e.orig.width=e._frame.width-r*2,e.orig.height=e._frame.height-r*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,i){const r=t.fill;if(Array.isArray(r)){if(r.length===1)return r[0]}else return r;let n;const a=t.dropShadow?t.dropShadowDistance:0,o=t.padding||0,h=this.canvas.width/this._resolution-a-o*2,u=this.canvas.height/this._resolution-a-o*2,d=r.slice(),l=t.fillGradientStops.slice();if(!l.length){const c=d.length+1;for(let f=1;f<c;++f)l.push(f/c)}if(d.unshift(r[0]),l.unshift(0),d.push(r[r.length-1]),l.push(1),t.fillGradientType===Ga.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,o,h/2,u+o);const c=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=i.lineHeight*(f-1)+c,m=i.lineHeight*f;let _=m;f>0&&p>m&&(_=(m+p)/2);const g=m+c,x=i.lineHeight*(f+1);let y=g;f+1<e.length&&x<g&&(y=(g+x)/2);const v=(y-_)/u;for(let b=0;b<d.length;b++){let E=0;typeof l[b]=="number"?E=l[b]:E=b/d.length;let w=Math.min(1,Math.max(0,_/u+E*v));w=Number(w.toFixed(5)),n.addColorStop(w,d[b])}}}else{n=this.context.createLinearGradient(o,u/2,h+o,u/2);const c=d.length+1;let f=1;for(let p=0;p<d.length;p++){let m;typeof l[p]=="number"?m=l[p]:m=f/c,n.addColorStop(m,d[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},tT,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=Wi(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=Wi(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 Di?this._style=t:this._style=new Di(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)}};vp.defaultAutoResolution=!0;let Va=vp;class eT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function iT(s,t){var i;let e=!1;if((i=s==null?void 0:s._textures)!=null&&i.length){for(let r=0;r<s._textures.length;r++)if(s._textures[r]instanceof W){const n=s._textures[r].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function sT(s,t){if(s.baseTexture instanceof J){const e=s.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function rT(s,t){if(s._texture&&s._texture instanceof W){const e=s._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function nT(s,t){return t instanceof Va?(t.updateText(!0),!0):!1}function aT(s,t){if(t instanceof Di){const e=t.toFontString();return Ji.measureFont(e),!0}return!1}function oT(s,t){if(s instanceof Va){t.includes(s.style)||t.push(s.style),t.includes(s)||t.push(s);const e=s._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function hT(s,t){return s instanceof Di?(t.includes(s)||t.push(s),!0):!1}const bp=class C_{constructor(t){this.limiter=new eT(C_.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(oT),this.registerFindHook(hT),this.registerFindHook(iT),this.registerFindHook(sT),this.registerFindHook(rT),this.registerUploadHook(nT),this.registerUploadHook(aT)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,ct.system.addOnce(this.tick,this,ji.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 i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)ct.system.addOnce(this.tick,this,ji.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;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,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof bt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&ct.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}};bp.uploadsPerFrame=4;let _l=bp;Object.defineProperties(H,{UPLOADS_PER_FRAME:{get(){return _l.uploadsPerFrame},set(s){it("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),_l.uploadsPerFrame=s}}});function Tp(s,t){return t instanceof J?(t._glTextures[s.CONTEXT_UID]||s.texture.bind(t),!0):!1}function lT(s,t){if(!(t instanceof ui))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let r=0;r<i.length;r++){const{texture:n}=i[r].style;n&&Tp(s,n.baseTexture)}return e.batchable||s.geometry.bind(e,t._resolveDirectShader(s)),!0}function uT(s,t){return s instanceof ui?(t.push(s),!0):!1}class wp extends _l{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(uT),this.registerUploadHook(Tp),this.registerUploadHook(lT)}}wp.extension={name:"prepare",type:G.RendererSystem},z.add(wp);var cT=`#version 300 es
|
|
968
|
+
`;class Gm extends xa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Rt,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=qs.from(kT,FT,{}),this.state=zs.for2d()}render(t){const e=t.children,s=t._maxSize,r=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=ip(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+=r,p+=1){let m=a-f;m>r&&(m=r),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,r=t._batchSize,n=t._properties;for(let a=0;a<s;a+=r)e.push(new Um(this.properties,n,r));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new Um(this.properties,s,e)}uploadVertices(t,e,s,r,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),r[a]=o*p,r[a+1]=u*m,r[a+n]=h*p,r[a+n+1]=u*m,r[a+n*2]=h*p,r[a+n*2+1]=l*m,r[a+n*3]=o*p,r[a+n*3+1]=l*m,a+=n*4}}uploadPosition(t,e,s,r,n,a){for(let h=0;h<s;h++){const o=t[e+h].position;r[a]=o.x,r[a+1]=o.y,r[a+n]=o.x,r[a+n+1]=o.y,r[a+n*2]=o.x,r[a+n*2+1]=o.y,r[a+n*3]=o.x,r[a+n*3+1]=o.y,a+=n*4}}uploadRotation(t,e,s,r,n,a){for(let h=0;h<s;h++){const o=t[e+h].rotation;r[a]=o,r[a+n]=o,r[a+n*2]=o,r[a+n*3]=o,a+=n*4}}uploadUvs(t,e,s,r,n,a){for(let h=0;h<s;++h){const o=t[e+h]._texture._uvs;o?(r[a]=o.x0,r[a+1]=o.y0,r[a+n]=o.x1,r[a+n+1]=o.y1,r[a+n*2]=o.x2,r[a+n*2+1]=o.y2,r[a+n*3]=o.x3,r[a+n*3+1]=o.y3,a+=n*4):(r[a]=0,r[a+1]=0,r[a+n]=0,r[a+n+1]=0,r[a+n*2]=0,r[a+n*2+1]=0,r[a+n*3]=0,r[a+n*3+1]=0,a+=n*4)}}uploadTint(t,e,s,r,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);r[a]=l,r[a+n]=l,r[a+n*2]=l,r[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Gm.extension={name:"particle",type:Y.RendererPlugin},K.add(Gm);var Ha=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(Ha||{});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,r,n,a,h,o,l){this.text=t,this.style=e,this.width=s,this.height=r,this.lines=n,this.lineWidths=a,this.lineHeight=h,this.maxLineWidth=o,this.fontProperties=l}static measureText(t,e,s,r=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=r.getContext("2d",Wa);h.font=n;const o=(s?J.wordWrap(t,e,r):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 r=!1;J.experimentalLetterSpacingSupported&&(J.experimentalLetterSpacing?(s.letterSpacing=`${e}px`,s.textLetterSpacing=`${e}px`,r=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));let n=s.measureText(t).width;return n>0&&(r?n-=e:n+=(J.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=J._canvas){const r=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,r);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,r);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,r){let n=s[t];return typeof n!="number"&&(n=J._measureText(t,e,r)+e,s[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!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 r=0;r<t.length;r++){const n=t[r],a=t[r+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,r,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,r=J._context;r.font=t;const n=J.METRICS_STRING+J.BASELINE_SYMBOL,a=Math.ceil(r.measureText(n).width);let h=Math.ceil(r.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,r.fillStyle="#f00",r.fillRect(0,0,a,o),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,h);const l=r.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 i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})(),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 $r=Qs;const BT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Xm=class No{constructor(t){this.styleID=0,this.reset(),yc(this,t,t)}clone(){const t={};return yc(t,this,No.defaultStyle),new No(t)}reset(){yc(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=_c(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=_c(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){DT(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=_c(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let r=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!BT.includes(r)&&(r=`"${r}"`),e[s]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Xm.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ha.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let vr=Xm;function _c(i){const t=Ct.shared,e=s=>{const r=t.setValue(s);return r.alpha===1?r.toHex():r.toRgbaString()};return Array.isArray(i)?i.map(e):e(i)}function DT(i,t){if(!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length)return!1;for(let e=0;e<i.length;++e)if(i[e]!==t[e])return!1;return!0}function yc(i,t,e){for(const s in e)Array.isArray(t[s])?i[s]=t[s].slice():i[s]=t[s]}const OT={texture:!0,children:!1,baseTexture:!0},$m=class bd extends qe{constructor(t,e,s){let r=!1;s||(s=z.ADAPTER.createCanvas(),r=!0),s.width=3,s.height=3;const n=q.from(s);n.orig=new rt,n.trim=new rt,super(n),this._ownCanvas=r,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=bd.defaultResolution??z.RESOLUTION,this._autoResolution=bd.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 $r.experimentalLetterSpacing}static set experimentalLetterSpacing(t){ot("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),$r.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,r=$r.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=r.width,a=r.height,h=r.lines,o=r.lineHeight,l=r.lineWidths,u=r.maxLineWidth,c=r.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,r),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,r=!1){const n=this._style.letterSpacing;let a=!1;if($r.experimentalLetterSpacingSupported&&($r.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||a){r?this.context.strokeText(t,e,s):this.context.fillText(t,e,s);return}let h=e;const o=$r.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<o.length;++c){const d=o[c];r?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=Jb(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,r=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=-r,e.trim.y=-r,e.orig.width=e._frame.width-r*2,e.orig.height=e._frame.height-r*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 r=t.fill;if(Array.isArray(r)){if(r.length===1)return r[0]}else return r;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=r.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(r[0]),c.unshift(0),u.push(r[r.length-1]),c.push(1),t.fillGradientType===Ha.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({},OT,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=Dr(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=Dr(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 vr?this._style=t:this._style=new vr(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)}};$m.defaultAutoResolution=!0;let za=$m;class LT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function NT(i,t){var s;let e=!1;if((s=i==null?void 0:i._textures)!=null&&s.length){for(let r=0;r<i._textures.length;r++)if(i._textures[r]instanceof q){const n=i._textures[r].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function VT(i,t){if(i.baseTexture instanceof et){const e=i.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function UT(i,t){if(i._texture&&i._texture instanceof q){const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function GT(i,t){return t instanceof za?(t.updateText(!0),!0):!1}function XT(i,t){if(t instanceof vr){const e=t.toFontString();return $r.measureFont(e),!0}return!1}function $T(i,t){if(i instanceof za){t.includes(i.style)||t.push(i.style),t.includes(i)||t.push(i);const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function YT(i,t){return i instanceof vr?(t.includes(i)||t.push(i),!0):!1}const Ym=class ny{constructor(t){this.limiter=new LT(ny.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($T),this.registerFindHook(YT),this.registerFindHook(NT),this.registerFindHook(VT),this.registerFindHook(UT),this.registerUploadHook(GT),this.registerUploadHook(XT)}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,Vr.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let s=0,r=this.uploadHooks.length;s<r;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,Vr.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 Bt)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 xc=Ym;Object.defineProperties(z,{UPLOADS_PER_FRAME:{get(){return xc.uploadsPerFrame},set(i){ot("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),xc.uploadsPerFrame=i}}});function Hm(i,t){return t instanceof et?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function HT(i,t){if(!(t instanceof Ks))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let r=0;r<s.length;r++){const{texture:n}=s[r].style;n&&Hm(i,n.baseTexture)}return e.batchable||i.geometry.bind(e,t._resolveDirectShader(i)),!0}function WT(i,t){return i instanceof Ks?(t.push(i),!0):!1}class Wm extends xc{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(WT),this.registerUploadHook(Hm),this.registerUploadHook(HT)}}Wm.extension={name:"prepare",type:Y.RendererSystem},K.add(Wm);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
|
-
`,
|
|
995
|
+
`,jT=`#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
|
-
`,
|
|
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
|
-
`,
|
|
1048
|
+
`,zm=`#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
|
-
`,
|
|
1068
|
+
`,ZT=`#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 Xa=new gt;class Ap extends pa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new hf,this.state=ai.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=hi.from(Ep,pT,e),this.shader=t.context.webGLVersion>1?hi.from(dT,cT,e):hi.from(Ep,fT,e)}render(t){const e=this.renderer,i=this.quad;let r=i.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;r=i.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,i.invalidate();const o=t._texture,h=o.baseTexture,u=h.alphaMode>0,d=t.tileTransform.localTransform,l=t.uvMatrix;let c=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;c&&(h._glTextures[e.CONTEXT_UID]?c=h.wrapMode!==Hi.CLAMP:h.wrapMode===Hi.CLAMP&&(h.wrapMode=Hi.REPEAT));const f=c?this.simpleShader:this.shader,p=o.width,m=o.height,_=t._width,g=t._height;Xa.set(d.a*p/_,d.b*p/g,d.c*m/_,d.d*m/g,d.tx/_,d.ty/g),Xa.invert(),c?Xa.prepend(l.mapCoord):(f.uniforms.uMapCoord=l.mapCoord.toArray(!0),f.uniforms.uClampFrame=l.uClampFrame,f.uniforms.uClampOffset=l.uClampOffset),f.uniforms.uTransform=Xa.toArray(!0),f.uniforms.uColor=pt.shared.setValue(t.tint).premultiply(t.worldAlpha,u).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(i),this.state.blendMode=Od(t.blendMode,u),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Ap.extension={name:"tilingSprite",type:G.RendererPlugin},z.add(Ap);const Sp=class On{constructor(t,e,i){this.linkedSheets=[],(t instanceof J||t instanceof W)&&(t={texture:t,data:e,resolutionFilename:i});const{texture:r,data:n,resolutionFilename:a=null,cachePrefix:o=""}=t;this.cachePrefix=o,this._texture=r instanceof W?r:null,this.baseTexture=r instanceof J?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const h=this.baseTexture.resource;this.resolution=this._updateResolution(a||(h?h.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let i=Ii(t,null);return i===null&&(i=typeof e=="number"?e:parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=On.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=On.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const r=this._frameKeys[e],n=this._frames[r],a=n.frame;if(a){let o=null,h=null;const u=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,d=new st(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);n.rotated?o=new st(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new st(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&&(h=new st(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[r]=new W(this.baseTexture,o,d,h,n.rotated?2:0,n.anchor,n.borders),W.addToCache(this.textures[r],this.cachePrefix+r.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const r=t[e][i];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*On.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*On.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].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=[]}};Sp.BATCH_SIZE=1e3;let Cp=Sp;const mT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Pp(s,t,e){const i={};if(s.forEach(r=>{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=Ft.dirname(s[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(i,Pp([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return i}const _T={extension:G.Asset,cache:{test:s=>s instanceof Cp,getCacheableAssets:(s,t)=>Pp(s,t,!1)},resolver:{test:s=>{const t=s.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&mT.includes(i)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=H.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",extension:{type:G.LoadParser,priority:Ie.Normal},async testParse(s,t){return Ft.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var d,l;const{texture:i,imageFilename:r,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=Ft.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let o;if(i&&i.baseTexture)o=i;else{const c=tl(a+(r??s.meta.image),t.src);o=(await e.load([c]))[c]}const h=new Cp({texture:o.baseTexture,data:s,resolutionFilename:t.src,cachePrefix:n});await h.parse();const u=(d=s==null?void 0:s.meta)==null?void 0:d.related_multi_packs;if(Array.isArray(u)){const c=[];for(const p of u){if(typeof p!="string")continue;let m=a+p;(l=t.data)!=null&&l.ignoreMultiPack||(m=tl(m,t.src),c.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(c);h.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[h].concat(h.linkedSheets.filter(m=>m!==p))})}return h},unload(s){s.destroy(!0)}}};z.add(_T);class Wa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class $a{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const a=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const u in o){const d=o[u].split("="),l=d[0],c=d[1].replace(/"/gm,""),f=parseFloat(c),p=isNaN(f)?c:f;h[l]=p}i[a].push(h)}const r=new Wa;return i.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class gl{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 Wa,i=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let u=0;u<i.length;u++)e.info.push({face:i[u].getAttribute("face"),size:parseInt(i[u].getAttribute("size"),10)});for(let u=0;u<r.length;u++)e.common.push({lineHeight:parseInt(r[u].getAttribute("lineHeight"),10)});for(let u=0;u<n.length;u++)e.page.push({id:parseInt(n[u].getAttribute("id"),10)||0,file:n[u].getAttribute("file")});for(let u=0;u<a.length;u++){const d=a[u];e.char.push({id:parseInt(d.getAttribute("id"),10),page:parseInt(d.getAttribute("page"),10)||0,x:parseInt(d.getAttribute("x"),10),y:parseInt(d.getAttribute("y"),10),width:parseInt(d.getAttribute("width"),10),height:parseInt(d.getAttribute("height"),10),xoffset:parseInt(d.getAttribute("xoffset"),10),yoffset:parseInt(d.getAttribute("yoffset"),10),xadvance:parseInt(d.getAttribute("xadvance"),10)})}for(let u=0;u<o.length;u++)e.kerning.push({first:parseInt(o[u].getAttribute("first"),10),second:parseInt(o[u].getAttribute("second"),10),amount:parseInt(o[u].getAttribute("amount"),10)});for(let u=0;u<h.length;u++)e.distanceField.push({fieldType:h[u].getAttribute("fieldType"),distanceRange:parseInt(h[u].getAttribute("distanceRange"),10)});return e}}class yl{static test(t){return typeof t=="string"&&t.includes("<font>")?gl.test(H.ADAPTER.parseXML(t)):!1}static parse(t){return gl.parse(H.ADAPTER.parseXML(t))}}const xl=[$a,gl,yl];function gT(s){for(let t=0;t<xl.length;t++)if(xl[t].test(s))return xl[t];return null}function yT(s,t,e,i,r,n){const a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let o;const h=e.dropShadow?e.dropShadowDistance:0,u=e.padding||0,d=s.width/i-h-u*2,l=s.height/i-h-u*2,c=a.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=c.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(c.unshift(a[0]),f.unshift(0),c.push(a[a.length-1]),f.push(1),e.fillGradientType===Ga.LINEAR_VERTICAL){o=t.createLinearGradient(d/2,u,d/2,l+u);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/l;for(let _=0;_<r.length;_++){const g=n.lineHeight*_;for(let x=0;x<c.length;x++){let y=0;typeof f[x]=="number"?y=f[x]:y=x/c.length;const v=g/l+y*m;let b=Math.max(p,v);b=Math.min(b,1),o.addColorStop(b,c[x]),p=b}}}else{o=t.createLinearGradient(u,l/2,d+u,l/2);const p=c.length+1;let m=1;for(let _=0;_<c.length;_++){let g;typeof f[_]=="number"?g=f[_]:g=m/p,o.addColorStop(g,c[_]),m++}}return o}function xT(s,t,e,i,r,n,a){const o=e.text,h=e.fontProperties;t.translate(i,r),t.scale(n,n);const u=a.strokeThickness/2,d=-(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=yT(s,t,a,n,[o],e),t.strokeStyle=a.stroke,a.dropShadow){const l=a.dropShadowColor,c=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=pt.shared.setValue(l).setAlpha(a.dropShadowAlpha).toRgbaString(),t.shadowBlur=c,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(o,u,d+e.lineHeight-h.descent),a.fill&&t.fillText(o,u,d+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function za(s){return s.codePointAt?s.codePointAt(0):s.charCodeAt(0)}function Ip(s){return Array.from?Array.from(s):s.split("")}function vT(s){typeof s=="string"&&(s=[s]);const t=[];for(let e=0,i=s.length;e<i;e++){const r=s[e];if(Array.isArray(r)){if(r.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);const n=r[0].charCodeAt(0),a=r[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let o=n,h=a;o<=h;o++)t.push(String.fromCharCode(o))}else t.push(...Ip(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const ts=class Ti{constructor(t,e,i){var d;const[r]=t.info,[n]=t.common,[a]=t.page,[o]=t.distanceField,h=Ii(a.file),u={};this._ownsTextures=i,this.font=r.face,this.size=r.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=u;for(let l=0;l<t.page.length;l++){const{id:c,file:f}=t.page[l];u[c]=e instanceof Array?e[l]:e[f],o!=null&&o.fieldType&&o.fieldType!=="none"&&(u[c].baseTexture.alphaMode=he.NO_PREMULTIPLIED_ALPHA,u[c].baseTexture.mipmap=Ke.OFF)}for(let l=0;l<t.char.length;l++){const{id:c,page:f}=t.char[l];let{x:p,y:m,width:_,height:g,xoffset:x,yoffset:y,xadvance:v}=t.char[l];p/=h,m/=h,_/=h,g/=h,x/=h,y/=h,v/=h;const b=new st(p+u[f].frame.x/h,m+u[f].frame.y/h,_,g);this.chars[c]={xOffset:x,yOffset:y,xAdvance:v,kerning:{},texture:new W(u[f].baseTexture,b),page:f}}for(let l=0;l<t.kerning.length;l++){let{first:c,second:f,amount:p}=t.kerning[l];c/=h,f/=h,p/=h,this.chars[f]&&(this.chars[f].kerning[c]=p)}this.distanceFieldRange=o==null?void 0:o.distanceRange,this.distanceFieldType=((d=o==null?void 0:o.fieldType)==null?void 0:d.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,i){let r;if(t instanceof Wa)r=t;else{const a=gT(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof W&&(e=[e]);const n=new Ti(r,e,i);return Ti.available[n.font]=n,n}static uninstall(t){const e=Ti.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Ti.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:a,textureWidth:o,textureHeight:h,...u}=Object.assign({},Ti.defaultOptions,i),d=vT(r),l=e instanceof Di?e:new Di(e),c=o,f=new Wa;f.info[0]={face:l.fontFamily,size:l.fontSize},f.common[0]={lineHeight:l.fontSize};let p=0,m=0,_,g,x,y=0;const v=[];for(let E=0;E<d.length;E++){_||(_=H.ADAPTER.createCanvas(),_.width=o,_.height=h,g=_.getContext("2d"),x=new J(_,{resolution:a,...u}),v.push(new W(x)),f.page.push({id:v.length-1,file:""}));const w=d[E],A=Ji.measureText(w,l,!1,_),T=A.width,P=Math.ceil(A.height),k=Math.ceil((l.fontStyle==="italic"?2:1)*T);if(m>=h-P*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${l.fontFamily}', fontSize: ${l.fontSize}px, char: '${w}')`);--E,_=null,g=null,x=null,m=0,p=0,y=0;continue}if(y=Math.max(P+A.fontProperties.descent,y),k*a+p>=c){if(p===0)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${l.fontFamily}', fontSize: ${l.fontSize}px, char: '${w}')`);--E,m+=y*a,m=Math.ceil(m),p=0,y=0;continue}xT(_,g,A,p,m,a,l);const R=za(A.text);f.char.push({id:R,page:v.length-1,x:p/a,y:m/a,width:k,height:P,xoffset:0,yoffset:0,xadvance:T-(l.dropShadow?l.dropShadowDistance:0)-(l.stroke?l.strokeThickness:0)}),p+=(k+2*n)*a,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let E=0,w=d.length;E<w;E++){const A=d[E];for(let T=0;T<w;T++){const P=d[T],k=g.measureText(A).width,R=g.measureText(P).width,S=g.measureText(A+P).width-(k+R);S&&f.kerning.push({first:za(A),second:za(P),amount:S})}}const b=new Ti(f,v,!0);return Ti.available[t]!==void 0&&Ti.uninstall(t),Ti.available[t]=b,b}};ts.ALPHA=[["a","z"],["A","Z"]," "],ts.NUMERIC=[["0","9"]],ts.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],ts.ASCII=[[" ","~"]],ts.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:ts.ALPHANUMERIC},ts.available={};let es=ts;var bT=`// Pixi texture info\r
|
|
1083
|
+
`;const ja=new Rt;class jm extends xa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Mp,this.state=zs.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=qs.from(zm,ZT,e),this.shader=t.context.webGLVersion>1?qs.from(jT,zT,e):qs.from(zm,qT,e)}render(t){const e=this.renderer,s=this.quad;let r=s.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;r=s.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,s.invalidate();const 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!==Fr.CLAMP:o.wrapMode===Fr.CLAMP&&(o.wrapMode=Fr.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=ip(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}jm.extension={name:"tilingSprite",type:Y.RendererPlugin},K.add(jm);const qm=class Vo{constructor(t,e,s){this.linkedSheets=[],(t instanceof et||t instanceof q)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:r,data:n,resolutionFilename:a=null,cachePrefix:h=""}=t;this.cachePrefix=h,this._texture=r instanceof q?r:null,this.baseTexture=r instanceof et?r: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=_r(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 r=this._frameKeys[e],n=this._frames[r],a=n.frame;if(a){let h=null,o=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new rt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?h=new rt(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 rt(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 rt(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[r]=new q(this.baseTexture,h,u,o,n.rotated?2:0,n.anchor,n.borders),q.addToCache(this.textures[r],this.cachePrefix+r.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 r=t[e][s];this.animations[e].push(this.textures[r])}}}_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=[]}};qm.BATCH_SIZE=1e3;let Zm=qm;const KT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Km(i,t,e){const s={};if(i.forEach(r=>{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=bt.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,Km([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const QT={extension:Y.Asset,cache:{test:i=>i instanceof Zm,getCacheableAssets:(i,t)=>Km(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&KT.includes(s)},parse:i=>{var e;const t=i.split(".");return{resolution:parseFloat(((e=z.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:Y.LoadParser,priority:Ne.Normal},async testParse(i,t){return bt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var u,c;const{texture:s,imageFilename:r,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=rc(a+(r??i.meta.image),t.src);h=(await e.load([d]))[d]}const o=new Zm({texture:h.baseTexture,data:i,resolutionFilename:t.src,cachePrefix:n});await o.parse();const l=(u=i==null?void 0:i.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=rc(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(i){i.destroy(!0)}}};K.add(QT);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 r=new qa;return s.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),s.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class vc{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"),r=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<r.length;l++)e.common.push({lineHeight:parseInt(r[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 bc{static test(t){return typeof t=="string"&&t.includes("<font>")?vc.test(z.ADAPTER.parseXML(t)):!1}static parse(t){return vc.parse(z.ADAPTER.parseXML(t))}}const wc=[Za,vc,bc];function JT(i){for(let t=0;t<wc.length;t++)if(wc[t].test(i))return wc[t];return null}function tA(i,t,e,s,r,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=i.width/s-o-l*2,c=i.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===Ha.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<r.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 eA(i,t,e,s,r,n,a){const h=e.text,o=e.fontProperties;t.translate(s,r),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=tA(i,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(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function Qm(i){return Array.from?Array.from(i):i.split("")}function sA(i){typeof i=="string"&&(i=[i]);const t=[];for(let e=0,s=i.length;e<s;e++){const r=i[e];if(Array.isArray(r)){if(r.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);const n=r[0].charCodeAt(0),a=r[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(...Qm(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Yr=class ur{constructor(t,e,s){var u;const[r]=t.info,[n]=t.common,[a]=t.page,[h]=t.distanceField,o=_r(a.file),l={};this._ownsTextures=s,this.font=r.face,this.size=r.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=xs.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 rt(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 r;if(t instanceof qa)r=t;else{const a=JT(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof q&&(e=[e]);const n=new ur(r,e,s);return ur.available[n.font]=n,n}static uninstall(t){const e=ur.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ur.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:a,textureWidth:h,textureHeight:o,...l}=Object.assign({},ur.defaultOptions,s),u=sA(r),c=e instanceof vr?e:new vr(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=$r.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}eA(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 ur(f,v,!0);return ur.available[t]!==void 0&&ur.uninstall(t),ur.available[t]=b,b}};Yr.ALPHA=[["a","z"],["A","Z"]," "],Yr.NUMERIC=[["0","9"]],Yr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Yr.ASCII=[[" ","~"]],Yr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Yr.ALPHANUMERIC},Yr.available={};let Hr=Yr;var rA=`// 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
|
-
`,
|
|
1121
|
+
`,iA=`// 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
|
|
1138
|
-
`)||" ",
|
|
1139
|
-
`){a.push(f),
|
|
1140
|
-
`&&(/(?:\s)/.test(b)&&(f=
|
|
1137
|
+
`;const Jm=[],tg=[],eg=[],sg=class oy extends Bt{constructor(t,e={}){super();const{align:s,tint:r,maxWidth:n,letterSpacing:a,fontName:h,fontSize:o}=Object.assign({},oy.styleDefaults,e);if(!Hr.available[h])throw new Error(`Missing BitmapFont "${h}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Ct(r),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 js(()=>{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=Hr.available[this._fontName],e=this.fontSize,s=e/t.size,r=new st,n=[],a=[],h=[],o=this._text.replace(/(?:\r\n|\r)/g,`
|
|
1138
|
+
`)||" ",l=Qm(o),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?Jm:tg;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,r.x=0,r.y+=t.lineHeight,d=null,v=0;continue}const k=t.chars[P];if(!k)continue;d&&k.kerning[d]&&(r.x+=k.kerning[d]);const U=eg.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(r.x+k.xOffset+this._letterSpacing/2),U.position.y=Math.round(r.y+k.yOffset),U.prevSpaces=v,n.push(U),f=U.position.x+Math.max(k.xAdvance-k.xOffset,k.texture.orig.width),r.x+=k.xAdvance+this._letterSpacing,y=Math.max(y,k.yOffset+k.texture.height),d=P,g!==-1&&u>0&&r.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++,r.x=0,r.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 gc;let L,$;t.distanceFieldType==="none"?(L=new $a(q.EMPTY),$=W.NORMAL):(L=new $a(q.EMPTY,{program:yr.from(iA,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=(r.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++)eg.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:r}=Hr.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/r,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=Hr.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(!Hr.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Hr.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=Hr.available[this._fontName].distanceFieldType==="none"?Jm:tg;s.push(...this._activePagesMeshData);for(const r of this._activePagesMeshData)this.removeChild(r.mesh);this._activePagesMeshData=[],s.filter(r=>e[r.mesh.texture.baseTexture.uid]).forEach(r=>{r.mesh.texture=q.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};sg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let nA=sg;const oA=[".xml",".fnt"],aA={extension:{type:Y.LoadParser,priority:Ne.Normal},name:"loadBitmapFont",test(i){return oA.includes(bt.extname(i).toLowerCase())},async testParse(i){return Za.test(i)||bc.test(i)},async parse(i,t,e){const s=Za.test(i)?Za.parse(i):bc.parse(i),{src:r}=t,{page:n}=s,a=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=bt.join(bt.dirname(r),u);c=rc(c,r),a.push(c)}const h=await e.load(a),o=a.map(l=>h[l]);return Hr.install(s,o,!0)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};K.add(aA);const Ec=class Nn extends vr{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 r=s[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,a)=>{const h=URL.createObjectURL(r),o=new FileReader;o.onload=()=>n([h,o.result]),o.onerror=a,o.readAsDataURL(r)})).then(async([r,n])=>{const a=Object.assign({family:bt.basename(t,bt.extname(t)),weight:"normal",style:"normal",display:"auto",src:r,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const 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=
|
|
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),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,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}};Ec.availableFonts={},Ec.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 Tc=Ec;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,r=q.from(s,{scaleMode:z.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new rt,r.trim=new rt,this.texture=r;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:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:s.toCSS(r)}),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(r)}),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:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();s.width=r.width=Math.ceil(Math.max(1,n)),s.height=r.height=Math.ceil(Math.max(1,a)),this._updateID++;const h=this._updateID;await new Promise(o=>{r.onload=async()=>{if(h<this._updateID){o();return}await e.onBeforeDraw(),s.src=r.src,r.onload=null,r.src="",this.updateTexture(),o()};const l=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:s,resolution:r}=this,{padding:n}=t,{baseTexture:a}=e;e.trim.width=e._frame.width=s.width/r,e.trim.height=e._frame.height=s.height/r,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,r),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,r,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,(r=this._svgRoot)==null||r.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=Dr(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=Dr(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 Tc?(this.ownsStyle=!1,this._style=t):t instanceof vr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Tc.from(t)):(this.ownsStyle=!0,this._style=new Tc(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(/ /gi," ")}};Qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qa.defaultMaxWidth=2024,Qa.defaultMaxHeight=2024,Qa.defaultAutoResolution=!0;class lA{constructor(t,e){this._fontName=t,this._defaultFontSize=e}createText(t,e){return new nA(t.toString(),{fontName:this._fontName,fontSize:this._defaultFontSize||e})}}function br(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function rg(i,t){i.prototype=Object.create(t.prototype),i.prototype.constructor=i,i.__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 ge={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},mr={duration:.5,overwrite:!1,delay:0},Tl,te,Tt,Me=1e8,yt=1/Me,wl=Math.PI*2,CT=wl/4,PT=0,Fp=Math.sqrt,IT=Math.cos,RT=Math.sin,jt=function(t){return typeof t=="string"},kt=function(t){return typeof t=="function"},Oi=function(t){return typeof t=="number"},El=function(t){return typeof t>"u"},di=function(t){return typeof t=="object"},le=function(t){return t!==!1},Al=function(){return typeof window<"u"},ja=function(t){return kt(t)||jt(t)},kp=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ee=Array.isArray,Sl=/(?:-?\.?\d|\.)+/gi,Lp=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,_r=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Cl=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Np=/[+-]=-?[.\d]+/,Up=/[^,'"\[\]\s]+/gi,MT=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ct,fi,Pl,Il,ye={},qa={},Gp,Hp=function(t){return(qa=Ms(t,ye))&&de},Rl=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},hn=function(t,e){return!e&&console.warn(t)},Vp=function(t,e){return t&&(ye[t]=e)&&qa&&(qa[t]=e)||ye},ln=function(){return 0},DT={suppressEvents:!0,isStart:!0,kill:!1},Ka={suppressEvents:!0,kill:!1},BT={suppressEvents:!0},Ml={},is=[],Dl={},Xp,xe={},Bl={},Wp=30,Za=[],Ol="",Fl=function(t){var e=t[0],i,r;if(di(e)||kt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(r=Za.length;r--&&!Za[r].targetTest(e););i=Za[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new xm(t[r],i)))||t.splice(r,1);return t},Rs=function(t){return t._gsap||Fl(Oe(t))[0]._gsap},$p=function(t,e,i){return(i=t[e])&&kt(i)?t[e]():El(i)&&t.getAttribute&&t.getAttribute(e)||i},ue=function(t,e){return(t=t.split(",")).forEach(e)||t},Ut=function(t){return Math.round(t*1e5)/1e5||0},qt=function(t){return Math.round(t*1e7)/1e7||0},gr=function(t,e){var i=e.charAt(0),r=parseFloat(e.substr(2));return t=parseFloat(t),i==="+"?t+r:i==="-"?t-r:i==="*"?t*r:t/r},OT=function(t,e){for(var i=e.length,r=0;t.indexOf(e[r])<0&&++r<i;);return r<i},Qa=function(){var t=is.length,e=is.slice(0),i,r;for(Dl={},is.length=0,i=0;i<t;i++)r=e[i],r&&r._lazy&&(r.render(r._lazy[0],r._lazy[1],!0)._lazy=0)},zp=function(t,e,i,r){is.length&&!te&&Qa(),t.render(e,i,r||te&&e<0&&(t._initted||t._startAt)),is.length&&!te&&Qa()},Yp=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(Up).length<2?e:jt(t)?t.trim():t},jp=function(t){return t},De=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},FT=function(t){return function(e,i){for(var r in i)r in e||r==="duration"&&t||r==="ease"||(e[r]=i[r])}},Ms=function(t,e){for(var i in e)t[i]=e[i];return t},qp=function s(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=di(e[i])?s(t[i]||(t[i]={}),e[i]):e[i]);return t},Ja=function(t,e){var i={},r;for(r in t)r in e||(i[r]=t[r]);return i},un=function(t){var e=t.parent||Ct,i=t.keyframes?FT(ee(t.keyframes)):De;if(le(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},kT=function(t,e){for(var i=t.length,r=i===e.length;r&&i--&&t[i]===e[i];);return i<0},Kp=function(t,e,i,r,n){i===void 0&&(i="_first"),r===void 0&&(r="_last");var a=t[r],o;if(n)for(o=e[n];a&&a[n]>o;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[r]=e,e._prev=a,e.parent=e._dp=t,e},to=function(t,e,i,r){i===void 0&&(i="_first"),r===void 0&&(r="_last");var n=e._prev,a=e._next;n?n._next=a:t[i]===e&&(t[i]=a),a?a._prev=n:t[r]===e&&(t[r]=n),e._next=e._prev=e.parent=null},ss=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Ds=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},LT=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},kl=function(t,e,i,r){return t._startAt&&(te?t._startAt.revert(Ka):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,r))},NT=function s(t){return!t||t._ts&&s(t.parent)},Zp=function(t){return t._repeat?yr(t._tTime,t=t.duration()+t._rDelay)*t:0},yr=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},eo=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},io=function(t){return t._end=qt(t._start+(t._tDur/Math.abs(t._ts||t._rts||yt)||0))},so=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=qt(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),io(t),i._dirty||Ds(i,t)),t},Qp=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=eo(t.rawTime(),e),(!e._dur||dn(0,e.totalDuration(),i)-e._tTime>yt)&&e.render(i,!0)),Ds(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-yt}},pi=function(t,e,i,r){return e.parent&&ss(e),e._start=qt((Oi(i)?i:i||t!==Ct?Be(t,i,e):t._time)+e._delay),e._end=qt(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),Kp(t,e,"_first","_last",t._sort?"_start":0),Ll(e)||(t._recent=e),r||Qp(t,e),t._ts<0&&so(t,t._tTime),t},Jp=function(t,e){return(ye.ScrollTrigger||Rl("scrollTrigger",e))&&ye.ScrollTrigger.create(e,t)},tm=function(t,e,i,r,n){if(zl(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!te&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&Xp!==be.frame)return is.push(t),t._lazy=[n,r],1},UT=function s(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||s(e))},Ll=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},GT=function(t,e,i,r){var n=t.ratio,a=e<0||!e&&(!t._start&&UT(t)&&!(!t._initted&&Ll(t))||(t._ts<0||t._dp._ts<0)&&!Ll(t))?0:1,o=t._rDelay,h=0,u,d,l;if(o&&t._repeat&&(h=dn(0,t._tDur,e),d=yr(h,o),t._yoyo&&d&1&&(a=1-a),d!==yr(t._tTime,o)&&(n=1-a,t.vars.repeatRefresh&&t._initted&&t.invalidate())),a!==n||te||r||t._zTime===yt||!e&&t._zTime){if(!t._initted&&tm(t,e,r,i,h))return;for(l=t._zTime,t._zTime=e||(i?yt:0),i||(i=e&&!l),t.ratio=a,t._from&&(a=1-a),t._time=0,t._tTime=h,u=t._pt;u;)u.r(a,u.d),u=u._next;e<0&&kl(t,e,i,!0),t._onUpdate&&!i&&ve(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&ve(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===a&&(a&&ss(t,1),!i&&!te&&(ve(t,a?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},HT=function(t,e,i){var r;if(i>e)for(r=t._first;r&&r._start<=i;){if(r.data==="isPause"&&r._start>e)return r;r=r._next}else for(r=t._last;r&&r._start>=i;){if(r.data==="isPause"&&r._start<e)return r;r=r._prev}},xr=function(t,e,i,r){var n=t._repeat,a=qt(e)||0,o=t._tTime/t._tDur;return o&&!r&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:qt(a*(n+1)+t._rDelay*n):a,o>0&&!r&&so(t,t._tTime=t._tDur*o),t.parent&&io(t),i||Ds(t.parent,t),t},em=function(t){return t instanceof ne?Ds(t):xr(t,t._dur)},VT={_start:0,endTime:ln,totalDuration:ln},Be=function s(t,e,i){var r=t.labels,n=t._recent||VT,a=t.duration()>=Me?n.endTime(!1):t._dur,o,h,u;return jt(e)&&(isNaN(e)||e in r)?(h=e.charAt(0),u=e.substr(-1)==="%",o=e.indexOf("="),h==="<"||h===">"?(o>=0&&(e=e.replace(/=/,"")),(h==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(u?(o<0?n:i).totalDuration()/100:1)):o<0?(e in r||(r[e]=a),r[e]):(h=parseFloat(e.charAt(o-1)+e.substr(o+1)),u&&i&&(h=h/100*(ee(i)?i[0]:i).totalDuration()),o>1?s(t,e.substr(0,o-1),i)+h:a+h)):e==null?a:+e},cn=function(t,e,i){var r=Oi(e[1]),n=(r?2:1)+(t<2?0:1),a=e[n],o,h;if(r&&(a.duration=e[1]),a.parent=i,t){for(o=a,h=i;h&&!("immediateRender"in o);)o=h.vars.defaults||{},h=le(h.vars.inherit)&&h.parent;a.immediateRender=le(o.immediateRender),t<2?a.runBackwards=1:a.startAt=e[n-1]}return new Vt(e[0],a,e[n+1])},rs=function(t,e){return t||t===0?e(t):e},dn=function(t,e,i){return i<t?t:i>e?e:i},ie=function(t,e){return!jt(t)||!(e=MT.exec(t))?"":e[1]},XT=function(t,e,i){return rs(i,function(r){return dn(t,e,r)})},Nl=[].slice,im=function(t,e){return t&&di(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&di(t[0]))&&!t.nodeType&&t!==fi},WT=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(r){var n;return jt(r)&&!e||im(r,1)?(n=i).push.apply(n,Oe(r)):i.push(r)})||i},Oe=function(t,e,i){return Tt&&!e&&Tt.selector?Tt.selector(t):jt(t)&&!i&&(Pl||!br())?Nl.call((e||Il).querySelectorAll(t),0):ee(t)?WT(t,i):im(t)?Nl.call(t,0):t?[t]:[]},Ul=function(t){return t=Oe(t)[0]||hn("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Oe(e,i.querySelectorAll?i:i===t?hn("Invalid scope")||Il.createElement("div"):t)}},sm=function(t){return t.sort(function(){return .5-Math.random()})},rm=function(t){if(kt(t))return t;var e=di(t)?t:{each:t},i=Bs(e.ease),r=e.from||0,n=parseFloat(e.base)||0,a={},o=r>0&&r<1,h=isNaN(r)||o,u=e.axis,d=r,l=r;return jt(r)?d=l={center:.5,edges:.5,end:1}[r]||0:!o&&h&&(d=r[0],l=r[1]),function(c,f,p){var m=(p||e).length,_=a[m],g,x,y,v,b,E,w,A,T;if(!_){if(T=e.grid==="auto"?0:(e.grid||[1,Me])[1],!T){for(w=-Me;w<(w=p[T++].getBoundingClientRect().left)&&T<m;);T<m&&T--}for(_=a[m]=[],g=h?Math.min(T,m)*d-.5:r%T,x=T===Me?0:h?m*l/T-.5:r/T|0,w=0,A=Me,E=0;E<m;E++)y=E%T-g,v=x-(E/T|0),_[E]=b=u?Math.abs(u==="y"?v:y):Fp(y*y+v*v),b>w&&(w=b),b<A&&(A=b);r==="random"&&sm(_),_.max=w-A,_.min=A,_.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(T>m?m-1:u?u==="y"?m/T:T:Math.max(T,m/T))||0)*(r==="edges"?-1:1),_.b=m<0?n-m:n,_.u=ie(e.amount||e.each)||0,i=i&&m<0?_m(i):i}return m=(_[c]-_.min)/_.max||0,qt(_.b+(i?i(m):m)*_.v)+_.u}},Gl=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var r=qt(Math.round(parseFloat(i)/t)*t*e);return(r-r%1)/e+(Oi(i)?0:ie(i))}},nm=function(t,e){var i=ee(t),r,n;return!i&&di(t)&&(r=i=t.radius||Me,t.values?(t=Oe(t.values),(n=!Oi(t[0]))&&(r*=r)):t=Gl(t.increment)),rs(e,i?kt(t)?function(a){return n=t(a),Math.abs(n-a)<=r?n:a}:function(a){for(var o=parseFloat(n?a.x:a),h=parseFloat(n?a.y:0),u=Me,d=0,l=t.length,c,f;l--;)n?(c=t[l].x-o,f=t[l].y-h,c=c*c+f*f):c=Math.abs(t[l]-o),c<u&&(u=c,d=l);return d=!r||u<=r?t[d]:a,n||d===a||Oi(a)?d:d+ie(a)}:Gl(t))},am=function(t,e,i,r){return rs(ee(t)?!e:i===!0?!!(i=0):!r,function(){return ee(t)?t[~~(Math.random()*t.length)]:(i=i||1e-5)&&(r=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((t-i/2+Math.random()*(e-t+i*.99))/i)*i*r)/r})},$T=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(r){return e.reduce(function(n,a){return a(n)},r)}},zT=function(t,e){return function(i){return t(parseFloat(i))+(e||ie(i))}},YT=function(t,e,i){return hm(t,e,0,1,i)},om=function(t,e,i){return rs(i,function(r){return t[~~e(r)]})},jT=function s(t,e,i){var r=e-t;return ee(t)?om(t,s(0,t.length),e):rs(i,function(n){return(r+(n-t)%r)%r+t})},qT=function s(t,e,i){var r=e-t,n=r*2;return ee(t)?om(t,s(0,t.length-1),e):rs(i,function(a){return a=(n+(a-t)%n)%n||0,t+(a>r?n-a:a)})},fn=function(t){for(var e=0,i="",r,n,a,o;~(r=t.indexOf("random(",e));)a=t.indexOf(")",r),o=t.charAt(r+7)==="[",n=t.substr(r+7,a-r-7).match(o?Up:Sl),i+=t.substr(e,r-e)+am(o?n:+n[0],o?0:+n[1],+n[2]||1e-5),e=a+1;return i+t.substr(e,t.length-e)},hm=function(t,e,i,r,n){var a=e-t,o=r-i;return rs(n,function(h){return i+((h-t)/a*o||0)})},KT=function s(t,e,i,r){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var a=jt(t),o={},h,u,d,l,c;if(i===!0&&(r=1)&&(i=null),a)t={p:t},e={p:e};else if(ee(t)&&!ee(e)){for(d=[],l=t.length,c=l-2,u=1;u<l;u++)d.push(s(t[u-1],t[u]));l--,n=function(p){p*=l;var m=Math.min(c,~~p);return d[m](p-m)},i=e}else r||(t=Ms(ee(t)?[]:{},t));if(!d){for(h in e)Wl.call(o,t,h,"get",e[h]);n=function(p){return ql(p,o)||(a?t.p:t)}}}return rs(i,n)},lm=function(t,e,i){var r=t.labels,n=Me,a,o,h;for(a in r)o=r[a]-e,o<0==!!i&&o&&n>(o=Math.abs(o))&&(h=a,n=o);return h},ve=function(t,e,i){var r=t.vars,n=r[e],a=Tt,o=t._ctx,h,u,d;if(n)return h=r[e+"Params"],u=r.callbackScope||t,i&&is.length&&Qa(),o&&(Tt=o),d=h?n.apply(u,h):n.call(u),Tt=a,d},pn=function(t){return ss(t),t.scrollTrigger&&t.scrollTrigger.kill(!!te),t.progress()<1&&ve(t,"onInterrupt"),t},vr,um=[],cm=function(t){if(t)if(t=!t.name&&t.default||t,Al()||t.headless){var e=t.name,i=kt(t),r=e&&!i&&t.init?function(){this._props=[]}:t,n={init:ln,render:ql,add:Wl,kill:dw,modifier:cw,rawVars:0},a={targetTest:0,get:0,getSetter:jl,aliases:{},register:0};if(br(),t!==r){if(xe[e])return;De(r,De(Ja(t,n),a)),Ms(r.prototype,Ms(n,Ja(t,a))),xe[r.prop=e]=r,t.targetTest&&(Za.push(r),Ml[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}Vp(e,r),t.register&&t.register(de,r,ce)}else um.push(t)},mt=255,mn={aqua:[0,mt,mt],lime:[0,mt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,mt],navy:[0,0,128],white:[mt,mt,mt],olive:[128,128,0],yellow:[mt,mt,0],orange:[mt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[mt,0,0],pink:[mt,192,203],cyan:[0,mt,mt],transparent:[mt,mt,mt,0]},Hl=function(t,e,i){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(i-e)*t*6:t<.5?i:t*3<2?e+(i-e)*(2/3-t)*6:e)*mt+.5|0},dm=function(t,e,i){var r=t?Oi(t)?[t>>16,t>>8&mt,t&mt]:0:mn.black,n,a,o,h,u,d,l,c,f,p;if(!r){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),mn[t])r=mn[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),a=t.charAt(2),o=t.charAt(3),t="#"+n+n+a+a+o+o+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return r=parseInt(t.substr(1,6),16),[r>>16,r>>8&mt,r&mt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),r=[t>>16,t>>8&mt,t&mt]}else if(t.substr(0,3)==="hsl"){if(r=p=t.match(Sl),!e)h=+r[0]%360/360,u=+r[1]/100,d=+r[2]/100,a=d<=.5?d*(u+1):d+u-d*u,n=d*2-a,r.length>3&&(r[3]*=1),r[0]=Hl(h+1/3,n,a),r[1]=Hl(h,n,a),r[2]=Hl(h-1/3,n,a);else if(~t.indexOf("="))return r=t.match(Lp),i&&r.length<4&&(r[3]=1),r}else r=t.match(Sl)||mn.transparent;r=r.map(Number)}return e&&!p&&(n=r[0]/mt,a=r[1]/mt,o=r[2]/mt,l=Math.max(n,a,o),c=Math.min(n,a,o),d=(l+c)/2,l===c?h=u=0:(f=l-c,u=d>.5?f/(2-l-c):f/(l+c),h=l===n?(a-o)/f+(a<o?6:0):l===a?(o-n)/f+2:(n-a)/f+4,h*=60),r[0]=~~(h+.5),r[1]=~~(u*100+.5),r[2]=~~(d*100+.5)),i&&r.length<4&&(r[3]=1),r},fm=function(t){var e=[],i=[],r=-1;return t.split(ns).forEach(function(n){var a=n.match(_r)||[];e.push.apply(e,a),i.push(r+=a.length+1)}),e.c=i,e},pm=function(t,e,i){var r="",n=(t+r).match(ns),a=e?"hsla(":"rgba(",o=0,h,u,d,l;if(!n)return t;if(n=n.map(function(c){return(c=dm(c,e,1))&&a+(e?c[0]+","+c[1]+"%,"+c[2]+"%,"+c[3]:c.join(","))+")"}),i&&(d=fm(t),h=i.c,h.join(r)!==d.c.join(r)))for(u=t.replace(ns,"1").split(_r),l=u.length-1;o<l;o++)r+=u[o]+(~h.indexOf(o)?n.shift()||a+"0,0,0,0)":(d.length?d:n.length?n:i).shift());if(!u)for(u=t.split(ns),l=u.length-1;o<l;o++)r+=u[o]+n[o];return r+u[l]},ns=function(){var s="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in mn)s+="|"+t+"\\b";return new RegExp(s+")","gi")}(),ZT=/hsl[a]?\(/,mm=function(t){var e=t.join(" "),i;if(ns.lastIndex=0,ns.test(e))return i=ZT.test(e),t[1]=pm(t[1],i),t[0]=pm(t[0],i,fm(t[1])),!0},_n,be=function(){var s=Date.now,t=500,e=33,i=s(),r=i,n=1e3/240,a=n,o=[],h,u,d,l,c,f,p=function m(_){var g=s()-r,x=_===!0,y,v,b,E;if((g>t||g<0)&&(i+=g-e),r+=g,b=r-i,y=b-a,(y>0||x)&&(E=++l.frame,c=b-l.time*1e3,l.time=b=b/1e3,a+=y+(y>=n?4:n-y),v=1),x||(h=u(m)),v)for(f=0;f<o.length;f++)o[f](b,c,E,_)};return l={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(_){return c/(1e3/(_||60))},wake:function(){Gp&&(!Pl&&Al()&&(fi=Pl=window,Il=fi.document||{},ye.gsap=de,(fi.gsapVersions||(fi.gsapVersions=[])).push(de.version),Hp(qa||fi.GreenSockGlobals||!fi.gsap&&fi||{}),um.forEach(cm)),d=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&l.sleep(),u=d||function(_){return setTimeout(_,a-l.time*1e3+1|0)},_n=1,p(2))},sleep:function(){(d?cancelAnimationFrame:clearTimeout)(h),_n=0,u=ln},lagSmoothing:function(_,g){t=_||1/0,e=Math.min(g||33,t)},fps:function(_){n=1e3/(_||240),a=l.time*1e3+n},add:function(_,g,x){var y=g?function(v,b,E,w){_(v,b,E,w),l.remove(y)}:_;return l.remove(_),o[x?"unshift":"push"](y),br(),y},remove:function(_,g){~(g=o.indexOf(_))&&o.splice(g,1)&&f>=g&&f--},_listeners:o},l}(),br=function(){return!_n&&be.wake()},at={},QT=/^[\d.\-M][\d.\-,\s]/,JT=/["']/g,tw=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),r=i[0],n=1,a=i.length,o,h,u;n<a;n++)h=i[n],o=n!==a-1?h.lastIndexOf(","):h.length,u=h.substr(0,o),e[r]=isNaN(u)?u.replace(JT,"").trim():+u,r=h.substr(o+1).trim();return e},ew=function(t){var e=t.indexOf("(")+1,i=t.indexOf(")"),r=t.indexOf("(",e);return t.substring(e,~r&&r<i?t.indexOf(")",i+1):i)},iw=function(t){var e=(t+"").split("("),i=at[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[tw(e[1])]:ew(t).split(",").map(Yp)):at._CE&&QT.test(t)?at._CE("",t):i},_m=function(t){return function(e){return 1-t(1-e)}},gm=function s(t,e){for(var i=t._first,r;i;)i instanceof ne?s(i,e):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==e&&(i.timeline?s(i.timeline,e):(r=i._ease,i._ease=i._yEase,i._yEase=r,i._yoyo=e)),i=i._next},Bs=function(t,e){return t&&(kt(t)?t:at[t]||iw(t))||e},Os=function(t,e,i,r){i===void 0&&(i=function(h){return 1-e(1-h)}),r===void 0&&(r=function(h){return h<.5?e(h*2)/2:1-e((1-h)*2)/2});var n={easeIn:e,easeOut:i,easeInOut:r},a;return ue(t,function(o){at[o]=ye[o]=n,at[a=o.toLowerCase()]=i;for(var h in n)at[a+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=at[o+"."+h]=n[h]}),n},ym=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Vl=function s(t,e,i){var r=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),a=n/wl*(Math.asin(1/r)||0),o=function(d){return d===1?1:r*Math.pow(2,-10*d)*RT((d-a)*n)+1},h=t==="out"?o:t==="in"?function(u){return 1-o(1-u)}:ym(o);return n=wl/n,h.config=function(u,d){return s(t,u,d)},h},Xl=function s(t,e){e===void 0&&(e=1.70158);var i=function(a){return a?--a*a*((e+1)*a+e)+1:0},r=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:ym(i);return r.config=function(n){return s(t,n)},r};ue("Linear,Quad,Cubic,Quart,Quint,Strong",function(s,t){var e=t<5?t+1:t;Os(s+",Power"+(e-1),t?function(i){return Math.pow(i,e)}:function(i){return i},function(i){return 1-Math.pow(1-i,e)},function(i){return i<.5?Math.pow(i*2,e)/2:1-Math.pow((1-i)*2,e)/2})}),at.Linear.easeNone=at.none=at.Linear.easeIn,Os("Elastic",Vl("in"),Vl("out"),Vl()),function(s,t){var e=1/t,i=2*e,r=2.5*e,n=function(o){return o<e?s*o*o:o<i?s*Math.pow(o-1.5/t,2)+.75:o<r?s*(o-=2.25/t)*o+.9375:s*Math.pow(o-2.625/t,2)+.984375};Os("Bounce",function(a){return 1-n(1-a)},n)}(7.5625,2.75),Os("Expo",function(s){return s?Math.pow(2,10*(s-1)):0}),Os("Circ",function(s){return-(Fp(1-s*s)-1)}),Os("Sine",function(s){return s===1?1:-IT(s*CT)+1}),Os("Back",Xl("in"),Xl("out"),Xl()),at.SteppedEase=at.steps=ye.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,r=t+(e?0:1),n=e?1:0,a=1-yt;return function(o){return((r*dn(0,a,o)|0)+n)*i}}},mr.ease=at["quad.out"],ue("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(s){return Ol+=s+","+s+"Params,"});var xm=function(t,e){this.id=PT++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:$p,this.set=e?e.getSetter:jl},gn=function(){function s(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,xr(this,+e.duration,1,1),this.data=e.data,Tt&&(this._ctx=Tt,Tt.data.push(this)),_n||be.wake()}var t=s.prototype;return t.delay=function(i){return i||i===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+i-this._delay),this._delay=i,this):this._delay},t.duration=function(i){return arguments.length?this.totalDuration(this._repeat>0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},t.totalDuration=function(i){return arguments.length?(this._dirty=0,xr(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,r){if(br(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(so(this,i),!n._dp||n.parent||Qp(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&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&pi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!r||this._initted&&Math.abs(this._zTime)===yt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),zp(this,i,r)),this},t.time=function(i,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+Zp(this))%(this._dur+this._rDelay)||(i?this._dur:0),r):this._time},t.totalProgress=function(i,r){return arguments.length?this.totalTime(this.totalDuration()*i,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(i,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+Zp(this),r):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(i,r){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,r):this._repeat?yr(this._tTime,n)+1:1},t.timeScale=function(i,r){if(!arguments.length)return this._rts===-yt?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?eo(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-yt?0:this._rts,this.totalTime(dn(-Math.abs(this._delay),this._tDur,n),r!==!1),io(this),LT(this)},t.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(br(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==yt&&(this._tTime-=yt)))),this):this._ps},t.startTime=function(i){if(arguments.length){this._start=i;var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&pi(r,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(le(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(i){var r=this.parent||this._dp;return r?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?eo(r.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=BT);var r=te;return te=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),te=r,this},t.globalTime=function(i){for(var r=this,n=arguments.length?i:r.rawTime();r;)n=r._start+n/(Math.abs(r._ts)||1),r=r._dp;return!this.parent&&this._sat?this._sat.globalTime(i):n},t.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,em(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var r=this._time;return this._rDelay=i,em(this),r?this.time(r):this}return this._rDelay},t.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},t.seek=function(i,r){return this.totalTime(Be(this,i),le(r))},t.restart=function(i,r){return this.play().totalTime(i?-this._delay:0,le(r))},t.play=function(i,r){return i!=null&&this.seek(i,r),this.reversed(!1).paused(!1)},t.reverse=function(i,r){return i!=null&&this.seek(i||this.totalDuration(),r),this.reversed(!0).paused(!1)},t.pause=function(i,r){return i!=null&&this.seek(i,r),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-yt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-yt,this},t.isActive=function(){var i=this.parent||this._dp,r=this._start,n;return!!(!i||this._ts&&this._initted&&i.isActive()&&(n=i.rawTime(!0))>=r&&n<this.endTime(!0)-yt)},t.eventCallback=function(i,r,n){var a=this.vars;return arguments.length>1?(r?(a[i]=r,n&&(a[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=r)):delete a[i],this):a[i]},t.then=function(i){var r=this;return new Promise(function(n){var a=kt(i)?i:jp,o=function(){var u=r.then;r.then=null,kt(a)&&(a=a(r))&&(a.then||a===r)&&(r.then=u),n(a),r.then=u};r._initted&&r.totalProgress()===1&&r._ts>=0||!r._tTime&&r._ts<0?o():r._prom=o})},t.kill=function(){pn(this)},s}();De(gn.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:-yt,_prom:0,_ps:!1,_rts:1});var ne=function(s){Op(t,s);function t(i,r){var n;return i===void 0&&(i={}),n=s.call(this,i)||this,n.labels={},n.smoothChildTiming=!!i.smoothChildTiming,n.autoRemoveChildren=!!i.autoRemoveChildren,n._sort=le(i.sortChildren),Ct&&pi(i.parent||Ct,Bi(n),r),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&Jp(Bi(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(r,n,a){return cn(0,arguments,this),this},e.from=function(r,n,a){return cn(1,arguments,this),this},e.fromTo=function(r,n,a,o){return cn(2,arguments,this),this},e.set=function(r,n,a){return n.duration=0,n.parent=this,un(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new Vt(r,n,Be(this,a),1),this},e.call=function(r,n,a){return pi(this,Vt.delayedCall(0,r,n),a)},e.staggerTo=function(r,n,a,o,h,u,d){return a.duration=n,a.stagger=a.stagger||o,a.onComplete=u,a.onCompleteParams=d,a.parent=this,new Vt(r,a,Be(this,h)),this},e.staggerFrom=function(r,n,a,o,h,u,d){return a.runBackwards=1,un(a).immediateRender=le(a.immediateRender),this.staggerTo(r,n,a,o,h,u,d)},e.staggerFromTo=function(r,n,a,o,h,u,d,l){return o.startAt=a,un(o).immediateRender=le(o.immediateRender),this.staggerTo(r,n,o,h,u,d,l)},e.render=function(r,n,a){var o=this._time,h=this._dirty?this.totalDuration():this._tDur,u=this._dur,d=r<=0?0:qt(r),l=this._zTime<0!=r<0&&(this._initted||!u),c,f,p,m,_,g,x,y,v,b,E,w;if(this!==Ct&&d>h&&r>=0&&(d=h),d!==this._tTime||a||l){if(o!==this._time&&u&&(d+=this._time-o,r+=this._time-o),c=d,v=this._start,y=this._ts,g=!y,l&&(u||(o=this._zTime),(r||!n)&&(this._zTime=r)),this._repeat){if(E=this._yoyo,_=u+this._rDelay,this._repeat<-1&&r<0)return this.totalTime(_*100+r,n,a);if(c=qt(d%_),d===h?(m=this._repeat,c=u):(m=~~(d/_),m&&m===d/_&&(c=u,m--),c>u&&(c=u)),b=yr(this._tTime,_),!o&&this._tTime&&b!==m&&this._tTime-b*_-this._dur<=0&&(b=m),E&&m&1&&(c=u-c,w=1),m!==b&&!this._lock){var A=E&&b&1,T=A===(E&&m&1);if(m<b&&(A=!A),o=A?0:d%u?u:d,this._lock=1,this.render(o||(w?0:qt(m*_)),n,!u)._lock=0,this._tTime=d,!n&&this.parent&&ve(this,"onRepeat"),this.vars.repeatRefresh&&!w&&(this.invalidate()._lock=1),o&&o!==this._time||g!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(u=this._dur,h=this._tDur,T&&(this._lock=2,o=A?u:-1e-4,this.render(o,!0),this.vars.repeatRefresh&&!w&&this.invalidate()),this._lock=0,!this._ts&&!g)return this;gm(this,w)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=HT(this,qt(o),qt(c)),x&&(d-=c-(c=x._start))),this._tTime=d,this._time=c,this._act=!y,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=r,o=0),!o&&c&&!n&&!m&&(ve(this,"onStart"),this._tTime!==d))return this;if(c>=o&&r>=0)for(f=this._first;f;){if(p=f._next,(f._act||c>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(r,n,a);if(f.render(f._ts>0?(c-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(c-f._start)*f._ts,n,a),c!==this._time||!this._ts&&!g){x=0,p&&(d+=this._zTime=-yt);break}}f=p}else{f=this._last;for(var P=r<0?r:c;f;){if(p=f._prev,(f._act||P<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(r,n,a);if(f.render(f._ts>0?(P-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(P-f._start)*f._ts,n,a||te&&(f._initted||f._startAt)),c!==this._time||!this._ts&&!g){x=0,p&&(d+=this._zTime=P?-yt:yt);break}}f=p}}if(x&&!n&&(this.pause(),x.render(c>=o?0:-yt)._zTime=c>=o?1:-1,this._ts))return this._start=v,io(this),this.render(r,n,a);this._onUpdate&&!n&&ve(this,"onUpdate",!0),(d===h&&this._tTime>=this.totalDuration()||!d&&o)&&(v===this._start||Math.abs(y)!==Math.abs(this._ts))&&(this._lock||((r||!u)&&(d===h&&this._ts>0||!d&&this._ts<0)&&ss(this,1),!n&&!(r<0&&!o)&&(d||o||!h)&&(ve(this,d===h&&r>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(d<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(r,n){var a=this;if(Oi(n)||(n=Be(this,n,r)),!(r instanceof gn)){if(ee(r))return r.forEach(function(o){return a.add(o,n)}),this;if(jt(r))return this.addLabel(r,n);if(kt(r))r=Vt.delayedCall(0,r);else return this}return this!==r?pi(this,r,n):this},e.getChildren=function(r,n,a,o){r===void 0&&(r=!0),n===void 0&&(n=!0),a===void 0&&(a=!0),o===void 0&&(o=-Me);for(var h=[],u=this._first;u;)u._start>=o&&(u instanceof Vt?n&&h.push(u):(a&&h.push(u),r&&h.push.apply(h,u.getChildren(!0,n,a)))),u=u._next;return h},e.getById=function(r){for(var n=this.getChildren(1,1,1),a=n.length;a--;)if(n[a].vars.id===r)return n[a]},e.remove=function(r){return jt(r)?this.removeLabel(r):kt(r)?this.killTweensOf(r):(to(this,r),r===this._recent&&(this._recent=this._last),Ds(this))},e.totalTime=function(r,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=qt(be.time-(this._ts>0?r/this._ts:(this.totalDuration()-r)/-this._ts))),s.prototype.totalTime.call(this,r,n),this._forcing=0,this):this._tTime},e.addLabel=function(r,n){return this.labels[r]=Be(this,n),this},e.removeLabel=function(r){return delete this.labels[r],this},e.addPause=function(r,n,a){var o=Vt.delayedCall(0,n||ln,a);return o.data="isPause",this._hasPause=1,pi(this,o,Be(this,r))},e.removePause=function(r){var n=this._first;for(r=Be(this,r);n;)n._start===r&&n.data==="isPause"&&ss(n),n=n._next},e.killTweensOf=function(r,n,a){for(var o=this.getTweensOf(r,a),h=o.length;h--;)as!==o[h]&&o[h].kill(r,n);return this},e.getTweensOf=function(r,n){for(var a=[],o=Oe(r),h=this._first,u=Oi(n),d;h;)h instanceof Vt?OT(h._targets,o)&&(u?(!as||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&a.push(h):(d=h.getTweensOf(o,n)).length&&a.push.apply(a,d),h=h._next;return a},e.tweenTo=function(r,n){n=n||{};var a=this,o=Be(a,r),h=n,u=h.startAt,d=h.onStart,l=h.onStartParams,c=h.immediateRender,f,p=Vt.to(a,De({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:o,overwrite:"auto",duration:n.duration||Math.abs((o-(u&&"time"in u?u.time:a._time))/a.timeScale())||yt,onStart:function(){if(a.pause(),!f){var _=n.duration||Math.abs((o-(u&&"time"in u?u.time:a._time))/a.timeScale());p._dur!==_&&xr(p,_,0,1).render(p._time,!0,!0),f=1}d&&d.apply(p,l||[])}},n));return c?p.render(0):p},e.tweenFromTo=function(r,n,a){return this.tweenTo(n,De({startAt:{time:Be(this,r)}},a))},e.recent=function(){return this._recent},e.nextLabel=function(r){return r===void 0&&(r=this._time),lm(this,Be(this,r))},e.previousLabel=function(r){return r===void 0&&(r=this._time),lm(this,Be(this,r),1)},e.currentLabel=function(r){return arguments.length?this.seek(r,!0):this.previousLabel(this._time+yt)},e.shiftChildren=function(r,n,a){a===void 0&&(a=0);for(var o=this._first,h=this.labels,u;o;)o._start>=a&&(o._start+=r,o._end+=r),o=o._next;if(n)for(u in h)h[u]>=a&&(h[u]+=r);return Ds(this)},e.invalidate=function(r){var n=this._first;for(this._lock=0;n;)n.invalidate(r),n=n._next;return s.prototype.invalidate.call(this,r)},e.clear=function(r){r===void 0&&(r=!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),r&&(this.labels={}),Ds(this)},e.totalDuration=function(r){var n=0,a=this,o=a._last,h=Me,u,d,l;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-r:r));if(a._dirty){for(l=a.parent;o;)u=o._prev,o._dirty&&o.totalDuration(),d=o._start,d>h&&a._sort&&o._ts&&!a._lock?(a._lock=1,pi(a,o,d-o._delay,1)._lock=0):h=d,d<0&&o._ts&&(n-=d,(!l&&!a._dp||l&&l.smoothChildTiming)&&(a._start+=d/a._ts,a._time-=d,a._tTime-=d),a.shiftChildren(-d,!1,-1/0),h=0),o._end>n&&o._ts&&(n=o._end),o=u;xr(a,a===Ct&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},t.updateRoot=function(r){if(Ct._ts&&(zp(Ct,eo(r,Ct)),Xp=be.frame),be.frame>=Wp){Wp+=ge.autoSleep||120;var n=Ct._first;if((!n||!n._ts)&&ge.autoSleep&&be._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||be.sleep()}}},t}(gn);De(ne.prototype,{_lock:0,_hasPause:0,_forcing:0});var sw=function(t,e,i,r,n,a,o){var h=new ce(this._pt,t,e,0,1,Am,null,n),u=0,d=0,l,c,f,p,m,_,g,x;for(h.b=i,h.e=r,i+="",r+="",(g=~r.indexOf("random("))&&(r=fn(r)),a&&(x=[i,r],a(x,t,e),i=x[0],r=x[1]),c=i.match(Cl)||[];l=Cl.exec(r);)p=l[0],m=r.substring(u,l.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==c[d++]&&(_=parseFloat(c[d-1])||0,h._pt={_next:h._pt,p:m||d===1?m:",",s:_,c:p.charAt(1)==="="?gr(_,p)-_:parseFloat(p)-_,m:f&&f<4?Math.round:0},u=Cl.lastIndex);return h.c=u<r.length?r.substring(u,r.length):"",h.fp=o,(Np.test(r)||g)&&(h.e=0),this._pt=h,h},Wl=function(t,e,i,r,n,a,o,h,u,d){kt(r)&&(r=r(n||0,t,a));var l=t[e],c=i!=="get"?i:kt(l)?u?t[e.indexOf("set")||!kt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](u):t[e]():l,f=kt(l)?u?hw:wm:Yl,p;if(jt(r)&&(~r.indexOf("random(")&&(r=fn(r)),r.charAt(1)==="="&&(p=gr(c,r)+(ie(c)||0),(p||p===0)&&(r=p))),!d||c!==r||$l)return!isNaN(c*r)&&r!==""?(p=new ce(this._pt,t,e,+c||0,r-(c||0),typeof l=="boolean"?uw:Em,0,f),u&&(p.fp=u),o&&p.modifier(o,this,t),this._pt=p):(!l&&!(e in t)&&Rl(e,r),sw.call(this,t,e,c,r,f,h||ge.stringFilter,u))},rw=function(t,e,i,r,n){if(kt(t)&&(t=yn(t,n,e,i,r)),!di(t)||t.style&&t.nodeType||ee(t)||kp(t))return jt(t)?yn(t,n,e,i,r):t;var a={},o;for(o in t)a[o]=yn(t[o],n,e,i,r);return a},vm=function(t,e,i,r,n,a){var o,h,u,d;if(xe[t]&&(o=new xe[t]).init(n,o.rawVars?e[t]:rw(e[t],r,n,a,i),i,r,a)!==!1&&(i._pt=h=new ce(i._pt,n,t,0,1,o.render,o,0,o.priority),i!==vr))for(u=i._ptLookup[i._targets.indexOf(n)],d=o._props.length;d--;)u[o._props[d]]=h;return o},as,$l,zl=function s(t,e,i){var r=t.vars,n=r.ease,a=r.startAt,o=r.immediateRender,h=r.lazy,u=r.onUpdate,d=r.runBackwards,l=r.yoyoEase,c=r.keyframes,f=r.autoRevert,p=t._dur,m=t._startAt,_=t._targets,g=t.parent,x=g&&g.data==="nested"?g.vars.targets:_,y=t._overwrite==="auto"&&!Tl,v=t.timeline,b,E,w,A,T,P,k,R,S,C,I,N,F;if(v&&(!c||!n)&&(n="none"),t._ease=Bs(n,mr.ease),t._yEase=l?_m(Bs(l===!0?n:l,mr.ease)):0,l&&t._yoyo&&!t._repeat&&(l=t._yEase,t._yEase=t._ease,t._ease=l),t._from=!v&&!!r.runBackwards,!v||c&&!r.stagger){if(R=_[0]?Rs(_[0]).harness:0,N=R&&r[R.prop],b=Ja(r,Ml),m&&(m._zTime<0&&m.progress(1),e<0&&d&&o&&!f?m.render(-1,!0):m.revert(d&&p?Ka:DT),m._lazy=0),a){if(ss(t._startAt=Vt.set(_,De({data:"isStart",overwrite:!1,parent:g,immediateRender:!0,lazy:!m&&le(h),startAt:null,delay:0,onUpdate:u&&function(){return ve(t,"onUpdate")},stagger:0},a))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(te||!o&&!f)&&t._startAt.revert(Ka),o&&p&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(d&&p&&!m){if(e&&(o=!1),w=De({overwrite:!1,data:"isFromStart",lazy:o&&!m&&le(h),immediateRender:o,stagger:0,parent:g},b),N&&(w[R.prop]=N),ss(t._startAt=Vt.set(_,w)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(te?t._startAt.revert(Ka):t._startAt.render(-1,!0)),t._zTime=e,!o)s(t._startAt,yt,yt);else if(!e)return}for(t._pt=t._ptCache=0,h=p&&le(h)||h&&!p,E=0;E<_.length;E++){if(T=_[E],k=T._gsap||Fl(_)[E]._gsap,t._ptLookup[E]=C={},Dl[k.id]&&is.length&&Qa(),I=x===_?E:x.indexOf(T),R&&(S=new R).init(T,N||b,t,I,x)!==!1&&(t._pt=A=new ce(t._pt,T,S.name,0,1,S.render,S,0,S.priority),S._props.forEach(function(B){C[B]=A}),S.priority&&(P=1)),!R||N)for(w in b)xe[w]&&(S=vm(w,b,t,I,T,x))?S.priority&&(P=1):C[w]=A=Wl.call(t,T,w,"get",b[w],I,x,0,r.stringFilter);t._op&&t._op[E]&&t.kill(T,t._op[E]),y&&t._pt&&(as=t,Ct.killTweensOf(T,C,t.globalTime(e)),F=!t.parent,as=0),t._pt&&h&&(Dl[k.id]=1)}P&&Sm(t),t._onInit&&t._onInit(t)}t._onUpdate=u,t._initted=(!t._op||t._pt)&&!F,c&&e<=0&&v.render(Me,!0,!0)},nw=function(t,e,i,r,n,a,o,h){var u=(t._pt&&t._ptCache||(t._ptCache={}))[e],d,l,c,f;if(!u)for(u=t._ptCache[e]=[],c=t._ptLookup,f=t._targets.length;f--;){if(d=c[f][e],d&&d.d&&d.d._pt)for(d=d.d._pt;d&&d.p!==e&&d.fp!==e;)d=d._next;if(!d)return $l=1,t.vars[e]="+=0",zl(t,o),$l=0,h?hn(e+" not eligible for reset"):1;u.push(d)}for(f=u.length;f--;)l=u[f],d=l._pt||l,d.s=(r||r===0)&&!n?r:d.s+(r||0)+a*d.c,d.c=i-d.s,l.e&&(l.e=Ut(i)+ie(l.e)),l.b&&(l.b=d.s+ie(l.b))},aw=function(t,e){var i=t[0]?Rs(t[0]).harness:0,r=i&&i.aliases,n,a,o,h;if(!r)return e;n=Ms({},e);for(a in r)if(a in n)for(h=r[a].split(","),o=h.length;o--;)n[h[o]]=n[a];return n},ow=function(t,e,i,r){var n=e.ease||r||"power1.inOut",a,o;if(ee(e))o=i[t]||(i[t]=[]),e.forEach(function(h,u){return o.push({t:u/(e.length-1)*100,v:h,e:n})});else for(a in e)o=i[a]||(i[a]=[]),a==="ease"||o.push({t:parseFloat(t),v:e[a],e:n})},yn=function(t,e,i,r,n){return kt(t)?t.call(e,i,r,n):jt(t)&&~t.indexOf("random(")?fn(t):t},bm=Ol+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Tm={};ue(bm+",id,stagger,delay,duration,paused,scrollTrigger",function(s){return Tm[s]=1});var Vt=function(s){Op(t,s);function t(i,r,n,a){var o;typeof r=="number"&&(n.duration=r,r=n,n=null),o=s.call(this,a?r:un(r))||this;var h=o.vars,u=h.duration,d=h.delay,l=h.immediateRender,c=h.stagger,f=h.overwrite,p=h.keyframes,m=h.defaults,_=h.scrollTrigger,g=h.yoyoEase,x=r.parent||Ct,y=(ee(i)||kp(i)?Oi(i[0]):"length"in r)?[i]:Oe(i),v,b,E,w,A,T,P,k;if(o._targets=y.length?Fl(y):hn("GSAP target "+i+" not found. https://gsap.com",!ge.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=f,p||c||ja(u)||ja(d)){if(r=o.vars,v=o.timeline=new ne({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:y}),v.kill(),v.parent=v._dp=Bi(o),v._start=0,c||ja(u)||ja(d)){if(w=y.length,P=c&&rm(c),di(c))for(A in c)~bm.indexOf(A)&&(k||(k={}),k[A]=c[A]);for(b=0;b<w;b++)E=Ja(r,Tm),E.stagger=0,g&&(E.yoyoEase=g),k&&Ms(E,k),T=y[b],E.duration=+yn(u,Bi(o),b,T,y),E.delay=(+yn(d,Bi(o),b,T,y)||0)-o._delay,!c&&w===1&&E.delay&&(o._delay=d=E.delay,o._start+=d,E.delay=0),v.to(T,E,P?P(b,T,y):0),v._ease=at.none;v.duration()?u=d=0:o.timeline=0}else if(p){un(De(v.vars.defaults,{ease:"none"})),v._ease=Bs(p.ease||r.ease||"none");var R=0,S,C,I;if(ee(p))p.forEach(function(N){return v.to(y,N,">")}),v.duration();else{E={};for(A in p)A==="ease"||A==="easeEach"||ow(A,p[A],E,p.easeEach);for(A in E)for(S=E[A].sort(function(N,F){return N.t-F.t}),R=0,b=0;b<S.length;b++)C=S[b],I={ease:C.e,duration:(C.t-(b?S[b-1].t:0))/100*u},I[A]=C.v,v.to(y,I,R),R+=I.duration;v.duration()<u&&v.to({},{duration:u-v.duration()})}}u||o.duration(u=v.duration())}else o.timeline=0;return f===!0&&!Tl&&(as=Bi(o),Ct.killTweensOf(y),as=0),pi(x,Bi(o),n),r.reversed&&o.reverse(),r.paused&&o.paused(!0),(l||!u&&!p&&o._start===qt(x._time)&&le(l)&&NT(Bi(o))&&x.data!=="nested")&&(o._tTime=-yt,o.render(Math.max(0,-d)||0)),_&&Jp(Bi(o),_),o}var e=t.prototype;return e.render=function(r,n,a){var o=this._time,h=this._tDur,u=this._dur,d=r<0,l=r>h-yt&&!d?h:r<yt?0:r,c,f,p,m,_,g,x,y,v;if(!u)GT(this,r,n,a);else if(l!==this._tTime||!r||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==d){if(c=l,y=this.timeline,this._repeat){if(m=u+this._rDelay,this._repeat<-1&&d)return this.totalTime(m*100+r,n,a);if(c=qt(l%m),l===h?(p=this._repeat,c=u):(p=~~(l/m),p&&p===qt(l/m)&&(c=u,p--),c>u&&(c=u)),g=this._yoyo&&p&1,g&&(v=this._yEase,c=u-c),_=yr(this._tTime,m),c===o&&!a&&this._initted&&p===_)return this._tTime=l,this;p!==_&&(y&&this._yEase&&gm(y,g),this.vars.repeatRefresh&&!g&&!this._lock&&this._time!==m&&this._initted&&(this._lock=a=1,this.render(qt(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(tm(this,d?r:c,a,n,l))return this._tTime=0,this;if(o!==this._time&&!(a&&this.vars.repeatRefresh&&p!==_))return this;if(u!==this._dur)return this.render(r,n,a)}if(this._tTime=l,this._time=c,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(c/u),this._from&&(this.ratio=x=1-x),c&&!o&&!n&&!p&&(ve(this,"onStart"),this._tTime!==l))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;y&&y.render(r<0?r:y._dur*y._ease(c/this._dur),n,a)||this._startAt&&(this._zTime=r),this._onUpdate&&!n&&(d&&kl(this,r,n,a),ve(this,"onUpdate")),this._repeat&&p!==_&&this.vars.onRepeat&&!n&&this.parent&&ve(this,"onRepeat"),(l===this._tDur||!l)&&this._tTime===l&&(d&&!this._onUpdate&&kl(this,r,!0,!0),(r||!u)&&(l===this._tDur&&this._ts>0||!l&&this._ts<0)&&ss(this,1),!n&&!(d&&!o)&&(l||o||g)&&(ve(this,l===h?"onComplete":"onReverseComplete",!0),this._prom&&!(l<h&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(r){return(!r||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(r),s.prototype.invalidate.call(this,r)},e.resetTo=function(r,n,a,o,h){_n||be.wake(),this._ts||this.play();var u=Math.min(this._dur,(this._dp._time-this._start)*this._ts),d;return this._initted||zl(this,u),d=this._ease(u/this._dur),nw(this,r,n,a,o,d,u,h)?this.resetTo(r,n,a,o,1):(so(this,0),this.parent||Kp(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(r,n){if(n===void 0&&(n="all"),!r&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?pn(this):this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(r,n,as&&as.vars.overwrite!==!0)._first||pn(this),this.parent&&a!==this.timeline.totalDuration()&&xr(this,this._dur*this.timeline._tDur/a,0,1),this}var o=this._targets,h=r?Oe(r):o,u=this._ptLookup,d=this._pt,l,c,f,p,m,_,g;if((!n||n==="all")&&kT(o,h))return n==="all"&&(this._pt=0),pn(this);for(l=this._op=this._op||[],n!=="all"&&(jt(n)&&(m={},ue(n,function(x){return m[x]=1}),n=m),n=aw(o,n)),g=o.length;g--;)if(~h.indexOf(o[g])){c=u[g],n==="all"?(l[g]=n,p=c,f={}):(f=l[g]=l[g]||{},p=n);for(m in p)_=c&&c[m],_&&((!("kill"in _.d)||_.d.kill(m)===!0)&&to(this,_,"_pt"),delete c[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&d&&pn(this),this},t.to=function(r,n){return new t(r,n,arguments[2])},t.from=function(r,n){return cn(1,arguments)},t.delayedCall=function(r,n,a,o){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:r,onComplete:n,onReverseComplete:n,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:o})},t.fromTo=function(r,n,a){return cn(2,arguments)},t.set=function(r,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(r,n)},t.killTweensOf=function(r,n,a){return Ct.killTweensOf(r,n,a)},t}(gn);De(Vt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ue("staggerTo,staggerFrom,staggerFromTo",function(s){Vt[s]=function(){var t=new ne,e=Nl.call(arguments,0);return e.splice(s==="staggerFromTo"?5:4,0,0),t[s].apply(t,e)}});var Yl=function(t,e,i){return t[e]=i},wm=function(t,e,i){return t[e](i)},hw=function(t,e,i,r){return t[e](r.fp,i)},lw=function(t,e,i){return t.setAttribute(e,i)},jl=function(t,e){return kt(t[e])?wm:El(t[e])&&t.setAttribute?lw:Yl},Em=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},uw=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Am=function(t,e){var i=e._pt,r="";if(!t&&e.b)r=e.b;else if(t===1&&e.e)r=e.e;else{for(;i;)r=i.p+(i.m?i.m(i.s+i.c*t):Math.round((i.s+i.c*t)*1e4)/1e4)+r,i=i._next;r+=e.c}e.set(e.t,e.p,r,e)},ql=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},cw=function(t,e,i,r){for(var n=this._pt,a;n;)a=n._next,n.p===r&&n.modifier(t,e,i),n=a},dw=function(t){for(var e=this._pt,i,r;e;)r=e._next,e.p===t&&!e.op||e.op===t?to(this,e,"_pt"):e.dep||(i=1),e=r;return!i},fw=function(t,e,i,r){r.mSet(t,e,r.m.call(r.tween,i,r.mt),r)},Sm=function(t){for(var e=t._pt,i,r,n,a;e;){for(i=e._next,r=n;r&&r.pr>e.pr;)r=r._next;(e._prev=r?r._prev:a)?e._prev._next=e:n=e,(e._next=r)?r._prev=e:a=e,e=i}t._pt=n},ce=function(){function s(e,i,r,n,a,o,h,u,d){this.t=i,this.s=n,this.c=a,this.p=r,this.r=o||Em,this.d=h||this,this.set=u||Yl,this.pr=d||0,this._next=e,e&&(e._prev=this)}var t=s.prototype;return t.modifier=function(i,r,n){this.mSet=this.mSet||this.set,this.set=fw,this.m=i,this.mt=n,this.tween=r},s}();ue(Ol+"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(s){return Ml[s]=1}),ye.TweenMax=ye.TweenLite=Vt,ye.TimelineLite=ye.TimelineMax=ne,Ct=new ne({sortChildren:!1,defaults:mr,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),ge.stringFilter=mm;var Fs=[],ro={},pw=[],Cm=0,mw=0,Kl=function(t){return(ro[t]||pw).map(function(e){return e()})},Zl=function(){var t=Date.now(),e=[];t-Cm>2&&(Kl("matchMediaInit"),Fs.forEach(function(i){var r=i.queries,n=i.conditions,a,o,h,u;for(o in r)a=fi.matchMedia(r[o]).matches,a&&(h=1),a!==n[o]&&(n[o]=a,u=1);u&&(i.revert(),h&&e.push(i))}),Kl("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(r){return i.add(null,r)})}),Cm=t,Kl("matchMedia"))},Pm=function(){function s(e,i){this.selector=i&&Ul(i),this.data=[],this._r=[],this.isReverted=!1,this.id=mw++,e&&this.add(e)}var t=s.prototype;return t.add=function(i,r,n){kt(i)&&(n=r,r=i,i=kt);var a=this,o=function(){var u=Tt,d=a.selector,l;return u&&u!==a&&u.data.push(a),n&&(a.selector=Ul(n)),Tt=a,l=r.apply(a,arguments),kt(l)&&a._r.push(l),Tt=u,a.selector=d,a.isReverted=!1,l};return a.last=o,i===kt?o(a,function(h){return a.add(null,h)}):i?a[i]=o:o},t.ignore=function(i){var r=Tt;Tt=null,i(this),Tt=r},t.getTweens=function(){var i=[];return this.data.forEach(function(r){return r instanceof s?i.push.apply(i,r.getTweens()):r instanceof Vt&&!(r.parent&&r.parent.data==="nested")&&i.push(r)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,r){var n=this;if(i?function(){for(var o=n.getTweens(),h=n.data.length,u;h--;)u=n.data[h],u.data==="isFlip"&&(u.revert(),u.getChildren(!0,!0,!1).forEach(function(d){return o.splice(o.indexOf(d),1)}));for(o.map(function(d){return{g:d._dur||d._delay||d._sat&&!d._sat.vars.immediateRender?d.globalTime(0):-1/0,t:d}}).sort(function(d,l){return l.g-d.g||-1/0}).forEach(function(d){return d.t.revert(i)}),h=n.data.length;h--;)u=n.data[h],u instanceof ne?u.data!=="nested"&&(u.scrollTrigger&&u.scrollTrigger.revert(),u.kill()):!(u instanceof Vt)&&u.revert&&u.revert(i);n._r.forEach(function(d){return d(i,n)}),n.isReverted=!0}():this.data.forEach(function(o){return o.kill&&o.kill()}),this.clear(),r)for(var a=Fs.length;a--;)Fs[a].id===this.id&&Fs.splice(a,1)},t.revert=function(i){this.kill(i||{})},s}(),_w=function(){function s(e){this.contexts=[],this.scope=e,Tt&&Tt.data.push(this)}var t=s.prototype;return t.add=function(i,r,n){di(i)||(i={matches:i});var a=new Pm(0,n||this.scope),o=a.conditions={},h,u,d;Tt&&!a.selector&&(a.selector=Tt.selector),this.contexts.push(a),r=a.add("onMatch",r),a.queries=i;for(u in i)u==="all"?d=1:(h=fi.matchMedia(i[u]),h&&(Fs.indexOf(a)<0&&Fs.push(a),(o[u]=h.matches)&&(d=1),h.addListener?h.addListener(Zl):h.addEventListener("change",Zl)));return d&&r(a,function(l){return a.add(null,l)}),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(r){return r.kill(i,!0)})},s}(),no={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach(function(r){return cm(r)})},timeline:function(t){return new ne(t)},getTweensOf:function(t,e){return Ct.getTweensOf(t,e)},getProperty:function(t,e,i,r){jt(t)&&(t=Oe(t)[0]);var n=Rs(t||{}).get,a=i?jp:Yp;return i==="native"&&(i=""),t&&(e?a((xe[e]&&xe[e].get||n)(t,e,i,r)):function(o,h,u){return a((xe[o]&&xe[o].get||n)(t,o,h,u))})},quickSetter:function(t,e,i){if(t=Oe(t),t.length>1){var r=t.map(function(d){return de.quickSetter(d,e,i)}),n=r.length;return function(d){for(var l=n;l--;)r[l](d)}}t=t[0]||{};var a=xe[e],o=Rs(t),h=o.harness&&(o.harness.aliases||{})[e]||e,u=a?function(d){var l=new a;vr._pt=0,l.init(t,i?d+i:d,vr,0,[t]),l.render(1,l),vr._pt&&ql(1,vr)}:o.set(t,h);return a?u:function(d){return u(t,h,i?d+i:d,o,1)}},quickTo:function(t,e,i){var r,n=de.to(t,Ms((r={},r[e]="+=0.1",r.paused=!0,r),i||{})),a=function(h,u,d){return n.resetTo(e,h,u,d)};return a.tween=n,a},isTweening:function(t){return Ct.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Bs(t.ease,mr.ease)),qp(mr,t||{})},config:function(t){return qp(ge,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,r=t.plugins,n=t.defaults,a=t.extendTimeline;(r||"").split(",").forEach(function(o){return o&&!xe[o]&&!ye[o]&&hn(e+" effect requires "+o+" plugin.")}),Bl[e]=function(o,h,u){return i(Oe(o),De(h||{},n),u)},a&&(ne.prototype[e]=function(o,h,u){return this.add(Bl[e](o,di(h)?h:(u=h)&&{},this),u)})},registerEase:function(t,e){at[t]=Bs(e)},parseEase:function(t,e){return arguments.length?Bs(t,e):at},getById:function(t){return Ct.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new ne(t),r,n;for(i.smoothChildTiming=le(t.smoothChildTiming),Ct.remove(i),i._dp=0,i._time=i._tTime=Ct._time,r=Ct._first;r;)n=r._next,(e||!(!r._dur&&r instanceof Vt&&r.vars.onComplete===r._targets[0]))&&pi(i,r,r._start-r._delay),r=n;return pi(Ct,i,0),i},context:function(t,e){return t?new Pm(t,e):Tt},matchMedia:function(t){return new _w(t)},matchMediaRefresh:function(){return Fs.forEach(function(t){var e=t.conditions,i,r;for(r in e)e[r]&&(e[r]=!1,i=1);i&&t.revert()})||Zl()},addEventListener:function(t,e){var i=ro[t]||(ro[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=ro[t],r=i&&i.indexOf(e);r>=0&&i.splice(r,1)},utils:{wrap:jT,wrapYoyo:qT,distribute:rm,random:am,snap:nm,normalize:YT,getUnit:ie,clamp:XT,splitColor:dm,toArray:Oe,selector:Ul,mapRange:hm,pipe:$T,unitize:zT,interpolate:KT,shuffle:sm},install:Hp,effects:Bl,ticker:be,updateRoot:ne.updateRoot,plugins:xe,globalTimeline:Ct,core:{PropTween:ce,globals:Vp,Tween:Vt,Timeline:ne,Animation:gn,getCache:Rs,_removeLinkedListItem:to,reverting:function(){return te},context:function(t){return t&&Tt&&(Tt.data.push(t),t._ctx=Tt),Tt},suppressOverwrites:function(t){return Tl=t}}};ue("to,from,fromTo,delayedCall,set,killTweensOf",function(s){return no[s]=Vt[s]}),be.add(ne.updateRoot),vr=no.to({},{duration:0});var gw=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},yw=function(t,e){var i=t._targets,r,n,a;for(r in e)for(n=i.length;n--;)a=t._ptLookup[n][r],a&&(a=a.d)&&(a._pt&&(a=gw(a,r)),a&&a.modifier&&a.modifier(e[r],t,i[n],r))},Ql=function(t,e){return{name:t,rawVars:1,init:function(r,n,a){a._onInit=function(o){var h,u;if(jt(n)&&(h={},ue(n,function(d){return h[d]=1}),n=h),e){h={};for(u in n)h[u]=e(n[u]);n=h}yw(o,n)}}}},de=no.registerPlugin({name:"attr",init:function(t,e,i,r,n){var a,o,h;this.tween=i;for(a in e)h=t.getAttribute(a)||"",o=this.add(t,"setAttribute",(h||0)+"",e[a],r,n,0,0,a),o.op=a,o.b=h,this._props.push(a)},render:function(t,e){for(var i=e._pt;i;)te?i.set(i.t,i.p,i.b,i):i.r(t,i.d),i=i._next}},{name:"endArray",init:function(t,e){for(var i=e.length;i--;)this.add(t,i,t[i]||0,e[i],0,0,0,0,0,1)}},Ql("roundProps",Gl),Ql("modifiers"),Ql("snap",nm))||no;Vt.version=ne.version=de.version="3.12.5",Gp=1,Al()&&br(),at.Power0,at.Power1,at.Power2,at.Power3,at.Power4,at.Linear,at.Quad,at.Cubic,at.Quart,at.Quint,at.Strong,at.Elastic,at.Back,at.SteppedEase,at.Bounce,at.Sine,at.Expo,at.Circ;/*!
|
|
1155
|
+
*/var Ze={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},_n={duration:.5,overwrite:!1,delay:0},Ac,Ae,Dt,hs=1e8,Mt=1/hs,Sc=Math.PI*2,hA=Sc/4,cA=0,ig=Math.sqrt,uA=Math.cos,dA=Math.sin,me=function(t){return typeof t=="string"},Zt=function(t){return typeof t=="function"},wr=function(t){return typeof t=="number"},Cc=function(t){return typeof t>"u"},Js=function(t){return typeof t=="object"},Ve=function(t){return t!==!1},Ic=function(){return typeof window<"u"},Ja=function(t){return Zt(t)||me(t)},ng=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Se=Array.isArray,Pc=/(?:-?\.?\d|\.)+/gi,og=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,yn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Rc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,ag=/[+-]=-?[.\d]+/,lg=/[^,'"\[\]\s]+/gi,fA=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ut,tr,Mc,Fc,Ke={},tl={},hg,cg=function(t){return(tl=Pi(t,Ke))&&Xe},kc=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)},ug=function(t,e){return t&&(Ke[t]=e)&&tl&&(tl[t]=e)||Ke},uo=function(){return 0},pA={suppressEvents:!0,isStart:!0,kill:!1},el={suppressEvents:!0,kill:!1},mA={suppressEvents:!0},Bc={},Wr=[],Dc={},dg,Qe={},Oc={},fg=30,sl=[],Lc="",Nc=function(t){var e=t[0],s,r;if(Js(e)||Zt(e)||(t=[t]),!(s=(e._gsap||{}).harness)){for(r=sl.length;r--&&!sl[r].targetTest(e););s=sl[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new Xg(t[r],s)))||t.splice(r,1);return t},Ii=function(t){return t._gsap||Nc(ds(t))[0]._gsap},pg=function(t,e,s){return(s=t[e])&&Zt(s)?t[e]():Cc(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),r=parseFloat(e.substr(2));return t=parseFloat(t),s==="+"?t+r:s==="-"?t-r:s==="*"?t*r:t/r},gA=function(t,e){for(var s=e.length,r=0;t.indexOf(e[r])<0&&++r<s;);return r<s},rl=function(){var t=Wr.length,e=Wr.slice(0),s,r;for(Dc={},Wr.length=0,s=0;s<t;s++)r=e[s],r&&r._lazy&&(r.render(r._lazy[0],r._lazy[1],!0)._lazy=0)},mg=function(t,e,s,r){Wr.length&&!Ae&&rl(),t.render(e,s,r||Ae&&e<0&&(t._initted||t._startAt)),Wr.length&&!Ae&&rl()},gg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(lg).length<2?e:me(t)?t.trim():t},_g=function(t){return t},cs=function(t,e){for(var s in e)s in t||(t[s]=e[s]);return t},_A=function(t){return function(e,s){for(var r in s)r in e||r==="duration"&&t||r==="ease"||(e[r]=s[r])}},Pi=function(t,e){for(var s in e)t[s]=e[s];return t},yg=function i(t,e){for(var s in e)s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(t[s]=Js(e[s])?i(t[s]||(t[s]={}),e[s]):e[s]);return t},il=function(t,e){var s={},r;for(r in t)r in e||(s[r]=t[r]);return s},fo=function(t){var e=t.parent||Ut,s=t.keyframes?_A(Se(t.keyframes)):cs;if(Ve(t.inherit))for(;e;)s(t,e.vars.defaults),e=e.parent||e._dp;return t},yA=function(t,e){for(var s=t.length,r=s===e.length;r&&s--&&t[s]===e[s];);return s<0},xg=function(t,e,s,r,n){s===void 0&&(s="_first"),r===void 0&&(r="_last");var a=t[r],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[r]=e,e._prev=a,e.parent=e._dp=t,e},nl=function(t,e,s,r){s===void 0&&(s="_first"),r===void 0&&(r="_last");var n=e._prev,a=e._next;n?n._next=a:t[s]===e&&(t[s]=a),a?a._prev=n:t[r]===e&&(t[r]=n),e._next=e._prev=e.parent=null},zr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Ri=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},xA=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Vc=function(t,e,s,r){return t._startAt&&(Ae?t._startAt.revert(el):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,r))},vA=function i(t){return!t||t._ts&&i(t.parent)},vg=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||Mt)||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||Ri(s,t)),t},bg=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>Mt)&&e.render(s,!0)),Ri(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=-Mt}},er=function(t,e,s,r){return e.parent&&zr(e),e._start=ge((wr(s)?s:s||t!==Ut?us(t,s,e):t._time)+e._delay),e._end=ge(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),xg(t,e,"_first","_last",t._sort?"_start":0),Uc(e)||(t._recent=e),r||bg(t,e),t._ts<0&&ll(t,t._tTime),t},wg=function(t,e){return(Ke.ScrollTrigger||kc("scrollTrigger",e))&&Ke.ScrollTrigger.create(e,t)},Eg=function(t,e,s,r,n){if(qc(t,e,n),!t._initted)return 1;if(!s&&t._pt&&!Ae&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&dg!==ts.frame)return Wr.push(t),t._lazy=[n,r],1},bA=function i(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||i(e))},Uc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},wA=function(t,e,s,r){var n=t.ratio,a=e<0||!e&&(!t._start&&bA(t)&&!(!t._initted&&Uc(t))||(t._ts<0||t._dp._ts<0)&&!Uc(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||r||t._zTime===Mt||!e&&t._zTime){if(!t._initted&&Eg(t,e,r,s,o))return;for(c=t._zTime,t._zTime=e||(s?Mt: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&&Vc(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&&zr(t,1),!s&&!Ae&&(Je(t,a?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},EA=function(t,e,s){var r;if(s>e)for(r=t._first;r&&r._start<=s;){if(r.data==="isPause"&&r._start>e)return r;r=r._next}else for(r=t._last;r&&r._start>=s;){if(r.data==="isPause"&&r._start<e)return r;r=r._prev}},bn=function(t,e,s,r){var n=t._repeat,a=ge(e)||0,h=t._tTime/t._tDur;return h&&!r&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:ge(a*(n+1)+t._rDelay*n):a,h>0&&!r&&ll(t,t._tTime=t._tDur*h),t.parent&&al(t),s||Ri(t.parent,t),t},Tg=function(t){return t instanceof Me?Ri(t):bn(t,t._dur)},TA={_start:0,endTime:uo,totalDuration:uo},us=function i(t,e,s){var r=t.labels,n=t._recent||TA,a=t.duration()>=hs?n.endTime(!1):t._dur,h,o,l;return me(e)&&(isNaN(e)||e in r)?(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 r||(r[e]=a),r[e]):(o=parseFloat(e.charAt(h-1)+e.substr(h+1)),l&&s&&(o=o/100*(Se(s)?s[0]:s).totalDuration()),h>1?i(t,e.substr(0,h-1),s)+o:a+o)):e==null?a:+e},po=function(t,e,s){var r=wr(e[1]),n=(r?2:1)+(t<2?0:1),a=e[n],h,o;if(r&&(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 ie(e[0],a,e[n+1])},jr=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=fA.exec(t))?"":e[1]},AA=function(t,e,s){return jr(s,function(r){return mo(t,e,r)})},Gc=[].slice,Ag=function(t,e){return t&&Js(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Js(t[0]))&&!t.nodeType&&t!==tr},SA=function(t,e,s){return s===void 0&&(s=[]),t.forEach(function(r){var n;return me(r)&&!e||Ag(r,1)?(n=s).push.apply(n,ds(r)):s.push(r)})||s},ds=function(t,e,s){return Dt&&!e&&Dt.selector?Dt.selector(t):me(t)&&!s&&(Mc||!En())?Gc.call((e||Fc).querySelectorAll(t),0):Se(t)?SA(t,s):Ag(t)?Gc.call(t,0):t?[t]:[]},Xc=function(t){return t=ds(t)[0]||co("Invalid scope")||{},function(e){var s=t.current||t.nativeElement||t;return ds(e,s.querySelectorAll?s:s===t?co("Invalid scope")||Fc.createElement("div"):t)}},Sg=function(t){return t.sort(function(){return .5-Math.random()})},Cg=function(t){if(Zt(t))return t;var e=Js(t)?t:{each:t},s=Mi(e.ease),r=e.from||0,n=parseFloat(e.base)||0,a={},h=r>0&&r<1,o=isNaN(r)||h,l=e.axis,u=r,c=r;return me(r)?u=c={center:.5,edges:.5,end:1}[r]||0:!h&&o&&(u=r[0],c=r[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,hs])[1],!A){for(E=-hs;E<(E=p[A++].getBoundingClientRect().left)&&A<m;);A<m&&A--}for(g=a[m]=[],_=o?Math.min(A,m)*u-.5:r%A,x=A===hs?0:o?m*c/A-.5:r/A|0,E=0,T=hs,w=0;w<m;w++)y=w%A-_,v=x-(w/A|0),g[w]=b=l?Math.abs(l==="y"?v:y):ig(y*y+v*v),b>E&&(E=b),b<T&&(T=b);r==="random"&&Sg(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)*(r==="edges"?-1:1),g.b=m<0?n-m:n,g.u=Ce(e.amount||e.each)||0,s=s&&m<0?Vg(s):s}return m=(g[d]-g.min)/g.max||0,ge(g.b+(s?s(m):m)*g.v)+g.u}},$c=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(s){var r=ge(Math.round(parseFloat(s)/t)*t*e);return(r-r%1)/e+(wr(s)?0:Ce(s))}},Ig=function(t,e){var s=Se(t),r,n;return!s&&Js(t)&&(r=s=t.radius||hs,t.values?(t=ds(t.values),(n=!wr(t[0]))&&(r*=r)):t=$c(t.increment)),jr(e,s?Zt(t)?function(a){return n=t(a),Math.abs(n-a)<=r?n:a}:function(a){for(var h=parseFloat(n?a.x:a),o=parseFloat(n?a.y:0),l=hs,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=!r||l<=r?t[u]:a,n||u===a||wr(a)?u:u+Ce(a)}:$c(t))},Pg=function(t,e,s,r){return jr(Se(t)?!e:s===!0?!!(s=0):!r,function(){return Se(t)?t[~~(Math.random()*t.length)]:(s=s||1e-5)&&(r=s<1?Math.pow(10,(s+"").length-2):1)&&Math.floor(Math.round((t-s/2+Math.random()*(e-t+s*.99))/s)*s*r)/r})},CA=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return function(r){return e.reduce(function(n,a){return a(n)},r)}},IA=function(t,e){return function(s){return t(parseFloat(s))+(e||Ce(s))}},PA=function(t,e,s){return Mg(t,e,0,1,s)},Rg=function(t,e,s){return jr(s,function(r){return t[~~e(r)]})},RA=function i(t,e,s){var r=e-t;return Se(t)?Rg(t,i(0,t.length),e):jr(s,function(n){return(r+(n-t)%r)%r+t})},MA=function i(t,e,s){var r=e-t,n=r*2;return Se(t)?Rg(t,i(0,t.length-1),e):jr(s,function(a){return a=(n+(a-t)%n)%n||0,t+(a>r?n-a:a)})},go=function(t){for(var e=0,s="",r,n,a,h;~(r=t.indexOf("random(",e));)a=t.indexOf(")",r),h=t.charAt(r+7)==="[",n=t.substr(r+7,a-r-7).match(h?lg:Pc),s+=t.substr(e,r-e)+Pg(h?n:+n[0],h?0:+n[1],+n[2]||1e-5),e=a+1;return s+t.substr(e,t.length-e)},Mg=function(t,e,s,r,n){var a=e-t,h=r-s;return jr(n,function(o){return s+((o-t)/a*h||0)})},FA=function i(t,e,s,r){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&&(r=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(i(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 r||(t=Pi(Se(t)?[]:{},t));if(!u){for(o in e)zc.call(h,t,o,"get",e[o]);n=function(p){return Qc(p,h)||(a?t.p:t)}}}return jr(s,n)},Fg=function(t,e,s){var r=t.labels,n=hs,a,h,o;for(a in r)h=r[a]-e,h<0==!!s&&h&&n>(h=Math.abs(h))&&(o=a,n=h);return o},Je=function(t,e,s){var r=t.vars,n=r[e],a=Dt,h=t._ctx,o,l,u;if(n)return o=r[e+"Params"],l=r.callbackScope||t,s&&Wr.length&&rl(),h&&(Dt=h),u=o?n.apply(l,o):n.call(l),Dt=a,u},_o=function(t){return zr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Ae),t.progress()<1&&Je(t,"onInterrupt"),t},wn,kg=[],Bg=function(t){if(t)if(t=!t.name&&t.default||t,Ic()||t.headless){var e=t.name,s=Zt(t),r=e&&!s&&t.init?function(){this._props=[]}:t,n={init:uo,render:Qc,add:zc,kill:jA,modifier:zA,rawVars:0},a={targetTest:0,get:0,getSetter:Kc,aliases:{},register:0};if(En(),t!==r){if(Qe[e])return;cs(r,cs(il(t,n),a)),Pi(r.prototype,Pi(n,il(t,a))),Qe[r.prop=e]=r,t.targetTest&&(sl.push(r),Bc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}ug(e,r),t.register&&t.register(Xe,r,Ge)}else kg.push(t)},It=255,yo={aqua:[0,It,It],lime:[0,It,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,It],navy:[0,0,128],white:[It,It,It],olive:[128,128,0],yellow:[It,It,0],orange:[It,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[It,0,0],pink:[It,192,203],cyan:[0,It,It],transparent:[It,It,It,0]},Yc=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)*It+.5|0},Dg=function(t,e,s){var r=t?wr(t)?[t>>16,t>>8&It,t&It]:0:yo.black,n,a,h,o,l,u,c,d,f,p;if(!r){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),yo[t])r=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 r=parseInt(t.substr(1,6),16),[r>>16,r>>8&It,r&It,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),r=[t>>16,t>>8&It,t&It]}else if(t.substr(0,3)==="hsl"){if(r=p=t.match(Pc),!e)o=+r[0]%360/360,l=+r[1]/100,u=+r[2]/100,a=u<=.5?u*(l+1):u+l-u*l,n=u*2-a,r.length>3&&(r[3]*=1),r[0]=Yc(o+1/3,n,a),r[1]=Yc(o,n,a),r[2]=Yc(o-1/3,n,a);else if(~t.indexOf("="))return r=t.match(og),s&&r.length<4&&(r[3]=1),r}else r=t.match(Pc)||yo.transparent;r=r.map(Number)}return e&&!p&&(n=r[0]/It,a=r[1]/It,h=r[2]/It,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),r[0]=~~(o+.5),r[1]=~~(l*100+.5),r[2]=~~(u*100+.5)),s&&r.length<4&&(r[3]=1),r},Og=function(t){var e=[],s=[],r=-1;return t.split(qr).forEach(function(n){var a=n.match(yn)||[];e.push.apply(e,a),s.push(r+=a.length+1)}),e.c=s,e},Lg=function(t,e,s){var r="",n=(t+r).match(qr),a=e?"hsla(":"rgba(",h=0,o,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=Dg(d,e,1))&&a+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),s&&(u=Og(t),o=s.c,o.join(r)!==u.c.join(r)))for(l=t.replace(qr,"1").split(yn),c=l.length-1;h<c;h++)r+=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(qr),c=l.length-1;h<c;h++)r+=l[h]+n[h];return r+l[c]},qr=function(){var i="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in yo)i+="|"+t+"\\b";return new RegExp(i+")","gi")}(),kA=/hsl[a]?\(/,Ng=function(t){var e=t.join(" "),s;if(qr.lastIndex=0,qr.test(e))return s=kA.test(e),t[1]=Lg(t[1],s),t[0]=Lg(t[0],s,Og(t[1])),!0},xo,ts=function(){var i=Date.now,t=500,e=33,s=i(),r=s,n=1e3/240,a=n,h=[],o,l,u,c,d,f,p=function m(g){var _=i()-r,x=g===!0,y,v,b,w;if((_>t||_<0)&&(s+=_-e),r+=_,b=r-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(){hg&&(!Mc&&Ic()&&(tr=Mc=window,Fc=tr.document||{},Ke.gsap=Xe,(tr.gsapVersions||(tr.gsapVersions=[])).push(Xe.version),cg(tl||tr.GreenSockGlobals||!tr.gsap&&tr||{}),kg.forEach(Bg)),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={},BA=/^[\d.\-M][\d.\-,\s]/,DA=/["']/g,OA=function(t){for(var e={},s=t.substr(1,t.length-3).split(":"),r=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[r]=isNaN(l)?l.replace(DA,"").trim():+l,r=o.substr(h+1).trim();return e},LA=function(t){var e=t.indexOf("(")+1,s=t.indexOf(")"),r=t.indexOf("(",e);return t.substring(e,~r&&r<s?t.indexOf(")",s+1):s)},NA=function(t){var e=(t+"").split("("),s=ut[e[0]];return s&&e.length>1&&s.config?s.config.apply(null,~t.indexOf("{")?[OA(e[1])]:LA(t).split(",").map(gg)):ut._CE&&BA.test(t)?ut._CE("",t):s},Vg=function(t){return function(e){return 1-t(1-e)}},Ug=function i(t,e){for(var s=t._first,r;s;)s instanceof Me?i(s,e):s.vars.yoyoEase&&(!s._yoyo||!s._repeat)&&s._yoyo!==e&&(s.timeline?i(s.timeline,e):(r=s._ease,s._ease=s._yEase,s._yEase=r,s._yoyo=e)),s=s._next},Mi=function(t,e){return t&&(Zt(t)?t:ut[t]||NA(t))||e},Fi=function(t,e,s,r){s===void 0&&(s=function(o){return 1-e(1-o)}),r===void 0&&(r=function(o){return o<.5?e(o*2)/2:1-e((1-o)*2)/2});var n={easeIn:e,easeOut:s,easeInOut:r},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},Gg=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Hc=function i(t,e,s){var r=e>=1?e:1,n=(s||(t?.3:.45))/(e<1?e:1),a=n/Sc*(Math.asin(1/r)||0),h=function(u){return u===1?1:r*Math.pow(2,-10*u)*dA((u-a)*n)+1},o=t==="out"?h:t==="in"?function(l){return 1-h(1-l)}:Gg(h);return n=Sc/n,o.config=function(l,u){return i(t,l,u)},o},Wc=function i(t,e){e===void 0&&(e=1.70158);var s=function(a){return a?--a*a*((e+1)*a+e)+1:0},r=t==="out"?s:t==="in"?function(n){return 1-s(1-n)}:Gg(s);return r.config=function(n){return i(t,n)},r};Ue("Linear,Quad,Cubic,Quart,Quint,Strong",function(i,t){var e=t<5?t+1:t;Fi(i+",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,Fi("Elastic",Hc("in"),Hc("out"),Hc()),function(i,t){var e=1/t,s=2*e,r=2.5*e,n=function(h){return h<e?i*h*h:h<s?i*Math.pow(h-1.5/t,2)+.75:h<r?i*(h-=2.25/t)*h+.9375:i*Math.pow(h-2.625/t,2)+.984375};Fi("Bounce",function(a){return 1-n(1-a)},n)}(7.5625,2.75),Fi("Expo",function(i){return i?Math.pow(2,10*(i-1)):0}),Fi("Circ",function(i){return-(ig(1-i*i)-1)}),Fi("Sine",function(i){return i===1?1:-uA(i*hA)+1}),Fi("Back",Wc("in"),Wc("out"),Wc()),ut.SteppedEase=ut.steps=Ke.SteppedEase={config:function(t,e){t===void 0&&(t=1);var s=1/t,r=t+(e?0:1),n=e?1:0,a=1-Mt;return function(h){return((r*mo(0,a,h)|0)+n)*s}}},_n.ease=ut["quad.out"],Ue("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(i){return Lc+=i+","+i+"Params,"});var Xg=function(t,e){this.id=cA++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:pg,this.set=e?e.getSetter:Kc},vo=function(){function i(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=i.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,r){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||bg(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)&&er(this._dp,this,this._start-this._delay)}return(this._tTime!==s||!this._dur&&!r||this._initted&&Math.abs(this._zTime)===Mt||!s&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=s),mg(this,s,r)),this},t.time=function(s,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),s+vg(this))%(this._dur+this._rDelay)||(s?this._dur:0),r):this._time},t.totalProgress=function(s,r){return arguments.length?this.totalTime(this.totalDuration()*s,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(s,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-s:s)+vg(this),r):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(s,r){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(s-1)*n,r):this._repeat?vn(this._tTime,n)+1:1},t.timeScale=function(s,r){if(!arguments.length)return this._rts===-Mt?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===-Mt?0:this._rts,this.totalTime(mo(-Math.abs(this._delay),this._tDur,n),r!==!1),al(this),xA(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)!==Mt&&(this._tTime-=Mt)))),this):this._ps},t.startTime=function(s){if(arguments.length){this._start=s;var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&er(r,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 r=this.parent||this._dp;return r?s&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?ol(r.rawTime(s),this):this._tTime:this._tTime},t.revert=function(s){s===void 0&&(s=mA);var r=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=r,this},t.globalTime=function(s){for(var r=this,n=arguments.length?s:r.rawTime();r;)n=r._start+n/(Math.abs(r._ts)||1),r=r._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,Tg(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(s){if(arguments.length){var r=this._time;return this._rDelay=s,Tg(this),r?this.time(r):this}return this._rDelay},t.yoyo=function(s){return arguments.length?(this._yoyo=s,this):this._yoyo},t.seek=function(s,r){return this.totalTime(us(this,s),Ve(r))},t.restart=function(s,r){return this.play().totalTime(s?-this._delay:0,Ve(r))},t.play=function(s,r){return s!=null&&this.seek(s,r),this.reversed(!1).paused(!1)},t.reverse=function(s,r){return s!=null&&this.seek(s||this.totalDuration(),r),this.reversed(!0).paused(!1)},t.pause=function(s,r){return s!=null&&this.seek(s,r),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?-Mt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Mt,this},t.isActive=function(){var s=this.parent||this._dp,r=this._start,n;return!!(!s||this._ts&&this._initted&&s.isActive()&&(n=s.rawTime(!0))>=r&&n<this.endTime(!0)-Mt)},t.eventCallback=function(s,r,n){var a=this.vars;return arguments.length>1?(r?(a[s]=r,n&&(a[s+"Params"]=n),s==="onUpdate"&&(this._onUpdate=r)):delete a[s],this):a[s]},t.then=function(s){var r=this;return new Promise(function(n){var a=Zt(s)?s:_g,h=function(){var l=r.then;r.then=null,Zt(a)&&(a=a(r))&&(a.then||a===r)&&(r.then=l),n(a),r.then=l};r._initted&&r.totalProgress()===1&&r._ts>=0||!r._tTime&&r._ts<0?h():r._prom=h})},t.kill=function(){_o(this)},i}();cs(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:-Mt,_prom:0,_ps:!1,_rts:1});var Me=function(i){rg(t,i);function t(s,r){var n;return s===void 0&&(s={}),n=i.call(this,s)||this,n.labels={},n.smoothChildTiming=!!s.smoothChildTiming,n.autoRemoveChildren=!!s.autoRemoveChildren,n._sort=Ve(s.sortChildren),Ut&&er(s.parent||Ut,br(n),r),s.reversed&&n.reverse(),s.paused&&n.paused(!0),s.scrollTrigger&&wg(br(n),s.scrollTrigger),n}var e=t.prototype;return e.to=function(r,n,a){return po(0,arguments,this),this},e.from=function(r,n,a){return po(1,arguments,this),this},e.fromTo=function(r,n,a,h){return po(2,arguments,this),this},e.set=function(r,n,a){return n.duration=0,n.parent=this,fo(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new ie(r,n,us(this,a),1),this},e.call=function(r,n,a){return er(this,ie.delayedCall(0,r,n),a)},e.staggerTo=function(r,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 ie(r,a,us(this,o)),this},e.staggerFrom=function(r,n,a,h,o,l,u){return a.runBackwards=1,fo(a).immediateRender=Ve(a.immediateRender),this.staggerTo(r,n,a,h,o,l,u)},e.staggerFromTo=function(r,n,a,h,o,l,u,c){return h.startAt=a,fo(h).immediateRender=Ve(h.immediateRender),this.staggerTo(r,n,h,o,l,u,c)},e.render=function(r,n,a){var h=this._time,o=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=r<=0?0:ge(r),c=this._zTime<0!=r<0&&(this._initted||!l),d,f,p,m,g,_,x,y,v,b,w,E;if(this!==Ut&&u>o&&r>=0&&(u=o),u!==this._tTime||a||c){if(h!==this._time&&l&&(u+=this._time-h,r+=this._time-h),d=u,v=this._start,y=this._ts,_=!y,c&&(l||(h=this._zTime),(r||!n)&&(this._zTime=r)),this._repeat){if(w=this._yoyo,g=l+this._rDelay,this._repeat<-1&&r<0)return this.totalTime(g*100+r,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;Ug(this,E)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=EA(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=r,h=0),!h&&d&&!n&&!m&&(Je(this,"onStart"),this._tTime!==u))return this;if(d>=h&&r>=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(r,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=-Mt);break}}f=p}else{f=this._last;for(var I=r<0?r:d;f;){if(p=f._prev,(f._act||I<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(r,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?-Mt:Mt);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=h?0:-Mt)._zTime=d>=h?1:-1,this._ts))return this._start=v,al(this),this.render(r,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||((r||!l)&&(u===o&&this._ts>0||!u&&this._ts<0)&&zr(this,1),!n&&!(r<0&&!h)&&(u||h||!o)&&(Je(this,u===o&&r>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<o&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(r,n){var a=this;if(wr(n)||(n=us(this,n,r)),!(r instanceof vo)){if(Se(r))return r.forEach(function(h){return a.add(h,n)}),this;if(me(r))return this.addLabel(r,n);if(Zt(r))r=ie.delayedCall(0,r);else return this}return this!==r?er(this,r,n):this},e.getChildren=function(r,n,a,h){r===void 0&&(r=!0),n===void 0&&(n=!0),a===void 0&&(a=!0),h===void 0&&(h=-hs);for(var o=[],l=this._first;l;)l._start>=h&&(l instanceof ie?n&&o.push(l):(a&&o.push(l),r&&o.push.apply(o,l.getChildren(!0,n,a)))),l=l._next;return o},e.getById=function(r){for(var n=this.getChildren(1,1,1),a=n.length;a--;)if(n[a].vars.id===r)return n[a]},e.remove=function(r){return me(r)?this.removeLabel(r):Zt(r)?this.killTweensOf(r):(nl(this,r),r===this._recent&&(this._recent=this._last),Ri(this))},e.totalTime=function(r,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ge(ts.time-(this._ts>0?r/this._ts:(this.totalDuration()-r)/-this._ts))),i.prototype.totalTime.call(this,r,n),this._forcing=0,this):this._tTime},e.addLabel=function(r,n){return this.labels[r]=us(this,n),this},e.removeLabel=function(r){return delete this.labels[r],this},e.addPause=function(r,n,a){var h=ie.delayedCall(0,n||uo,a);return h.data="isPause",this._hasPause=1,er(this,h,us(this,r))},e.removePause=function(r){var n=this._first;for(r=us(this,r);n;)n._start===r&&n.data==="isPause"&&zr(n),n=n._next},e.killTweensOf=function(r,n,a){for(var h=this.getTweensOf(r,a),o=h.length;o--;)Zr!==h[o]&&h[o].kill(r,n);return this},e.getTweensOf=function(r,n){for(var a=[],h=ds(r),o=this._first,l=wr(n),u;o;)o instanceof ie?gA(o._targets,h)&&(l?(!Zr||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(r,n){n=n||{};var a=this,h=us(a,r),o=n,l=o.startAt,u=o.onStart,c=o.onStartParams,d=o.immediateRender,f,p=ie.to(a,cs({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())||Mt,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(r,n,a){return this.tweenTo(n,cs({startAt:{time:us(this,r)}},a))},e.recent=function(){return this._recent},e.nextLabel=function(r){return r===void 0&&(r=this._time),Fg(this,us(this,r))},e.previousLabel=function(r){return r===void 0&&(r=this._time),Fg(this,us(this,r),1)},e.currentLabel=function(r){return arguments.length?this.seek(r,!0):this.previousLabel(this._time+Mt)},e.shiftChildren=function(r,n,a){a===void 0&&(a=0);for(var h=this._first,o=this.labels,l;h;)h._start>=a&&(h._start+=r,h._end+=r),h=h._next;if(n)for(l in o)o[l]>=a&&(o[l]+=r);return Ri(this)},e.invalidate=function(r){var n=this._first;for(this._lock=0;n;)n.invalidate(r),n=n._next;return i.prototype.invalidate.call(this,r)},e.clear=function(r){r===void 0&&(r=!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),r&&(this.labels={}),Ri(this)},e.totalDuration=function(r){var n=0,a=this,h=a._last,o=hs,l,u,c;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-r:r));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,er(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(r){if(Ut._ts&&(mg(Ut,ol(r,Ut)),dg=ts.frame),ts.frame>=fg){fg+=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);cs(Me.prototype,{_lock:0,_hasPause:0,_forcing:0});var VA=function(t,e,s,r,n,a,h){var o=new Ge(this._pt,t,e,0,1,jg,null,n),l=0,u=0,c,d,f,p,m,g,_,x;for(o.b=s,o.e=r,s+="",r+="",(_=~r.indexOf("random("))&&(r=go(r)),a&&(x=[s,r],a(x,t,e),s=x[0],r=x[1]),d=s.match(Rc)||[];c=Rc.exec(r);)p=c[0],m=r.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=Rc.lastIndex);return o.c=l<r.length?r.substring(l,r.length):"",o.fp=h,(ag.test(r)||_)&&(o.e=0),this._pt=o,o},zc=function(t,e,s,r,n,a,h,o,l,u){Zt(r)&&(r=r(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:Wg:Zc,p;if(me(r)&&(~r.indexOf("random(")&&(r=go(r)),r.charAt(1)==="="&&(p=xn(d,r)+(Ce(d)||0),(p||p===0)&&(r=p))),!u||d!==r||jc)return!isNaN(d*r)&&r!==""?(p=new Ge(this._pt,t,e,+d||0,r-(d||0),typeof c=="boolean"?WA:zg,0,f),l&&(p.fp=l),h&&p.modifier(h,this,t),this._pt=p):(!c&&!(e in t)&&kc(e,r),VA.call(this,t,e,d,r,f,o||Ze.stringFilter,l))},UA=function(t,e,s,r,n){if(Zt(t)&&(t=bo(t,n,e,s,r)),!Js(t)||t.style&&t.nodeType||Se(t)||ng(t))return me(t)?bo(t,n,e,s,r):t;var a={},h;for(h in t)a[h]=bo(t[h],n,e,s,r);return a},$g=function(t,e,s,r,n,a){var h,o,l,u;if(Qe[t]&&(h=new Qe[t]).init(n,h.rawVars?e[t]:UA(e[t],r,n,a,s),s,r,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},Zr,jc,qc=function i(t,e,s){var r=t.vars,n=r.ease,a=r.startAt,h=r.immediateRender,o=r.lazy,l=r.onUpdate,u=r.runBackwards,c=r.yoyoEase,d=r.keyframes,f=r.autoRevert,p=t._dur,m=t._startAt,g=t._targets,_=t.parent,x=_&&_.data==="nested"?_.vars.targets:g,y=t._overwrite==="auto"&&!Ac,v=t.timeline,b,w,E,T,A,I,M,R,C,P,k,U,V;if(v&&(!d||!n)&&(n="none"),t._ease=Mi(n,_n.ease),t._yEase=c?Vg(Mi(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&&!!r.runBackwards,!v||d&&!r.stagger){if(R=g[0]?Ii(g[0]).harness:0,U=R&&r[R.prop],b=il(r,Bc),m&&(m._zTime<0&&m.progress(1),e<0&&u&&h&&!f?m.render(-1,!0):m.revert(u&&p?el:pA),m._lazy=0),a){if(zr(t._startAt=ie.set(g,cs({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=cs({overwrite:!1,data:"isFromStart",lazy:h&&!m&&Ve(o),immediateRender:h,stagger:0,parent:_},b),U&&(E[R.prop]=U),zr(t._startAt=ie.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)i(t._startAt,Mt,Mt);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||Nc(g)[w]._gsap,t._ptLookup[w]=P={},Dc[M.id]&&Wr.length&&rl(),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=$g(E,b,t,k,A,x))?C.priority&&(I=1):P[E]=T=zc.call(t,A,E,"get",b[E],k,x,0,r.stringFilter);t._op&&t._op[w]&&t.kill(A,t._op[w]),y&&t._pt&&(Zr=t,Ut.killTweensOf(A,P,t.globalTime(e)),V=!t.parent,Zr=0),t._pt&&o&&(Dc[M.id]=1)}I&&qg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!V,d&&e<=0&&v.render(hs,!0,!0)},GA=function(t,e,s,r,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 jc=1,t.vars[e]="+=0",qc(t,h),jc=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=(r||r===0)&&!n?r:u.s+(r||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))},XA=function(t,e){var s=t[0]?Ii(t[0]).harness:0,r=s&&s.aliases,n,a,h,o;if(!r)return e;n=Pi({},e);for(a in r)if(a in n)for(o=r[a].split(","),h=o.length;h--;)n[o[h]]=n[a];return n},$A=function(t,e,s,r){var n=e.ease||r||"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,r,n){return Zt(t)?t.call(e,s,r,n):me(t)&&~t.indexOf("random(")?go(t):t},Yg=Lc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Hg={};Ue(Yg+",id,stagger,delay,duration,paused,scrollTrigger",function(i){return Hg[i]=1});var ie=function(i){rg(t,i);function t(s,r,n,a){var h;typeof r=="number"&&(n.duration=r,r=n,n=null),h=i.call(this,a?r:fo(r))||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=r.parent||Ut,y=(Se(s)||ng(s)?wr(s[0]):"length"in r)?[s]:ds(s),v,b,w,E,T,A,I,M;if(h._targets=y.length?Nc(y):co("GSAP target "+s+" not found. https://gsap.com",!Ze.nullTargetWarn)||[],h._ptLookup=[],h._overwrite=f,p||d||Ja(l)||Ja(u)){if(r=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=br(h),v._start=0,d||Ja(l)||Ja(u)){if(E=y.length,I=d&&Cg(d),Js(d))for(T in d)~Yg.indexOf(T)&&(M||(M={}),M[T]=d[T]);for(b=0;b<E;b++)w=il(r,Hg),w.stagger=0,_&&(w.yoyoEase=_),M&&Pi(w,M),A=y[b],w.duration=+bo(l,br(h),b,A,y),w.delay=(+bo(u,br(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(cs(v.vars.defaults,{ease:"none"})),v._ease=Mi(p.ease||r.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"||$A(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&&!Ac&&(Zr=br(h),Ut.killTweensOf(y),Zr=0),er(x,br(h),n),r.reversed&&h.reverse(),r.paused&&h.paused(!0),(c||!l&&!p&&h._start===ge(x._time)&&Ve(c)&&vA(br(h))&&x.data!=="nested")&&(h._tTime=-Mt,h.render(Math.max(0,-u)||0)),g&&wg(br(h),g),h}var e=t.prototype;return e.render=function(r,n,a){var h=this._time,o=this._tDur,l=this._dur,u=r<0,c=r>o-Mt&&!u?o:r<Mt?0:r,d,f,p,m,g,_,x,y,v;if(!l)wA(this,r,n,a);else if(c!==this._tTime||!r||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+r,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&&Ug(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(Eg(this,u?r: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(r,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(r<0?r:y._dur*y._ease(d/this._dur),n,a)||this._startAt&&(this._zTime=r),this._onUpdate&&!n&&(u&&Vc(this,r,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&&Vc(this,r,!0,!0),(r||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&zr(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(r){return(!r||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(r),i.prototype.invalidate.call(this,r)},e.resetTo=function(r,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||qc(this,l),u=this._ease(l/this._dur),GA(this,r,n,a,h,u,l,o)?this.resetTo(r,n,a,h,1):(ll(this,0),this.parent||xg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(r,n){if(n===void 0&&(n="all"),!r&&(!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(r,n,Zr&&Zr.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=r?ds(r):h,l=this._ptLookup,u=this._pt,c,d,f,p,m,g,_;if((!n||n==="all")&&yA(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=XA(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(r,n){return new t(r,n,arguments[2])},t.from=function(r,n){return po(1,arguments)},t.delayedCall=function(r,n,a,h){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:r,onComplete:n,onReverseComplete:n,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:h})},t.fromTo=function(r,n,a){return po(2,arguments)},t.set=function(r,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(r,n)},t.killTweensOf=function(r,n,a){return Ut.killTweensOf(r,n,a)},t}(vo);cs(ie.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ue("staggerTo,staggerFrom,staggerFromTo",function(i){ie[i]=function(){var t=new Me,e=Gc.call(arguments,0);return e.splice(i==="staggerFromTo"?5:4,0,0),t[i].apply(t,e)}});var Zc=function(t,e,s){return t[e]=s},Wg=function(t,e,s){return t[e](s)},YA=function(t,e,s,r){return t[e](r.fp,s)},HA=function(t,e,s){return t.setAttribute(e,s)},Kc=function(t,e){return Zt(t[e])?Wg:Cc(t[e])&&t.setAttribute?HA:Zc},zg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},WA=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},jg=function(t,e){var s=e._pt,r="";if(!t&&e.b)r=e.b;else if(t===1&&e.e)r=e.e;else{for(;s;)r=s.p+(s.m?s.m(s.s+s.c*t):Math.round((s.s+s.c*t)*1e4)/1e4)+r,s=s._next;r+=e.c}e.set(e.t,e.p,r,e)},Qc=function(t,e){for(var s=e._pt;s;)s.r(t,s.d),s=s._next},zA=function(t,e,s,r){for(var n=this._pt,a;n;)a=n._next,n.p===r&&n.modifier(t,e,s),n=a},jA=function(t){for(var e=this._pt,s,r;e;)r=e._next,e.p===t&&!e.op||e.op===t?nl(this,e,"_pt"):e.dep||(s=1),e=r;return!s},qA=function(t,e,s,r){r.mSet(t,e,r.m.call(r.tween,s,r.mt),r)},qg=function(t){for(var e=t._pt,s,r,n,a;e;){for(s=e._next,r=n;r&&r.pr>e.pr;)r=r._next;(e._prev=r?r._prev:a)?e._prev._next=e:n=e,(e._next=r)?r._prev=e:a=e,e=s}t._pt=n},Ge=function(){function i(e,s,r,n,a,h,o,l,u){this.t=s,this.s=n,this.c=a,this.p=r,this.r=h||zg,this.d=o||this,this.set=l||Zc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=i.prototype;return t.modifier=function(s,r,n){this.mSet=this.mSet||this.set,this.set=qA,this.m=s,this.mt=n,this.tween=r},i}();Ue(Lc+"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(i){return Bc[i]=1}),Ke.TweenMax=Ke.TweenLite=ie,Ke.TimelineLite=Ke.TimelineMax=Me,Ut=new Me({sortChildren:!1,defaults:_n,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ze.stringFilter=Ng;var ki=[],hl={},ZA=[],Zg=0,KA=0,Jc=function(t){return(hl[t]||ZA).map(function(e){return e()})},tu=function(){var t=Date.now(),e=[];t-Zg>2&&(Jc("matchMediaInit"),ki.forEach(function(s){var r=s.queries,n=s.conditions,a,h,o,l;for(h in r)a=tr.matchMedia(r[h]).matches,a&&(o=1),a!==n[h]&&(n[h]=a,l=1);l&&(s.revert(),o&&e.push(s))}),Jc("matchMediaRevert"),e.forEach(function(s){return s.onMatch(s,function(r){return s.add(null,r)})}),Zg=t,Jc("matchMedia"))},Kg=function(){function i(e,s){this.selector=s&&Xc(s),this.data=[],this._r=[],this.isReverted=!1,this.id=KA++,e&&this.add(e)}var t=i.prototype;return t.add=function(s,r,n){Zt(s)&&(n=r,r=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=Xc(n)),Dt=a,c=r.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 r=Dt;Dt=null,s(this),Dt=r},t.getTweens=function(){var s=[];return this.data.forEach(function(r){return r instanceof i?s.push.apply(s,r.getTweens()):r instanceof ie&&!(r.parent&&r.parent.data==="nested")&&s.push(r)}),s},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(s,r){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 ie)&&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(),r)for(var a=ki.length;a--;)ki[a].id===this.id&&ki.splice(a,1)},t.revert=function(s){this.kill(s||{})},i}(),QA=function(){function i(e){this.contexts=[],this.scope=e,Dt&&Dt.data.push(this)}var t=i.prototype;return t.add=function(s,r,n){Js(s)||(s={matches:s});var a=new Kg(0,n||this.scope),h=a.conditions={},o,l,u;Dt&&!a.selector&&(a.selector=Dt.selector),this.contexts.push(a),r=a.add("onMatch",r),a.queries=s;for(l in s)l==="all"?u=1:(o=tr.matchMedia(s[l]),o&&(ki.indexOf(a)<0&&ki.push(a),(h[l]=o.matches)&&(u=1),o.addListener?o.addListener(tu):o.addEventListener("change",tu)));return u&&r(a,function(c){return a.add(null,c)}),this},t.revert=function(s){this.kill(s||{})},t.kill=function(s){this.contexts.forEach(function(r){return r.kill(s,!0)})},i}(),cl={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e.forEach(function(r){return Bg(r)})},timeline:function(t){return new Me(t)},getTweensOf:function(t,e){return Ut.getTweensOf(t,e)},getProperty:function(t,e,s,r){me(t)&&(t=ds(t)[0]);var n=Ii(t||{}).get,a=s?_g:gg;return s==="native"&&(s=""),t&&(e?a((Qe[e]&&Qe[e].get||n)(t,e,s,r)):function(h,o,l){return a((Qe[h]&&Qe[h].get||n)(t,h,o,l))})},quickSetter:function(t,e,s){if(t=ds(t),t.length>1){var r=t.map(function(u){return Xe.quickSetter(u,e,s)}),n=r.length;return function(u){for(var c=n;c--;)r[c](u)}}t=t[0]||{};var a=Qe[e],h=Ii(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&&Qc(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 r,n=Xe.to(t,Pi((r={},r[e]="+=0.1",r.paused=!0,r),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=Mi(t.ease,_n.ease)),yg(_n,t||{})},config:function(t){return yg(Ze,t||{})},registerEffect:function(t){var e=t.name,s=t.effect,r=t.plugins,n=t.defaults,a=t.extendTimeline;(r||"").split(",").forEach(function(h){return h&&!Qe[h]&&!Ke[h]&&co(e+" effect requires "+h+" plugin.")}),Oc[e]=function(h,o,l){return s(ds(h),cs(o||{},n),l)},a&&(Me.prototype[e]=function(h,o,l){return this.add(Oc[e](h,Js(o)?o:(l=o)&&{},this),l)})},registerEase:function(t,e){ut[t]=Mi(e)},parseEase:function(t,e){return arguments.length?Mi(t,e):ut},getById:function(t){return Ut.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var s=new Me(t),r,n;for(s.smoothChildTiming=Ve(t.smoothChildTiming),Ut.remove(s),s._dp=0,s._time=s._tTime=Ut._time,r=Ut._first;r;)n=r._next,(e||!(!r._dur&&r instanceof ie&&r.vars.onComplete===r._targets[0]))&&er(s,r,r._start-r._delay),r=n;return er(Ut,s,0),s},context:function(t,e){return t?new Kg(t,e):Dt},matchMedia:function(t){return new QA(t)},matchMediaRefresh:function(){return ki.forEach(function(t){var e=t.conditions,s,r;for(r in e)e[r]&&(e[r]=!1,s=1);s&&t.revert()})||tu()},addEventListener:function(t,e){var s=hl[t]||(hl[t]=[]);~s.indexOf(e)||s.push(e)},removeEventListener:function(t,e){var s=hl[t],r=s&&s.indexOf(e);r>=0&&s.splice(r,1)},utils:{wrap:RA,wrapYoyo:MA,distribute:Cg,random:Pg,snap:Ig,normalize:PA,getUnit:Ce,clamp:AA,splitColor:Dg,toArray:ds,selector:Xc,mapRange:Mg,pipe:CA,unitize:IA,interpolate:FA,shuffle:Sg},install:cg,effects:Oc,ticker:ts,updateRoot:Me.updateRoot,plugins:Qe,globalTimeline:Ut,core:{PropTween:Ge,globals:ug,Tween:ie,Timeline:Me,Animation:vo,getCache:Ii,_removeLinkedListItem:nl,reverting:function(){return Ae},context:function(t){return t&&Dt&&(Dt.data.push(t),t._ctx=Dt),Dt},suppressOverwrites:function(t){return Ac=t}}};Ue("to,from,fromTo,delayedCall,set,killTweensOf",function(i){return cl[i]=ie[i]}),ts.add(Me.updateRoot),wn=cl.to({},{duration:0});var JA=function(t,e){for(var s=t._pt;s&&s.p!==e&&s.op!==e&&s.fp!==e;)s=s._next;return s},tS=function(t,e){var s=t._targets,r,n,a;for(r in e)for(n=s.length;n--;)a=t._ptLookup[n][r],a&&(a=a.d)&&(a._pt&&(a=JA(a,r)),a&&a.modifier&&a.modifier(e[r],t,s[n],r))},eu=function(t,e){return{name:t,rawVars:1,init:function(r,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}tS(h,n)}}}},Xe=cl.registerPlugin({name:"attr",init:function(t,e,s,r,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],r,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)}},eu("roundProps",$c),eu("modifiers"),eu("snap",Ig))||cl;ie.version=Me.version=Xe.version="3.12.5",hg=1,Ic()&&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,13 +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 Im,os,Tr,Jl,ks,Rm,tu,xw=function(){return typeof window<"u"},Fi={},Ls=180/Math.PI,wr=Math.PI/180,Er=Math.atan2,Mm=1e8,eu=/([A-Z])/g,vw=/(left|right|width|margin|padding|x)/i,bw=/[\s,\(]\S/,mi={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},iu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},Tw=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)},ww=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)},Ew=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},Dm=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Bm=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},Aw=function(t,e,i){return t.style[e]=i},Sw=function(t,e,i){return t.style.setProperty(e,i)},Cw=function(t,e,i){return t._gsap[e]=i},Pw=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},Iw=function(t,e,i,r,n){var a=t._gsap;a.scaleX=a.scaleY=i,a.renderTransform(n,a)},Rw=function(t,e,i,r,n){var a=t._gsap;a[e]=i,a.renderTransform(n,a)},Pt="transform",fe=Pt+"Origin",Mw=function s(t,e){var i=this,r=this.target,n=r.style,a=r._gsap;if(t in Fi&&n){if(this.tfm=this.tfm||{},t!=="transform")t=mi[t]||t,~t.indexOf(",")?t.split(",").forEach(function(o){return i.tfm[o]=ki(r,o)}):this.tfm[t]=a.x?a[t]:ki(r,t),t===fe&&(this.tfm.zOrigin=a.zOrigin);else return mi.transform.split(",").forEach(function(o){return s.call(i,o,e)});if(this.props.indexOf(Pt)>=0)return;a.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(fe,e,"")),t=Pt}(n||e)&&this.props.push(t,e,n[t])},Om=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},Dw=function(){var t=this.props,e=this.target,i=e.style,r=e._gsap,n,a;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(eu,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)r[a]=this.tfm[a];r.svg&&(r.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=tu(),(!n||!n.isStart)&&!i[Pt]&&(Om(i),r.zOrigin&&i[fe]&&(i[fe]+=" "+r.zOrigin+"px",r.zOrigin=0,r.renderTransform()),r.uncache=1)}},Fm=function(t,e){var i={target:t,props:[],revert:Dw,save:Mw};return t._gsap||de.core.getCache(t),e&&e.split(",").forEach(function(r){return i.save(r)}),i},km,su=function(t,e){var i=os.createElementNS?os.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):os.createElement(t);return i&&i.style?i:os.createElement(t)},_i=function s(t,e,i){var r=getComputedStyle(t);return r[e]||r.getPropertyValue(e.replace(eu,"-$1").toLowerCase())||r.getPropertyValue(e)||!i&&s(t,Ar(e)||e,1)||""},Lm="O,Moz,ms,Ms,Webkit".split(","),Ar=function(t,e,i){var r=e||ks,n=r.style,a=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(Lm[a]+t in n););return a<0?null:(a===3?"ms":a>=0?Lm[a]:"")+t},ru=function(){xw()&&window.document&&(Im=window,os=Im.document,Tr=os.documentElement,ks=su("div")||{style:{}},su("div"),Pt=Ar(Pt),fe=Pt+"Origin",ks.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",km=!!Ar("perspective"),tu=de.core.reverting,Jl=1)},nu=function s(t){var e=su("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,r=this.nextSibling,n=this.style.cssText,a;if(Tr.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=s}catch{}else this._gsapBBox&&(a=this._gsapBBox());return i&&(r?i.insertBefore(this,r):i.appendChild(this)),Tr.removeChild(e),this.style.cssText=n,a},Nm=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},Um=function(t){var e;try{e=t.getBBox()}catch{e=nu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===nu||(e=nu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Nm(t,["x","cx","x1"])||0,y:+Nm(t,["y","cy","y1"])||0,width:0,height:0}:e},Gm=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Um(t))},Ns=function(t,e){if(e){var i=t.style,r;e in Fi&&e!==fe&&(e=Pt),i.removeProperty?(r=e.substr(0,2),(r==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(r==="--"?e:e.replace(eu,"-$1").toLowerCase())):i.removeAttribute(e)}},hs=function(t,e,i,r,n,a){var o=new ce(t._pt,e,i,0,1,a?Bm:Dm);return t._pt=o,o.b=r,o.e=n,t._props.push(i),o},Hm={deg:1,rad:1,turn:1},Bw={grid:1,flex:1},ls=function s(t,e,i,r){var n=parseFloat(i)||0,a=(i+"").trim().substr((n+"").length)||"px",o=ks.style,h=vw.test(e),u=t.tagName.toLowerCase()==="svg",d=(u?"client":"offset")+(h?"Width":"Height"),l=100,c=r==="px",f=r==="%",p,m,_,g;if(r===a||!n||Hm[r]||Hm[a])return n;if(a!=="px"&&!c&&(n=s(t,e,i,"px")),g=t.getCTM&&Gm(t),(f||a==="%")&&(Fi[e]||~e.indexOf("adius")))return p=g?t.getBBox()[h?"width":"height"]:t[d],Ut(f?n/p*l:n/100*p);if(o[h?"width":"height"]=l+(c?a:r),m=~e.indexOf("adius")||r==="em"&&t.appendChild&&!u?t:t.parentNode,g&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===os||!m.appendChild)&&(m=os.body),_=m._gsap,_&&f&&_.width&&h&&_.time===be.time&&!_.uncache)return Ut(n/_.width*l);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=l+r,p=t[d],x?t.style[e]=x:Ns(t,e)}else(f||a==="%")&&!Bw[_i(m,"display")]&&(o.position=_i(t,"position")),m===t&&(o.position="static"),m.appendChild(ks),p=ks[d],m.removeChild(ks),o.position="absolute";return h&&f&&(_=Rs(m),_.time=be.time,_.width=m[d]),Ut(c?p*n/l:p&&n?l/p*n:0)},ki=function(t,e,i,r){var n;return Jl||ru(),e in mi&&e!=="transform"&&(e=mi[e],~e.indexOf(",")&&(e=e.split(",")[0])),Fi[e]&&e!=="transform"?(n=vn(t,r),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:oo(_i(t,fe))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||r||~(n+"").indexOf("calc("))&&(n=ao[e]&&ao[e](t,e,i)||_i(t,e)||$p(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?ls(t,e,n,i)+i:n},Ow=function(t,e,i,r){if(!i||i==="none"){var n=Ar(e,t,1),a=n&&_i(t,n,1);a&&a!==i?(e=n,i=a):e==="borderColor"&&(i=_i(t,"borderTopColor"))}var o=new ce(this._pt,t.style,e,0,1,Am),h=0,u=0,d,l,c,f,p,m,_,g,x,y,v,b;if(o.b=i,o.e=r,i+="",r+="",r==="auto"&&(m=t.style[e],t.style[e]=r,r=_i(t,e)||r,m?t.style[e]=m:Ns(t,e)),d=[i,r],mm(d),i=d[0],r=d[1],c=i.match(_r)||[],b=r.match(_r)||[],b.length){for(;l=_r.exec(r);)_=l[0],x=r.substring(h,l.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),_!==(m=c[u++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),_.charAt(1)==="="&&(_=gr(f,_)+v),g=parseFloat(_),y=_.substr((g+"").length),h=_r.lastIndex-y.length,y||(y=y||ge.units[e]||v,h===r.length&&(r+=y,o.e+=y)),v!==y&&(f=ls(t,e,m,y)||0),o._pt={_next:o._pt,p:x||u===1?x:",",s:f,c:g-f,m:p&&p<4||e==="zIndex"?Math.round:0});o.c=h<r.length?r.substring(h,r.length):""}else o.r=e==="display"&&r==="none"?Bm:Dm;return Np.test(r)&&(o.e=0),this._pt=o,o},Vm={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Fw=function(t){var e=t.split(" "),i=e[0],r=e[1]||"50%";return(i==="top"||i==="bottom"||r==="left"||r==="right")&&(t=i,i=r,r=t),e[0]=Vm[i]||i,e[1]=Vm[r]||r,e.join(" ")},kw=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,r=i.style,n=e.u,a=i._gsap,o,h,u;if(n==="all"||n===!0)r.cssText="",h=1;else for(n=n.split(","),u=n.length;--u>-1;)o=n[u],Fi[o]&&(h=1,o=o==="transformOrigin"?fe:Pt),Ns(i,o);h&&(Ns(i,Pt),a&&(a.svg&&i.removeAttribute("transform"),vn(i,1),a.uncache=1,Om(r)))}},ao={clearProps:function(t,e,i,r,n){if(n.data!=="isFromStart"){var a=t._pt=new ce(t._pt,e,i,0,0,kw);return a.u=r,a.pr=-10,a.tween=n,t._props.push(i),1}}},xn=[1,0,0,1,0,0],Xm={},Wm=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},$m=function(t){var e=_i(t,Pt);return Wm(e)?xn:e.substr(7).match(Lp).map(Ut)},au=function(t,e){var i=t._gsap||Rs(t),r=t.style,n=$m(t),a,o,h,u;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?xn:n):(n===xn&&!t.offsetParent&&t!==Tr&&!i.svg&&(h=r.display,r.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(u=1,o=t.nextElementSibling,Tr.appendChild(t)),n=$m(t),h?r.display=h:Ns(t,"display"),u&&(o?a.insertBefore(t,o):a?a.appendChild(t):Tr.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},ou=function(t,e,i,r,n,a){var o=t._gsap,h=n||au(t,!0),u=o.xOrigin||0,d=o.yOrigin||0,l=o.xOffset||0,c=o.yOffset||0,f=h[0],p=h[1],m=h[2],_=h[3],g=h[4],x=h[5],y=e.split(" "),v=parseFloat(y[0])||0,b=parseFloat(y[1])||0,E,w,A,T;i?h!==xn&&(w=f*_-p*m)&&(A=v*(_/w)+b*(-m/w)+(m*x-_*g)/w,T=v*(-p/w)+b*(f/w)-(f*x-p*g)/w,v=A,b=T):(E=Um(t),v=E.x+(~y[0].indexOf("%")?v/100*E.width:v),b=E.y+(~(y[1]||y[0]).indexOf("%")?b/100*E.height:b)),r||r!==!1&&o.smooth?(g=v-u,x=b-d,o.xOffset=l+(g*f+x*m)-g,o.yOffset=c+(g*p+x*_)-x):o.xOffset=o.yOffset=0,o.xOrigin=v,o.yOrigin=b,o.smooth=!!r,o.origin=e,o.originIsAbsolute=!!i,t.style[fe]="0px 0px",a&&(hs(a,o,"xOrigin",u,v),hs(a,o,"yOrigin",d,b),hs(a,o,"xOffset",l,o.xOffset),hs(a,o,"yOffset",c,o.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},vn=function(t,e){var i=t._gsap||new xm(t);if("x"in i&&!e&&!i.uncache)return i;var r=t.style,n=i.scaleX<0,a="px",o="deg",h=getComputedStyle(t),u=_i(t,fe)||"0",d,l,c,f,p,m,_,g,x,y,v,b,E,w,A,T,P,k,R,S,C,I,N,F,B,X,M,D,$,Y,U,rt;return d=l=c=m=_=g=x=y=v=0,f=p=1,i.svg=!!(t.getCTM&&Gm(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(r[Pt]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Pt]!=="none"?h[Pt]:"")),r.scale=r.rotate=r.translate="none"),w=au(t,i.svg),i.svg&&(i.uncache?(B=t.getBBox(),u=i.xOrigin-B.x+"px "+(i.yOrigin-B.y)+"px",F=""):F=!e&&t.getAttribute("data-svg-origin"),ou(t,F||u,!!F||i.originIsAbsolute,i.smooth!==!1,w)),b=i.xOrigin||0,E=i.yOrigin||0,w!==xn&&(k=w[0],R=w[1],S=w[2],C=w[3],d=I=w[4],l=N=w[5],w.length===6?(f=Math.sqrt(k*k+R*R),p=Math.sqrt(C*C+S*S),m=k||R?Er(R,k)*Ls:0,x=S||C?Er(S,C)*Ls+m:0,x&&(p*=Math.abs(Math.cos(x*wr))),i.svg&&(d-=b-(b*k+E*S),l-=E-(b*R+E*C))):(rt=w[6],Y=w[7],M=w[8],D=w[9],$=w[10],U=w[11],d=w[12],l=w[13],c=w[14],A=Er(rt,$),_=A*Ls,A&&(T=Math.cos(-A),P=Math.sin(-A),F=I*T+M*P,B=N*T+D*P,X=rt*T+$*P,M=I*-P+M*T,D=N*-P+D*T,$=rt*-P+$*T,U=Y*-P+U*T,I=F,N=B,rt=X),A=Er(-S,$),g=A*Ls,A&&(T=Math.cos(-A),P=Math.sin(-A),F=k*T-M*P,B=R*T-D*P,X=S*T-$*P,U=C*P+U*T,k=F,R=B,S=X),A=Er(R,k),m=A*Ls,A&&(T=Math.cos(A),P=Math.sin(A),F=k*T+R*P,B=I*T+N*P,R=R*T-k*P,N=N*T-I*P,k=F,I=B),_&&Math.abs(_)+Math.abs(m)>359.9&&(_=m=0,g=180-g),f=Ut(Math.sqrt(k*k+R*R+S*S)),p=Ut(Math.sqrt(N*N+rt*rt)),A=Er(I,N),x=Math.abs(A)>2e-4?A*Ls:0,v=U?1/(U<0?-U:U):0),i.svg&&(F=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Wm(_i(t,Pt)),F&&t.setAttribute("transform",F))),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||i.uncache,i.x=d-((i.xPercent=d&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-d)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+a,i.y=l-((i.yPercent=l&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-l)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+a,i.z=c+a,i.scaleX=Ut(f),i.scaleY=Ut(p),i.rotation=Ut(m)+o,i.rotationX=Ut(_)+o,i.rotationY=Ut(g)+o,i.skewX=x+o,i.skewY=y+o,i.transformPerspective=v+a,(i.zOrigin=parseFloat(u.split(" ")[2])||!e&&i.zOrigin||0)&&(r[fe]=oo(u)),i.xOffset=i.yOffset=0,i.force3D=ge.force3D,i.renderTransform=i.svg?Nw:km?zm:Lw,i.uncache=0,i},oo=function(t){return(t=t.split(" "))[0]+" "+t[1]},hu=function(t,e,i){var r=ie(e);return Ut(parseFloat(e)+parseFloat(ls(t,"x",i+"px",r)))+r},Lw=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,zm(t,e)},Us="0deg",bn="0px",Gs=") ",zm=function(t,e){var i=e||this,r=i.xPercent,n=i.yPercent,a=i.x,o=i.y,h=i.z,u=i.rotation,d=i.rotationY,l=i.rotationX,c=i.skewX,f=i.skewY,p=i.scaleX,m=i.scaleY,_=i.transformPerspective,g=i.force3D,x=i.target,y=i.zOrigin,v="",b=g==="auto"&&t&&t!==1||g===!0;if(y&&(l!==Us||d!==Us)){var E=parseFloat(d)*wr,w=Math.sin(E),A=Math.cos(E),T;E=parseFloat(l)*wr,T=Math.cos(E),a=hu(x,a,w*T*-y),o=hu(x,o,-Math.sin(E)*-y),h=hu(x,h,A*T*-y+y)}_!==bn&&(v+="perspective("+_+Gs),(r||n)&&(v+="translate("+r+"%, "+n+"%) "),(b||a!==bn||o!==bn||h!==bn)&&(v+=h!==bn||b?"translate3d("+a+", "+o+", "+h+") ":"translate("+a+", "+o+Gs),u!==Us&&(v+="rotate("+u+Gs),d!==Us&&(v+="rotateY("+d+Gs),l!==Us&&(v+="rotateX("+l+Gs),(c!==Us||f!==Us)&&(v+="skew("+c+", "+f+Gs),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Gs),x.style[Pt]=v||"translate(0, 0)"},Nw=function(t,e){var i=e||this,r=i.xPercent,n=i.yPercent,a=i.x,o=i.y,h=i.rotation,u=i.skewX,d=i.skewY,l=i.scaleX,c=i.scaleY,f=i.target,p=i.xOrigin,m=i.yOrigin,_=i.xOffset,g=i.yOffset,x=i.forceCSS,y=parseFloat(a),v=parseFloat(o),b,E,w,A,T;h=parseFloat(h),u=parseFloat(u),d=parseFloat(d),d&&(d=parseFloat(d),u+=d,h+=d),h||u?(h*=wr,u*=wr,b=Math.cos(h)*l,E=Math.sin(h)*l,w=Math.sin(h-u)*-c,A=Math.cos(h-u)*c,u&&(d*=wr,T=Math.tan(u-d),T=Math.sqrt(1+T*T),w*=T,A*=T,d&&(T=Math.tan(d),T=Math.sqrt(1+T*T),b*=T,E*=T)),b=Ut(b),E=Ut(E),w=Ut(w),A=Ut(A)):(b=l,A=c,E=w=0),(y&&!~(a+"").indexOf("px")||v&&!~(o+"").indexOf("px"))&&(y=ls(f,"x",a,"px"),v=ls(f,"y",o,"px")),(p||m||_||g)&&(y=Ut(y+p-(p*b+m*w)+_),v=Ut(v+m-(p*E+m*A)+g)),(r||n)&&(T=f.getBBox(),y=Ut(y+r/100*T.width),v=Ut(v+n/100*T.height)),T="matrix("+b+","+E+","+w+","+A+","+y+","+v+")",f.setAttribute("transform",T),x&&(f.style[Pt]=T)},Uw=function(t,e,i,r,n){var a=360,o=jt(n),h=parseFloat(n)*(o&&~n.indexOf("rad")?Ls:1),u=h-r,d=r+u+"deg",l,c;return o&&(l=n.split("_")[1],l==="short"&&(u%=a,u!==u%(a/2)&&(u+=u<0?a:-a)),l==="cw"&&u<0?u=(u+a*Mm)%a-~~(u/a)*a:l==="ccw"&&u>0&&(u=(u-a*Mm)%a-~~(u/a)*a)),t._pt=c=new ce(t._pt,e,i,r,u,Tw),c.e=d,c.u="deg",t._props.push(i),c},Ym=function(t,e){for(var i in e)t[i]=e[i];return t},Gw=function(t,e,i){var r=Ym({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=i.style,o,h,u,d,l,c,f,p;r.svg?(u=i.getAttribute("transform"),i.setAttribute("transform",""),a[Pt]=e,o=vn(i,1),Ns(i,Pt),i.setAttribute("transform",u)):(u=getComputedStyle(i)[Pt],a[Pt]=e,o=vn(i,1),a[Pt]=u);for(h in Fi)u=r[h],d=o[h],u!==d&&n.indexOf(h)<0&&(f=ie(u),p=ie(d),l=f!==p?ls(i,h,u,p):parseFloat(u),c=parseFloat(d),t._pt=new ce(t._pt,o,h,l,c-l,iu),t._pt.u=p||0,t._props.push(h));Ym(o,r)};ue("padding,margin,Width,Radius",function(s,t){var e="Top",i="Right",r="Bottom",n="Left",a=(t<3?[e,i,r,n]:[e+n,e+i,r+i,r+n]).map(function(o){return t<2?s+o:"border"+o+s});ao[t>1?"border"+s:s]=function(o,h,u,d,l){var c,f;if(arguments.length<4)return c=a.map(function(p){return ki(o,p,u)}),f=c.join(" "),f.split(c[0]).length===5?c[0]:f;c=(d+"").split(" "),f={},a.forEach(function(p,m){return f[p]=c[m]=c[m]||c[(m-1)/2|0]}),o.init(h,f,l)}});var jm={name:"css",register:ru,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,r,n){var a=this._props,o=t.style,h=i.vars.startAt,u,d,l,c,f,p,m,_,g,x,y,v,b,E,w,A;Jl||ru(),this.styles=this.styles||Fm(t),A=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(d=e[m],!(xe[m]&&vm(m,e,i,r,t,n)))){if(f=typeof d,p=ao[m],f==="function"&&(d=d.call(i,r,t,n),f=typeof d),f==="string"&&~d.indexOf("random(")&&(d=fn(d)),p)p(this,t,m,d,i)&&(w=1);else if(m.substr(0,2)==="--")u=(getComputedStyle(t).getPropertyValue(m)+"").trim(),d+="",ns.lastIndex=0,ns.test(u)||(_=ie(u),g=ie(d)),g?_!==g&&(u=ls(t,m,u,g)+g):_&&(d+=_),this.add(o,"setProperty",u,d,r,n,0,0,m),a.push(m),A.push(m,0,o[m]);else if(f!=="undefined"){if(h&&m in h?(u=typeof h[m]=="function"?h[m].call(i,r,t,n):h[m],jt(u)&&~u.indexOf("random(")&&(u=fn(u)),ie(u+"")||u==="auto"||(u+=ge.units[m]||ie(ki(t,m))||""),(u+"").charAt(1)==="="&&(u=ki(t,m))):u=ki(t,m),c=parseFloat(u),x=f==="string"&&d.charAt(1)==="="&&d.substr(0,2),x&&(d=d.substr(2)),l=parseFloat(d),m in mi&&(m==="autoAlpha"&&(c===1&&ki(t,"visibility")==="hidden"&&l&&(c=0),A.push("visibility",0,o.visibility),hs(this,o,"visibility",c?"inherit":"hidden",l?"inherit":"hidden",!l)),m!=="scale"&&m!=="transform"&&(m=mi[m],~m.indexOf(",")&&(m=m.split(",")[0]))),y=m in Fi,y){if(this.styles.save(m),v||(b=t._gsap,b.renderTransform&&!e.parseTransform||vn(t,e.parseTransform),E=e.smoothOrigin!==!1&&b.smooth,v=this._pt=new ce(this._pt,o,Pt,0,1,b.renderTransform,b,0,-1),v.dep=1),m==="scale")this._pt=new ce(this._pt,b,"scaleY",b.scaleY,(x?gr(b.scaleY,x+l):l)-b.scaleY||0,iu),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){A.push(fe,0,o[fe]),d=Fw(d),b.svg?ou(t,d,0,E,0,this):(g=parseFloat(d.split(" ")[2])||0,g!==b.zOrigin&&hs(this,b,"zOrigin",b.zOrigin,g),hs(this,o,m,oo(u),oo(d)));continue}else if(m==="svgOrigin"){ou(t,d,1,E,0,this);continue}else if(m in Xm){Uw(this,b,m,c,x?gr(c,x+d):d);continue}else if(m==="smoothOrigin"){hs(this,b,"smooth",b.smooth,d);continue}else if(m==="force3D"){b[m]=d;continue}else if(m==="transform"){Gw(this,d,t);continue}}else m in o||(m=Ar(m)||m);if(y||(l||l===0)&&(c||c===0)&&!bw.test(d)&&m in o)_=(u+"").substr((c+"").length),l||(l=0),g=ie(d)||(m in ge.units?ge.units[m]:_),_!==g&&(c=ls(t,m,u,g)),this._pt=new ce(this._pt,y?b:o,m,c,(x?gr(c,x+l):l)-c,!y&&(g==="px"||m==="zIndex")&&e.autoRound!==!1?Ew:iu),this._pt.u=g||0,_!==g&&g!=="%"&&(this._pt.b=u,this._pt.r=ww);else if(m in o)Ow.call(this,t,m,u,x?x+d:d);else if(m in t)this.add(t,m,u||t[m],x?x+d:d,r,n);else if(m!=="parseTransform"){Rl(m,d);continue}y||(m in o?A.push(m,0,o[m]):A.push(m,1,u||t[m])),a.push(m)}}w&&Sm(this)},render:function(t,e){if(e.tween._time||!tu())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:ki,aliases:mi,getSetter:function(t,e,i){var r=mi[e];return r&&r.indexOf(",")<0&&(e=r),e in Fi&&e!==fe&&(t._gsap.x||ki(t,"x"))?i&&Rm===i?e==="scale"?Pw:Cw:(Rm=i||{})&&(e==="scale"?Iw:Rw):t.style&&!El(t.style[e])?Aw:~e.indexOf("-")?Sw:jl(t,e)},core:{_removeProperty:Ns,_getMatrix:au}};de.utils.checkPrefix=Ar,de.core.getStyleSaver=Fm,function(s,t,e,i){var r=ue(s+","+t+","+e,function(n){Fi[n]=1});ue(t,function(n){ge.units[n]="deg",Xm[n]=1}),mi[r[13]]=s+","+t,ue(i,function(n){var a=n.split(":");mi[a[1]]=r[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(s){ge.units[s]="px"}),de.registerPlugin(jm);var ut=de.registerPlugin(jm)||de;ut.core.Tween;class lu extends ui{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:i=0,width:r=0,height:n=0,bgColor:a="#fff",alpha:o=1,radius:h=0,borderWidth:u=0,borderColor:d="black",enableTint:l=!0}=t;this.x=e,this.y=i,this.bgAlpha=o,this.radius=h,this.enableTint=l,this.bgColor=a,this.borderWidth=u,this.borderColor=d,this.renderBg(r,n)}updateColor(t){ut.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 Tn extends bt{constructor(t,e,i,r){if(super(),r){const n=new ui;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}i?(this._bgColorFill=new lu({width:t,height:e,bgColor:i}),this.addChild(this._bgColorFill)):(this._fill=new _e,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 Qg,Kr,Tn,su,Bi,Jg,ru,eS=function(){return typeof window<"u"},Er={},Di=180/Math.PI,An=Math.PI/180,Sn=Math.atan2,t_=1e8,iu=/([A-Z])/g,sS=/(left|right|width|margin|padding|x)/i,rS=/[\s,\(]\S/,sr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},nu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},iS=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)},nS=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)},oS=function(t,e){var s=e.s+e.c*t;e.set(e.t,e.p,~~(s+(s<0?-.5:.5))+e.u,e)},e_=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},s_=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},aS=function(t,e,s){return t.style[e]=s},lS=function(t,e,s){return t.style.setProperty(e,s)},hS=function(t,e,s){return t._gsap[e]=s},cS=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},uS=function(t,e,s,r,n){var a=t._gsap;a.scaleX=a.scaleY=s,a.renderTransform(n,a)},dS=function(t,e,s,r,n){var a=t._gsap;a[e]=s,a.renderTransform(n,a)},Gt="transform",$e=Gt+"Origin",fS=function i(t,e){var s=this,r=this.target,n=r.style,a=r._gsap;if(t in Er&&n){if(this.tfm=this.tfm||{},t!=="transform")t=sr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(h){return s.tfm[h]=Tr(r,h)}):this.tfm[t]=a.x?a[t]:Tr(r,t),t===$e&&(this.tfm.zOrigin=a.zOrigin);else return sr.transform.split(",").forEach(function(h){return i.call(s,h,e)});if(this.props.indexOf(Gt)>=0)return;a.svg&&(this.svgo=r.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"))},pS=function(){var t=this.props,e=this.target,s=e.style,r=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)r[a]=this.tfm[a];r.svg&&(r.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=ru(),(!n||!n.isStart)&&!s[Gt]&&(r_(s),r.zOrigin&&s[$e]&&(s[$e]+=" "+r.zOrigin+"px",r.zOrigin=0,r.renderTransform()),r.uncache=1)}},i_=function(t,e){var s={target:t,props:[],revert:pS,save:fS};return t._gsap||Xe.core.getCache(t),e&&e.split(",").forEach(function(r){return s.save(r)}),s},n_,ou=function(t,e){var s=Kr.createElementNS?Kr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Kr.createElement(t);return s&&s.style?s:Kr.createElement(t)},rr=function i(t,e,s){var r=getComputedStyle(t);return r[e]||r.getPropertyValue(e.replace(iu,"-$1").toLowerCase())||r.getPropertyValue(e)||!s&&i(t,Cn(e)||e,1)||""},o_="O,Moz,ms,Ms,Webkit".split(","),Cn=function(t,e,s){var r=e||Bi,n=r.style,a=5;if(t in n&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(o_[a]+t in n););return a<0?null:(a===3?"ms":a>=0?o_[a]:"")+t},au=function(){eS()&&window.document&&(Qg=window,Kr=Qg.document,Tn=Kr.documentElement,Bi=ou("div")||{style:{}},ou("div"),Gt=Cn(Gt),$e=Gt+"Origin",Bi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",n_=!!Cn("perspective"),ru=Xe.core.reverting,su=1)},lu=function i(t){var e=ou("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,r=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=i}catch{}else this._gsapBBox&&(a=this._gsapBBox());return s&&(r?s.insertBefore(this,r):s.appendChild(this)),Tn.removeChild(e),this.style.cssText=n,a},a_=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},l_=function(t){var e;try{e=t.getBBox()}catch{e=lu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===lu||(e=lu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+a_(t,["x","cx","x1"])||0,y:+a_(t,["y","cy","y1"])||0,width:0,height:0}:e},h_=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&l_(t))},Oi=function(t,e){if(e){var s=t.style,r;e in Er&&e!==$e&&(e=Gt),s.removeProperty?(r=e.substr(0,2),(r==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(r==="--"?e:e.replace(iu,"-$1").toLowerCase())):s.removeAttribute(e)}},Qr=function(t,e,s,r,n,a){var h=new Ge(t._pt,e,s,0,1,a?s_:e_);return t._pt=h,h.b=r,h.e=n,t._props.push(s),h},c_={deg:1,rad:1,turn:1},mS={grid:1,flex:1},Jr=function i(t,e,s,r){var n=parseFloat(s)||0,a=(s+"").trim().substr((n+"").length)||"px",h=Bi.style,o=sS.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(o?"Width":"Height"),c=100,d=r==="px",f=r==="%",p,m,g,_;if(r===a||!n||c_[r]||c_[a])return n;if(a!=="px"&&!d&&(n=i(t,e,s,"px")),_=t.getCTM&&h_(t),(f||a==="%")&&(Er[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:r),m=~e.indexOf("adius")||r==="em"&&t.appendChild&&!l?t:t.parentNode,_&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Kr||!m.appendChild)&&(m=Kr.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+r,p=t[u],x?t.style[e]=x:Oi(t,e)}else(f||a==="%")&&!mS[rr(m,"display")]&&(h.position=rr(t,"position")),m===t&&(h.position="static"),m.appendChild(Bi),p=Bi[u],m.removeChild(Bi),h.position="absolute";return o&&f&&(g=Ii(m),g.time=ts.time,g.width=m[u]),te(d?p*n/c:p&&n?c/p*n:0)},Tr=function(t,e,s,r){var n;return su||au(),e in sr&&e!=="transform"&&(e=sr[e],~e.indexOf(",")&&(e=e.split(",")[0])),Er[e]&&e!=="transform"?(n=Eo(t,r),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dl(rr(t,$e))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||r||~(n+"").indexOf("calc("))&&(n=ul[e]&&ul[e](t,e,s)||rr(t,e)||pg(t,e)||(e==="opacity"?1:0))),s&&!~(n+"").trim().indexOf(" ")?Jr(t,e,n,s)+s:n},gS=function(t,e,s,r){if(!s||s==="none"){var n=Cn(e,t,1),a=n&&rr(t,n,1);a&&a!==s?(e=n,s=a):e==="borderColor"&&(s=rr(t,"borderTopColor"))}var h=new Ge(this._pt,t.style,e,0,1,jg),o=0,l=0,u,c,d,f,p,m,g,_,x,y,v,b;if(h.b=s,h.e=r,s+="",r+="",r==="auto"&&(m=t.style[e],t.style[e]=r,r=rr(t,e)||r,m?t.style[e]=m:Oi(t,e)),u=[s,r],Ng(u),s=u[0],r=u[1],d=s.match(yn)||[],b=r.match(yn)||[],b.length){for(;c=yn.exec(r);)g=c[0],x=r.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===r.length&&(r+=y,h.e+=y)),v!==y&&(f=Jr(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<r.length?r.substring(o,r.length):""}else h.r=e==="display"&&r==="none"?s_:e_;return ag.test(r)&&(h.e=0),this._pt=h,h},u_={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},_S=function(t){var e=t.split(" "),s=e[0],r=e[1]||"50%";return(s==="top"||s==="bottom"||r==="left"||r==="right")&&(t=s,s=r,r=t),e[0]=u_[s]||s,e[1]=u_[r]||r,e.join(" ")},yS=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,r=s.style,n=e.u,a=s._gsap,h,o,l;if(n==="all"||n===!0)r.cssText="",o=1;else for(n=n.split(","),l=n.length;--l>-1;)h=n[l],Er[h]&&(o=1,h=h==="transformOrigin"?$e:Gt),Oi(s,h);o&&(Oi(s,Gt),a&&(a.svg&&s.removeAttribute("transform"),Eo(s,1),a.uncache=1,r_(r)))}},ul={clearProps:function(t,e,s,r,n){if(n.data!=="isFromStart"){var a=t._pt=new Ge(t._pt,e,s,0,0,yS);return a.u=r,a.pr=-10,a.tween=n,t._props.push(s),1}}},wo=[1,0,0,1,0,0],d_={},f_=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},p_=function(t){var e=rr(t,Gt);return f_(e)?wo:e.substr(7).match(og).map(te)},hu=function(t,e){var s=t._gsap||Ii(t),r=t.style,n=p_(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=r.display,r.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,h=t.nextElementSibling,Tn.appendChild(t)),n=p_(t),o?r.display=o:Oi(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)},cu=function(t,e,s,r,n,a){var h=t._gsap,o=n||hu(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=l_(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)),r||r!==!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=!!r,h.origin=e,h.originIsAbsolute=!!s,t.style[$e]="0px 0px",a&&(Qr(a,h,"xOrigin",l,v),Qr(a,h,"yOrigin",u,b),Qr(a,h,"xOffset",c,h.xOffset),Qr(a,h,"yOffset",d,h.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},Eo=function(t,e){var s=t._gsap||new Xg(t);if("x"in s&&!e&&!s.uncache)return s;var r=t.style,n=s.scaleX<0,a="px",h="deg",o=getComputedStyle(t),l=rr(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,H,lt;return u=c=d=m=g=_=x=y=v=0,f=p=1,s.svg=!!(t.getCTM&&h_(t)),o.translate&&((o.translate!=="none"||o.scale!=="none"||o.rotate!=="none")&&(r[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]:"")),r.scale=r.rotate=r.translate="none"),E=hu(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"),cu(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)*Di:0,x=C||P?Sn(C,P)*Di+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],H=E[11],u=E[12],c=E[13],d=E[14],T=Sn(lt,Z),g=T*Di,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,H=Q*-I+H*A,k=V,U=L,lt=$),T=Sn(-C,Z),_=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=M*A-O*I,L=R*A-N*I,$=C*A-Z*I,H=P*I+H*A,M=V,R=L,C=$),T=Sn(R,M),m=T*Di,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*Di:0,v=H?1/(H<0?-H:H):0),s.svg&&(V=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!f_(rr(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)&&(r[$e]=dl(l)),s.xOffset=s.yOffset=0,s.force3D=Ze.force3D,s.renderTransform=s.svg?vS:n_?m_:xS,s.uncache=0,s},dl=function(t){return(t=t.split(" "))[0]+" "+t[1]},uu=function(t,e,s){var r=Ce(e);return te(parseFloat(e)+parseFloat(Jr(t,"x",s+"px",r)))+r},xS=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,m_(t,e)},Li="0deg",To="0px",Ni=") ",m_=function(t,e){var s=e||this,r=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!==Li||u!==Li)){var w=parseFloat(u)*An,E=Math.sin(w),T=Math.cos(w),A;w=parseFloat(c)*An,A=Math.cos(w),a=uu(x,a,E*A*-y),h=uu(x,h,-Math.sin(w)*-y),o=uu(x,o,T*A*-y+y)}g!==To&&(v+="perspective("+g+Ni),(r||n)&&(v+="translate("+r+"%, "+n+"%) "),(b||a!==To||h!==To||o!==To)&&(v+=o!==To||b?"translate3d("+a+", "+h+", "+o+") ":"translate("+a+", "+h+Ni),l!==Li&&(v+="rotate("+l+Ni),u!==Li&&(v+="rotateY("+u+Ni),c!==Li&&(v+="rotateX("+c+Ni),(d!==Li||f!==Li)&&(v+="skew("+d+", "+f+Ni),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Ni),x.style[Gt]=v||"translate(0, 0)"},vS=function(t,e){var s=e||this,r=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=Jr(f,"x",a,"px"),v=Jr(f,"y",h,"px")),(p||m||g||_)&&(y=te(y+p-(p*b+m*E)+g),v=te(v+m-(p*w+m*T)+_)),(r||n)&&(A=f.getBBox(),y=te(y+r/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)},bS=function(t,e,s,r,n){var a=360,h=me(n),o=parseFloat(n)*(h&&~n.indexOf("rad")?Di:1),l=o-r,u=r+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*t_)%a-~~(l/a)*a:c==="ccw"&&l>0&&(l=(l-a*t_)%a-~~(l/a)*a)),t._pt=d=new Ge(t._pt,e,s,r,l,iS),d.e=u,d.u="deg",t._props.push(s),d},g_=function(t,e){for(var s in e)t[s]=e[s];return t},wS=function(t,e,s){var r=g_({},s._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=s.style,h,o,l,u,c,d,f,p;r.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),a[Gt]=e,h=Eo(s,1),Oi(s,Gt),s.setAttribute("transform",l)):(l=getComputedStyle(s)[Gt],a[Gt]=e,h=Eo(s,1),a[Gt]=l);for(o in Er)l=r[o],u=h[o],l!==u&&n.indexOf(o)<0&&(f=Ce(l),p=Ce(u),c=f!==p?Jr(s,o,l,p):parseFloat(l),d=parseFloat(u),t._pt=new Ge(t._pt,h,o,c,d-c,nu),t._pt.u=p||0,t._props.push(o));g_(h,r)};Ue("padding,margin,Width,Radius",function(i,t){var e="Top",s="Right",r="Bottom",n="Left",a=(t<3?[e,s,r,n]:[e+n,e+s,r+s,r+n]).map(function(h){return t<2?i+h:"border"+h+i});ul[t>1?"border"+i:i]=function(h,o,l,u,c){var d,f;if(arguments.length<4)return d=a.map(function(p){return Tr(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 __={name:"css",register:au,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,r,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;su||au(),this.styles=this.styles||i_(t),T=this.styles.props,this.tween=s;for(m in e)if(m!=="autoRound"&&(u=e[m],!(Qe[m]&&$g(m,e,s,r,t,n)))){if(f=typeof u,p=ul[m],f==="function"&&(u=u.call(s,r,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+="",qr.lastIndex=0,qr.test(l)||(g=Ce(l),_=Ce(u)),_?g!==_&&(l=Jr(t,m,l,_)+_):g&&(u+=g),this.add(h,"setProperty",l,u,r,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,r,t,n):o[m],me(l)&&~l.indexOf("random(")&&(l=go(l)),Ce(l+"")||l==="auto"||(l+=Ze.units[m]||Ce(Tr(t,m))||""),(l+"").charAt(1)==="="&&(l=Tr(t,m))):l=Tr(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 sr&&(m==="autoAlpha"&&(d===1&&Tr(t,"visibility")==="hidden"&&c&&(d=0),T.push("visibility",0,h.visibility),Qr(this,h,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),m!=="scale"&&m!=="transform"&&(m=sr[m],~m.indexOf(",")&&(m=m.split(",")[0]))),y=m in Er,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,nu),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){T.push($e,0,h[$e]),u=_S(u),b.svg?cu(t,u,0,w,0,this):(_=parseFloat(u.split(" ")[2])||0,_!==b.zOrigin&&Qr(this,b,"zOrigin",b.zOrigin,_),Qr(this,h,m,dl(l),dl(u)));continue}else if(m==="svgOrigin"){cu(t,u,1,w,0,this);continue}else if(m in d_){bS(this,b,m,d,x?xn(d,x+u):u);continue}else if(m==="smoothOrigin"){Qr(this,b,"smooth",b.smooth,u);continue}else if(m==="force3D"){b[m]=u;continue}else if(m==="transform"){wS(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=Jr(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?oS:nu),this._pt.u=_||0,g!==_&&_!=="%"&&(this._pt.b=l,this._pt.r=nS);else if(m in h)gS.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,r,n);else if(m!=="parseTransform"){kc(m,u);continue}y||(m in h?T.push(m,0,h[m]):T.push(m,1,l||t[m])),a.push(m)}}E&&qg(this)},render:function(t,e){if(e.tween._time||!ru())for(var s=e._pt;s;)s.r(t,s.d),s=s._next;else e.styles.revert()},get:Tr,aliases:sr,getSetter:function(t,e,s){var r=sr[e];return r&&r.indexOf(",")<0&&(e=r),e in Er&&e!==$e&&(t._gsap.x||Tr(t,"x"))?s&&Jg===s?e==="scale"?cS:hS:(Jg=s||{})&&(e==="scale"?uS:dS):t.style&&!Cc(t.style[e])?aS:~e.indexOf("-")?lS:Kc(t,e)},core:{_removeProperty:Oi,_getMatrix:hu}};Xe.utils.checkPrefix=Cn,Xe.core.getStyleSaver=i_,function(i,t,e,s){var r=Ue(i+","+t+","+e,function(n){Er[n]=1});Ue(t,function(n){Ze.units[n]="deg",d_[n]=1}),sr[r[13]]=i+","+t,Ue(s,function(n){var a=n.split(":");sr[a[1]]=r[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(i){Ze.units[i]="px"}),Xe.registerPlugin(__);var xt=Xe.registerPlugin(__)||Xe;xt.core.Tween;class du extends Ks{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:r=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(r,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 Bt{constructor(t,e,s,r){if(super(),r){const n=new Ks;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}s?(this._bgColorFill=new du({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 gi{constructor(t,e,i){this.value=t,this.time=e,this.next=null,this.isStepped=!1,i?this.ease=typeof i=="function"?i:Zm(i):this.ease=null}static createList(t){if("list"in t){const i=t.list;let r;const{value:n,time:a}=i[0],o=r=new gi(typeof n=="string"?lo(n):n,a,t.ease);if(i.length>2||i.length===2&&i[1].value!==n)for(let h=1;h<i.length;++h){const{value:u,time:d}=i[h];r.next=new gi(typeof u=="string"?lo(u):u,d),r=r.next}return o.isStepped=!!t.isStepped,o}const e=new gi(typeof t.start=="string"?lo(t.start):t.start,0);return t.end!==t.start&&(e.next=new gi(typeof t.end=="string"?lo(t.end):t.end,1)),e}}let wn=W.from;const yi=Math.PI/180;function Li(s,t){if(!s)return;const e=Math.sin(s),i=Math.cos(s),r=t.x*i-t.y*e,n=t.x*e+t.y*i;t.x=r,t.y=n}function ho(s,t,e){return s<<16|t<<8|e}function qm(s){return Math.sqrt(s.x*s.x+s.y*s.y)}function Hw(s){const t=1/qm(s);s.x*=t,s.y*=t}function Km(s,t){s.x*=t,s.y*=t}function lo(s,t){t||(t={}),s.charAt(0)==="#"?s=s.substr(1):s.indexOf("0x")===0&&(s=s.substr(2));let e;return s.length===8&&(e=s.substr(0,2),s=s.substr(2)),t.r=parseInt(s.substr(0,2),16),t.g=parseInt(s.substr(2,2),16),t.b=parseInt(s.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function Zm(s){const t=s.length,e=1/t;return function(i){const r=t*i|0,n=(i-r*e)*t,a=s[r]||s[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function Vw(s){return s?(s=s.toUpperCase().replace(/ /g,"_"),K[s]||K.NORMAL):K.NORMAL}class uu extends _e{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 xt;(function(s){s[s.Spawn=0]="Spawn",s[s.Normal=2]="Normal",s[s.Late=5]="Late"})(xt||(xt={}));const cu=ct.shared,Hs=Symbol("Position particle per emitter position");class dt{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 tt,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new tt,this._prevEmitterPos=new tt,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){dt.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:Zm(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(i=>{const r=dt.knownBehaviors[i.type];return r?new r(i.config):(console.error(`Unknown behavior: ${i.type}`),null)}).filter(i=>!!i);e.push(Hs),e.sort((i,r)=>i===Hs?r.order===xt.Spawn?1:-1:r===Hs?i.order===xt.Spawn?-1:1:i.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(i=>i!==Hs&&i.updateParticle),this.recycleBehaviors=e.filter(i=>i!==Hs&&i.recycleParticle)}getBehavior(t){return dt.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof dt.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 i=0;i<this.recycleBehaviors.length;++i)this.recycleBehaviors[i].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,Li(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?cu.remove(this.update,this):!this._autoUpdate&&t&&cu.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=cu.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,o;a;a=o)if(o=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let h=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?h=this.customEase(h,0,1,1):h=this.customEase(h)),a.agePercent=h;for(let u=0;u<this.updateBehaviors.length;++u)if(this.updateBehaviors[u].updateParticle(a,t)){this.recycle(a);break}}let e,i;this._prevPosIsValid&&(e=this._prevEmitterPos.x,i=this._prevEmitterPos.y);const r=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,o;if(this._prevPosIsValid&&this._posChanged){const d=1+this._spawnTimer/t;a=(r-e)*d+e,o=(n-i)*d+i}else a=r,o=n;let h=null,u=null;for(let d=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),l=0;l<d;++l){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let c;if(this.minLifetime===this.maxLifetime?c=this.minLifetime:c=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=c)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new uu(this),f.init(c),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),h?(u.next=f,f.prev=u,u=f):u=h=f,++this.particleCount}if(h){this._activeParticlesLast?(this._activeParticlesLast.next=h,h.prev=this._activeParticlesLast,this._activeParticlesLast=u):(this._activeParticlesFirst=h,this._activeParticlesLast=u);for(let d=0;d<this.initBehaviors.length;++d){const l=this.initBehaviors[d];if(l===Hs)for(let c=h,f;c;c=f){f=c.next,this.rotation!==0&&(Li(this.rotation,c.position),c.rotation+=this.rotation),c.position.x+=a,c.position.y+=o,c.age+=-this._spawnTimer;let p=c.age*c.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),c.agePercent=p}else l.initParticles(h)}for(let d=h,l;d;d=l){l=d.next;for(let c=0;c<this.updateBehaviors.length;++c)if(this.updateBehaviors[c].updateParticle(d,-this._spawnTimer)){this.recycle(d);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=r,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 i=null,r=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 o;this._poolFirst?(o=this._poolFirst,this._poolFirst=this._poolFirst.next,o.next=null):o=new uu(this);let h;this.minLifetime===this.maxLifetime?h=this.minLifetime:h=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,o.init(h),this.addAtBack?this._parent.addChildAt(o,0):this._parent.addChild(o),i?(r.next=o,o.prev=r,r=o):r=i=o,++this.particleCount}if(i){this._activeParticlesLast?(this._activeParticlesLast.next=i,i.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=i,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Hs)for(let o=i,h;o;o=h)h=o.next,this.rotation!==0&&(Li(this.rotation,o.position),o.rotation+=this.rotation),o.position.x+=t,o.position.y+=e;else a.initParticles(i)}}}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}}dt.knownBehaviors={};class du{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}}du.type="rect",du.editorConfig=null;class uo{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),Li(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}uo.type="torus",uo.editorConfig=null;class fu{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 i=t[e];let r=i[0];for(let n=1;n<i.length;++n){const a=i[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let i=1;i<t.length;++i){const r=t[i];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:i,p2:r}=this.segments[e],n=Math.sqrt((r.x-i.x)*(r.x-i.x)+(r.y-i.y)*(r.y-i.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let i,r;if(this.segments.length===1)i=this.segments[0],r=e;else for(let o=0;o<this.countingLengths.length;++o)if(e<this.countingLengths[o]){i=this.segments[o],r=o===0?e:e-this.countingLengths[o-1];break}r/=i.l||1;const{p1:n,p2:a}=i;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}fu.type="polygonalChain",fu.editorConfig=null;class pu{constructor(t){var e;this.order=xt.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 i=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new tt(i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity,r=i.x,n=i.y;if(i.x+=this.accel.x*e,i.y+=this.accel.y*e,this.maxSpeed){const a=qm(i);a>this.maxSpeed&&Km(i,this.maxSpeed/a)}t.x+=(r+i.x)/2*e,t.y+=(n+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}}pu.type="moveAcceleration",pu.editorConfig=null;function Xw(s){return this.ease&&(s=this.ease(s)),(this.first.next.value-this.first.value)*s+this.first.value}function Ww(s){this.ease&&(s=this.ease(s));const t=this.first.value,e=this.first.next.value,i=(e.r-t.r)*s+t.r,r=(e.g-t.g)*s+t.g,n=(e.b-t.b)*s+t.b;return ho(i,r,n)}function $w(s){this.ease&&(s=this.ease(s));let t=this.first,e=t.next;for(;s>e.time;)t=e,e=e.next;return s=(s-t.time)/(e.time-t.time),(e.value-t.value)*s+t.value}function zw(s){this.ease&&(s=this.ease(s));let t=this.first,e=t.next;for(;s>e.time;)t=e,e=e.next;s=(s-t.time)/(e.time-t.time);const i=t.value,r=e.value,n=(r.r-i.r)*s+i.r,a=(r.g-i.g)*s+i.g,o=(r.b-i.b)*s+i.b;return ho(n,a,o)}function Yw(s){this.ease&&(s=this.ease(s));let t=this.first;for(;t.next&&s>t.next.time;)t=t.next;return t.value}function jw(s){this.ease&&(s=this.ease(s));let t=this.first;for(;t.next&&s>t.next.time;)t=t.next;const e=t.value;return ho(e.r,e.g,e.b)}class En{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?Ww:Xw:t.isStepped?this.interpolate=this.isColor?jw:Yw:this.interpolate=this.isColor?zw:$w,this.ease=this.first.ease}}class mu{constructor(t){this.order=xt.Normal,this.list=new En(!1),this.list.reset(gi.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)}}mu.type="alpha",mu.editorConfig=null;class _u{constructor(t){this.order=xt.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 Qm(s){const t=[];for(let e=0;e<s.length;++e){let i=s[e];if(typeof i=="string")t.push(wn(i));else if(i instanceof W)t.push(i);else{let r=i.count||1;for(typeof i.texture=="string"?i=wn(i.texture):i=i.texture;r>0;--r)t.push(i)}}return t}class gu{constructor(t){this.order=xt.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const i=t.anims[e],r=Qm(i.textures),n=i.framerate<0?-1:i.framerate>0?i.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!i.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[i];e.texture=r.textures[0],e.config.animElapsed=0,r.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=r.textures.length/e.maxLife):(e.config.animDuration=r.duration,e.config.animFramerate=r.framerate),e=e.next}}updateParticle(t,e){const i=t.config,r=i.anim;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(i.anim.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const n=i.animElapsed*i.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||W.EMPTY}}gu.type="animatedRandom",gu.editorConfig=null;class yu{constructor(t){this.order=xt.Normal;const e=t.anim,i=Qm(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:i,duration:r>0?i.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const i=this.anim;for(;e;)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 i=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(i.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=i.textures[n]||i.textures[i.textures.length-1]||W.EMPTY}}yu.type="animatedSingle",yu.editorConfig=null;class xu{constructor(t){this.order=xt.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=Vw(this.value),e=e.next}}xu.type="blendMode",xu.editorConfig=null;class vu{constructor(t){this.order=xt.Spawn,this.spacing=t.spacing*yi,this.start=t.start*yi,this.distance=t.distance}initParticles(t){let e=0,i=t;for(;i;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,i.rotation=r,this.distance&&(i.position.x=this.distance,Li(r,i.position)),i=i.next,++e}}}vu.type="spawnBurst",vu.editorConfig=null;class bu{constructor(t){this.order=xt.Normal,this.list=new En(!0),this.list.reset(gi.createList(t.color))}initParticles(t){let e=t;const i=this.list.first.value,r=ho(i.r,i.g,i.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}bu.type="color",bu.editorConfig=null;class Tu{constructor(t){this.order=xt.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}}Tu.type="colorStatic",Tu.editorConfig=null;class wu{constructor(t){this.order=xt.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?wn(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}}wu.type="textureOrdered",wu.editorConfig=null;const Sr=new tt,Jm=["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"],qw=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(Jm).join("|"),"g");function Kw(s){const t=s.match(qw);for(let e=t.length-1;e>=0;--e)Jm.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return s=t.join(""),new Function("x",`return ${s};`)}class Eu{constructor(t){var e;if(this.order=xt.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=Kw(t.path)}catch{this.path=null}else this.path=i=>i;this.list=new En(!1),this.list.reset(gi.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 tt(e.x,e.y),e.config.movement=0;const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=i*e,Sr.x=t.config.movement,Sr.y=this.path(Sr.x),Li(t.config.initRotation,Sr),t.position.x=t.config.initPosition.x+Sr.x,t.position.y=t.config.initPosition.y+Sr.y}}Eu.type="movePath",Eu.editorConfig=null;class Au{constructor(){this.order=xt.Spawn}initParticles(t){}}Au.type="spawnPoint",Au.editorConfig=null;class Su{constructor(t){this.order=xt.Normal,this.textures=t.textures.map(e=>typeof e=="string"?wn(e):e)}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[i],e=e.next}}}Su.type="textureRandom",Su.editorConfig=null;class Cu{constructor(t){this.order=xt.Normal,this.minStart=t.minStart*yi,this.maxStart=t.maxStart*yi,this.minSpeed=t.minSpeed*yi,this.maxSpeed=t.maxSpeed*yi,this.accel=t.accel*yi}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 i=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+i)/2*e}else t.rotation+=t.config.rotSpeed*e}}Cu.type="rotation",Cu.editorConfig=null;class Pu{constructor(t){this.order=xt.Normal,this.min=t.min*yi,this.max=t.max*yi}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 Iu{constructor(t){this.order=xt.Late+1,this.rotation=(t.rotation||0)*yi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Iu.type="noRotation",Iu.editorConfig=null;class Ru{constructor(t){var e;this.order=xt.Normal,this.list=new En(!1),this.list.reset(gi.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=i,e.scale.x=e.scale.y=this.list.first.value*i,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Ru.type="scale",Ru.editorConfig=null;class Mu{constructor(t){this.order=xt.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=i,e=e.next}}}Mu.type="scaleStatic",Mu.editorConfig=null;class ze{constructor(t){this.order=xt.Spawn;const e=ze.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){ze.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}ze.type="spawnShape",ze.editorConfig=null,ze.shapes={},ze.registerShape(fu),ze.registerShape(du),ze.registerShape(uo),ze.registerShape(uo,"circle");class Du{constructor(t){this.order=xt.Normal,this.texture=typeof t.texture=="string"?wn(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Du.type="textureSingle",Du.editorConfig=null;class Bu{constructor(t){var e;this.order=xt.Late,this.list=new En(!1),this.list.reset(gi.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e.config.velocity?e.config.velocity.set(this.list.first.value*i,0):e.config.velocity=new tt(this.list.first.value*i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;Hw(r),Km(r,i),t.x+=r.x*e,t.y+=r.y*e}}Bu.type="moveSpeed",Bu.editorConfig=null;class Ou{constructor(t){this.order=xt.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new tt(i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity;t.x+=i.x*e,t.y+=i.y*e}}Ou.type="moveSpeedStatic",Ou.editorConfig=null,dt.registerBehavior(pu),dt.registerBehavior(mu),dt.registerBehavior(_u),dt.registerBehavior(gu),dt.registerBehavior(yu),dt.registerBehavior(xu),dt.registerBehavior(vu),dt.registerBehavior(bu),dt.registerBehavior(Tu),dt.registerBehavior(wu),dt.registerBehavior(Eu),dt.registerBehavior(Au),dt.registerBehavior(Su),dt.registerBehavior(Cu),dt.registerBehavior(Pu),dt.registerBehavior(Iu),dt.registerBehavior(Ru),dt.registerBehavior(Mu),dt.registerBehavior(ze),dt.registerBehavior(Du),dt.registerBehavior(Bu),dt.registerBehavior(Ou);class Fu extends Va{constructor(t){const{text:e,fontSize:i=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:o,fontFamily:h="Arial",fontWeight:u="normal",wordWrap:d=!1,wordWrapWidth:l=100,lineHeight:c=1.25,align:f="left",indent:p=0,shadow:m}=t,_=new Di({fontSize:i,wordWrap:d,wordWrapWidth:l,fontWeight:u,lineHeight:c*i,breakWords:d,fill:r,align:f,fontFamily:h,stroke:n?a:"transparent",strokeThickness:n?o:0,lineJoin:"round"});m&&(_.dropShadow=!0,_.dropShadowColor=m[0],_.dropShadowAngle=m[1]*(Math.PI/180),_.dropShadowBlur=m[2],_.dropShadowDistance=m[3]),super(e,_),this.position.x=p*i}}class Zw extends bt{constructor(t){super();const{start:e,control:i,end:r,json:n,duration:a,ease:o="power1.out",showControl:h=!1,loop:u=!1}=t;this._particleContainer=new q1,this.addChild(this._particleContainer);const d=new dt(this._particleContainer,n),l=this._createBezierPoints([e,...i,r],100,h),c={pathThrough:0};ut.to(c,{duration:a,pathThrough:l.length-1,repeat:u?-1:0,ease:o,onStart:()=>{d.emit=!0},onUpdate:()=>{const p=Math.floor(c.pathThrough),m=l[p];d.updateOwnerPos(m.x,m.y)},onComplete:()=>{ut.to(this,{alpha:0,duration:.5,onComplete:()=>{d.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new ct;f.add(()=>{d.update(1/75)}),f.start()}_createBezierPoints(t,e,i){const r=[];i&&t.forEach((n,a)=>{const o=new Fu({text:a+1,fontSize:16});o.position.set(n.x,n.y),this.addChild(o)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const i=t.length;let r=0,n=0;const a=[];for(let o=0;o<i;o++)a[o]=this._binomial(i-1,o);for(let o=0;o<i;o++){const h=t[o],u=a[o],d=Math.pow(e,o),l=Math.pow(1-e,i-1-o);r+=h.x*l*d*u,n+=h.y*l*d*u}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let i=1;for(let r=1;r<=e;r++)i=i*(t-r+1)/r;return i}}var xi=(s=>(s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping",s))(xi||{}),j=(s=>(s[s.setup=0]="setup",s[s.first=1]="first",s[s.replace=2]="replace",s[s.add=3]="add",s))(j||{}),Te=(s=>(s[s.mixIn=0]="mixIn",s[s.mixOut=1]="mixOut",s))(Te||{}),co=(s=>(s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent",s))(co||{}),Vs=(s=>(s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale",s))(Vs||{}),se=(s=>(s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection",s))(se||{});class t_{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 Qw{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}}const Xs=class{constructor(s=0,t=0,e=0,i=0){this.r=s,this.g=t,this.b=e,this.a=i}set(s,t,e,i){return this.r=s,this.g=t,this.b=e,this.a=i,this.clamp()}setFromColor(s){return this.r=s.r,this.g=s.g,this.b=s.b,this.a=s.a,this}setFromString(s){return s=s.charAt(0)=="#"?s.substr(1):s,this.r=parseInt(s.substr(0,2),16)/255,this.g=parseInt(s.substr(2,2),16)/255,this.b=parseInt(s.substr(4,2),16)/255,this.a=s.length!=8?1:parseInt(s.substr(6,2),16)/255,this}add(s,t,e,i){return this.r+=s,this.g+=t,this.b+=e,this.a+=i,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(s,t){s.r=((t&4278190080)>>>24)/255,s.g=((t&16711680)>>>16)/255,s.b=((t&65280)>>>8)/255,s.a=(t&255)/255}static rgb888ToColor(s,t){s.r=((t&16711680)>>>16)/255,s.g=((t&65280)>>>8)/255,s.b=(t&255)/255}static fromString(s){return new Xs().setFromString(s)}};let we=Xs;we.WHITE=new Xs(1,1,1,1),we.RED=new Xs(1,0,0,1),we.GREEN=new Xs(0,1,0,1),we.BLUE=new Xs(0,0,1,1),we.MAGENTA=new Xs(1,0,1,1);const Ni=class{static clamp(s,t,e){return s<t?t:s>e?e:s}static cosDeg(s){return Math.cos(s*Ni.degRad)}static sinDeg(s){return Math.sin(s*Ni.degRad)}static signum(s){return Math.sign(s)}static toInt(s){return s>0?Math.floor(s):Math.ceil(s)}static cbrt(s){const t=Math.pow(Math.abs(s),.3333333333333333);return s<0?-t:t}static randomTriangular(s,t){return Ni.randomTriangularWith(s,t,(s+t)*.5)}static randomTriangularWith(s,t,e){const i=Math.random(),r=t-s;return i<=(e-s)/r?s+Math.sqrt(i*r*(e-s)):t-Math.sqrt((1-i)*r*(t-e))}static isPowerOfTwo(s){return s&&(s&s-1)===0}};let L=Ni;L.PI=3.1415927,L.PI2=Ni.PI*2,L.radiansToDegrees=180/Ni.PI,L.radDeg=Ni.radiansToDegrees,L.degreesToRadians=Ni.PI/180,L.degRad=Ni.degreesToRadians;class Jw{apply(t,e,i){return t+(e-t)*this.applyInternal(i)}}class tE extends Jw{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 eE extends tE{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Cr=class{static arrayCopy(s,t,e,i,r){for(let n=t,a=i;n<t+r;n++,a++)e[a]=s[n]}static arrayFill(s,t,e,i){for(let r=t;r<e;r++)s[r]=i}static setArraySize(s,t,e=0){const i=s.length;if(i==t)return s;if(s.length=t,i<t)for(let r=i;r<t;r++)s[r]=e;return s}static ensureArrayCapacity(s,t,e=0){return s.length>=t?s:Cr.setArraySize(s,t,e)}static newArray(s,t){const e=new Array(s);for(let i=0;i<s;i++)e[i]=t;return e}static newFloatArray(s){if(Cr.SUPPORTS_TYPED_ARRAYS)return new Float32Array(s);const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(s){if(Cr.SUPPORTS_TYPED_ARRAYS)return new Int16Array(s);const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(s){return Cr.SUPPORTS_TYPED_ARRAYS?new Float32Array(s):s}static toSinglePrecision(s){return Cr.SUPPORTS_TYPED_ARRAYS?Math.fround(s):s}static webkit602BugfixHelper(s,t){}static contains(s,t,e=!0){for(let i=0;i<s.length;i++)if(s[i]==t)return!0;return!1}static enumValue(s,t){return s[t[0].toUpperCase()+t.slice(1)]}};let Q=Cr;Q.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class iE{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 sE{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 rE={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},us=[0,0,0];class nE extends _e{constructor(){super(...arguments),this.region=null,this.attachment=null}}class aE extends j1{constructor(t,e,i,r,n){super(t,e,i,r,n),this.region=null,this.attachment=null}}const e_=class extends bt{constructor(s){if(super(),!s)throw new Error("The spineData param is required.");if(typeof s=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=s,this.createSkeleton(s),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t],r=i.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===xi.Region){const a=r.name,o=this.createSprite(i,r,a);i.currentSprite=o,i.currentSpriteName=a,n.addChild(o)}else if(r.type===xi.Mesh){const a=this.createMesh(i,r);i.currentMesh=a,i.currentMeshId=r.id,i.currentMeshName=r.name,n.addChild(a)}else r.type===xi.Clipping&&(this.createGraphics(i,r),n.addChild(i.clippingContainer),n.addChild(i.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(s){var t;s!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),s==null||s.registerSpine(this),this._debug=s)}get autoUpdate(){return this._autoUpdate}set autoUpdate(s){s!==this._autoUpdate&&(this._autoUpdate=s,this.updateTransform=s?e_.prototype.autoUpdateTransform:bt.prototype.updateTransform)}get tint(){return Qr(this.tintRgb)}set tint(s){this.tintRgb=Dd(s,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:rE.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(s){var u;const t=this.delayLimit;if(s>t&&(s=t),this.state.update(s),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,i=this.color;let r=null,n=null;i?(r=i.light,n=i.dark):r=this.tintRgb;for(let d=0,l=e.length;d<l;d++){const c=e[d],f=c.getAttachment(),p=this.slotContainers[d];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(c,f);let _=f.region;const g=f.color;switch(f!=null&&f.type){case xi.Region:if(p.transform.setFromMatrix(c.bone.matrix),_=f.region,c.currentMesh&&(c.currentMesh.visible=!1,c.currentMesh=null,c.currentMeshId=void 0,c.currentMeshName=void 0),!_){c.currentSprite&&(c.currentSprite.renderable=!1);break}if(!c.currentSpriteName||c.currentSpriteName!==f.name){const v=f.name;if(c.currentSprite&&(c.currentSprite.visible=!1),c.sprites=c.sprites||{},c.sprites[v]!==void 0)c.sprites[v].visible=!0;else{const b=this.createSprite(c,f,v);p.addChild(b)}c.currentSprite=c.sprites[v],c.currentSpriteName=v}c.currentSprite.renderable=!0,c.hackRegion||this.setSpriteRegion(f,c.currentSprite,_),c.currentSprite.color?m=c.currentSprite.color:(us[0]=r[0]*c.color.r*g.r,us[1]=r[1]*c.color.g*g.g,us[2]=r[2]*c.color.b*g.b,c.currentSprite.tint=Qr(us)),c.currentSprite.blendMode=c.blendMode;break;case xi.Mesh:if(c.currentSprite){c.currentSprite.visible=!1,c.currentSprite=null,c.currentSpriteName=void 0;const v=new ua;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!_){c.currentMesh&&(c.currentMesh.renderable=!1);break}const y=f.id;if(c.currentMeshId===void 0||c.currentMeshId!==y){const v=y;if(c.currentMesh&&(c.currentMesh.visible=!1),c.meshes=c.meshes||{},c.meshes[v]!==void 0)c.meshes[v].visible=!0;else{const b=this.createMesh(c,f);p.addChild(b)}c.currentMesh=c.meshes[v],c.currentMeshName=f.name,c.currentMeshId=v}c.currentMesh.renderable=!0,f.computeWorldVerticesOld(c,c.currentMesh.vertices),c.currentMesh.color?m=c.currentMesh.color:(us[0]=r[0]*c.color.r*g.r,us[1]=r[1]*c.color.g*g.g,us[2]=r[2]*c.color.b*g.b,c.currentMesh.tint=Qr(us)),c.currentMesh.blendMode=c.blendMode,c.hackRegion||this.setMeshRegion(f,c.currentMesh,_);break;case xi.Clipping:c.currentGraphics||(this.createGraphics(c,f),p.addChild(c.clippingContainer),p.addChild(c.currentGraphics)),this.updateGraphics(c,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=c.color.r*g.r,y=c.color.g*g.g,v=c.color.b*g.b;m.setLight(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v)),c.darkColor?(x=c.darkColor.r,y=c.darkColor.g,v=c.darkColor.b):(x=0,y=0,v=0),m.setDark(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v))}p.alpha=c.color.a}const a=this.skeleton.drawOrder;let o=null,h=null;for(let d=0,l=a.length;d<l;d++){const c=e[a[d].data.index],f=this.slotContainers[a[d].data.index];if(h||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),c.currentGraphics&&c.getAttachment())h=c.clippingContainer,o=c.getAttachment(),h.children.length=0,this.children[d]=f,o.endSlot===c.data&&(o.endSlot=null);else if(h){let p=this.tempClipContainers[d];p||(p=this.tempClipContainers[d]=this.newContainer(),p.visible=!1),this.children[d]=p,f.parent=null,h.addChild(f),o.endSlot==c.data&&(h.renderable=!0,h=null,o=null)}else this.children[d]=f}(u=this._debug)==null||u.renderDebug(this)}setSpriteRegion(s,t,e){t.attachment===s&&t.region===e||(t.region=e,t.attachment=s,t.texture=e.texture,t.rotation=s.rotation*L.degRad,t.position.x=s.x,t.position.y=s.y,t.alpha=s.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=s.scaleX*s.width/e.originalWidth,t.scale.y=-s.scaleY*s.height/e.originalHeight))}setMeshRegion(s,t,e){t.attachment===s&&t.region===e||(t.region=e,t.attachment=s,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(s.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const s=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(s)}bt.prototype.updateTransform.call(this)}createSprite(s,t,e){let i=t.region;s.hackAttachment===t&&(i=s.hackRegion);const r=i?i.texture:null,n=this.newSprite(r);return n.anchor.set(.5),i&&this.setSpriteRegion(t,n,t.region),s.sprites=s.sprites||{},s.sprites[e]=n,n}createMesh(s,t){let e=t.region;s.hackAttachment===t&&(e=s.hackRegion,s.hackAttachment=null,s.hackRegion=null);const i=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),Ue.TRIANGLES);return typeof i._canvasPadding<"u"&&(i._canvasPadding=1.5),i.alpha=t.color.a,i.region=t.region,e&&this.setMeshRegion(t,i,e),s.meshes=s.meshes||{},s.meshes[t.id]=i,i}createGraphics(s,t){const e=this.newGraphics(),i=new Yi([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(i),e.renderable=!1,s.currentGraphics=e,s.clippingContainer=this.newContainer(),s.clippingContainer.mask=s.currentGraphics,e}updateGraphics(s,t){const e=s.currentGraphics.geometry,i=e.graphicsData[0].shape.points,r=t.worldVerticesLength;i.length=r,t.computeWorldVertices(s,0,r,i,0,2),e.invalidate()}hackTextureBySlotIndex(s,t=null,e=null){const i=this.skeleton.slots[s];if(!i)return!1;const r=i.getAttachment();let n=r.region;return t?(n=new t_,n.texture=t,n.size=e,i.hackRegion=n,i.hackAttachment=r):(i.hackRegion=null,i.hackAttachment=null),i.currentSprite?this.setSpriteRegion(r,i.currentSprite,n):i.currentMesh&&this.setMeshRegion(r,i.currentMesh,n),!0}hackTextureBySlotName(s,t=null,e=null){const i=this.skeleton.findSlotIndex(s);return i==-1?!1:this.hackTextureBySlotIndex(i,t,e)}hackTextureAttachment(s,t,e,i=null){const r=this.skeleton.findSlotIndex(s),n=this.skeleton.getAttachmentByName(s,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const o=a.getAttachment();if(t===o.name){let h=n.region;return e?(h=new t_,h.texture=e,h.size=i,a.hackRegion=h,a.hackAttachment=o):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=h?(this.setSpriteRegion(o,a.currentSprite,h),a.currentSprite.region=h):a.currentMesh&&a.currentMesh.region!=h&&this.setMeshRegion(o,a.currentMesh,h),!0}return!1}newContainer(){return new bt}newSprite(s){return new nE(s)}newGraphics(){return new ui}newMesh(s,t,e,i,r){return new aE(s,t,e,i,r)}transformHack(){return 1}hackAttachmentGroups(s,t,e){if(!s)return;const i=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const o=this.skeleton.slots[n],h=o.currentSpriteName||o.currentMeshName||"",u=o.currentSprite||o.currentMesh;h.endsWith(s)?(u.parentGroup=t,r.push(u)):e&&u&&(u.parentGroup=e,i.push(u))}return[i,r]}destroy(s){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t];for(const r in i.meshes)i.meshes[r].destroy(s);i.meshes=null;for(const r in i.sprites)i.sprites[r].destroy(s);i.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(s);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(s)}};let ku=e_;ku.clippingPolygon=[],Object.defineProperty(ku.prototype,"visible",{get(){return this._visible},set(s){s!==this._visible&&(this._visible=s,s&&(this.lastTime=0))}});class i_{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}}const s_=class extends i_{constructor(s){super(s),this.id=(s_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(s,t){this.computeWorldVertices(s,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(s,t,e,i,r,n){e=r+(e>>1)*n;const a=s.bone.skeleton,o=s.deform;let h=this.vertices;const u=this.bones;if(u==null){o.length>0&&(h=o);const f=s.bone.matrix,p=f.tx,m=f.ty,_=f.a,g=f.c,x=f.b,y=f.d;for(let v=t,b=r;b<e;v+=2,b+=n){const E=h[v],w=h[v+1];i[b]=E*_+w*g+p,i[b+1]=E*x+w*y+m}return}let d=0,l=0;for(let f=0;f<t;f+=2){const p=u[d];d+=p+1,l+=p}const c=a.bones;if(o.length==0)for(let f=r,p=l*3;f<e;f+=n){let m=0,_=0,g=u[d++];for(g+=d;d<g;d++,p+=3){const x=c[u[d]].matrix,y=h[p],v=h[p+1],b=h[p+2];m+=(y*x.a+v*x.c+x.tx)*b,_+=(y*x.b+v*x.d+x.ty)*b}i[f]=m,i[f+1]=_}else{const f=o;for(let p=r,m=l*3,_=l<<1;p<e;p+=n){let g=0,x=0,y=u[d++];for(y+=d;d<y;d++,m+=3,_+=2){const v=c[u[d]].matrix,b=h[m]+f[_],E=h[m+1]+f[_+1],w=h[m+2];g+=(b*v.a+E*v.c+v.tx)*w,x+=(b*v.b+E*v.d+v.ty)*w}i[p]=g,i[p+1]=x}}}copyTo(s){this.bones!=null?(s.bones=new Array(this.bones.length),Q.arrayCopy(this.bones,0,s.bones,0,this.bones.length)):s.bones=null,this.vertices!=null?(s.vertices=Q.newFloatArray(this.vertices.length),Q.arrayCopy(this.vertices,0,s.vertices,0,this.vertices.length)):s.vertices=null,s.worldVerticesLength=this.worldVerticesLength,s.deformAttachment=this.deformAttachment}};let Lu=s_;Lu.nextID=0;class fo extends Lu{constructor(t){super(t),this.type=xi.Mesh,this.color=new we(1,1,1,1),this.tempColor=new we(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 fo(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),Q.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),Q.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),Q.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new fo(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}}class An extends Lu{constructor(t){super(t),this.type=xi.Path,this.closed=!1,this.constantSpeed=!1,this.color=new we(1,1,1,1)}copy(){const t=new An(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Q.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class r_{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 we,this.darkColor=t.darkColor==null?null:new we,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 Kt=class extends i_{constructor(s){super(s),this.type=xi.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 we(1,1,1,1),this.offset=Q.newFloatArray(8),this.uvs=Q.newFloatArray(8),this.tempColor=new we(1,1,1,1)}updateOffset(){const s=this.width/this.region.originalWidth*this.scaleX,t=this.height/this.region.originalHeight*this.scaleY,e=-this.width/2*this.scaleX+this.region.offsetX*s,i=-this.height/2*this.scaleY+this.region.offsetY*t,r=e+this.region.width*s,n=i+this.region.height*t,a=this.rotation*Math.PI/180,o=Math.cos(a),h=Math.sin(a),u=e*o+this.x,d=e*h,l=i*o+this.y,c=i*h,f=r*o+this.x,p=r*h,m=n*o+this.y,_=n*h,g=this.offset;g[Kt.OX1]=u-c,g[Kt.OY1]=l+d,g[Kt.OX2]=u-_,g[Kt.OY2]=m+d,g[Kt.OX3]=f-_,g[Kt.OY3]=m+p,g[Kt.OX4]=f-c,g[Kt.OY4]=l+p}setRegion(s){this.region=s;const t=this.uvs;s.rotate?(t[2]=s.u,t[3]=s.v2,t[4]=s.u,t[5]=s.v,t[6]=s.u2,t[7]=s.v,t[0]=s.u2,t[1]=s.v2):(t[0]=s.u,t[1]=s.v2,t[2]=s.u,t[3]=s.v,t[4]=s.u2,t[5]=s.v,t[6]=s.u2,t[7]=s.v2)}computeWorldVertices(s,t,e,i){const r=this.offset,n=s instanceof r_?s.bone.matrix:s.matrix,a=n.tx,o=n.ty,h=n.a,u=n.c,d=n.b,l=n.d;let c=0,f=0;c=r[Kt.OX1],f=r[Kt.OY1],t[e]=c*h+f*u+a,t[e+1]=c*d+f*l+o,e+=i,c=r[Kt.OX2],f=r[Kt.OY2],t[e]=c*h+f*u+a,t[e+1]=c*d+f*l+o,e+=i,c=r[Kt.OX3],f=r[Kt.OY3],t[e]=c*h+f*u+a,t[e+1]=c*d+f*l+o,e+=i,c=r[Kt.OX4],f=r[Kt.OY4],t[e]=c*h+f*u+a,t[e+1]=c*d+f*l+o}copy(){const s=new Kt(this.name);return s.region=this.region,s.rendererObject=this.rendererObject,s.path=this.path,s.x=this.x,s.y=this.y,s.scaleX=this.scaleX,s.scaleY=this.scaleY,s.rotation=this.rotation,s.width=this.width,s.height=this.height,Q.arrayCopy(this.uvs,0,s.uvs,0,8),Q.arrayCopy(this.offset,0,s.offset,0,8),s.color.setFromColor(this.color),s}};let et=Kt;et.OX1=0,et.OY1=1,et.OX2=2,et.OY2=3,et.OX3=4,et.OY3=5,et.OX4=6,et.OY4=7,et.X1=0,et.Y1=1,et.C1R=2,et.C1G=3,et.C1B=4,et.C1A=5,et.U1=6,et.V1=7,et.X2=8,et.Y2=9,et.C2R=10,et.C2G=11,et.C2B=12,et.C2A=13,et.U2=14,et.V2=15,et.X3=16,et.Y3=17,et.C3R=18,et.C3G=19,et.C3B=20,et.C3A=21,et.U3=22,et.V3=23,et.X4=24,et.Y4=25,et.C4R=26,et.C4G=27,et.C4B=28,et.C4A=29,et.U4=30,et.V4=31,new eE(2);class pe{constructor(t,e,i){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 r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=i}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,i,r,n,a,o,h){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(i%=this.duration,e>0&&(e%=this.duration));const u=this.timelines;for(let d=0,l=u.length;d<l;d++)u[d].apply(t,e,i,n,a,o,h)}static binarySearch(t,e,i=1){let r=0,n=t.length/i-2;if(n==0)return i;let a=n>>>1;for(;;){if(t[(a+1)*i]<=e?r=a+1:n=a,r==n)return(r+1)*i;a=r+n>>>1}}static linearSearch(t,e,i){for(let r=0,n=t.length-i;r<=n;r+=i)if(t[r]>e)return r;return-1}}const Gt=class{constructor(s){if(s<=0)throw new Error(`frameCount must be > 0: ${s}`);this.curves=Q.newFloatArray((s-1)*Gt.BEZIER_SIZE)}getFrameCount(){return this.curves.length/Gt.BEZIER_SIZE+1}setLinear(s){this.curves[s*Gt.BEZIER_SIZE]=Gt.LINEAR}setStepped(s){this.curves[s*Gt.BEZIER_SIZE]=Gt.STEPPED}getCurveType(s){const t=s*Gt.BEZIER_SIZE;if(t==this.curves.length)return Gt.LINEAR;const e=this.curves[t];return e==Gt.LINEAR?Gt.LINEAR:e==Gt.STEPPED?Gt.STEPPED:Gt.BEZIER}setCurve(s,t,e,i,r){const n=(-t*2+i)*.03,a=(-e*2+r)*.03,o=((t-i)*3+1)*.006,h=((e-r)*3+1)*.006;let u=n*2+o,d=a*2+h,l=t*.3+n+o*.16666667,c=e*.3+a+h*.16666667,f=s*Gt.BEZIER_SIZE;const p=this.curves;p[f++]=Gt.BEZIER;let m=l,_=c;for(let g=f+Gt.BEZIER_SIZE-1;f<g;f+=2)p[f]=m,p[f+1]=_,l+=u,c+=d,u+=o,d+=h,m+=l,_+=c}getCurvePercent(s,t){t=L.clamp(t,0,1);const e=this.curves;let i=s*Gt.BEZIER_SIZE;const r=e[i];if(r==Gt.LINEAR)return t;if(r==Gt.STEPPED)return 0;i++;let n=0;for(let o=i,h=i+Gt.BEZIER_SIZE-1;i<h;i+=2)if(n=e[i],n>=t){let u,d;return i==o?(u=0,d=0):(u=e[i-2],d=e[i-1]),d+(e[i+1]-d)*(t-u)/(n-u)}const a=e[i-1];return a+(1-a)*(t-n)/(1-n)}};let Fe=Gt;Fe.LINEAR=0,Fe.STEPPED=1,Fe.BEZIER=2,Fe.BEZIER_SIZE=10*2-1;const cs=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(s,t,e){s<<=1,this.frames[s]=t,this.frames[s+cs.ROTATION]=e}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.bones[this.boneIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.rotation=h.data.rotation;return;case j.first:const p=h.data.rotation-h.rotation;h.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=o[o.length-cs.ENTRIES]){let p=o[o.length+cs.PREV_ROTATION];switch(n){case j.setup:h.rotation=h.data.rotation+p*r;break;case j.first:case j.replace:p+=h.data.rotation-h.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case j.add:h.rotation+=p*r}return}const u=pe.binarySearch(o,e,cs.ENTRIES),d=o[u+cs.PREV_ROTATION],l=o[u],c=this.getCurvePercent((u>>1)-1,1-(e-l)/(o[u+cs.PREV_TIME]-l));let f=o[u+cs.ROTATION]-d;switch(f=d+(f-(16384-(16384.499999999996-f/360|0))*360)*c,n){case j.setup:h.rotation=h.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case j.first:case j.replace:f+=h.data.rotation-h.rotation;case j.add:h.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let ke=cs;ke.ENTRIES=2,ke.PREV_TIME=-2,ke.PREV_ROTATION=-1,ke.ROTATION=1;const ae=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ae.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(s,t,e,i){s*=ae.ENTRIES,this.frames[s]=t,this.frames[s+ae.X]=e,this.frames[s+ae.Y]=i}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.bones[this.boneIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.x=h.data.x,h.y=h.data.y;return;case j.first:h.x+=(h.data.x-h.x)*r,h.y+=(h.data.y-h.y)*r}return}let u=0,d=0;if(e>=o[o.length-ae.ENTRIES])u=o[o.length+ae.PREV_X],d=o[o.length+ae.PREV_Y];else{const l=pe.binarySearch(o,e,ae.ENTRIES);u=o[l+ae.PREV_X],d=o[l+ae.PREV_Y];const c=o[l],f=this.getCurvePercent(l/ae.ENTRIES-1,1-(e-c)/(o[l+ae.PREV_TIME]-c));u+=(o[l+ae.X]-u)*f,d+=(o[l+ae.Y]-d)*f}switch(n){case j.setup:h.x=h.data.x+u*r,h.y=h.data.y+d*r;break;case j.first:case j.replace:h.x+=(h.data.x+u-h.x)*r,h.y+=(h.data.y+d-h.y)*r;break;case j.add:h.x+=u*r,h.y+=d*r}}};let Pr=ae;Pr.ENTRIES=3,Pr.PREV_TIME=-3,Pr.PREV_X=-2,Pr.PREV_Y=-1,Pr.X=1,Pr.Y=2;const It=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*It.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(s,t,e,i,r,n){s*=It.ENTRIES,this.frames[s]=t,this.frames[s+It.R]=e,this.frames[s+It.G]=i,this.frames[s+It.B]=r,this.frames[s+It.A]=n}apply(s,t,e,i,r,n,a){const o=s.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(e<h[0]){switch(n){case j.setup:o.color.setFromColor(o.data.color);return;case j.first:const f=o.color,p=o.data.color;f.add((p.r-f.r)*r,(p.g-f.g)*r,(p.b-f.b)*r,(p.a-f.a)*r)}return}let u=0,d=0,l=0,c=0;if(e>=h[h.length-It.ENTRIES]){const f=h.length;u=h[f+It.PREV_R],d=h[f+It.PREV_G],l=h[f+It.PREV_B],c=h[f+It.PREV_A]}else{const f=pe.binarySearch(h,e,It.ENTRIES);u=h[f+It.PREV_R],d=h[f+It.PREV_G],l=h[f+It.PREV_B],c=h[f+It.PREV_A];const p=h[f],m=this.getCurvePercent(f/It.ENTRIES-1,1-(e-p)/(h[f+It.PREV_TIME]-p));u+=(h[f+It.R]-u)*m,d+=(h[f+It.G]-d)*m,l+=(h[f+It.B]-l)*m,c+=(h[f+It.A]-c)*m}if(r==1)o.color.set(u,d,l,c);else{const f=o.color;n==j.setup&&f.setFromColor(o.data.color),f.add((u-f.r)*r,(d-f.g)*r,(l-f.b)*r,(c-f.a)*r)}}};let vi=It;vi.ENTRIES=5,vi.PREV_TIME=-5,vi.PREV_R=-4,vi.PREV_G=-3,vi.PREV_B=-2,vi.PREV_A=-1,vi.R=1,vi.G=2,vi.B=3,vi.A=4;const ot=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ot.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(s,t,e,i,r,n,a,o,h){s*=ot.ENTRIES,this.frames[s]=t,this.frames[s+ot.R]=e,this.frames[s+ot.G]=i,this.frames[s+ot.B]=r,this.frames[s+ot.A]=n,this.frames[s+ot.R2]=a,this.frames[s+ot.G2]=o,this.frames[s+ot.B2]=h}apply(s,t,e,i,r,n,a){const o=s.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(e<h[0]){switch(n){case j.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case j.first:const _=o.color,g=o.darkColor,x=o.data.color,y=o.data.darkColor;_.add((x.r-_.r)*r,(x.g-_.g)*r,(x.b-_.b)*r,(x.a-_.a)*r),g.add((y.r-g.r)*r,(y.g-g.g)*r,(y.b-g.b)*r,0)}return}let u=0,d=0,l=0,c=0,f=0,p=0,m=0;if(e>=h[h.length-ot.ENTRIES]){const _=h.length;u=h[_+ot.PREV_R],d=h[_+ot.PREV_G],l=h[_+ot.PREV_B],c=h[_+ot.PREV_A],f=h[_+ot.PREV_R2],p=h[_+ot.PREV_G2],m=h[_+ot.PREV_B2]}else{const _=pe.binarySearch(h,e,ot.ENTRIES);u=h[_+ot.PREV_R],d=h[_+ot.PREV_G],l=h[_+ot.PREV_B],c=h[_+ot.PREV_A],f=h[_+ot.PREV_R2],p=h[_+ot.PREV_G2],m=h[_+ot.PREV_B2];const g=h[_],x=this.getCurvePercent(_/ot.ENTRIES-1,1-(e-g)/(h[_+ot.PREV_TIME]-g));u+=(h[_+ot.R]-u)*x,d+=(h[_+ot.G]-d)*x,l+=(h[_+ot.B]-l)*x,c+=(h[_+ot.A]-c)*x,f+=(h[_+ot.R2]-f)*x,p+=(h[_+ot.G2]-p)*x,m+=(h[_+ot.B2]-m)*x}if(r==1)o.color.set(u,d,l,c),o.darkColor.set(f,p,m,1);else{const _=o.color,g=o.darkColor;n==j.setup&&(_.setFromColor(o.data.color),g.setFromColor(o.data.darkColor)),_.add((u-_.r)*r,(d-_.g)*r,(l-_.b)*r,(c-_.a)*r),g.add((f-g.r)*r,(p-g.g)*r,(m-g.b)*r,0)}}};let re=ot;re.ENTRIES=8,re.PREV_TIME=-8,re.PREV_R=-7,re.PREV_G=-6,re.PREV_B=-5,re.PREV_A=-4,re.PREV_R2=-3,re.PREV_G2=-2,re.PREV_B2=-1,re.R=1,re.G=2,re.B=3,re.A=4,re.R2=5,re.G2=6,re.B2=7;class po{constructor(t){this.frames=Q.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i}apply(t,e,i,r,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;if(o==Te.mixOut){a==j.setup&&this.setAttachment(t,h,h.data.attachmentName);return}const u=this.frames;if(i<u[0]){(a==j.setup||a==j.first)&&this.setAttachment(t,h,h.data.attachmentName);return}let d=0;i>=u[u.length-1]?d=u.length-1:d=pe.binarySearch(u,i,1)-1;const l=this.attachmentNames[d];t.slots[this.slotIndex].setAttachment(l==null?null:t.getAttachment(this.slotIndex,l))}setAttachment(t,e,i){e.setAttachment(i==null?null:t.getAttachment(this.slotIndex,i))}}class oE{constructor(t){this.frames=Q.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,i,r,n,a,o){if(r==null)return;const h=this.frames,u=this.frames.length;if(e>i)this.apply(t,e,Number.MAX_VALUE,r,n,a,o),e=-1;else if(e>=h[u-1])return;if(i<h[0])return;let d=0;if(e<h[0])d=0;else{d=pe.binarySearch(h,e);const l=h[d];for(;d>0&&h[d-1]==l;)d--}for(;d<u&&i>=h[d];d++)r.push(this.events[d])}}class Nu{constructor(t){this.frames=Q.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.drawOrders[t]=i}apply(t,e,i,r,n,a,o){const h=t.drawOrder,u=t.slots;if(o==Te.mixOut&&a==j.setup){Q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const d=this.frames;if(i<d[0]){(a==j.setup||a==j.first)&&Q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let l=0;i>=d[d.length-1]?l=d.length-1:l=pe.binarySearch(d,i)-1;const c=this.drawOrders[l];if(c==null)Q.arrayCopy(u,0,h,0,u.length);else for(let f=0,p=c.length;f<p;f++)h[f]=u[c[f]]}}const ht=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ht.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(s,t,e,i,r,n,a){s*=ht.ENTRIES,this.frames[s]=t,this.frames[s+ht.MIX]=e,this.frames[s+ht.SOFTNESS]=i,this.frames[s+ht.BEND_DIRECTION]=r,this.frames[s+ht.COMPRESS]=n?1:0,this.frames[s+ht.STRETCH]=a?1:0}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.ikConstraints[this.ikConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch;return;case j.first:h.mix+=(h.data.mix-h.mix)*r,h.softness+=(h.data.softness-h.softness)*r,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}return}if(e>=o[o.length-ht.ENTRIES]){n==j.setup?(h.mix=h.data.mix+(o[o.length+ht.PREV_MIX]-h.data.mix)*r,h.softness=h.data.softness+(o[o.length+ht.PREV_SOFTNESS]-h.data.softness)*r,a==Te.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=o[o.length+ht.PREV_BEND_DIRECTION],h.compress=o[o.length+ht.PREV_COMPRESS]!=0,h.stretch=o[o.length+ht.PREV_STRETCH]!=0)):(h.mix+=(o[o.length+ht.PREV_MIX]-h.mix)*r,h.softness+=(o[o.length+ht.PREV_SOFTNESS]-h.softness)*r,a==Te.mixIn&&(h.bendDirection=o[o.length+ht.PREV_BEND_DIRECTION],h.compress=o[o.length+ht.PREV_COMPRESS]!=0,h.stretch=o[o.length+ht.PREV_STRETCH]!=0));return}const u=pe.binarySearch(o,e,ht.ENTRIES),d=o[u+ht.PREV_MIX],l=o[u+ht.PREV_SOFTNESS],c=o[u],f=this.getCurvePercent(u/ht.ENTRIES-1,1-(e-c)/(o[u+ht.PREV_TIME]-c));n==j.setup?(h.mix=h.data.mix+(d+(o[u+ht.MIX]-d)*f-h.data.mix)*r,h.softness=h.data.softness+(l+(o[u+ht.SOFTNESS]-l)*f-h.data.softness)*r,a==Te.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=o[u+ht.PREV_BEND_DIRECTION],h.compress=o[u+ht.PREV_COMPRESS]!=0,h.stretch=o[u+ht.PREV_STRETCH]!=0)):(h.mix+=(d+(o[u+ht.MIX]-d)*f-h.mix)*r,h.softness+=(l+(o[u+ht.SOFTNESS]-l)*f-h.softness)*r,a==Te.mixIn&&(h.bendDirection=o[u+ht.PREV_BEND_DIRECTION],h.compress=o[u+ht.PREV_COMPRESS]!=0,h.stretch=o[u+ht.PREV_STRETCH]!=0))}};let Le=ht;Le.ENTRIES=6,Le.PREV_TIME=-6,Le.PREV_MIX=-5,Le.PREV_SOFTNESS=-4,Le.PREV_BEND_DIRECTION=-3,Le.PREV_COMPRESS=-2,Le.PREV_STRETCH=-1,Le.MIX=1,Le.SOFTNESS=2,Le.BEND_DIRECTION=3,Le.COMPRESS=4,Le.STRETCH=5;const Rt=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*Rt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(s,t,e,i,r,n){s*=Rt.ENTRIES,this.frames[s]=t,this.frames[s+Rt.ROTATE]=e,this.frames[s+Rt.TRANSLATE]=i,this.frames[s+Rt.SCALE]=r,this.frames[s+Rt.SHEAR]=n}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.transformConstraints[this.transformConstraintIndex];if(!h.active)return;if(e<o[0]){const f=h.data;switch(n){case j.setup:h.rotateMix=f.rotateMix,h.translateMix=f.translateMix,h.scaleMix=f.scaleMix,h.shearMix=f.shearMix;return;case j.first:h.rotateMix+=(f.rotateMix-h.rotateMix)*r,h.translateMix+=(f.translateMix-h.translateMix)*r,h.scaleMix+=(f.scaleMix-h.scaleMix)*r,h.shearMix+=(f.shearMix-h.shearMix)*r}return}let u=0,d=0,l=0,c=0;if(e>=o[o.length-Rt.ENTRIES]){const f=o.length;u=o[f+Rt.PREV_ROTATE],d=o[f+Rt.PREV_TRANSLATE],l=o[f+Rt.PREV_SCALE],c=o[f+Rt.PREV_SHEAR]}else{const f=pe.binarySearch(o,e,Rt.ENTRIES);u=o[f+Rt.PREV_ROTATE],d=o[f+Rt.PREV_TRANSLATE],l=o[f+Rt.PREV_SCALE],c=o[f+Rt.PREV_SHEAR];const p=o[f],m=this.getCurvePercent(f/Rt.ENTRIES-1,1-(e-p)/(o[f+Rt.PREV_TIME]-p));u+=(o[f+Rt.ROTATE]-u)*m,d+=(o[f+Rt.TRANSLATE]-d)*m,l+=(o[f+Rt.SCALE]-l)*m,c+=(o[f+Rt.SHEAR]-c)*m}if(n==j.setup){const f=h.data;h.rotateMix=f.rotateMix+(u-f.rotateMix)*r,h.translateMix=f.translateMix+(d-f.translateMix)*r,h.scaleMix=f.scaleMix+(l-f.scaleMix)*r,h.shearMix=f.shearMix+(c-f.shearMix)*r}else h.rotateMix+=(u-h.rotateMix)*r,h.translateMix+=(d-h.translateMix)*r,h.scaleMix+=(l-h.scaleMix)*r,h.shearMix+=(c-h.shearMix)*r}};let bi=Rt;bi.ENTRIES=5,bi.PREV_TIME=-5,bi.PREV_ROTATE=-4,bi.PREV_TRANSLATE=-3,bi.PREV_SCALE=-2,bi.PREV_SHEAR=-1,bi.ROTATE=1,bi.TRANSLATE=2,bi.SCALE=3,bi.SHEAR=4;const Ye=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*Ye.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(s,t,e){s*=Ye.ENTRIES,this.frames[s]=t,this.frames[s+Ye.VALUE]=e}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.position=h.data.position;return;case j.first:h.position+=(h.data.position-h.position)*r}return}let u=0;if(e>=o[o.length-Ye.ENTRIES])u=o[o.length+Ye.PREV_VALUE];else{const d=pe.binarySearch(o,e,Ye.ENTRIES);u=o[d+Ye.PREV_VALUE];const l=o[d],c=this.getCurvePercent(d/Ye.ENTRIES-1,1-(e-l)/(o[d+Ye.PREV_TIME]-l));u+=(o[d+Ye.VALUE]-u)*c}n==j.setup?h.position=h.data.position+(u-h.data.position)*r:h.position+=(u-h.position)*r}};let mo=Ye;mo.ENTRIES=2,mo.PREV_TIME=-2,mo.PREV_VALUE=-1,mo.VALUE=1;const oe=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(s,t,e,i){s*=oe.ENTRIES,this.frames[s]=t,this.frames[s+oe.ROTATE]=e,this.frames[s+oe.TRANSLATE]=i}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.rotateMix=h.data.rotateMix,h.translateMix=h.data.translateMix;return;case j.first:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*r,h.translateMix+=(h.data.translateMix-h.translateMix)*r}return}let u=0,d=0;if(e>=o[o.length-oe.ENTRIES])u=o[o.length+oe.PREV_ROTATE],d=o[o.length+oe.PREV_TRANSLATE];else{const l=pe.binarySearch(o,e,oe.ENTRIES);u=o[l+oe.PREV_ROTATE],d=o[l+oe.PREV_TRANSLATE];const c=o[l],f=this.getCurvePercent(l/oe.ENTRIES-1,1-(e-c)/(o[l+oe.PREV_TIME]-c));u+=(o[l+oe.ROTATE]-u)*f,d+=(o[l+oe.TRANSLATE]-d)*f}n==j.setup?(h.rotateMix=h.data.rotateMix+(u-h.data.rotateMix)*r,h.translateMix=h.data.translateMix+(d-h.data.translateMix)*r):(h.rotateMix+=(u-h.rotateMix)*r,h.translateMix+=(d-h.translateMix)*r)}};let Ir=oe;Ir.ENTRIES=3,Ir.PREV_TIME=-3,Ir.PREV_ROTATE=-2,Ir.PREV_TRANSLATE=-1,Ir.ROTATE=1,Ir.TRANSLATE=2;const Mt=class{constructor(s){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new n_(this),this.propertyIDs=new Qw,this.animationsChanged=!1,this.trackEntryPool=new iE(()=>new Uu),this.data=s}update(s){s*=this.timeScale;const t=this.tracks;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=s*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let a=r.next;if(a!=null){const o=r.trackLast-a.delay;if(o>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(o/r.timeScale+s)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=s,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){t[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,s)){let o=r.mixingFrom;for(r.mixingFrom=null,o!=null&&(o.mixingTo=null);o!=null;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(s,t){const e=s.mixingFrom;if(e==null)return!0;const i=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,s.mixTime>0&&s.mixTime>=s.mixDuration?((e.totalAlpha==0||s.mixDuration==0)&&(s.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=s),s.interruptAlpha=e.interruptAlpha,this.queue.end(e)),i):(e.trackTime+=t*e.timeScale,s.mixTime+=t,!1)}apply(s){if(s==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let i=!1;for(let a=0,o=e.length;a<o;a++){const h=e[a];if(h==null||h.delay>0)continue;i=!0;const u=a==0?j.first:h.mixBlend;let d=h.alpha;h.mixingFrom!=null?d*=this.applyMixingFrom(h,s,u):h.trackTime>=h.trackEnd&&h.next==null&&(d=0);const l=h.animationLast,c=h.getAnimationTime(),f=h.animation.timelines.length,p=h.animation.timelines;if(a==0&&d==1||u==j.add)for(let m=0;m<f;m++){const _=p[m];_ instanceof po?this.applyAttachmentTimeline(_,s,c,u,!0):_.apply(s,l,c,t,d,u,Te.mixIn)}else{const m=h.timelineMode,_=h.timelinesRotation.length==0;_&&Q.setArraySize(h.timelinesRotation,f<<1,null);const g=h.timelinesRotation;for(let x=0;x<f;x++){const y=p[x],v=m[x]==Mt.SUBSEQUENT?u:j.setup;y instanceof ke?this.applyRotateTimeline(y,s,c,d,v,g,x<<1,_):y instanceof po?this.applyAttachmentTimeline(y,s,c,u,!0):y.apply(s,l,c,t,d,v,Te.mixIn)}}this.queueEvents(h,c),t.length=0,h.nextAnimationLast=c,h.nextTrackLast=h.trackTime}const r=this.unkeyedState+Mt.SETUP,n=s.slots;for(let a=0,o=s.slots.length;a<o;a++){const h=n[a];if(h.attachmentState==r){const u=h.data.attachmentName;h.setAttachment(u==null?null:s.getAttachment(h.data.index,u))}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(s,t,e){const i=s.mixingFrom;i.mixingFrom!=null&&this.applyMixingFrom(i,t,e);let r=0;s.mixDuration==0?(r=1,e==j.first&&(e=j.setup)):(r=s.mixTime/s.mixDuration,r>1&&(r=1),e!=j.first&&(e=i.mixBlend));const n=r<i.eventThreshold?this.events:null,a=r<i.attachmentThreshold,o=r<i.drawOrderThreshold,h=i.animationLast,u=i.getAnimationTime(),d=i.animation.timelines.length,l=i.animation.timelines,c=i.alpha*s.interruptAlpha,f=c*(1-r);if(e==j.add)for(let p=0;p<d;p++)l[p].apply(t,h,u,n,f,e,Te.mixOut);else{const p=i.timelineMode,m=i.timelineHoldMix,_=i.timelinesRotation.length==0;_&&Q.setArraySize(i.timelinesRotation,d<<1,null);const g=i.timelinesRotation;i.totalAlpha=0;for(let x=0;x<d;x++){const y=l[x];let v=Te.mixOut,b,E=0;switch(p[x]){case Mt.SUBSEQUENT:if(!o&&y instanceof Nu)continue;b=e,E=f;break;case Mt.FIRST:b=j.setup,E=f;break;case Mt.HOLD_SUBSEQUENT:b=e,E=c;break;case Mt.HOLD_FIRST:b=j.setup,E=c;break;default:b=j.setup;const w=m[x];E=c*Math.max(0,1-w.mixTime/w.mixDuration);break}i.totalAlpha+=E,y instanceof ke?this.applyRotateTimeline(y,t,u,E,b,g,x<<1,_):y instanceof po?this.applyAttachmentTimeline(y,t,u,b,a):(o&&y instanceof Nu&&b==j.setup&&(v=Te.mixIn),y.apply(t,h,u,n,E,b,v))}}return s.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(s,t,e,i,r){const n=t.slots[s.slotIndex];if(!n.bone.active)return;const a=s.frames;if(e<a[0])(i==j.setup||i==j.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let o;e>=a[a.length-1]?o=a.length-1:o=pe.binarySearch(a,e)-1,this.setAttachment(t,n,s.attachmentNames[o],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Mt.SETUP)}setAttachment(s,t,e,i){t.setAttachment(e==null?null:s.getAttachment(t.data.index,e)),i&&(t.attachmentState=this.unkeyedState+Mt.CURRENT)}applyRotateTimeline(s,t,e,i,r,n,a,o){if(o&&(n[a]=0),i==1){s.apply(t,0,e,null,1,r,Te.mixIn);return}const h=s,u=h.frames,d=t.bones[h.boneIndex];if(!d.active)return;let l=0,c=0;if(e<u[0])switch(r){case j.setup:d.rotation=d.data.rotation;default:return;case j.first:l=d.rotation,c=d.data.rotation}else if(l=r==j.setup?d.data.rotation:d.rotation,e>=u[u.length-ke.ENTRIES])c=d.data.rotation+u[u.length+ke.PREV_ROTATION];else{const m=pe.binarySearch(u,e,ke.ENTRIES),_=u[m+ke.PREV_ROTATION],g=u[m],x=h.getCurvePercent((m>>1)-1,1-(e-g)/(u[m+ke.PREV_TIME]-g));c=u[m+ke.ROTATION]-_,c-=(16384-(16384.499999999996-c/360|0))*360,c=_+c*x+d.data.rotation,c-=(16384-(16384.499999999996-c/360|0))*360}let f=0,p=c-l;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,_=0;o?(m=0,_=p):(m=n[a],_=n[a+1]);const g=p>0;let x=m>=0;L.signum(_)!=L.signum(p)&&Math.abs(_)<=90&&(Math.abs(m)>180&&(m+=360*L.signum(m)),x=g),f=p+m-m%360,x!=g&&(f+=360*L.signum(m)),n[a]=f}n[a+1]=p,l+=f*i,d.rotation=l-(16384-(16384.499999999996-l/360|0))*360}queueEvents(s,t){const e=s.animationStart,i=s.animationEnd,r=i-e,n=s.trackLast%r,a=this.events;let o=0;const h=a.length;for(;o<h;o++){const d=a[o];if(d.time<n)break;d.time>i||this.queue.event(s,d)}let u=!1;for(s.loop?u=r==0||n>s.trackTime%r:u=t>=i&&s.animationLast<i,u&&this.queue.complete(s);o<h;o++)a[o].time<e||this.queue.event(s,a[o])}clearTracks(){const s=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=s,this.queue.drain()}clearTrack(s){if(s>=this.tracks.length)return;const t=this.tracks[s];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const i=e.mixingFrom;if(i==null)break;this.queue.end(i),e.mixingFrom=null,e.mixingTo=null,e=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(s,t,e){const i=this.expandToIndex(s);this.tracks[s]=t,i!=null&&(e&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom!=null&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(s,t,e){const i=this.data.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(s,i,e)}setAnimationWith(s,t,e){if(t==null)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(s);r!=null&&(r.nextTrackLast==-1?(this.tracks[s]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,i=!1):this.disposeNext(r));const n=this.trackEntry(s,t,e,r);return this.setCurrent(s,n,i),this.queue.drain(),n}addAnimation(s,t,e,i){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(s,r,e,i)}addAnimationWith(s,t,e,i){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(s);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(s,t,e,r);if(r==null)this.setCurrent(s,n,!0),this.queue.drain();else if(r.next=n,i<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?i+=a*(1+(r.trackTime/a|0)):i+=Math.max(a,r.trackTime),i-=this.data.getMix(r.animation,t)):i=r.trackTime}return n.delay=i,n}setEmptyAnimation(s,t){const e=this.setAnimationWith(s,Mt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(s,t,e){e<=0&&(e-=t);const i=this.addAnimationWith(s,Mt.emptyAnimation,!1,e);return i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(s){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e<i;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,s)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(s){return s<this.tracks.length?this.tracks[s]:(Q.ensureArrayCapacity(this.tracks,s+1,null),this.tracks.length=s+1,null)}trackEntry(s,t,e,i){const r=this.trackEntryPool.obtain();return r.trackIndex=s,r.animation=t,r.loop=e,r.holdPrevious=!1,r.eventThreshold=0,r.attachmentThreshold=0,r.drawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.interruptAlpha=1,r.mixTime=0,r.mixDuration=i==null?0:this.data.getMix(i.animation,t),r.mixBlend=j.replace,r}disposeNext(s){let t=s.next;for(;t!=null;)this.queue.dispose(t),t=t.next;s.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let s=0,t=this.tracks.length;s<t;s++){let e=this.tracks[s];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=j.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(s){const t=s.mixingTo,e=s.animation.timelines,i=s.animation.timelines.length,r=Q.setArraySize(s.timelineMode,i);s.timelineHoldMix.length=0;const n=Q.setArraySize(s.timelineHoldMix,i),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let o=0;o<i;o++)r[o]=a.add(e[o].getPropertyId())?Mt.HOLD_FIRST:Mt.HOLD_SUBSEQUENT;return}t:for(let o=0;o<i;o++){const h=e[o],u=h.getPropertyId();if(!a.add(u))r[o]=Mt.SUBSEQUENT;else if(t==null||h instanceof po||h instanceof Nu||h instanceof oE||!t.animation.hasTimeline(u))r[o]=Mt.FIRST;else{for(let d=t.mixingTo;d!=null;d=d.mixingTo)if(!d.animation.hasTimeline(u)){if(s.mixDuration>0){r[o]=Mt.HOLD_MIX,n[o]=d;continue t}break}r[o]=Mt.HOLD_FIRST}}}getCurrent(s){return s>=this.tracks.length?null:this.tracks[s]}addListener(s){if(s==null)throw new Error("listener cannot be null.");this.listeners.push(s)}removeListener(s){const t=this.listeners.indexOf(s);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(s,t,e){Mt.deprecatedWarning1||(Mt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(s,t,e)}addAnimationByName(s,t,e,i){Mt.deprecatedWarning2||(Mt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(s,t,e,i)}hasAnimation(s){return this.data.skeletonData.findAnimation(s)!==null}hasAnimationByName(s){return Mt.deprecatedWarning3||(Mt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(s)}};let Ne=Mt;Ne.emptyAnimation=new pe("<empty>",[],0),Ne.SUBSEQUENT=0,Ne.FIRST=1,Ne.HOLD_SUBSEQUENT=2,Ne.HOLD_FIRST=3,Ne.HOLD_MIX=4,Ne.SETUP=1,Ne.CURRENT=2,Ne.deprecatedWarning1=!1,Ne.deprecatedWarning2=!1,Ne.deprecatedWarning3=!1;const Ui=class{constructor(){this.mixBlend=j.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 s=this.animationEnd-this.animationStart;return s==0?this.animationStart:this.trackTime%s+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(s){this.animationLast=s,this.nextAnimationLast=s}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ui.deprecatedWarning1||(Ui.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(s){Ui.deprecatedWarning1||(Ui.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=s}get endTime(){return Ui.deprecatedWarning2||(Ui.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(s){Ui.deprecatedWarning2||(Ui.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=s}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Uu=Ui;Uu.deprecatedWarning1=!1,Uu.deprecatedWarning2=!1;const Gu=class{constructor(s){this.objects=[],this.drainDisabled=!1,this.animState=s}start(s){this.objects.push(Ee.start),this.objects.push(s),this.animState.animationsChanged=!0}interrupt(s){this.objects.push(Ee.interrupt),this.objects.push(s)}end(s){this.objects.push(Ee.end),this.objects.push(s),this.animState.animationsChanged=!0}dispose(s){this.objects.push(Ee.dispose),this.objects.push(s)}complete(s){this.objects.push(Ee.complete),this.objects.push(s)}event(s,t){this.objects.push(Ee.event),this.objects.push(s),this.objects.push(t)}deprecateStuff(){return Gu.deprecatedWarning1||(Gu.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 s=this.objects,t=this.animState.listeners;for(let e=0;e<s.length;e+=2){const i=s[e],r=s[e+1];switch(i){case Ee.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let o=0;o<t.length;o++)t[o].start&&t[o].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case Ee.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<t.length;o++)t[o].interrupt&&t[o].interrupt(r);break;case Ee.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let o=0;o<t.length;o++)t[o].end&&t[o].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case Ee.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<t.length;o++)t[o].dispose&&t[o].dispose(r);this.animState.trackEntryPool.free(r);break;case Ee.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<t.length;o++)t[o].complete&&t[o].complete(r);const n=L.toInt(r.loopsCount());r.onComplete&&this.deprecateStuff()&&r.onComplete(r.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(r.trackIndex,n);break;case Ee.event:const a=s[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let o=0;o<t.length;o++)t[o].event&&t[o].event(r,a);r.onEvent&&this.deprecateStuff()&&r.onEvent(r.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(r.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let n_=Gu;n_.deprecatedWarning1=!1;var Ee=(s=>(s[s.start=0]="start",s[s.interrupt=1]="interrupt",s[s.end=2]="end",s[s.dispose=3]="dispose",s[s.complete=4]="complete",s[s.event=5]="event",s))(Ee||{});const Hu=class{constructor(s){if(this.animationToMixTime={},this.defaultMix=0,s==null)throw new Error("skeletonData cannot be null.");this.skeletonData=s}setMix(s,t,e){const i=this.skeletonData.findAnimation(s);if(i==null)throw new Error(`Animation not found: ${s}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(i,r,e)}setMixByName(s,t,e){Hu.deprecatedWarning1||(Hu.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(s,t,e)}setMixWith(s,t,e){if(s==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const i=`${s.name}.${t.name}`;this.animationToMixTime[i]=e}getMix(s,t){const e=`${s.name}.${t.name}`,i=this.animationToMixTime[e];return i===void 0?this.defaultMix:i}};let a_=Hu;a_.deprecatedWarning1=!1;class o_{constructor(t,e,i){if(this.matrix=new gt,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=i,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,i,r,n,a,o){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;const h=this.parent,u=this.matrix,d=this.skeleton.scaleX,l=-this.skeleton.scaleY;if(h==null){const _=this.skeleton,g=i+90+o;u.a=L.cosDeg(i+a)*r*d,u.c=L.cosDeg(g)*n*d,u.b=L.sinDeg(i+a)*r*l,u.d=L.sinDeg(g)*n*l,u.tx=t*d+_.x,u.ty=e*l+_.y;return}let c=h.matrix.a,f=h.matrix.c,p=h.matrix.b,m=h.matrix.d;switch(u.tx=c*t+f*e+h.matrix.tx,u.ty=p*t+m*e+h.matrix.ty,this.data.transformMode){case se.Normal:{const _=i+90+o,g=L.cosDeg(i+a)*r,x=L.cosDeg(_)*n,y=L.sinDeg(i+a)*r,v=L.sinDeg(_)*n;u.a=c*g+f*y,u.c=c*x+f*v,u.b=p*g+m*y,u.d=p*x+m*v;return}case se.OnlyTranslation:{const _=i+90+o;u.a=L.cosDeg(i+a)*r,u.c=L.cosDeg(_)*n,u.b=L.sinDeg(i+a)*r,u.d=L.sinDeg(_)*n;break}case se.NoRotationOrReflection:{let _=c*c+p*p,g=0;_>1e-4?(_=Math.abs(c*m-f*p)/_,c/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*_,m=c*_,g=Math.atan2(p,c)*L.radDeg):(c=0,p=0,g=90-Math.atan2(m,f)*L.radDeg);const x=i+a-g,y=i+o-g+90,v=L.cosDeg(x)*r,b=L.cosDeg(y)*n,E=L.sinDeg(x)*r,w=L.sinDeg(y)*n;u.a=c*v-f*E,u.c=c*b-f*w,u.b=p*v+m*E,u.d=p*b+m*w;break}case se.NoScale:case se.NoScaleOrReflection:{const _=L.cosDeg(i),g=L.sinDeg(i);let x=(c*_+f*g)/d,y=(p*_+m*g)/l,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==se.NoScale&&c*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(y,x),E=Math.cos(b)*v,w=Math.sin(b)*v,A=L.cosDeg(a)*r,T=L.cosDeg(90+o)*n,P=L.sinDeg(a)*r,k=L.sinDeg(90+o)*n;u.a=x*A+E*P,u.c=x*T+E*k,u.b=y*A+w*P,u.d=y*T+w*k;break}}u.a*=d,u.c*=d,u.b*=l,u.d*=l}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)*L.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*L.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)*L.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)*L.radDeg;return}const i=t.matrix,r=1/(i.a*i.d-i.b*i.c),n=e.tx-i.tx,a=e.ty-i.ty;this.ax=n*i.d*r-a*i.c*r,this.ay=a*i.a*r-n*i.b*r;const o=r*i.d,h=r*i.a,u=r*i.c,d=r*i.b,l=o*e.a-u*e.b,c=o*e.c-u*e.d,f=h*e.b-d*e.a,p=h*e.d-d*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(l*l+f*f),this.ascaleX>1e-4){const m=l*p-c*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(l*c+f*p,m)*L.radDeg,this.arotation=Math.atan2(f,l)*L.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(c*c+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,c)*L.radDeg}worldToLocal(t){const e=this.matrix,i=e.a,r=e.c,n=e.b,a=e.d,o=1/(i*a-r*n),h=t.x-e.tx,u=t.y-e.ty;return t.x=h*a*o-u*r*o,t.y=u*i*o-h*n*o,t}localToWorld(t){const e=this.matrix,i=t.x,r=t.y;return t.x=i*e.a+r*e.c+e.tx,t.y=i*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=L.sinDeg(t),i=L.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*i,r.d*i-r.c*e)*L.radDeg}localToWorldRotation(t){const e=L.sinDeg(t),i=L.cosDeg(t),r=this.matrix;return Math.atan2(i*r.b+e*r.d,i*r.a+e*r.c)*L.radDeg}rotateWorld(t){const e=this.matrix,i=e.a,r=e.c,n=e.b,a=e.d,o=L.cosDeg(t),h=L.sinDeg(t);e.a=o*i-h*n,e.c=o*r-h*a,e.b=h*i+o*n,e.d=h*r+o*a,this.appliedValid=!1}}class hE{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 i=0;i<t.bones.length;i++)this.bones.push(e.findBone(t.bones[i].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,i,r,n,a,o){t.appliedValid||t.updateAppliedTransform();const h=t.parent.matrix,u=h.a;let d=h.c;const l=h.b;let c=h.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case se.OnlyTranslation:p=e-t.worldX,m=i-t.worldY;break;case se.NoRotationOrReflection:const x=Math.abs(u*c-d*l)/(u*u+l*l),y=u/t.skeleton.scaleX,v=l/t.skeleton.scaleY;d=-v*x*t.skeleton.scaleX,c=y*x*t.skeleton.scaleY,f+=Math.atan2(v,y)*L.radDeg;default:const b=e-h.tx,E=i-h.ty,w=u*c-d*l;p=(b*c-E*d)/w-t.ax,m=(E*u-b*l)/w-t.ay}f+=Math.atan2(m,p)*L.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let _=t.ascaleX,g=t.ascaleY;if(r||n){switch(t.data.transformMode){case se.NoScale:case se.NoScaleOrReflection:p=e-t.worldX,m=i-t.worldY}const x=t.data.length*_,y=Math.sqrt(p*p+m*m);if(r&&y<x||n&&y>x&&x>1e-4){const v=(y/x-1)*o+1;_*=v,a&&(g*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,_,g,t.ashearX,t.ashearY)}apply2(t,e,i,r,n,a,o,h){if(h==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const u=t.ax,d=t.ay;let l=t.ascaleX,c=l,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let _=0,g=0,x=0;l<0?(l=-l,_=180,x=-1):(_=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,g=180):g=0;const y=e.ax;let v=0,b=0,E=0,w=m.a,A=m.c,T=m.b,P=m.d;const k=Math.abs(l-f)<=1e-4;k?(v=e.ay,b=w*y+A*v+m.tx,E=T*y+P*v+m.ty):(v=0,b=w*y+m.tx,E=T*y+m.ty);const R=t.parent.matrix;w=R.a,A=R.c,T=R.b,P=R.d;const S=1/(w*P-A*T);let C=b-R.tx,I=E-R.ty;const N=(C*P-I*A)*S-u,F=(I*w-C*T)*S-d,B=Math.sqrt(N*N+F*F);let X=e.data.length*p,M,D;if(B<1e-4){this.apply1(t,i,r,!1,a,!1,h),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}C=i-R.tx,I=r-R.ty;let $=(C*P-I*A)*S-u,Y=(I*w-C*T)*S-d,U=$*$+Y*Y;if(o!=0){o*=l*(p+1)/2;const lt=Math.sqrt(U),vt=lt-B-X*l+o;if(vt>0){let Dt=Math.min(1,vt/(o*2))-1;Dt=(vt-o*(1-Dt*Dt))/lt,$-=Dt*$,Y-=Dt*Y,U=$*$+Y*Y}}t:if(k){X*=l;let lt=(U-B*B-X*X)/(2*B*X);lt<-1?lt=-1:lt>1&&(lt=1,a&&(c*=(Math.sqrt(U)/(B+X)-1)*h+1)),D=Math.acos(lt)*n,w=B+X*lt,A=X*Math.sin(D),M=Math.atan2(Y*w-$*A,$*w+Y*A)}else{w=l*X,A=f*X;const lt=w*w,vt=A*A,Dt=Math.atan2(Y,$);T=vt*B*B+lt*U-lt*vt;const Lt=-2*vt*B,_t=vt-lt;if(P=Lt*Lt-4*_t*T,P>=0){let Br=Math.sqrt(P);Lt<0&&(Br=-Br),Br=-(Lt+Br)/2;const w_=Br/_t,E_=T/Br,Or=Math.abs(w_)<Math.abs(E_)?w_:E_;if(Or*Or<=U){I=Math.sqrt(U-Or*Or)*n,M=Dt-Math.atan2(I,Or),D=Math.atan2(I/f,(Or-B)/l);break t}}let Bt=L.PI,wt=B-w,me=wt*wt,Ae=0,ds=0,Dr=B+w,fs=Dr*Dr,T_=0;T=-w*B/(lt-vt),T>=-1&&T<=1&&(T=Math.acos(T),C=w*Math.cos(T)+B,I=A*Math.sin(T),P=C*C+I*I,P<me&&(Bt=T,me=P,wt=C,Ae=I),P>fs&&(ds=T,fs=P,Dr=C,T_=I)),U<=(me+fs)/2?(M=Dt-Math.atan2(Ae*n,wt),D=Bt*n):(M=Dt-Math.atan2(T_*n,Dr),D=ds*n)}const rt=Math.atan2(v,y)*x;let ft=t.arotation;M=(M-rt)*L.radDeg+_-ft,M>180?M-=360:M<-180&&(M+=360),t.updateWorldTransformWith(u,d,ft+M*h,c,t.ascaleY,0,0),ft=e.arotation,D=((D+rt)*L.radDeg-e.ashearX)*x+g-ft,D>180?D-=360:D<-180&&(D+=360),e.updateWorldTransformWith(y,v,ft+D*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}var Rr=(s=>(s[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",s))(Rr||{});const Ws=class{constructor(s,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,s==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=s,this.bones=new Array;for(let e=0,i=s.bones.length;e<i;e++)this.bones.push(t.findBone(s.bones[e].name));this.target=t.findSlot(s.target.name),this.position=s.position,this.spacing=s.spacing,this.rotateMix=s.rotateMix,this.translateMix=s.translateMix}isActive(){return this.active}apply(){this.update()}update(){const s=this.target.getAttachment();if(!(s instanceof An))return;const t=this.rotateMix,e=this.translateMix,i=e>0,r=t>0;if(!i&&!r)return;const n=this.data,a=n.spacingMode,o=a==Rr.Length,h=n.rotateMode,u=h==Vs.Tangent,d=h==Vs.ChainScale,l=this.bones.length,c=u?l:l+1,f=this.bones,p=Q.setArraySize(this.spaces,c);let m=null;const _=this.spacing;if(d||o){d&&(m=Q.setArraySize(this.lengths,l));for(let E=0,w=c-1;E<w;){const A=f[E],T=A.data.length;if(T<Ws.epsilon)d&&(m[E]=0),p[++E]=0;else{const P=T*A.matrix.a,k=T*A.matrix.b,R=Math.sqrt(P*P+k*k);d&&(m[E]=R),p[++E]=(o?T+_:_)*R/T}}}else for(let E=1;E<c;E++)p[E]=_;const g=this.computeWorldPositions(s,c,u,n.positionMode==co.Percent,a==Rr.Percent);let x=g[0],y=g[1],v=n.offsetRotation,b=!1;if(v==0)b=h==Vs.Chain;else{b=!1;const E=this.target.bone.matrix;v*=E.a*E.d-E.b*E.c>0?L.degRad:-L.degRad}for(let E=0,w=3;E<l;E++,w+=3){const A=f[E],T=A.matrix;T.tx+=(x-T.tx)*e,T.ty+=(y-T.ty)*e;const P=g[w],k=g[w+1],R=P-x,S=k-y;if(d){const C=m[E];if(C!=0){const I=(Math.sqrt(R*R+S*S)/C-1)*t+1;T.a*=I,T.b*=I}}if(x=P,y=k,r){const C=T.a,I=T.c,N=T.b,F=T.d;let B=0,X=0,M=0;if(u&&(u?B=g[w-1]:p[E+1]==0?B=g[w+2]:B=Math.atan2(S,R)),B-=Math.atan2(N,C),b){X=Math.cos(B),M=Math.sin(B);const D=A.data.length;x+=(D*(X*C-M*N)-R)*t,y+=(D*(M*C+X*N)-S)*t}else B+=v;B>L.PI?B-=L.PI2:B<-L.PI&&(B+=L.PI2),B*=t,X=Math.cos(B),M=Math.sin(B),T.a=X*C-M*N,T.c=X*I-M*F,T.b=M*C+X*N,T.d=M*I+X*F}A.appliedValid=!1}}computeWorldPositions(s,t,e,i,r){const n=this.target;let a=this.position;const o=this.spaces,h=Q.setArraySize(this.positions,t*3+2);let u=null;const d=s.closed;let l=s.worldVerticesLength,c=l/6,f=Ws.NONE;if(!s.constantSpeed){const B=s.lengths;c-=d?1:2;const X=B[c];if(i&&(a*=X),r)for(let M=0;M<t;M++)o[M]*=X;u=Q.setArraySize(this.world,8);for(let M=0,D=0,$=0;M<t;M++,D+=3){const Y=o[M];a+=Y;let U=a;if(d)U%=X,U<0&&(U+=X),$=0;else if(U<0){f!=Ws.BEFORE&&(f=Ws.BEFORE,s.computeWorldVertices(n,2,4,u,0,2)),this.addBeforePosition(U,u,0,h,D);continue}else if(U>X){f!=Ws.AFTER&&(f=Ws.AFTER,s.computeWorldVertices(n,l-6,4,u,0,2)),this.addAfterPosition(U-X,u,0,h,D);continue}for(;;$++){const rt=B[$];if(!(U>rt)){if($==0)U/=rt;else{const ft=B[$-1];U=(U-ft)/(rt-ft)}break}}$!=f&&(f=$,d&&$==c?(s.computeWorldVertices(n,l-4,4,u,0,2),s.computeWorldVertices(n,0,4,u,4,2)):s.computeWorldVertices(n,$*6+2,8,u,0,2)),this.addCurvePosition(U,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,D,e||M>0&&Y==0)}return h}d?(l+=2,u=Q.setArraySize(this.world,l),s.computeWorldVertices(n,2,l-4,u,0,2),s.computeWorldVertices(n,0,2,u,l-4,2),u[l-2]=u[0],u[l-1]=u[1]):(c--,l-=4,u=Q.setArraySize(this.world,l),s.computeWorldVertices(n,2,l,u,0,2));const p=Q.setArraySize(this.curves,c);let m=0,_=u[0],g=u[1],x=0,y=0,v=0,b=0,E=0,w=0,A=0,T=0,P=0,k=0,R=0,S=0,C=0,I=0;for(let B=0,X=2;B<c;B++,X+=6)x=u[X],y=u[X+1],v=u[X+2],b=u[X+3],E=u[X+4],w=u[X+5],A=(_-x*2+v)*.1875,T=(g-y*2+b)*.1875,P=((x-v)*3-_+E)*.09375,k=((y-b)*3-g+w)*.09375,R=A*2+P,S=T*2+k,C=(x-_)*.75+A+P*.16666667,I=(y-g)*.75+T+k*.16666667,m+=Math.sqrt(C*C+I*I),C+=R,I+=S,R+=P,S+=k,m+=Math.sqrt(C*C+I*I),C+=R,I+=S,m+=Math.sqrt(C*C+I*I),C+=R+P,I+=S+k,m+=Math.sqrt(C*C+I*I),p[B]=m,_=E,g=w;if(i&&(a*=m),r)for(let B=0;B<t;B++)o[B]*=m;const N=this.segments;let F=0;for(let B=0,X=0,M=0,D=0;B<t;B++,X+=3){const $=o[B];a+=$;let Y=a;if(d)Y%=m,Y<0&&(Y+=m),M=0;else if(Y<0){this.addBeforePosition(Y,u,0,h,X);continue}else if(Y>m){this.addAfterPosition(Y-m,u,l-4,h,X);continue}for(;;M++){const U=p[M];if(!(Y>U)){if(M==0)Y/=U;else{const rt=p[M-1];Y=(Y-rt)/(U-rt)}break}}if(M!=f){f=M;let U=M*6;for(_=u[U],g=u[U+1],x=u[U+2],y=u[U+3],v=u[U+4],b=u[U+5],E=u[U+6],w=u[U+7],A=(_-x*2+v)*.03,T=(g-y*2+b)*.03,P=((x-v)*3-_+E)*.006,k=((y-b)*3-g+w)*.006,R=A*2+P,S=T*2+k,C=(x-_)*.3+A+P*.16666667,I=(y-g)*.3+T+k*.16666667,F=Math.sqrt(C*C+I*I),N[0]=F,U=1;U<8;U++)C+=R,I+=S,R+=P,S+=k,F+=Math.sqrt(C*C+I*I),N[U]=F;C+=R,I+=S,F+=Math.sqrt(C*C+I*I),N[8]=F,C+=R+P,I+=S+k,F+=Math.sqrt(C*C+I*I),N[9]=F,D=0}for(Y*=F;;D++){const U=N[D];if(!(Y>U)){if(D==0)Y/=U;else{const rt=N[D-1];Y=D+(Y-rt)/(U-rt)}break}}this.addCurvePosition(Y*.1,_,g,x,y,v,b,E,w,h,X,e||B>0&&$==0)}return h}addBeforePosition(s,t,e,i,r){const n=t[e],a=t[e+1],o=t[e+2]-n,h=t[e+3]-a,u=Math.atan2(h,o);i[r]=n+s*Math.cos(u),i[r+1]=a+s*Math.sin(u),i[r+2]=u}addAfterPosition(s,t,e,i,r){const n=t[e+2],a=t[e+3],o=n-t[e],h=a-t[e+1],u=Math.atan2(h,o);i[r]=n+s*Math.cos(u),i[r+1]=a+s*Math.sin(u),i[r+2]=u}addCurvePosition(s,t,e,i,r,n,a,o,h,u,d,l){(s==0||isNaN(s))&&(s=1e-4);const c=s*s,f=c*s,p=1-s,m=p*p,_=m*p,g=p*s,x=g*3,y=p*x,v=x*s,b=t*_+i*y+n*v+o*f,E=e*_+r*y+a*v+h*f;u[d]=b,u[d+1]=E,l&&(u[d+2]=Math.atan2(E-(e*m+r*g*2+a*c),b-(t*m+i*g*2+n*c)))}};let Sn=Ws;Sn.NONE=-1,Sn.BEFORE=-2,Sn.AFTER=-3,Sn.epsilon=1e-5;class lE{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new sE,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 i=0;i<t.bones.length;i++)this.bones.push(e.findBone(t.bones[i].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,i=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,u=a.b,d=a.d,l=o*d-h*u>0?L.degRad:-L.degRad,c=this.data.offsetRotation*l,f=this.data.offsetShearY*l,p=this.bones;for(let m=0,_=p.length;m<_;m++){const g=p[m];let x=!1;const y=g.matrix;if(t!=0){const v=y.a,b=y.c,E=y.b,w=y.d;let A=Math.atan2(u,o)-Math.atan2(E,v)+c;A>L.PI?A-=L.PI2:A<-L.PI&&(A+=L.PI2),A*=t;const T=Math.cos(A),P=Math.sin(A);y.a=T*v-P*E,y.c=T*b-P*w,y.b=P*v+T*E,y.d=P*b+T*w,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(i>0){let v=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(o*o+u*u);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*i)/v),y.a*=v,y.b*=v,v=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(h*h+d*d),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*i)/v),y.c*=v,y.d*=v,x=!0}if(r>0){const v=y.c,b=y.d,E=Math.atan2(b,v);let w=Math.atan2(d,h)-Math.atan2(u,o)-(E-Math.atan2(y.b,y.a));w>L.PI?w-=L.PI2:w<-L.PI&&(w+=L.PI2),w=E+(w+f)*r;const A=Math.sqrt(v*v+b*b);y.c=Math.cos(w)*A,y.d=Math.sin(w)*A,x=!0}x&&(g.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,u=a.b,d=a.d,l=o*d-h*u>0?L.degRad:-L.degRad,c=this.data.offsetRotation*l,f=this.data.offsetShearY*l,p=this.bones;for(let m=0,_=p.length;m<_;m++){const g=p[m];let x=!1;const y=g.matrix;if(t!=0){const v=y.a,b=y.c,E=y.b,w=y.d;let A=Math.atan2(u,o)+c;A>L.PI?A-=L.PI2:A<-L.PI&&(A+=L.PI2),A*=t;const T=Math.cos(A),P=Math.sin(A);y.a=T*v-P*E,y.c=T*b-P*w,y.b=P*v+T*E,y.d=P*b+T*w,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(i>0){let v=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleX)*i+1;y.a*=v,y.b*=v,v=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*i+1,y.c*=v,y.d*=v,x=!0}if(r>0){let v=Math.atan2(d,h)-Math.atan2(u,o);v>L.PI?v-=L.PI2:v<-L.PI&&(v+=L.PI2);const b=y.c,E=y.d;v=Math.atan2(E,b)+(v-L.PI/2+f)*r;const w=Math.sqrt(b*b+E*E);y.c=Math.cos(v)*w,y.d=Math.sin(v)*w,x=!0}x&&(g.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let o=0,h=a.length;o<h;o++){const u=a[o];u.appliedValid||u.updateAppliedTransform();let d=u.arotation;if(t!=0){let _=n.arotation-d+this.data.offsetRotation;_-=(16384-(16384.499999999996-_/360|0))*360,d+=_*t}let l=u.ax,c=u.ay;e!=0&&(l+=(n.ax-l+this.data.offsetX)*e,c+=(n.ay-c+this.data.offsetY)*e);let f=u.ascaleX,p=u.ascaleY;i>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*i)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*i)/p));const m=u.ashearY;if(r>0){let _=n.ashearY-m+this.data.offsetShearY;_-=(16384-(16384.499999999996-_/360|0))*360,u.shearY+=_*r}u.updateWorldTransformWith(l,c,d,f,p,u.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let o=0,h=a.length;o<h;o++){const u=a[o];u.appliedValid||u.updateAppliedTransform();let d=u.arotation;t!=0&&(d+=(n.arotation+this.data.offsetRotation)*t);let l=u.ax,c=u.ay;e!=0&&(l+=(n.ax+this.data.offsetX)*e,c+=(n.ay+this.data.offsetY)*e);let f=u.ascaleX,p=u.ascaleY;i>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*i+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*i+1));let m=u.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),u.updateWorldTransformWith(l,c,d,f,p,u.ashearX,m)}}}const Cn=class{constructor(s){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,s==null)throw new Error("data cannot be null.");this.data=s,this.bones=new Array;for(let t=0;t<s.bones.length;t++){const e=s.bones[t];let i;if(e.parent==null)i=new o_(e,this,null);else{const r=this.bones[e.parent.index];i=new o_(e,this,r),r.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<s.slots.length;t++){const e=s.slots[t],i=this.bones[e.boneData.index],r=new r_(e,i);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<s.ikConstraints.length;t++){const e=s.ikConstraints[t];this.ikConstraints.push(new hE(e,this))}this.transformConstraints=new Array;for(let t=0;t<s.transformConstraints.length;t++){const e=s.transformConstraints[t];this.transformConstraints.push(new lE(e,this))}this.pathConstraints=new Array;for(let t=0;t<s.pathConstraints.length;t++){const e=s.pathConstraints[t];this.pathConstraints.push(new Sn(e,this))}this.color=new we(1,1,1,1),this.updateCache()}updateCache(){const s=this._updateCache;s.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let u=0,d=t.length;u<d;u++){const l=t[u];l.sorted=l.data.skinRequired,l.active=!l.sorted}if(this.skin!=null){const u=this.skin.bones;for(let d=0,l=this.skin.bones.length;d<l;d++){let c=this.bones[u[d].index];do c.sorted=!1,c.active=!0,c=c.parent;while(c!=null)}}const e=this.ikConstraints,i=this.transformConstraints,r=this.pathConstraints,n=e.length,a=i.length,o=r.length,h=n+a+o;t:for(let u=0;u<h;u++){for(let d=0;d<n;d++){const l=e[d];if(l.data.order==u){this.sortIkConstraint(l);continue t}}for(let d=0;d<a;d++){const l=i[d];if(l.data.order==u){this.sortTransformConstraint(l);continue t}}for(let d=0;d<o;d++){const l=r[d];if(l.data.order==u){this.sortPathConstraint(l);continue t}}}for(let u=0,d=t.length;u<d;u++)this.sortBone(t[u])}sortIkConstraint(s){if(s.active=s.target.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;const t=s.target;this.sortBone(t);const e=s.bones,i=e[0];if(this.sortBone(i),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(s),this.sortReset(i.children),e[e.length-1].sorted=!0}sortPathConstraint(s){if(s.active=s.target.bone.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;const t=s.target,e=t.data.index,i=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,i),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,i);for(let o=0,h=this.data.skins.length;o<h;o++)this.sortPathConstraintAttachment(this.data.skins[o],e,i);const r=t.getAttachment();r instanceof An&&this.sortPathConstraintAttachmentWith(r,i);const n=s.bones,a=n.length;for(let o=0;o<a;o++)this.sortBone(n[o]);this._updateCache.push(s);for(let o=0;o<a;o++)this.sortReset(n[o].children);for(let o=0;o<a;o++)n[o].sorted=!0}sortTransformConstraint(s){if(s.active=s.target.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;this.sortBone(s.target);const t=s.bones,e=t.length;if(s.data.local)for(let i=0;i<e;i++){const r=t[i];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let i=0;i<e;i++)this.sortBone(t[i]);this._updateCache.push(s);for(let i=0;i<e;i++)this.sortReset(t[i].children);for(let i=0;i<e;i++)t[i].sorted=!0}sortPathConstraintAttachment(s,t,e){const i=s.attachments[t];if(i)for(const r in i)this.sortPathConstraintAttachmentWith(i[r],e)}sortPathConstraintAttachmentWith(s,t){if(!(s instanceof An))return;const e=s.bones;if(e==null)this.sortBone(t);else{const i=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const o=e[r];this.sortBone(i[o])}}}}sortBone(s){if(s.sorted)return;const t=s.parent;t!=null&&this.sortBone(t),s.sorted=!0,this._updateCache.push(s)}sortReset(s){for(let t=0,e=s.length;t<e;t++){const i=s[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(){const s=this.updateCacheReset;for(let e=0,i=s.length;e<i;e++){const r=s[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}const t=this._updateCache;for(let e=0,i=t.length;e<i;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const s=this.bones;for(let r=0,n=s.length;r<n;r++)s[r].setToSetupPose();const t=this.ikConstraints;for(let r=0,n=t.length;r<n;r++){const a=t[r];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 r=0,n=e.length;r<n;r++){const a=e[r],o=a.data;a.rotateMix=o.rotateMix,a.translateMix=o.translateMix,a.scaleMix=o.scaleMix,a.shearMix=o.shearMix}const i=this.pathConstraints;for(let r=0,n=i.length;r<n;r++){const a=i[r],o=a.data;a.position=o.position,a.spacing=o.spacing,a.rotateMix=o.rotateMix,a.translateMix=o.translateMix}}setSlotsToSetupPose(){const s=this.slots;Q.arrayCopy(s,0,this.drawOrder,0,s.length);for(let t=0,e=s.length;t<e;t++)s[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(s){if(s==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findBoneIndex(s){if(s==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,i=t.length;e<i;e++)if(t[e].data.name==s)return e;return-1}findSlot(s){if(s==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findSlotIndex(s){if(s==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,i=t.length;e<i;e++)if(t[e].data.name==s)return e;return-1}setSkinByName(s){const t=this.data.findSkin(s);if(t==null)throw new Error(`Skin not found: ${s}`);this.setSkin(t)}setSkin(s){if(s!=this.skin){if(s!=null)if(this.skin!=null)s.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,i=t.length;e<i;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=s.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=s,this.updateCache()}}getAttachmentByName(s,t){return this.getAttachment(this.data.findSlotIndex(s),t)}getAttachment(s,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(s,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(s,t):null}setAttachment(s,t){if(s==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let i=0,r=e.length;i<r;i++){const n=e[i];if(n.data.name==s){let a=null;if(t!=null&&(a=this.getAttachment(i,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${s}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${s}`)}findIkConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findTransformConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findPathConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}getBounds(s,t,e=new Array(2)){if(s==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const i=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let h=0,u=i.length;h<u;h++){const d=i[h];if(!d.bone.active)continue;let l=0,c=null;const f=d.getAttachment();if(f instanceof et)l=8,c=Q.setArraySize(e,l,0),f.computeWorldVertices(d.bone,c,0,2);else if(f instanceof fo){const p=f;l=p.worldVerticesLength,c=Q.setArraySize(e,l,0),p.computeWorldVertices(d,0,l,c,0,2)}if(c!=null)for(let p=0,m=c.length;p<m;p+=2){const _=c[p],g=c[p+1];r=Math.min(r,_),n=Math.min(n,g),a=Math.max(a,_),o=Math.max(o,g)}}s.set(r,n),t.set(a-r,o-n)}update(s){this.time+=s}get flipX(){return this.scaleX==-1}set flipX(s){Cn.deprecatedWarning1||(Cn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=s?1:-1}get flipY(){return this.scaleY==-1}set flipY(s){Cn.deprecatedWarning1||(Cn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=s?1:-1}};let h_=Cn;h_.deprecatedWarning1=!1,se.Normal,se.OnlyTranslation,se.NoRotationOrReflection,se.NoScale,se.NoScaleOrReflection,co.Fixed,co.Percent,Rr.Length,Rr.Fixed,Rr.Percent,Vs.Tangent,Vs.Chain,Vs.ChainScale,K.NORMAL,K.ADD,K.MULTIPLY,K.SCREEN;class uE extends ku{createSkeleton(t){this.skeleton=new h_(t),this.skeleton.updateWorldTransform(),this.stateData=new a_(t),this.state=new Ne(this.stateData)}}class cE extends uE{constructor(t,e){const{followPointList:i,visible:r=!1}=e||{};let n;typeof t=="string"?n=Zi.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,i!=null&&i.length&&(i==null||i.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||!0})})),this._loopFn=this._loop.bind(this),ct.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(i=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{i()}}})}addAnimation(t="animation",e=!1,i=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,i).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){ct.system.remove(this._loopFn),this.destroy({children:!0})}_loop(){if(this.destroyed){ct.system.remove(this._loopFn);return}this.update(ct.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:i}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:i,rotate:r,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=r),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,i+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{ut.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Gi=(s,t,e,i=!1)=>{s.cursor="pointer",s.eventMode="static";const r=n=>{n.button!==2&&e(n)};i?s.once(t,r):s.on(t,r)};class dE extends bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:i,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=i,this._tintColor=r,this._disabledColor=a,this._btn=new _e(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Gi(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Gi(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,r&&(this._btn.tint=r))})}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 fE extends Tn{constructor(t){const{sprite:e,onClick:i}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Gi(this,"pointerenter",()=>{ut.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Gi(this,"pointerleave",()=>{e.alpha=1,ut.to(e,{duration:.25,rotation:0})}),Gi(this,"pointerdown",()=>{e.alpha=.5}),Gi(this,"pointerup",()=>{i()})}}class pE extends bt{constructor(t){super(),this._maskUI=new lu({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,ut.to(this._maskUI,{duration:.25,alpha:.5}),ut.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){ut.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await ut.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class mE extends bt{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._paramTxts=[];for(let e=0;e<3;e++){const i=new Fu({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=i,i.x=0,i.y=i.height*e,this.addChild(i),i.alpha=.75}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++},ct.shared.add(()=>{const t=ct.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTxtInfo(0,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._setTxtInfo(1,this._drawCount),this._setTxtInfo(2,this._maxDrawCount),this._drawCount=0},ji.UTILITY)}_setTxtInfo(t,e){const i=a=>{this._paramTxts[t].style.fill="#fff",a<=30&&(this._paramTxts[t].style.fill="yellow"),a<=20&&(this._paramTxts[t].style.fill="red")},r=a=>{this._paramTxts[t].style.fill="#fff",a>=75&&(this._paramTxts[t].style.fill="yellow"),a>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(i(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class _E extends bt{constructor(t){super();const{bgWidth:e,bgHeight:i,barWidth:r,barHeight:n,bgTexture:a,barTexture:o}=t,h=new _e(a);this.addChild(h),this._progressBar=new _e(o),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(i-n)/2;const u=new ui;u.beginFill(16777215),u.drawRect(0,0,0,this._progressBar.height),u.endFill(),this._progressBar.addChild(u),this._progressBar.mask=u,this._maskGraphics=u}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 gE extends Tn{constructor(t){const{width:e,height:i,scrollContent:r,bottomMargin:n=50}=t;if(super(e,i),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=r,this._content=new bt,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new _e;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new ui,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,i),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(){ut.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,ut.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const i=t.getLocalPosition(this).y-this._startY;this._content.y=i}}_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)),ut.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){ut.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)ut.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);ut.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else ut.to(this._content,{duration:.25,y:0})}}class yE extends Tn{constructor(t){const{width:e,height:i,content:r,slideCallback:n,scrollCallback:a,pageNum:o,pageHeight:h}=t;super(e,i),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 u=new ui;u.beginFill(16777215),u.drawRect(0,0,this.width,this.height),u.endFill(),this.addChild(u),this.mask=u,this._scrollHeight=i,this._slideHeight=h,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=o-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,e=!0){var i;t<0?(ut.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(ut.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,ut.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:e?.25:.01,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}})),(i=this._slideCallback)==null||i.call(this,this._currentIndex)}setDepth(t,e,i=0){const r=e-i,n=Math.floor(Math.abs(r)/70),a=Math.abs(r)%70/70,o=n-1,h=n+1,u=n+2,d=t[n];if(d.alpha=this.lerp(.5,1,1-a),d.scale.y=this.lerp(.85,1,1-a),h<t.length){const l=t[h];l.alpha=this.lerp(.5,1,a),l.scale.y=this.lerp(.85,1,a)}if(u<t.length){const l=t[u];l.alpha=this.lerp(.1,.5,a)}if(o>=0){const l=t[o];l.alpha=this.lerp(.1,.5,1-a)}}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,ut.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var a;if(!this._isDragging)return;const e=t.pageY-this._startY;let i=this._offsetY+e;const r=this._scrollHeight/2,n=-this._pageNum*this._slideHeight+this._scrollHeight/2;i>r&&(i=r),i<n&&(i=n),this._slideArea.y=i,(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,i=this._startY-t.pageY,r=Math.abs(i)/e,n=.275,a=this._slideHeight/2,o=Math.round(i/this._slideHeight);(Math.abs(i)>a||r>n)&&(this._currentIndex+=o),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}lerp(t,e,i){return t*(1-i)+e*i}}const l_=s=>{const t=new ui;return t.beginFill(16777215),t.drawRect(0,0,s.width,s.height),t.endFill(),s.addChild(t),s.mask=t,t};class xE extends Tn{constructor(t,e,i,r){super(t,e),this._currentIndex=0,this._slideWidth=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,l_(this),this._slideWidth=t,this._slideArea=i,this.slideCallback=r,this._pageNum=Math.floor(i.width/this._slideWidth)-1,this.addChild(i),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?(ut.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(ut.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,ut.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,ut.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}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,i=this._startX-t.pageX,r=Math.abs(i)/e,n=this._slideWidth/2,a=.275;(Math.abs(i)>n||r>a)&&(i>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class vE{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 bE{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:i,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=i,this._baseNumSteper=new vE(i,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 u_=(s,t,e)=>{const i=t/s.width*s.scale.x,r=e?e/s.height*s.scale.y:i,n=Math.min(i,r);s.scale.set(n>1?1:n)};class TE extends bt{constructor(t){super();const{data:e,cellWidth:i=130,cellHeight:r=100,fontColor:n="#fff",firstColumnFontColor:a="#fff",fontSize:o=30,lineWidth:h=2,lineColor:u="#5b5b5b",outsideBorder:d=!0,fontBold:l=!0}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=i,this._cellHeight=r,this._fontColor=n,this._fontSize=o,this._lineWidth=h,this._lineColor=u,this._outsideBorder=d,this._fontBold=l,this._firstColumnFontColor=a,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,i=new ui;i.lineStyle(this._lineWidth,this._lineColor),this._outsideBorder&&i.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)i.moveTo(0,r*this._cellHeight),i.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)i.moveTo(r*this._cellWidth,0),i.lineTo(r*this._cellWidth,e);this.addChild(i)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const i=this._data[t][e];this._createNumberText(i,e,t)}}_createNumberText(t,e,i){const r=new Va(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=i*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),u_(r,this._cellWidth*.9)}}var Vu={};/*!
|
|
1169
|
+
*/class ir{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:v_(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let r;const{value:n,time:a}=s[0],h=r=new ir(typeof n=="string"?pl(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];r.next=new ir(typeof l=="string"?pl(l):l,u),r=r.next}return h.isStepped=!!t.isStepped,h}const e=new ir(typeof t.start=="string"?pl(t.start):t.start,0);return t.end!==t.start&&(e.next=new ir(typeof t.end=="string"?pl(t.end):t.end,1)),e}}let So=q.from;const nr=Math.PI/180;function Ar(i,t){if(!i)return;const e=Math.sin(i),s=Math.cos(i),r=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=r,t.y=n}function fl(i,t,e){return i<<16|t<<8|e}function y_(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function ES(i){const t=1/y_(i);i.x*=t,i.y*=t}function x_(i,t){i.x*=t,i.y*=t}function pl(i,t){t||(t={}),i.charAt(0)==="#"?i=i.substr(1):i.indexOf("0x")===0&&(i=i.substr(2));let e;return i.length===8&&(e=i.substr(0,2),i=i.substr(2)),t.r=parseInt(i.substr(0,2),16),t.g=parseInt(i.substr(2,2),16),t.b=parseInt(i.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function v_(i){const t=i.length,e=1/t;return function(s){const r=t*s|0,n=(s-r*e)*t,a=i[r]||i[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function TS(i){return i?(i=i.toUpperCase().replace(/ /g,"_"),W[i]||W.NORMAL):W.NORMAL}class fu 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 Ft;(function(i){i[i.Spawn=0]="Spawn",i[i.Normal=2]="Normal",i[i.Late=5]="Late"})(Ft||(Ft={}));const pu=wt.shared,Vi=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:v_(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 r=Et.knownBehaviors[s.type];return r?new r(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Vi),e.sort((s,r)=>s===Vi?r.order===Ft.Spawn?1:-1:r===Vi?s.order===Ft.Spawn?-1:1:s.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Vi&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Vi&&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 fu(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,Ar(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?pu.remove(this.update,this):!this._autoUpdate&&t&&pu.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=pu.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 r=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=(r-e)*u+e,h=(n-s)*u+s}else a=r,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 fu(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===Vi)for(let d=o,f;d;d=f){f=d.next,this.rotation!==0&&(Ar(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=r,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,r=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 fu(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?(r.next=h,h.prev=r,r=h):r=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=s,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Vi)for(let h=s,o;h;h=o)o=h.next,this.rotation!==0&&(Ar(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 mu{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}}mu.type="rect",mu.editorConfig=null;class ml{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),Ar(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}ml.type="torus",ml.editorConfig=null;class gu{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 r=s[0];for(let n=1;n<s.length;++n){const a=s[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let s=1;s<t.length;++s){const r=t[s];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:r}=this.segments[e],n=Math.sqrt((r.x-s.x)*(r.x-s.x)+(r.y-s.y)*(r.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,r;if(this.segments.length===1)s=this.segments[0],r=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],r=h===0?e:e-this.countingLengths[h-1];break}r/=s.l||1;const{p1:n,p2:a}=s;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}gu.type="polygonalChain",gu.editorConfig=null;class _u{constructor(t){var e;this.order=Ft.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),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,r=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const a=y_(s);a>this.maxSpeed&&x_(s,this.maxSpeed/a)}t.x+=(r+s.x)/2*e,t.y+=(n+s.y)/2*e,this.rotate&&(t.rotation=Math.atan2(s.y,s.x))}}_u.type="moveAcceleration",_u.editorConfig=null;function AS(i){return this.ease&&(i=this.ease(i)),(this.first.next.value-this.first.value)*i+this.first.value}function SS(i){this.ease&&(i=this.ease(i));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*i+t.r,r=(e.g-t.g)*i+t.g,n=(e.b-t.b)*i+t.b;return fl(s,r,n)}function CS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;return i=(i-t.time)/(e.time-t.time),(e.value-t.value)*i+t.value}function IS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;i=(i-t.time)/(e.time-t.time);const s=t.value,r=e.value,n=(r.r-s.r)*i+s.r,a=(r.g-s.g)*i+s.g,h=(r.b-s.b)*i+s.b;return fl(n,a,h)}function PS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;return t.value}function RS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;const e=t.value;return fl(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?SS:AS:t.isStepped?this.interpolate=this.isColor?RS:PS:this.interpolate=this.isColor?IS:CS,this.ease=this.first.ease}}class yu{constructor(t){this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.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)}}yu.type="alpha",yu.editorConfig=null;class xu{constructor(t){this.order=Ft.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}xu.type="alphaStatic",xu.editorConfig=null;function b_(i){const t=[];for(let e=0;e<i.length;++e){let s=i[e];if(typeof s=="string")t.push(So(s));else if(s instanceof q)t.push(s);else{let r=s.count||1;for(typeof s.texture=="string"?s=So(s.texture):s=s.texture;r>0;--r)t.push(s)}}return t}class vu{constructor(t){this.order=Ft.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const s=t.anims[e],r=b_(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,a={textures:r,duration:n>0?r.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),r=e.config.anim=this.anims[s];e.texture=r.textures[0],e.config.animElapsed=0,r.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=r.textures.length/e.maxLife):(e.config.animDuration=r.duration,e.config.animFramerate=r.framerate),e=e.next}}updateParticle(t,e){const s=t.config,r=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=r.textures[n]||r.textures[r.textures.length-1]||q.EMPTY}}vu.type="animatedRandom",vu.editorConfig=null;class bu{constructor(t){this.order=Ft.Normal;const e=t.anim,s=b_(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:r>0?s.length/r:0,framerate:r,loop:r>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,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(s.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}bu.type="animatedSingle",bu.editorConfig=null;class wu{constructor(t){this.order=Ft.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=TS(this.value),e=e.next}}wu.type="blendMode",wu.editorConfig=null;class Eu{constructor(t){this.order=Ft.Spawn,this.spacing=t.spacing*nr,this.start=t.start*nr,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,s.rotation=r,this.distance&&(s.position.x=this.distance,Ar(r,s.position)),s=s.next,++e}}}Eu.type="spawnBurst",Eu.editorConfig=null;class Tu{constructor(t){this.order=Ft.Normal,this.list=new Co(!0),this.list.reset(ir.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,r=fl(s.r,s.g,s.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}Tu.type="color",Tu.editorConfig=null;class Au{constructor(t){this.order=Ft.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}}Au.type="colorStatic",Au.editorConfig=null;class Su{constructor(t){this.order=Ft.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}}Su.type="textureOrdered",Su.editorConfig=null;const In=new st,w_=["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"],MS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(w_).join("|"),"g");function FS(i){const t=i.match(MS);for(let e=t.length-1;e>=0;--e)w_.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return i=t.join(""),new Function("x",`return ${i};`)}class Cu{constructor(t){var e;if(this.order=Ft.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=FS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Co(!1),this.list.reset(ir.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),Ar(t.config.initRotation,In),t.position.x=t.config.initPosition.x+In.x,t.position.y=t.config.initPosition.y+In.y}}Cu.type="movePath",Cu.editorConfig=null;class Iu{constructor(){this.order=Ft.Spawn}initParticles(t){}}Iu.type="spawnPoint",Iu.editorConfig=null;class Pu{constructor(t){this.order=Ft.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}}}Pu.type="textureRandom",Pu.editorConfig=null;class Ru{constructor(t){this.order=Ft.Normal,this.minStart=t.minStart*nr,this.maxStart=t.maxStart*nr,this.minSpeed=t.minSpeed*nr,this.maxSpeed=t.maxSpeed*nr,this.accel=t.accel*nr}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}}Ru.type="rotation",Ru.editorConfig=null;class Mu{constructor(t){this.order=Ft.Normal,this.min=t.min*nr,this.max=t.max*nr}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}}Mu.type="rotationStatic",Mu.editorConfig=null;class Fu{constructor(t){this.order=Ft.Late+1,this.rotation=(t.rotation||0)*nr}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Fu.type="noRotation",Fu.editorConfig=null;class ku{constructor(t){var e;this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.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}}ku.type="scale",ku.editorConfig=null;class Bu{constructor(t){this.order=Ft.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}}}Bu.type="scaleStatic",Bu.editorConfig=null;class Ss{constructor(t){this.order=Ft.Spawn;const e=Ss.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){Ss.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Ss.type="spawnShape",Ss.editorConfig=null,Ss.shapes={},Ss.registerShape(gu),Ss.registerShape(mu),Ss.registerShape(ml),Ss.registerShape(ml,"circle");class Du{constructor(t){this.order=Ft.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}}Du.type="textureSingle",Du.editorConfig=null;class Ou{constructor(t){var e;this.order=Ft.Late,this.list=new Co(!1),this.list.reset(ir.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),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;ES(r),x_(r,s),t.x+=r.x*e,t.y+=r.y*e}}Ou.type="moveSpeed",Ou.editorConfig=null;class Lu{constructor(t){this.order=Ft.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),Ar(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}}Lu.type="moveSpeedStatic",Lu.editorConfig=null,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(ku),Et.registerBehavior(Bu),Et.registerBehavior(Ss),Et.registerBehavior(Du),Et.registerBehavior(Ou),Et.registerBehavior(Lu);class Nu extends za{constructor(t){const{text:e,fontSize:s=36,fontColor:r=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 vr({fontSize:s,wordWrap:u,wordWrapWidth:c,fontWeight:l,lineHeight:d*s,breakWords:u,fill:r,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 kS extends Bt{constructor(t){super();const{start:e,control:s,end:r,json:n,duration:a,ease:h="power1.out",showControl:o=!1,loop:l=!1}=t;this._particleContainer=new MT,this.addChild(this._particleContainer);const u=new Et(this._particleContainer,n),c=this._createBezierPoints([e,...s,r],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 r=[];s&&t.forEach((n,a)=>{const h=new Nu({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);r.push(a)}return r}_multiPointBezier(t,e){const s=t.length;let r=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);r+=o.x*c*u*l,n+=o.y*c*u*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let r=1;r<=e;r++)s=s*(t-r+1)/r;return s}}var at=(i=>(i[i.Region=0]="Region",i[i.BoundingBox=1]="BoundingBox",i[i.Mesh=2]="Mesh",i[i.LinkedMesh=3]="LinkedMesh",i[i.Path=4]="Path",i[i.Point=5]="Point",i[i.Clipping=6]="Clipping",i))(at||{});class gl{constructor(t,e=new Array,s=0,r=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=r}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 r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(r),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(i=>(i[i.setup=0]="setup",i[i.first=1]="first",i[i.replace=2]="replace",i[i.add=3]="add",i))(S||{}),At=(i=>(i[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",i))(At||{}),ne=(i=>(i[i.Fixed=0]="Fixed",i[i.Percent=1]="Percent",i))(ne||{}),Fe=(i=>(i[i.Tangent=0]="Tangent",i[i.Chain=1]="Chain",i[i.ChainScale=2]="ChainScale",i))(Fe||{}),vt=(i=>(i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection",i))(vt||{});function E_(i){switch(i.toLowerCase()){case"nearest":return Ye.Nearest;case"linear":return Ye.Linear;case"mipmap":return Ye.MipMap;case"mipmapnearestnearest":return Ye.MipMapNearestNearest;case"mipmaplinearnearest":return Ye.MipMapLinearNearest;case"mipmapnearestlinear":return Ye.MipMapNearestLinear;case"mipmaplinearlinear":return Ye.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${i}`)}}var Ye=(i=>(i[i.Nearest=9728]="Nearest",i[i.Linear=9729]="Linear",i[i.MipMap=9987]="MipMap",i[i.MipMapNearestNearest=9984]="MipMapNearestNearest",i[i.MipMapLinearNearest=9985]="MipMapLinearNearest",i[i.MipMapNearestLinear=9986]="MipMapNearestLinear",i[i.MipMapLinearLinear=9987]="MipMapLinearLinear",i))(Ye||{}),Ui=(i=>(i[i.MirroredRepeat=33648]="MirroredRepeat",i[i.ClampToEdge=33071]="ClampToEdge",i[i.Repeat=10497]="Repeat",i))(Ui||{});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 BS{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 r=null;for(let a=0;a<s.length;a++)if(s[a].baseTexture===e.baseTexture){r=s[a];break}if(r===null){r=new T_,r.name="texturePage";const a=e.baseTexture;r.width=a.realWidth,r.height=a.realHeight,r.baseTexture=a,r.minFilter=r.magFilter=Ye.Nearest,r.uWrap=Ui.ClampToEdge,r.vWrap=Ui.ClampToEdge,s.push(r)}const n=new A_;return n.name=t,n.page=r,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 r=new DS(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=E_(n[1]),a.magFilter=E_(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(a.uWrap=Ui.Repeat),n[1].indexOf("y")!=-1&&(a.vWrap=Ui.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=r.readLine();for(;u!=null&&u.trim().length==0;)u=r.readLine();for(;!(u==null||u.trim().length==0||r.readEntry(n,u)==0);)u=r.readLine();const c=()=>{for(;;){if(u==null)return s&&s(this);if(u.trim().length==0)a=null,u=r.readLine();else if(a===null){for(a=new T_,a.name=u.trim();r.readEntry(n,u=r.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 BS;const d=new A_;d.name=u,d.page=a;let f=null,p=null;for(;;){const v=r.readEntry(n,u=r.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 rt(o.x,o.y,g?o.height:o.width,g?o.width:o.height),x=new rt(0,0,o.originalWidth,o.originalHeight),y=new rt(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 DS{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 r=1,n=s+1;;r++){const a=e.indexOf(",",n);if(a==-1)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,a-n).trim(),n=a+1,r==4)return 4}}}class T_{constructor(){this.minFilter=Ye.Nearest,this.magFilter=Ye.Nearest,this.uWrap=Ui.ClampToEdge,this.vWrap=Ui.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==Ye.Linear?t.scaleMode=je.LINEAR:this.minFilter==Ye.Nearest?t.scaleMode=je.NEAREST:(t.mipmap=xs.POW2,e==Ye.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class A_ extends Vu{}class OS{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 LS{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,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Gi=class{constructor(i=0,t=0,e=0,s=0){this.r=i,this.g=t,this.b=e,this.a=s}set(i,t,e,s){return this.r=i,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(i){return this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this}setFromString(i){return i=i.charAt(0)=="#"?i.substr(1):i,this.r=parseInt(i.substr(0,2),16)/255,this.g=parseInt(i.substr(2,2),16)/255,this.b=parseInt(i.substr(4,2),16)/255,this.a=i.length!=8?1:parseInt(i.substr(6,2),16)/255,this}add(i,t,e,s){return this.r+=i,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(i,t){i.r=((t&4278190080)>>>24)/255,i.g=((t&16711680)>>>16)/255,i.b=((t&65280)>>>8)/255,i.a=(t&255)/255}static rgb888ToColor(i,t){i.r=((t&16711680)>>>16)/255,i.g=((t&65280)>>>8)/255,i.b=(t&255)/255}static fromString(i){return new Gi().setFromString(i)}};let X=Gi;X.WHITE=new Gi(1,1,1,1),X.RED=new Gi(1,0,0,1),X.GREEN=new Gi(0,1,0,1),X.BLUE=new Gi(0,0,1,1),X.MAGENTA=new Gi(1,0,1,1);const Sr=class{static clamp(i,t,e){return i<t?t:i>e?e:i}static cosDeg(i){return Math.cos(i*Sr.degRad)}static sinDeg(i){return Math.sin(i*Sr.degRad)}static signum(i){return Math.sign(i)}static toInt(i){return i>0?Math.floor(i):Math.ceil(i)}static cbrt(i){const t=Math.pow(Math.abs(i),.3333333333333333);return i<0?-t:t}static randomTriangular(i,t){return Sr.randomTriangularWith(i,t,(i+t)*.5)}static randomTriangularWith(i,t,e){const s=Math.random(),r=t-i;return s<=(e-i)/r?i+Math.sqrt(s*r*(e-i)):t-Math.sqrt((1-s)*r*(t-e))}static isPowerOfTwo(i){return i&&(i&i-1)===0}};let D=Sr;D.PI=3.1415927,D.PI2=Sr.PI*2,D.radiansToDegrees=180/Sr.PI,D.radDeg=Sr.radiansToDegrees,D.degreesToRadians=Sr.PI/180,D.degRad=Sr.degreesToRadians;class NS{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class VS extends NS{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 S_ extends VS{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Pn=class{static arrayCopy(i,t,e,s,r){for(let n=t,a=s;n<t+r;n++,a++)e[a]=i[n]}static arrayFill(i,t,e,s){for(let r=t;r<e;r++)i[r]=s}static setArraySize(i,t,e=0){const s=i.length;if(s==t)return i;if(i.length=t,s<t)for(let r=s;r<t;r++)i[r]=e;return i}static ensureArrayCapacity(i,t,e=0){return i.length>=t?i:Pn.setArraySize(i,t,e)}static newArray(i,t){const e=new Array(i);for(let s=0;s<i;s++)e[s]=t;return e}static newFloatArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(i){return Pn.SUPPORTS_TYPED_ARRAYS?new Float32Array(i):i}static toSinglePrecision(i){return Pn.SUPPORTS_TYPED_ARRAYS?Math.fround(i):i}static webkit602BugfixHelper(i,t){}static contains(i,t,e=!0){for(let s=0;s<i.length;s++)if(i[s]==t)return!0;return!1}static enumValue(i,t){return i[t[0].toUpperCase()+t.slice(1)]}};let B=Pn;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class US{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 GS{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 XS={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},ti=[0,0,0];class $S extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class YS extends RT{constructor(t,e,s,r,n){super(t,e,s,r,n),this.region=null,this.attachment=null}}const C_=class extends Bt{constructor(i){if(super(),!i)throw new Error("The spineData param is required.");if(typeof i=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=i,this.createSkeleton(i),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],r=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===at.Region){const a=r.name,h=this.createSprite(s,r,a);s.currentSprite=h,s.currentSpriteName=a,n.addChild(h)}else if(r.type===at.Mesh){const a=this.createMesh(s,r);s.currentMesh=a,s.currentMeshId=r.id,s.currentMeshName=r.name,n.addChild(a)}else r.type===at.Clipping&&(this.createGraphics(s,r),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(i){var t;i!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),i==null||i.registerSpine(this),this._debug=i)}get autoUpdate(){return this._autoUpdate}set autoUpdate(i){i!==this._autoUpdate&&(this._autoUpdate=i,this.updateTransform=i?C_.prototype.autoUpdateTransform:Bt.prototype.updateTransform)}get tint(){return eo(this.tintRgb)}set tint(i){this.tintRgb=sp(i,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:XS.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(i){var l;const t=this.delayLimit;if(i>t&&(i=t),this.state.update(i),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let r=null,n=null;s?(r=s.light,n=s.dark):r=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:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentSprite.tint=eo(ti)),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:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentMesh.tint=eo(ti)),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(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[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(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[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(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,t.rotation=i.rotation*D.degRad,t.position.x=i.x,t.position.y=i.y,t.alpha=i.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=i.scaleX*i.width/e.originalWidth,t.scale.y=-i.scaleY*i.height/e.originalHeight))}setMeshRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(i.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const i=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(i)}Bt.prototype.updateTransform.call(this)}createSprite(i,t,e){let s=t.region;i.hackAttachment===t&&(s=i.hackRegion);const r=s?s.texture:null,n=this.newSprite(r);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),i.sprites=i.sprites||{},i.sprites[e]=n,n}createMesh(i,t){let e=t.region;i.hackAttachment===t&&(e=i.hackRegion,i.hackAttachment=null,i.hackRegion=null);const s=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),ys.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),i.meshes=i.meshes||{},i.meshes[t.id]=s,s}createGraphics(i,t){const e=this.newGraphics(),s=new Nr([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,i.currentGraphics=e,i.clippingContainer=this.newContainer(),i.clippingContainer.mask=i.currentGraphics,e}updateGraphics(i,t){const e=i.currentGraphics.geometry,s=e.graphicsData[0].shape.points,r=t.worldVerticesLength;s.length=r,t.computeWorldVertices(i,0,r,s,0,2),e.invalidate()}hackTextureBySlotIndex(i,t=null,e=null){const s=this.skeleton.slots[i];if(!s)return!1;const r=s.getAttachment();let n=r.region;return t?(n=new Vu,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=r):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(r,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(r,s.currentMesh,n),!0}hackTextureBySlotName(i,t=null,e=null){const s=this.skeleton.findSlotIndex(i);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(i,t,e,s=null){const r=this.skeleton.findSlotIndex(i),n=this.skeleton.getAttachmentByName(i,t);n.region.texture=e;const a=this.skeleton.slots[r];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 Bt}newSprite(i){return new $S(i)}newGraphics(){return new Ks}newMesh(i,t,e,s,r){return new YS(i,t,e,s,r)}transformHack(){return 1}hackAttachmentGroups(i,t,e){if(!i)return;const s=[],r=[];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(i)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,r]}destroy(i){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const r in s.meshes)s.meshes[r].destroy(i);s.meshes=null;for(const r in s.sprites)s.sprites[r].destroy(i);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(i);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(i)}};let Gu=C_;Gu.clippingPolygon=[],Object.defineProperty(Gu.prototype,"visible",{get(){return this._visible},set(i){i!==this._visible&&(this._visible=i,i&&(this.lastTime=0))}});let I_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const P_=class extends I_{constructor(t){super(t),this.id=(P_.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,r,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];r[w]=E*_+T*x+m,r[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}r[p]=g,r[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}r[m]=x,r[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 Xi=P_;Xi.nextID=0;let HS=class ay extends Xi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new ay(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},WS=class ly extends Xi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new ly(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Xu=class wd extends Xi{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 wd(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 wd(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}},_l=class hy extends Xi{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 hy(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 cy extends Xi{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),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new cy(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},R_=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 I_{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,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+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=r*o+this.y,f=r*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,r){const n=this.offset,a=t instanceof R_?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+=r,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,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 it=_e;it.OX1=0,it.OY1=1,it.OX2=2,it.OY2=3,it.OX3=4,it.OY3=5,it.OX4=6,it.OY4=7,it.X1=0,it.Y1=1,it.C1R=2,it.C1G=3,it.C1B=4,it.C1A=5,it.U1=6,it.V1=7,it.X2=8,it.Y2=9,it.C2R=10,it.C2G=11,it.C2B=12,it.C2A=13,it.U2=14,it.V2=15,it.X3=16,it.Y3=17,it.C3R=18,it.C3G=19,it.C3B=20,it.C3A=21,it.U3=22,it.V3=23,it.X4=24,it.Y4=25,it.C4R=26,it.C4G=27,it.C4B=28,it.C4A=29,it.U4=30,it.V4=31,new S_(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 r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&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 r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;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,r,n){const a=(-e*2+r)*.03,h=(-s*2+n)*.03,o=((e-r)*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 r=t*ee.BEZIER_SIZE;const n=s[r];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;r++;let a=0;for(let o=r,l=r+ee.BEZIER_SIZE-1;r<l;r+=2)if(a=s[r],a>=e){let u,c;return r==o?(u=0,c=0):(u=s[r-2],c=s[r-1]),c+(s[r+1]-c)*(e-u)/(a-u)}const h=s[r-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 ei=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+ei.ROTATION]=s}apply(t,e,s,r,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-ei.ENTRIES]){let m=o[o.length+ei.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,ei.ENTRIES),c=o[u+ei.PREV_ROTATION],d=o[u],f=this.getCurvePercent((u>>1)-1,1-(s-d)/(o[u+ei.PREV_TIME]-d));let p=o[u+ei.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=ei;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,r){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=r}apply(t,e,s,r,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 fs=ke;fs.ENTRIES=3,fs.PREV_TIME=-3,fs.PREV_X=-2,fs.PREV_Y=-1,fs.X=1,fs.Y=2;let M_=class ks extends fs{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,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-ks.ENTRIES])u=o[o.length+ks.PREV_X]*l.data.scaleX,c=o[o.length+ks.PREV_Y]*l.data.scaleY;else{const d=oe.binarySearch(o,s,ks.ENTRIES);u=o[d+ks.PREV_X],c=o[d+ks.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ks.ENTRIES-1,1-(s-f)/(o[d+ks.PREV_TIME]-f));u=(u+(o[d+ks.X]-u)*p)*l.data.scaleX,c=(c+(o[d+ks.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}}}},F_=class Bs extends fs{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,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-Bs.ENTRIES])u=o[o.length+Bs.PREV_X],c=o[o.length+Bs.PREV_Y];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,c=c+(o[d+Bs.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,r,n,a){t*=Xt.ENTRIES,this.frames[t]=e,this.frames[t+Xt.R]=s,this.frames[t+Xt.G]=r,this.frames[t+Xt.B]=n,this.frames[t+Xt.A]=a}apply(t,e,s,r,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 He=Xt;He.ENTRIES=5,He.PREV_TIME=-5,He.PREV_R=-4,He.PREV_G=-3,He.PREV_B=-2,He.PREV_A=-1,He.R=1,He.G=2,He.B=3,He.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,r,n,a,h,o,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=r,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,r,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,r,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))}},k_=null,B_=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),k_==null&&(k_=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,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!(l instanceof Xi)||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,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,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++)r.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,r,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,r,n,a,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=r,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,r,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,r,n,a){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=r,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=a}apply(t,e,s,r,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 Cs=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Cs.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Cs.ENTRIES,this.frames[t]=e,this.frames[t+Cs.VALUE]=s}apply(t,e,s,r,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-Cs.ENTRIES])u=o[o.length+Cs.PREV_VALUE];else{const c=oe.binarySearch(o,s,Cs.ENTRIES);u=o[c+Cs.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/Cs.ENTRIES-1,1-(s-d)/(o[c+Cs.PREV_TIME]-d));u+=(o[c+Cs.VALUE]-u)*f}a==S.setup?l.position=l.data.position+(u-l.data.position)*n:l.position+=(u-l.position)*n}};let Cr=Cs;Cr.ENTRIES=2,Cr.PREV_TIME=-2,Cr.PREV_VALUE=-1,Cr.VALUE=1;let D_=class ci extends Cr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,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-ci.ENTRIES])u=o[o.length+ci.PREV_VALUE];else{const c=oe.binarySearch(o,s,ci.ENTRIES);u=o[c+ci.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ci.ENTRIES-1,1-(s-d)/(o[c+ci.PREV_TIME]-d));u+=(o[c+ci.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,r){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=r}apply(t,e,s,r,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 or=Be;or.ENTRIES=3,or.PREV_TIME=-3,or.PREV_ROTATE=-2,or.PREV_TRANSLATE=-1,or.ROTATE=1,or.TRANSLATE=2;const Yt=class{constructor(i){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new O_(this),this.propertyIDs=new OS,this.animationsChanged=!1,this.trackEntryPool=new US(()=>new Yu),this.data=i}update(i){i*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=i*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let a=r.next;if(a!=null){const h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(h/r.timeScale+i)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=i,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){t[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,i)){let h=r.mixingFrom;for(r.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(i,t){const e=i.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,i.mixTime>0&&i.mixTime>=i.mixDuration?((e.totalAlpha==0||i.mixDuration==0)&&(i.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=i),i.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,i.mixTime+=t,!1)}apply(i){if(i==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,i,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,i,d,l,!0):g.apply(i,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]==Yt.SUBSEQUENT?l:S.setup;y instanceof Ie?this.applyRotateTimeline(y,i,d,u,v,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,i,d,l,!0):y.apply(i,c,d,t,u,v,At.mixIn)}}this.queueEvents(o,d),t.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Yt.SETUP,n=i.slots;for(let a=0,h=i.slots.length;a<h;a++){const o=n[a];if(o.attachmentState==r){const l=o.data.attachmentName;o.setAttachment(l==null?null:i.getAttachment(o.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(i,t,e){const s=i.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let r=0;i.mixDuration==0?(r=1,e==S.first&&(e=S.setup)):(r=i.mixTime/i.mixDuration,r>1&&(r=1),e!=S.first&&(e=s.mixBlend));const n=r<s.eventThreshold?this.events:null,a=r<s.attachmentThreshold,h=r<s.drawOrderThreshold,o=s.animationLast,l=s.getAnimationTime(),u=s.animation.timelines.length,c=s.animation.timelines,d=s.alpha*i.interruptAlpha,f=d*(1-r);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 Yt.SUBSEQUENT:if(!h&&y instanceof Io)continue;b=e,w=f;break;case Yt.FIRST:b=S.setup,w=f;break;case Yt.HOLD_SUBSEQUENT:b=e,w=d;break;case Yt.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 i.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,r}applyAttachmentTimeline(i,t,e,s,r){const n=t.slots[i.slotIndex];if(!n.bone.active)return;const a=i.frames;if(e<a[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let h;e>=a[a.length-1]?h=a.length-1:h=oe.binarySearch(a,e)-1,this.setAttachment(t,n,i.attachmentNames[h],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Yt.SETUP)}setAttachment(i,t,e,s){t.setAttachment(e==null?null:i.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Yt.CURRENT)}applyRotateTimeline(i,t,e,s,r,n,a,h){if(h&&(n[a]=0),s==1){i.apply(t,0,e,null,1,r,At.mixIn);return}const o=i,l=o.frames,u=t.bones[o.boneIndex];if(!u.active)return;let c=0,d=0;if(e<l[0])switch(r){case S.setup:u.rotation=u.data.rotation;default:return;case S.first:c=u.rotation,d=u.data.rotation}else if(c=r==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(i,t){const e=i.animationStart,s=i.animationEnd,r=s-e,n=i.trackLast%r,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(i,u)}let l=!1;for(i.loop?l=r==0||n>i.trackTime%r:l=t>=s&&i.animationLast<s,l&&this.queue.complete(i);h<o;h++)a[h].time<e||this.queue.event(i,a[h])}clearTracks(){const i=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=i,this.queue.drain()}clearTrack(i){if(i>=this.tracks.length)return;const t=this.tracks[i];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(i,t,e){const s=this.expandToIndex(i);this.tracks[i]=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(i,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(i,s,e)}setAnimationWith(i,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,r=this.expandToIndex(i);r!=null&&(r.nextTrackLast==-1?(this.tracks[i]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,s=!1):this.disposeNext(r));const n=this.trackEntry(i,t,e,r);return this.setCurrent(i,n,s),this.queue.drain(),n}addAnimation(i,t,e,s){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(i,r,e,s)}addAnimationWith(i,t,e,s){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(i);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(i,t,e,r);if(r==null)this.setCurrent(i,n,!0),this.queue.drain();else if(r.next=n,s<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?s+=a*(1+(r.trackTime/a|0)):s+=Math.max(a,r.trackTime),s-=this.data.getMix(r.animation,t)):s=r.trackTime}return n.delay=s,n}setEmptyAnimation(i,t){const e=this.setAnimationWith(i,Yt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(i,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(i,Yt.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(i){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,i)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(i){return i<this.tracks.length?this.tracks[i]:(B.ensureArrayCapacity(this.tracks,i+1,null),this.tracks.length=i+1,null)}trackEntry(i,t,e,s){const r=this.trackEntryPool.obtain();return r.trackIndex=i,r.animation=t,r.loop=e,r.holdPrevious=!1,r.eventThreshold=0,r.attachmentThreshold=0,r.drawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.interruptAlpha=1,r.mixTime=0,r.mixDuration=s==null?0:this.data.getMix(s.animation,t),r.mixBlend=S.replace,r}disposeNext(i){let t=i.next;for(;t!=null;)this.queue.dispose(t),t=t.next;i.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let i=0,t=this.tracks.length;i<t;i++){let e=this.tracks[i];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(i){const t=i.mixingTo,e=i.animation.timelines,s=i.animation.timelines.length,r=B.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;const n=B.setArraySize(i.timelineHoldMix,s),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)r[h]=a.add(e[h].getPropertyId())?Yt.HOLD_FIRST:Yt.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const o=e[h],l=o.getPropertyId();if(!a.add(l))r[h]=Yt.SUBSEQUENT;else if(t==null||o instanceof Rn||o instanceof Io||o instanceof $u||!t.animation.hasTimeline(l))r[h]=Yt.FIRST;else{for(let u=t.mixingTo;u!=null;u=u.mixingTo)if(!u.animation.hasTimeline(l)){if(i.mixDuration>0){r[h]=Yt.HOLD_MIX,n[h]=u;continue t}break}r[h]=Yt.HOLD_FIRST}}}getCurrent(i){return i>=this.tracks.length?null:this.tracks[i]}addListener(i){if(i==null)throw new Error("listener cannot be null.");this.listeners.push(i)}removeListener(i){const t=this.listeners.indexOf(i);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(i,t,e){Yt.deprecatedWarning1||(Yt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(i,t,e)}addAnimationByName(i,t,e,s){Yt.deprecatedWarning2||(Yt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(i,t,e,s)}hasAnimation(i){return this.data.skeletonData.findAnimation(i)!==null}hasAnimationByName(i){return Yt.deprecatedWarning3||(Yt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(i)}};let ps=Yt;ps.emptyAnimation=new oe("<empty>",[],0),ps.SUBSEQUENT=0,ps.FIRST=1,ps.HOLD_SUBSEQUENT=2,ps.HOLD_FIRST=3,ps.HOLD_MIX=4,ps.SETUP=1,ps.CURRENT=2,ps.deprecatedWarning1=!1,ps.deprecatedWarning2=!1,ps.deprecatedWarning3=!1;const Ir=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 i=this.animationEnd-this.animationStart;return i==0?this.animationStart:this.trackTime%i+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(i){this.animationLast=i,this.nextAnimationLast=i}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(i){Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=i}get endTime(){return Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(i){Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=i}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Yu=Ir;Yu.deprecatedWarning1=!1,Yu.deprecatedWarning2=!1;const Hu=class{constructor(i){this.objects=[],this.drainDisabled=!1,this.animState=i}start(i){this.objects.push(ss.start),this.objects.push(i),this.animState.animationsChanged=!0}interrupt(i){this.objects.push(ss.interrupt),this.objects.push(i)}end(i){this.objects.push(ss.end),this.objects.push(i),this.animState.animationsChanged=!0}dispose(i){this.objects.push(ss.dispose),this.objects.push(i)}complete(i){this.objects.push(ss.complete),this.objects.push(i)}event(i,t){this.objects.push(ss.event),this.objects.push(i),this.objects.push(t)}deprecateStuff(){return Hu.deprecatedWarning1||(Hu.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 i=this.objects,t=this.animState.listeners;for(let e=0;e<i.length;e+=2){const s=i[e],r=i[e+1];switch(s){case ss.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case ss.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(r);break;case ss.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case ss.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(r);this.animState.trackEntryPool.free(r);break;case ss.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(r);const n=D.toInt(r.loopsCount());r.onComplete&&this.deprecateStuff()&&r.onComplete(r.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(r.trackIndex,n);break;case ss.event:const a=i[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(r,a);r.onEvent&&this.deprecateStuff()&&r.onEvent(r.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(r.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let O_=Hu;O_.deprecatedWarning1=!1;var ss=(i=>(i[i.start=0]="start",i[i.interrupt=1]="interrupt",i[i.end=2]="end",i[i.dispose=3]="dispose",i[i.complete=4]="complete",i[i.event=5]="event",i))(ss||{});const Wu=class{constructor(i){if(this.animationToMixTime={},this.defaultMix=0,i==null)throw new Error("skeletonData cannot be null.");this.skeletonData=i}setMix(i,t,e){const s=this.skeletonData.findAnimation(i);if(s==null)throw new Error(`Animation not found: ${i}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,r,e)}setMixByName(i,t,e){Wu.deprecatedWarning1||(Wu.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(i,t,e)}setMixWith(i,t,e){if(i==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${i.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(i,t){const e=`${i.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let L_=Wu;L_.deprecatedWarning1=!1;let N_=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new it(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Xu(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new HS(e)}newPathAttachment(t,e){return new _l(e)}newPointAttachment(t,e){return new zS(e)}newClippingAttachment(t,e){return new WS(e)}};class V_{constructor(t,e,s){if(this.matrix=new Rt,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,r,n,a,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,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)*r*u,l.c=D.cosDeg(_)*n*u,l.b=D.sinDeg(s+a)*r*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)*r,x=D.cosDeg(g)*n,y=D.sinDeg(s+a)*r,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)*r,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+a)*r,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)*r,b=D.cosDeg(y)*n,w=D.sinDeg(x)*r,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)*r,A=D.cosDeg(90+h)*n,I=D.sinDeg(a)*r,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,r=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,a=e.ty-s.ty;this.ax=n*s.d*r-a*s.c*r,this.ay=a*s.a*r-n*s.b*r;const h=r*s.d,o=r*s.a,l=r*s.c,u=r*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,r=e.c,n=e.b,a=e.d,h=1/(s*a-r*n),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*a*h-l*r*h,t.y=l*s*h-o*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,r=t.y;return t.x=s*e.a+r*e.c+e.tx,t.y=s*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=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*r-o*a,e.b=o*s+h*n,e.d=o*r+h*a,this.appliedValid=!1}}let U_=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}},G_=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},X_=class{constructor(t){this.name=t}};class jS{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,r,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(r||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(r&&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,r,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,r,!1,a,!1,o),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=r-R.ty;let Z=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-u,H=Z*Z+Q*Q;if(h!=0){h*=c*(p+1)/2;const _t=Math.sqrt(H),kt=_t-L-$*c+h;if(kt>0){let zt=Math.min(1,kt/(h*2))-1;zt=(kt-h*(1-zt*zt))/_t,Z-=zt*Z,Q-=zt*Q,H=Z*Z+Q*Q}}t:if(M){$*=c;let _t=(H-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,a&&(d*=(Math.sqrt(H)/(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,kt=T*T,zt=Math.atan2(Q,Z);A=kt*L*L+_t*H-_t*kt;const Qt=-2*kt*L,Pt=kt-_t;if(I=Qt*Qt-4*Pt*A,I>=0){let Bn=Math.sqrt(I);Qt<0&&(Bn=-Bn),Bn=-(Qt+Bn)/2;const ey=Bn/Pt,sy=A/Bn,Dn=Math.abs(ey)<Math.abs(sy)?ey:sy;if(Dn*Dn<=H){k=Math.sqrt(H-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,is=0,li=0,kn=L+E,hi=kn*kn,ty=0;A=-E*L/(_t-kt),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,is=k),I>hi&&(li=A,hi=I,kn=P,ty=k)),H<=(ze+hi)/2?(O=zt-Math.atan2(is*n,Ot),N=jt*n):(O=zt-Math.atan2(ty*n,kn),N=li*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 $_=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=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(be||{});const $i=class{constructor(i,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,i==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=i,this.bones=new Array;for(let e=0,s=i.bones.length;e<s;e++)this.bones.push(t.findBone(i.bones[e].name));this.target=t.findSlot(i.target.name),this.position=i.position,this.spacing=i.spacing,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix}isActive(){return this.active}apply(){this.update()}update(){const i=this.target.getAttachment();if(!(i instanceof _l))return;const t=this.rotateMix,e=this.translateMix,s=e>0,r=t>0;if(!s&&!r)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<$i.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(i,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,r){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(i,t,e,s,r){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=i.closed;let c=i.worldVerticesLength,d=c/6,f=$i.NONE;if(!i.constantSpeed){const L=i.lengths;d-=u?1:2;const $=L[d];if(s&&(a*=$),r)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 H=a;if(u)H%=$,H<0&&(H+=$),Z=0;else if(H<0){f!=$i.BEFORE&&(f=$i.BEFORE,i.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(H,l,0,o,N);continue}else if(H>$){f!=$i.AFTER&&(f=$i.AFTER,i.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(H-$,l,0,o,N);continue}for(;;Z++){const lt=L[Z];if(!(H>lt)){if(Z==0)H/=lt;else{const Tt=L[Z-1];H=(H-Tt)/(lt-Tt)}break}}Z!=f&&(f=Z,u&&Z==d?(i.computeWorldVertices(n,c-4,4,l,0,2),i.computeWorldVertices(n,0,4,l,4,2)):i.computeWorldVertices(n,Z*6+2,8,l,0,2)),this.addCurvePosition(H,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),i.computeWorldVertices(n,2,c-4,l,0,2),i.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),i.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),r)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 H=p[O];if(!(Q>H)){if(O==0)Q/=H;else{const lt=p[O-1];Q=(Q-lt)/(H-lt)}break}}if(O!=f){f=O;let H=O*6;for(g=l[H],_=l[H+1],x=l[H+2],y=l[H+3],v=l[H+4],b=l[H+5],w=l[H+6],E=l[H+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,H=1;H<8;H++)P+=R,k+=C,R+=I,C+=M,V+=Math.sqrt(P*P+k*k),U[H]=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 H=U[N];if(!(Q>H)){if(N==0)Q/=H;else{const lt=U[N-1];Q=N+(Q-lt)/(H-lt)}break}}this.addCurvePosition(Q*.1,g,_,x,y,v,b,w,E,o,$,e||L>0&&Z==0)}return o}addBeforePosition(i,t,e,s,r){const n=t[e],a=t[e+1],h=t[e+2]-n,o=t[e+3]-a,l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addAfterPosition(i,t,e,s,r){const n=t[e+2],a=t[e+3],h=n-t[e],o=a-t[e+1],l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addCurvePosition(i,t,e,s,r,n,a,h,o,l,u,c){(i==0||isNaN(i))&&(i=1e-4);const d=i*i,f=d*i,p=1-i,m=p*p,g=m*p,_=p*i,x=_*3,y=p*x,v=x*i,b=t*g+s*y+n*v+h*f,w=e*g+r*y+a*v+o*f;l[u]=b,l[u+1]=w,c&&(l[u+2]=Math.atan2(w-(e*m+r*_*2+a*d),b-(t*m+s*_*2+n*d)))}};let Po=$i;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 GS,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,r=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(r>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)*r;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,r=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(r>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)*r;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,r=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(r>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*r}l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=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;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}}const Ro=class{constructor(i){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,i==null)throw new Error("data cannot be null.");this.data=i,this.bones=new Array;for(let t=0;t<i.bones.length;t++){const e=i.bones[t];let s;if(e.parent==null)s=new V_(e,this,null);else{const r=this.bones[e.parent.index];s=new V_(e,this,r),r.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<i.slots.length;t++){const e=i.slots[t],s=this.bones[e.boneData.index],r=new R_(e,s);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<i.ikConstraints.length;t++){const e=i.ikConstraints[t];this.ikConstraints.push(new jS(e,this))}this.transformConstraints=new Array;for(let t=0;t<i.transformConstraints.length;t++){const e=i.transformConstraints[t];this.transformConstraints.push(new qS(e,this))}this.pathConstraints=new Array;for(let t=0;t<i.pathConstraints.length;t++){const e=i.pathConstraints[t];this.pathConstraints.push(new Po(e,this))}this.color=new X(1,1,1,1),this.updateCache()}updateCache(){const i=this._updateCache;i.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,r=this.pathConstraints,n=e.length,a=s.length,h=r.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=r[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(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target;this.sortBone(t);const e=i.bones,s=e[0];if(this.sortBone(s),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(i),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(i){if(i.active=i.target.bone.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.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 r=t.getAttachment();r instanceof _l&&this.sortPathConstraintAttachmentWith(r,s);const n=i.bones,a=n.length;for(let h=0;h<a;h++)this.sortBone(n[h]);this._updateCache.push(i);for(let h=0;h<a;h++)this.sortReset(n[h].children);for(let h=0;h<a;h++)n[h].sorted=!0}sortTransformConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;this.sortBone(i.target);const t=i.bones,e=t.length;if(i.data.local)for(let s=0;s<e;s++){const r=t[s];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(i);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(i,t,e){const s=i.attachments[t];if(s)for(const r in s)this.sortPathConstraintAttachmentWith(s[r],e)}sortPathConstraintAttachmentWith(i,t){if(!(i instanceof _l))return;const e=i.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const h=e[r];this.sortBone(s[h])}}}}sortBone(i){if(i.sorted)return;const t=i.parent;t!=null&&this.sortBone(t),i.sorted=!0,this._updateCache.push(i)}sortReset(i){for(let t=0,e=i.length;t<e;t++){const s=i[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const i=this.updateCacheReset;for(let e=0,s=i.length;e<s;e++){const r=i[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.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 i=this.bones;for(let r=0,n=i.length;r<n;r++)i[r].setToSetupPose();const t=this.ikConstraints;for(let r=0,n=t.length;r<n;r++){const a=t[r];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 r=0,n=e.length;r<n;r++){const a=e[r],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 r=0,n=s.length;r<n;r++){const a=s[r],h=a.data;a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix}}setSlotsToSetupPose(){const i=this.slots;B.arrayCopy(i,0,this.drawOrder,0,i.length);for(let t=0,e=i.length;t<e;t++)i[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findBoneIndex(i){if(i==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==i)return e;return-1}findSlot(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findSlotIndex(i){if(i==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==i)return e;return-1}setSkinByName(i){const t=this.data.findSkin(i);if(t==null)throw new Error(`Skin not found: ${i}`);this.setSkin(t)}setSkin(i){if(i!=this.skin){if(i!=null)if(this.skin!=null)i.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=i.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=i,this.updateCache()}}getAttachmentByName(i,t){return this.getAttachment(this.data.findSlotIndex(i),t)}getAttachment(i,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(i,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(i,t):null}setAttachment(i,t){if(i==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.data.name==i){let a=null;if(t!=null&&(a=this.getAttachment(s,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${i}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${i}`)}findIkConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findTransformConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findPathConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}getBounds(i,t,e=new Array(2)){if(i==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let r=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 it)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];r=Math.min(r,g),n=Math.min(n,_),a=Math.max(a,g),h=Math.max(h,_)}}i.set(r,n),t.set(a-r,h-n)}update(i){this.time+=i}get flipX(){return this.scaleX==-1}set flipX(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=i?1:-1}get flipY(){return this.scaleY==-1}set flipY(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=i?1:-1}};let H_=Ro;H_.deprecatedWarning1=!1;let W_=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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},z_=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}},j_=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}},q_=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 r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment!=null&&(r.attachment instanceof Xu?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.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 r in s){const n=s[r];n&&t.push(new q_(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new q_(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],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(i){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=i}readSkeletonData(i){const t=this.scale,e=new W_;e.name="";const s=new gl(i);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 r=s.readBoolean();r&&(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 U_(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(),r&&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 z_(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 $_(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 j_(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,r);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,r)}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 X_(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(i,t,e,s){let r=null,n=0;if(e){if(n=i.readInt(!0),n==0)return null;r=new ju("default")}else{r=new ju(i.readStringRef()),r.bones.length=i.readInt(!0);for(let a=0,h=r.bones.length;a<h;a++)r.bones[a]=t.bones[i.readInt(!0)];for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.ikConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.transformConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.pathConstraints[i.readInt(!0)]);n=i.readInt(!0)}for(let a=0;a<n;a++){const h=i.readInt(!0);for(let o=0,l=i.readInt(!0);o<l;o++){const u=i.readStringRef(),c=this.readAttachment(i,t,r,h,u,s);c!=null&&r.setAttachment(h,u,c)}}return r}readAttachment(i,t,e,s,r,n){const a=this.scale;let h=i.readStringRef();h==null&&(h=r);const o=i.readByte();switch(Kt.AttachmentTypeValues[o]){case at.Region:{let u=i.readStringRef();const c=i.readFloat(),d=i.readFloat(),f=i.readFloat(),p=i.readFloat(),m=i.readFloat(),g=i.readFloat(),_=i.readFloat(),x=i.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=i.readInt(!0),c=this.readVertices(i,u),d=n?i.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=i.readStringRef();const c=i.readInt32(),d=i.readInt(!0),f=this.readFloatArray(i,d<<1,1),p=this.readShortArray(i),m=this.readVertices(i,d),g=i.readInt(!0);let _=null,x=0,y=0;n&&(_=this.readShortArray(i),x=i.readFloat(),y=i.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=i.readStringRef();const c=i.readInt32(),d=i.readStringRef(),f=i.readStringRef(),p=i.readBoolean();let m=0,g=0;n&&(m=i.readFloat(),g=i.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 ZS(_,d,s,f,p)),_)}case at.Path:{const u=i.readBoolean(),c=i.readBoolean(),d=i.readInt(!0),f=this.readVertices(i,d),p=B.newArray(d/3,0);for(let _=0,x=p.length;_<x;_++)p[_]=i.readFloat()*a;const m=n?i.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=i.readFloat(),c=i.readFloat(),d=i.readFloat(),f=n?i.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=i.readInt(!0),c=i.readInt(!0),d=this.readVertices(i,c),f=n?i.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(i,t){const e=t<<1,s=new KS,r=this.scale;if(!i.readBoolean())return s.vertices=this.readFloatArray(i,e,r),s;const n=new Array,a=new Array;for(let h=0;h<t;h++){const o=i.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(i.readInt(!0)),n.push(i.readFloat()*r),n.push(i.readFloat()*r),n.push(i.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=a,s}readFloatArray(i,t,e){const s=new Array(t);if(e==1)for(let r=0;r<t;r++)s[r]=i.readFloat();else for(let r=0;r<t;r++)s[r]=i.readFloat()*e;return s}readShortArray(i){const t=i.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=i.readShort();return e}readAnimation(i,t,e){const s=new Array,r=this.scale;let n=0;const a=new X,h=new X;for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.SLOT_ATTACHMENT:{const _=new Rn(g);_.slotIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readStringRef());s.push(_),n=Math.max(n,_.frames[g-1]);break}case Kt.SLOT_COLOR:{const _=new He(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*He.ENTRIES]);break}case Kt.SLOT_TWO_COLOR:{const _=new ae(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),X.rgb888ToColor(h,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a,h.r,h.g,h.b),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*ae.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.BONE_ROTATE:{const _=new Ie(g);_.boneIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readFloat()),x<g-1&&this.readCurve(i,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 M_(g):m==Kt.BONE_SHEAR?_=new F_(g):(_=new fs(g),x=r),_.boneIndex=d;for(let y=0;y<g;y++)_.setFrame(y,i.readFloat(),i.readFloat()*x,i.readFloat()*x),y<g-1&&this.readCurve(i,y,_);s.push(_),n=Math.max(n,_.frames[(g-1)*fs.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new Pe(f);p.ikConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat()*r,i.readByte(),i.readBoolean(),i.readBoolean()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new We(f);p.transformConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=e.pathConstraints[d];for(let p=0,m=i.readInt(!0);p<m;p++){const g=i.readByte(),_=i.readInt(!0);switch(g){case Kt.PATH_POSITION:case Kt.PATH_SPACING:{let x,y=1;g==Kt.PATH_SPACING?(x=new D_(_),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(y=r)):(x=new Cr(_),f.positionMode==ne.Fixed&&(y=r)),x.pathConstraintIndex=d;for(let v=0;v<_;v++)x.setFrame(v,i.readFloat(),i.readFloat()*y),v<_-1&&this.readCurve(i,v,x);s.push(x),n=Math.max(n,x.frames[(_-1)*Cr.ENTRIES]);break}case Kt.PATH_MIX:{const x=new or(_);x.pathConstraintIndex=d;for(let y=0;y<_;y++)x.setFrame(y,i.readFloat(),i.readFloat(),i.readFloat()),y<_-1&&this.readCurve(i,y,x);s.push(x),n=Math.max(n,x.frames[(_-1)*or.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=e.skins[i.readInt(!0)];for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readInt(!0);for(let g=0,_=i.readInt(!0);g<_;g++){const x=d.getAttachment(m,i.readStringRef()),y=x.bones!=null,v=x.vertices,b=y?v.length/3*2:v.length,w=i.readInt(!0),E=new B_(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=i.readFloat();let I,M=i.readInt(!0);if(M==0)I=y?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=i.readInt(!0);if(M+=R,r==1)for(let C=R;C<M;C++)I[C]=i.readFloat();else for(let C=R;C<M;C++)I[C]=i.readFloat()*r;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(i,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const o=i.readInt(!0);if(o>0){const u=new Io(o),c=e.slots.length;for(let d=0;d<o;d++){const f=i.readFloat(),p=i.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=i.readInt(!0);for(;_!=v;)g[x++]=_++;m[_+i.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=i.readInt(!0);if(l>0){const u=new $u(l);for(let c=0;c<l;c++){const d=i.readFloat(),f=e.events[i.readInt(!0)],p=new G_(d,f);p.intValue=i.readInt(!1),p.floatValue=i.readFloat(),p.stringValue=i.readBoolean()?i.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=i.readFloat(),p.balance=i.readFloat()),u.setFrame(c,p)}s.push(u),n=Math.max(n,u.frames[l-1])}return new oe(t,s,n)}readCurve(i,t,e){switch(i.readByte()){case Kt.CURVE_STEPPED:e.setStepped(t);break;case Kt.CURVE_BEZIER:this.setCurve(e,t,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat());break}}setCurve(i,t,e,s,r,n){i.setCurve(t,e,s,r,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 ZS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}},KS=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},QS=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new W_,r=typeof t=="string"?JSON.parse(t):t,n=r.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(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.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 U_(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(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.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 z_(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(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new $_(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(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new j_(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(r.path)for(let a=0;a<r.path.length;a++){const h=r.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(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.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,r.events)for(const a in r.events){const h=r.events[a],o=new X_(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(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,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,r);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",r),l=this.attachmentLoader.newMeshAttachment(e,r,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 JS(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,r);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,r);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,r);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 r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;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]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=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 He(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)*He.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 M_(d.length),m=1):c==="shear"?f=new F_(d.length):(f=new fs(d.length),p=r),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)*fs.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)*r,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 D_(f.length),(c.spacingMode==be.Length||c.spacingMode==be.Fixed)&&(m=r)):(p=new Cr(f.length),c.positionMode==ne.Fixed&&(m=r)),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)*Cr.ENTRIES])}else if(d==="mix"){const p=new or(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)*or.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 B_(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),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;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 G_(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 r=t.curve;e.setCurve(s,r,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}`)}},JS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}};class tC extends Gu{createSkeleton(t){this.skeleton=new H_(t),this.skeleton.updateWorldTransform(),this.stateData=new L_(t),this.state=new ps(this.stateData)}}const eC={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(i){return Le(i,".atlas")},async load(i){return await(await z.ADAPTER.fetch(i)).text()},testParse(i,t){const e=Le(t.src,".atlas"),s=typeof i=="string";return Promise.resolve(e&&s)},async parse(i,t,e){const s=t.data;let r=bt.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");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(i,(c,d)=>{const f=u[c]||u.default;f&&f.baseTexture?d(f.baseTexture):d(f)},l)}else o=new Uu(i,Z_(e,r,s.imageMetadata),l);return await h},unload(i){i.dispose()}}},Z_=(i,t,e)=>async(s,r)=>{const n=bt.normalize([...t.split(bt.sep),s].join(bt.sep)),a=await i.load({src:n,data:e});r(a.baseTexture)};K.add(eC);function K_(i){return i.hasOwnProperty("bones")}function sC(i){return i instanceof ArrayBuffer}class rC{constructor(){}installLoader(){const t=this,e={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(s){return Le(s,".skel")},async load(s){return await(await z.ADAPTER.fetch(s)).arrayBuffer()},testParse(s,r){var o;const n=Le(r.src,".json")&&K_(s),a=Le(r.src,".skel")&&sC(s),h=((o=r.data)==null?void 0:o.spineAtlas)===!1;return Promise.resolve(n&&!h||a)},async parse(s,r,n){const a=bt.extname(r.src).toLowerCase(),h=bt.basename(r.src,a);let o=bt.dirname(r.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=Le(r.src,".json")&&K_(s);let u=null,c=s;l?u=t.createJsonParser():(u=t.createBinaryParser(),c=new Uint8Array(s));const d=r.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,Z_(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 Q_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const J_=class extends Q_{constructor(t){super(t),this.id=(J_.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,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];r[w]=E*_+T*x+m,r[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}r[p]=g,r[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}r[m]=x,r[m+1]=y}}}applyDeform(t){return this==t}};let Yi=J_;Yi.nextID=0;let iC=class extends Yi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},nC=class extends Yi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},oC=class extends Yi{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)}},aC=class extends Yi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},lC=class extends Yi{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),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}};class hC{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 Q_{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,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+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=r*o+this.y,f=r*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,r){const n=this.offset,a=t instanceof hC?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+=r,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,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 S_(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,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&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 r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const se=class{constructor(i){if(i<=0)throw new Error(`frameCount must be > 0: ${i}`);this.curves=B.newFloatArray((i-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(i){this.curves[i*se.BEZIER_SIZE]=se.LINEAR}setStepped(i){this.curves[i*se.BEZIER_SIZE]=se.STEPPED}getCurveType(i){const t=i*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(i,t,e,s,r){const n=(-t*2+s)*.03,a=(-e*2+r)*.03,h=((t-s)*3+1)*.006,o=((e-r)*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=i*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(i,t){t=D.clamp(t,0,1);const e=this.curves;let s=i*se.BEZIER_SIZE;const r=e[s];if(r==se.LINEAR)return t;if(r==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 rs=se;rs.LINEAR=0,rs.STEPPED=1,rs.BEZIER=2,rs.BEZIER_SIZE=10*2-1;const si=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(i,t,e){i<<=1,this.frames[i]=t,this.frames[i+si.ROTATION]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.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)*r}return}if(e>=h[h.length-si.ENTRIES]){let p=h[h.length+si.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*r;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*r}return}const l=Ee.binarySearch(h,e,si.ENTRIES),u=h[l+si.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+si.PREV_TIME]-c));let f=h[l+si.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)*r;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)*r}}};let Mn=si;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(i,t,e,s){i*=De.ENTRIES,this.frames[i]=t,this.frames[i+De.X]=e,this.frames[i+De.Y]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.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)*r,o.y+=(o.data.y-o.y)*r}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*r,o.y=o.data.y+u*r;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*r,o.y+=(o.data.y+u-o.y)*r;break;case S.add:o.x+=l*r,o.y+=u*r}}};let ar=De;ar.ENTRIES=3,ar.PREV_TIME=-3,ar.PREV_X=-2,ar.PREV_Y=-1,ar.X=1,ar.Y=2;let cC=class Ds extends ar{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,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-Ds.ENTRIES])u=o[o.length+Ds.PREV_X]*l.data.scaleX,c=o[o.length+Ds.PREV_Y]*l.data.scaleY;else{const d=Ee.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)*l.data.scaleX,c=(c+(o[d+Ds.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}}}},uC=class Os extends ar{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,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-Os.ENTRIES])u=o[o.length+Os.PREV_X],c=o[o.length+Os.PREV_Y];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,c=c+(o[d+Os.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 Ht=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(i,t,e,s,r,n){i*=Ht.ENTRIES,this.frames[i]=t,this.frames[i+Ht.R]=e,this.frames[i+Ht.G]=s,this.frames[i+Ht.B]=r,this.frames[i+Ht.A]=n}apply(i,t,e,s,r,n,a){const h=i.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)*r,(p.g-f.g)*r,(p.b-f.b)*r,(p.a-f.a)*r)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Ht.ENTRIES]){const f=o.length;l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A]}else{const f=Ee.binarySearch(o,e,Ht.ENTRIES);l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A];const p=o[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(o[f+Ht.PREV_TIME]-p));l+=(o[f+Ht.R]-l)*m,u+=(o[f+Ht.G]-u)*m,c+=(o[f+Ht.B]-c)*m,d+=(o[f+Ht.A]-d)*m}if(r==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)*r,(u-f.g)*r,(c-f.b)*r,(d-f.a)*r)}}};let ms=Ht;ms.ENTRIES=5,ms.PREV_TIME=-5,ms.PREV_R=-4,ms.PREV_G=-3,ms.PREV_B=-2,ms.PREV_A=-1,ms.R=1,ms.G=2,ms.B=3,ms.A=4;const ft=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(i,t,e,s,r,n,a,h,o){i*=ft.ENTRIES,this.frames[i]=t,this.frames[i+ft.R]=e,this.frames[i+ft.G]=s,this.frames[i+ft.B]=r,this.frames[i+ft.A]=n,this.frames[i+ft.R2]=a,this.frames[i+ft.G2]=h,this.frames[i+ft.B2]=o}apply(i,t,e,s,r,n,a){const h=i.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)*r,(x.g-g.g)*r,(x.b-g.b)*r,(x.a-g.a)*r),_.add((y.r-_.r)*r,(y.g-_.g)*r,(y.b-_.b)*r,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(r==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)*r,(u-g.g)*r,(c-g.b)*r,(d-g.a)*r),_.add((f-_.r)*r,(p-_.g)*r,(m-_.b)*r,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 dC=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,r,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))}},t0=null,fC=class extends rs{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),t0==null&&(t0=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,r,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Yi)||!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}}}},pC=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,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,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++)r.push(this.events[u])}},mC=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,r,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 rs{constructor(i){super(i),this.frames=B.newFloatArray(i*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(i,t,e,s,r,n){i*=St.ENTRIES,this.frames[i]=t,this.frames[i+St.MIX]=e,this.frames[i+St.BEND_DIRECTION]=s,this.frames[i+St.COMPRESS]=r?1:0,this.frames[i+St.STRETCH]=n?1:0}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.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)*r,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)*r,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)*r,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)*r,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)*r,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 gs=St;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_MIX=-4,gs.PREV_BEND_DIRECTION=-3,gs.PREV_COMPRESS=-2,gs.PREV_STRETCH=-1,gs.MIX=1,gs.BEND_DIRECTION=2,gs.COMPRESS=3,gs.STRETCH=4;const Wt=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(i,t,e,s,r,n){i*=Wt.ENTRIES,this.frames[i]=t,this.frames[i+Wt.ROTATE]=e,this.frames[i+Wt.TRANSLATE]=s,this.frames[i+Wt.SCALE]=r,this.frames[i+Wt.SHEAR]=n}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.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)*r,o.translateMix+=(f.translateMix-o.translateMix)*r,o.scaleMix+=(f.scaleMix-o.scaleMix)*r,o.shearMix+=(f.shearMix-o.shearMix)*r}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)*r,o.translateMix=f.translateMix+(u-f.translateMix)*r,o.scaleMix=f.scaleMix+(c-f.scaleMix)*r,o.shearMix=f.shearMix+(d-f.shearMix)*r}else o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r,o.scaleMix+=(c-o.scaleMix)*r,o.shearMix+=(d-o.shearMix)*r}};let _s=Wt;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_ROTATE=-4,_s.PREV_TRANSLATE=-3,_s.PREV_SCALE=-2,_s.PREV_SHEAR=-1,_s.ROTATE=1,_s.TRANSLATE=2,_s.SCALE=3,_s.SHEAR=4;const Is=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(i,t,e){i*=Is.ENTRIES,this.frames[i]=t,this.frames[i+Is.VALUE]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.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)*r}return}let l=0;if(e>=h[h.length-Is.ENTRIES])l=h[h.length+Is.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Is.ENTRIES);l=h[u+Is.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Is.ENTRIES-1,1-(e-c)/(h[u+Is.PREV_TIME]-c));l+=(h[u+Is.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*r:o.position+=(l-o.position)*r}};let Hi=Is;Hi.ENTRIES=2,Hi.PREV_TIME=-2,Hi.PREV_VALUE=-1,Hi.VALUE=1;let gC=class ui extends Hi{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,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-ui.ENTRIES])u=o[o.length+ui.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ui.ENTRIES);u=o[c+ui.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ui.ENTRIES-1,1-(s-d)/(o[c+ui.PREV_TIME]-d));u+=(o[c+ui.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 rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(i,t,e,s){i*=Oe.ENTRIES,this.frames[i]=t,this.frames[i+Oe.ROTATE]=e,this.frames[i+Oe.TRANSLATE]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.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)*r,o.translateMix+=(o.data.translateMix-o.translateMix)*r}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)*r,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*r):(o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r)}};let ri=Oe;ri.ENTRIES=3,ri.PREV_TIME=-3,ri.PREV_ROTATE=-2,ri.PREV_TRANSLATE=-1,ri.ROTATE=1,ri.TRANSLATE=2,new Ee("<empty>",[],0);let _C=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new oC(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new iC(e)}newPathAttachment(t,e){return new aC(e)}newPointAttachment(t,e){return new lC(e)}newClippingAttachment(t,e){return new nC(e)}},yC=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}},xC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},vC=class{constructor(t){this.name=t}},bC=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}},wC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var ii=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(ii||{});let EC=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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},TC=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}},AC=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}},SC=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 r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],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++}}},CC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new EC,r=typeof t=="string"?JSON.parse(t):t,n=r.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),r.bones)for(let a=0;a<r.bones.length;a++){const h=r.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 yC(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(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.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 TC(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(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new bC(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(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[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.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(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[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(`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==ii.Length||o.spacingMode==ii.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(const a in r.skins){const h=r.skins[a],o=new SC(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,r.events)for(const a in r.events){const h=r.events[a],o=new vC(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(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,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,r);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",r),l=this.attachmentLoader.newMeshAttachment(e,r,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 IC(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,r);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,r);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,r);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 r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;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]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=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 dC(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 ms(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)*ms.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 cC(d.length):c==="shear"?f=new uC(d.length):(f=new ar(d.length),p=r),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)*ar.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 gs(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)*gs.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new _s(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)*_s.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 gC(f.length),(c.spacingMode==ii.Length||c.spacingMode==ii.Fixed)&&(m=r)):(p=new Hi(f.length),c.positionMode==ne.Fixed&&(m=r)),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)*Hi.ENTRIES])}else if(d==="mix"){const p=new ri(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)*ri.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 fC(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),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;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 mC(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 pC(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 xC(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 r=t.curve;e.setCurve(s,r[0],r[1],r[2],r[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 ii.Length;if(t=="fixed")return ii.Fixed;if(t=="percent")return ii.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}`)}},IC=class{constructor(t,e,s,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r}};class e0{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const s0=class extends e0{constructor(i){super(i),this.id=s0.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(i,t){this.computeWorldVertices(i,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(i,t,e,s,r,n){e=r+(e>>1)*n;const a=i.bone.skeleton,h=i.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=i.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=r;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=r,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=r,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(i){this.bones?(i.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,i.bones,0,this.bones.length)):i.bones=null,this.vertices&&(i.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,i.vertices,0,this.vertices.length)),i.worldVerticesLength=this.worldVerticesLength,i.timelineAttachment=this.timelineAttachment}};let ni=s0;ni.nextID=0;class qu extends ni{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 ni{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 ni{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,r,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,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 ni{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 ni{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),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*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 e0{constructor(i,t){super(i),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 i=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,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+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=r*o+c,m=r*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;i.degrees==90?(b[2]=i.u,b[3]=i.v2,b[4]=i.u,b[5]=i.v,b[6]=i.u2,b[7]=i.v,b[0]=i.u2,b[1]=i.v2):(b[0]=i.u,b[1]=i.v2,b[2]=i.u,b[3]=i.v,b[4]=i.u2,b[5]=i.v,b[6]=i.u2,b[7]=i.v2)}computeWorldVertices(i,t,e,s){this.sequence!=null&&this.sequence.apply(i,this);const r=i.bone,n=this.offset,a=r.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 i=new r0(this.name,this.path);return i.region=this.region,i.rendererObject=this.rendererObject,i.x=this.x,i.y=this.y,i.scaleX=this.scaleX,i.scaleY=this.scaleY,i.rotation=this.rotation,i.width=this.width,i.height=this.height,B.arrayCopy(this.uvs,0,i.uvs,0,8),B.arrayCopy(this.offset,0,i.offset,0,8),i.color.setFromColor(this.color),i.sequence=this.sequence!=null?this.sequence.copy():null,i}};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 yl=class{constructor(i){this.id=yl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(i)}copy(){const i=new yl(this.regions.length);return B.arrayCopy(this.regions,0,i.regions,0,this.regions.length),i.start=this.start,i.digits=this.digits,i.setupIndex=this.setupIndex,i}apply(i,t){let e=i.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(i,t){let e=i;const s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)e+="0";return e+=s,e}static nextID(){return yl._nextID++}};let Ju=yl;Ju._nextID=0;var Pr=(i=>(i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse",i))(Pr||{});const i0=[0,1,2,3,4,5,6];class td{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new LS,!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,r,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");r&&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 r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){const r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}}class lr 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,r,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=(r-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-r+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=r+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,r){const n=this.curves;if(n[r]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}const a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){const l=n[r-2],u=n[r-1];return u+(t-l)/(n[r]-l)*(n[r+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 hr extends lr{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 r=this.curves[s>>1];switch(r){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,r-2)}}class ed extends lr{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class n0 extends hr{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,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 o0 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,r,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 a0 extends hr{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,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 l0 extends hr{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,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 h0 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,r,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 c0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,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 u0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,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 d0 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,r,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 f0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,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 p0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,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 m0 extends lr{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,r,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,r,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 g0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,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 _0 extends hr{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,r,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 y0 extends lr{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,r,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,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,r,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 x0 extends lr{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,r,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,r,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 v0 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,r,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 b0 extends lr{constructor(t,e,s,r){super(t,e,[`${yt.deform}|${s}|${r.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=r,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,r,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=(r-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-r+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=r+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 r=s[e];switch(r){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(r-=2,s[r]>t){const o=this.frames[e];return s[r+1]*(t-o)/(s[r]-o)}const n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){const o=s[r-2],l=s[r-1];return l+(t-o)/(s[r]-o)*(s[r+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,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof ni)||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 w0=class extends he{constructor(i){super(i,w0.propertyIds),this.events=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t){this.frames[i]=t.time,this.events[i]=t}apply(i,t,e,s,r,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(i,t,Number.MAX_VALUE,s,r,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=w0;sd.propertyIds=[`${yt.event}`];const E0=class extends he{constructor(i){super(i,E0.propertyIds),this.drawOrders=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t,e){this.frames[i]=t,this.drawOrders[i]=e}apply(i,t,e,s,r,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);else{const l=i.drawOrder,u=i.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let rd=E0;rd.propertyIds=[`${yt.drawOrder}`];class T0 extends lr{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,r,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 A0 extends lr{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,r,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 S0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,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 C0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,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 I0 extends lr{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=r,a[t+3]=n}apply(t,e,s,r,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 oi=class extends he{constructor(i,t,e){super(i,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return oi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(i,t,e,s,r){const n=this.frames;i*=oi.ENTRIES,n[i]=t,n[i+oi.MODE]=e|s<<4,n[i+oi.DELAY]=r}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof ni)||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,oi.ENTRIES),d=u[c],f=u[c+oi.MODE],p=u[c+oi.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=i0[f&15];if(_!=Pr.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pr.once:m=Math.min(g-1,m);break;case Pr.loop:m%=g;break;case Pr.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pr.onceReverse:m=Math.max(g-1-m,0);break;case Pr.loopReverse:m=g-1-m%g;break;case Pr.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=oi;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new td("<empty>",[],0);class P0{constructor(t){this.atlas=t}loadSequence(t,e,s){const r=s.regions;for(let n=0,a=r.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})`);r[n]=o,r[n].renderObject=r[n]}}newRegionAttachment(t,e,s,r){const n=new gt(e,s);if(r!=null)this.loadSequence(e,s,r);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,r){const n=new Mo(e,s);if(r!=null)this.loadSequence(e,s,r);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 R0{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 id{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let M0=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 F0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class k0 extends id{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 B0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Ps.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 Ps=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional",i))(Ps||{});class D0{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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}}class O0{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 L0 extends id{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 N0{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 r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment&&(r.attachment instanceof Mo?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.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 r in s){const n=s[r];n&&t.push(new N0(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new N0(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],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 V0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new D0;s.name="";const r=new gl(t),n=r.readInt32(),a=r.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=r.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=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat();const o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("String in string table must not be null.");r.strings.push(d)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[r.readInt(!0)],p=new R0(c,d,f);p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.transformMode=r.readInt(!0),p.skinRequired=r.readBoolean(),o&&X.rgba8888ToColor(p.color,r.readInt32()),s.bones.push(p)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[r.readInt(!0)],p=new O0(c,d,f);X.rgba8888ToColor(p.color,r.readInt32());const m=r.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=r.readStringRef(),p.blendMode=r.readInt(!0),s.slots.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new k0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.mix=r.readFloat(),p.softness=r.readFloat()*e,p.bendDirection=r.readByte(),p.compress=r.readBoolean(),p.stretch=r.readBoolean(),p.uniform=r.readBoolean(),s.ikConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new L0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.local=r.readBoolean(),p.relative=r.readBoolean(),p.offsetRotation=r.readFloat(),p.offsetX=r.readFloat()*e,p.offsetY=r.readFloat()*e,p.offsetScaleX=r.readFloat(),p.offsetScaleY=r.readFloat(),p.offsetShearY=r.readFloat(),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),p.mixScaleX=r.readFloat(),p.mixScaleY=r.readFloat(),p.mixShearY=r.readFloat(),s.transformConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new B0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.slots[r.readInt(!0)],p.positionMode=r.readInt(!0),p.spacingMode=r.readInt(!0),p.rotateMode=r.readInt(!0),p.offsetRotation=r.readFloat(),p.position=r.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=r.readFloat(),(p.spacingMode==Ps.Length||p.spacingMode==Ps.Fixed)&&(p.spacing*=e),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(r,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+r.readInt(!0));c<l;c++){const d=this.readSkin(r,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=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readStringRef();if(!d)throw new Error;const f=new F0(d);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,d,s))}return s}readSkin(t,e,s,r){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,r);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,r,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 PC(_,c,r,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?U0:t.readByte()}readVertices(t,e){const s=this.scale,r=e<<1,n=new RC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,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 r=new Array(e);if(s==1)for(let n=0;n<e;n++)r[n]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const r=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 GC:{const _=new v0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());r.push(_);break}case XC:{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;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 Rs:x.setStepped(T);break;case Ms: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}r.push(x);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;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 Rs:x.setStepped(E);break;case Ms: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}r.push(x);break}case YC:{const _=t.readInt(!0),x=new y0(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 Rs:x.setStepped(M);break;case Ms: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}r.push(x);break}case HC:{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;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 Rs:x.setStepped(I);break;case Ms: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}r.push(x);break}case WC:{const _=new _0(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 Rs:_.setStepped(v);break;case Ms:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}r.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 MC:r.push(Rr(t,new n0(m,g,c),1));break;case FC:r.push(od(t,new o0(m,g,c),n));break;case kC:r.push(Rr(t,new a0(m,g,c),n));break;case BC:r.push(Rr(t,new l0(m,g,c),n));break;case DC:r.push(od(t,new h0(m,g,c),1));break;case OC:r.push(Rr(t,new c0(m,g,c),1));break;case LC:r.push(Rr(t,new u0(m,g,c),1));break;case NC:r.push(od(t,new d0(m,g,c),1));break;case VC:r.push(Rr(t,new f0(m,g,c),1));break;case UC:r.push(Rr(t,new p0(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 T0(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 Rs:p.setStepped(x);break;case Ms: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}r.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 A0(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 Rs:p.setStepped(w);break;case Ms: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}r.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 jC:r.push(Rr(t,new S0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case qC:r.push(Rr(t,new C0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Ps.Length||d.spacingMode==Ps.Fixed?n:1));break;case ZC:const m=new I0(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 Rs:m.setStepped(v);break;case Ms: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}r.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 U0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new b0(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 Rs:M.setStepped(C);break;case Ms:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}r.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,i0[A&15],A>>4,t.readFloat())}r.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new rd(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)}r.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 M0(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)}r.push(l)}let o=0;for(let l=0,u=r.length;l<u;l++)o=Math.max(o,r[l].getDuration());return new td(e,r,o)}}V0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let PC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};class RC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Rr(i,t,e){let s=i.readFloat(),r=i.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,r),n!=h;n++){const o=i.readFloat(),l=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(n);break;case Ms:ct(i,t,a++,n,0,s,o,r,l,e)}s=o,r=l}return t}function od(i,t,e){let s=i.readFloat(),r=i.readFloat()*e,n=i.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,r,n),a!=o;a++){const l=i.readFloat(),u=i.readFloat()*e,c=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(a);break;case Ms:ct(i,t,h++,a,0,s,l,r,u,e),ct(i,t,h++,a,1,s,l,n,c,e)}s=l,r=u,n=c}return t}function ct(i,t,e,s,r,n,a,h,o,l){t.setBezier(e,s,r,n,h,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,a,o)}const MC=0,FC=1,kC=2,BC=3,DC=4,OC=5,LC=6,NC=7,VC=8,UC=9,GC=0,XC=1,$C=2,YC=3,HC=4,WC=5,U0=0,zC=1,jC=0,qC=1,ZC=2,Rs=1,Ms=2;class ad{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new D0,r=typeof t=="string"?JSON.parse(t):t,n=r.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(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.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 R0(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(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.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 O0(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(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new k0(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(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new L0(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(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new B0(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(Ps,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==Ps.Length||o.spacingMode==Ps.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(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.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,r.events)for(const a in r.events){const h=r.events[a],o=new F0(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(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=F(t,"name",r),F(t,"type","region")){case"region":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,r,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,r);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",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,r,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 KC(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,r);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,r);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,r);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 r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;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]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=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 v0(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 m0(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 g0(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(cr(d,new _0(f,f,u),0,1));else if(c=="rgba2"){const p=new y0(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 x0(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(cr(d,new n0(f,f,u),0,1));else if(c==="translate"){const p=new o0(f,f<<1,u);n.push(ld(d,p,"x","y",0,r))}else if(c==="translatex"){const p=new a0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="translatey"){const p=new l0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="scale"){const p=new h0(f,f<<1,u);n.push(ld(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new c0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="scaley"){const p=new u0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="shear"){const p=new d0(f,f<<1,u);n.push(ld(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new f0(f,f,u);n.push(cr(d,p,0,1))}else if(c==="sheary"){const p=new p0(f,f,u);n.push(cr(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 T0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*r;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)*r,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,r)),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 A0(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 S0(p,p,u);n.push(cr(d,m,0,l.positionMode==ne.Fixed?r:1))}else if(c==="spacing"){const m=new C0(p,p,u);n.push(cr(d,m,0,l.spacingMode==Ps.Length||l.spacingMode==Ps.Fixed?r:1))}else if(c==="mix"){const m=new I0(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 b0(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),r!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=r;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=Pr[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 rd(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 M0(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 KC{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}}function cr(i,t,e,s){let r=i[0],n=F(r,"time",0),a=F(r,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=i[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;r.curve&&(h=pt(r.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,r=l}}function ld(i,t,e,s,r,n){let a=i[0],h=F(a,"time",0),o=F(a,e,r)*n,l=F(a,s,r)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=i[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,r)*n,m=F(d,s,r)*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(i,t,e,s,r,n,a,h,o,l){if(i=="stepped")return t.setStepped(s),e;const u=r<<2,c=i[u],d=i[u+1]*l,f=i[u+2],p=i[u+3]*l;return t.setBezier(e,s,r,n,h,c,d,f,p,a,o),e+1}function F(i,t,e){return i[t]!==void 0?i[t]:e}var ai=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VER37=37]="VER37",i[i.VER38=38]="VER38",i[i.VER40=40]="VER40",i[i.VER41=41]="VER41",i))(ai||{});function hd(i){const t=i.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 QC{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=hd(r);if(n===ai.VER38&&(s=new le(new N_(t))),r=this.readVersionNewFormat(e),n=hd(r),(n===ai.VER40||n===ai.VER41)&&(s=new V0(new P0(t))),!s){const a=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new gl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new gl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class JC{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=hd(s);let n=null;if(r===ai.VER37&&(n=new CC(new _C(t))),r===ai.VER38&&(n=new QS(new N_(t))),(r===ai.VER40||r===ai.VER41)&&(n=new ad(new P0(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 tI extends rC{createBinaryParser(){return new QC}createJsonParser(){return new JC}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new tI().installLoader();class eI extends tC{constructor(t,e){const{followPointList:s,visible:r=!1}=e||{};let n;typeof t=="string"?n=Gr.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,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||!0})})),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(r=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{r()}}})}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,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:r,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=r),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 Mr=(i,t,e,s=!1)=>{i.cursor="pointer",i.eventMode="static";const r=n=>{n.button!==2&&e(n)};s?i.once(t,r):i.on(t,r)};class sI extends Bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=r,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Mr(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mr(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,r&&(this._btn.tint=r))})}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 rI 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,Mr(this,"pointerenter",()=>{xt.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Mr(this,"pointerleave",()=>{e.alpha=1,xt.to(e,{duration:.25,rotation:0})}),Mr(this,"pointerdown",()=>{e.alpha=.5}),Mr(this,"pointerup",()=>{s()})}}class iI extends Bt{constructor(t){super(),this._maskUI=new du({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 nI extends Bt{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._paramTxts=[];for(let e=0;e<3;e++){const s=new Nu({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=s,s.x=0,s.y=s.height*e,this.addChild(s),s.alpha=.75}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._setTxtInfo(0,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._setTxtInfo(1,this._drawCount),this._setTxtInfo(2,this._maxDrawCount),this._drawCount=0},Vr.UTILITY)}_setTxtInfo(t,e){const s=a=>{this._paramTxts[t].style.fill="#fff",a<=30&&(this._paramTxts[t].style.fill="yellow"),a<=20&&(this._paramTxts[t].style.fill="red")},r=a=>{this._paramTxts[t].style.fill="#fff",a>=75&&(this._paramTxts[t].style.fill="yellow"),a>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(s(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class oI extends Bt{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:r,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-r)/2,this._progressBar.y=(s-n)/2;const l=new Ks;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 aI extends Ao{constructor(t){const{width:e,height:s,scrollContent:r,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=r,this._content=new Bt,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 Ks,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 lI extends Ao{constructor(t){const{width:e,height:s,content:r,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 Ks;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=r,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,e=!0){var s;t<0?(xt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.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 r;(r=this._scrollCallback)==null||r.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:e?.25:.01,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}})),(s=this._slideCallback)==null||s.call(this,this._currentIndex)}setDepth(t,e,s=0){const r=e-s,n=Math.floor(Math.abs(r)/70),a=Math.abs(r)%70/70,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 r=this._scrollHeight/2,n=-this._pageNum*this._slideHeight+this._scrollHeight/2;s>r&&(s=r),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,r=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||r>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 G0=i=>{const t=new Ks;return t.beginFill(16777215),t.drawRect(0,0,i.width,i.height),t.endFill(),i.addChild(t),i.mask=t,t};class hI extends Ao{constructor(t,e,s,r){super(t,e),this._currentIndex=0,this._slideWidth=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,G0(this),this._slideWidth=t,this._slideArea=s,this.slideCallback=r,this._pageNum=Math.floor(s.width/this._slideWidth)-1,this.addChild(s),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}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25})),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}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,r=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||r>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class cI{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 uI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new cI(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 X0=(i,t,e)=>{const s=t/i.width*i.scale.x,r=e?e/i.height*i.scale.y:s,n=Math.min(s,r);i.scale.set(n>1?1:n)};class dI extends Bt{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:r=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=r,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 Ks;s.lineStyle(this._lineWidth,this._lineColor),this._outsideBorder&&s.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)s.moveTo(0,r*this._cellHeight),s.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)s.moveTo(r*this._cellWidth,0),s.lineTo(r*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 r=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(r),r.anchor.set(.5),r.position.set(n,a),X0(r,this._cellWidth*.9)}}var cd={};/*!
|
|
1170
1172
|
* howler.js v2.2.4
|
|
1171
1173
|
* howlerjs.com
|
|
1172
1174
|
*
|
|
@@ -1174,7 +1176,7 @@ void main(void)\r
|
|
|
1174
1176
|
* goldfirestudios.com
|
|
1175
1177
|
*
|
|
1176
1178
|
* MIT License
|
|
1177
|
-
*/(function(s){(function(){var t=function(){this.init()};t.prototype={init:function(){var l=this||e;return l._counter=1e3,l._html5AudioPool=[],l.html5PoolSize=10,l._codecs={},l._howls=[],l._muted=!1,l._volume=1,l._canPlayEvent="canplaythrough",l._navigator=typeof window<"u"&&window.navigator?window.navigator:null,l.masterGain=null,l.noAudio=!1,l.usingWebAudio=!0,l.autoSuspend=!0,l.ctx=null,l.autoUnlock=!0,l._setup(),l},volume:function(l){var c=this||e;if(l=parseFloat(l),c.ctx||d(),typeof l<"u"&&l>=0&&l<=1){if(c._volume=l,c._muted)return c;c.usingWebAudio&&c.masterGain.gain.setValueAtTime(l,e.ctx.currentTime);for(var f=0;f<c._howls.length;f++)if(!c._howls[f]._webAudio)for(var p=c._howls[f]._getSoundIds(),m=0;m<p.length;m++){var _=c._howls[f]._soundById(p[m]);_&&_._node&&(_._node.volume=_._volume*l)}return c}return c._volume},mute:function(l){var c=this||e;c.ctx||d(),c._muted=l,c.usingWebAudio&&c.masterGain.gain.setValueAtTime(l?0:c._volume,e.ctx.currentTime);for(var f=0;f<c._howls.length;f++)if(!c._howls[f]._webAudio)for(var p=c._howls[f]._getSoundIds(),m=0;m<p.length;m++){var _=c._howls[f]._soundById(p[m]);_&&_._node&&(_._node.muted=l?!0:_._muted)}return c},stop:function(){for(var l=this||e,c=0;c<l._howls.length;c++)l._howls[c].stop();return l},unload:function(){for(var l=this||e,c=l._howls.length-1;c>=0;c--)l._howls[c].unload();return l.usingWebAudio&&l.ctx&&typeof l.ctx.close<"u"&&(l.ctx.close(),l.ctx=null,d()),l},codecs:function(l){return(this||e)._codecs[l.replace(/^x-/,"")]},_setup:function(){var l=this||e;if(l.state=l.ctx&&l.ctx.state||"suspended",l._autoSuspend(),!l.usingWebAudio)if(typeof Audio<"u")try{var c=new Audio;typeof c.oncanplaythrough>"u"&&(l._canPlayEvent="canplay")}catch{l.noAudio=!0}else l.noAudio=!0;try{var c=new Audio;c.muted&&(l.noAudio=!0)}catch{}return l.noAudio||l._setupCodecs(),l},_setupCodecs:function(){var l=this||e,c=null;try{c=typeof Audio<"u"?new Audio:null}catch{return l}if(!c||typeof c.canPlayType!="function")return l;var f=c.canPlayType("audio/mpeg;").replace(/^no$/,""),p=l._navigator?l._navigator.userAgent:"",m=p.match(/OPR\/(\d+)/g),_=m&&parseInt(m[0].split("/")[1],10)<33,g=p.indexOf("Safari")!==-1&&p.indexOf("Chrome")===-1,x=p.match(/Version\/(.*?) /),y=g&&x&&parseInt(x[1],10)<15;return l._codecs={mp3:!!(!_&&(f||c.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!f,opus:!!c.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!c.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!c.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(c.canPlayType('audio/wav; codecs="1"')||c.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!c.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!c.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(c.canPlayType("audio/x-m4a;")||c.canPlayType("audio/m4a;")||c.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(c.canPlayType("audio/x-m4b;")||c.canPlayType("audio/m4b;")||c.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(c.canPlayType("audio/x-mp4;")||c.canPlayType("audio/mp4;")||c.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!y&&c.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!y&&c.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!c.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(c.canPlayType("audio/x-flac;")||c.canPlayType("audio/flac;")).replace(/^no$/,"")},l},_unlockAudio:function(){var l=this||e;if(!(l._audioUnlocked||!l.ctx)){l._audioUnlocked=!1,l.autoUnlock=!1,!l._mobileUnloaded&&l.ctx.sampleRate!==44100&&(l._mobileUnloaded=!0,l.unload()),l._scratchBuffer=l.ctx.createBuffer(1,1,22050);var c=function(f){for(;l._html5AudioPool.length<l.html5PoolSize;)try{var p=new Audio;p._unlocked=!0,l._releaseHtml5Audio(p)}catch{l.noAudio=!0;break}for(var m=0;m<l._howls.length;m++)if(!l._howls[m]._webAudio)for(var _=l._howls[m]._getSoundIds(),g=0;g<_.length;g++){var x=l._howls[m]._soundById(_[g]);x&&x._node&&!x._node._unlocked&&(x._node._unlocked=!0,x._node.load())}l._autoResume();var y=l.ctx.createBufferSource();y.buffer=l._scratchBuffer,y.connect(l.ctx.destination),typeof y.start>"u"?y.noteOn(0):y.start(0),typeof l.ctx.resume=="function"&&l.ctx.resume(),y.onended=function(){y.disconnect(0),l._audioUnlocked=!0,document.removeEventListener("touchstart",c,!0),document.removeEventListener("touchend",c,!0),document.removeEventListener("click",c,!0),document.removeEventListener("keydown",c,!0);for(var v=0;v<l._howls.length;v++)l._howls[v]._emit("unlock")}};return document.addEventListener("touchstart",c,!0),document.addEventListener("touchend",c,!0),document.addEventListener("click",c,!0),document.addEventListener("keydown",c,!0),l}},_obtainHtml5Audio:function(){var l=this||e;if(l._html5AudioPool.length)return l._html5AudioPool.pop();var c=new Audio().play();return c&&typeof Promise<"u"&&(c instanceof Promise||typeof c.then=="function")&&c.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(l){var c=this||e;return l._unlocked&&c._html5AudioPool.push(l),c},_autoSuspend:function(){var l=this;if(!(!l.autoSuspend||!l.ctx||typeof l.ctx.suspend>"u"||!e.usingWebAudio)){for(var c=0;c<l._howls.length;c++)if(l._howls[c]._webAudio){for(var f=0;f<l._howls[c]._sounds.length;f++)if(!l._howls[c]._sounds[f]._paused)return l}return l._suspendTimer&&clearTimeout(l._suspendTimer),l._suspendTimer=setTimeout(function(){if(l.autoSuspend){l._suspendTimer=null,l.state="suspending";var p=function(){l.state="suspended",l._resumeAfterSuspend&&(delete l._resumeAfterSuspend,l._autoResume())};l.ctx.suspend().then(p,p)}},3e4),l}},_autoResume:function(){var l=this;if(!(!l.ctx||typeof l.ctx.resume>"u"||!e.usingWebAudio))return l.state==="running"&&l.ctx.state!=="interrupted"&&l._suspendTimer?(clearTimeout(l._suspendTimer),l._suspendTimer=null):l.state==="suspended"||l.state==="running"&&l.ctx.state==="interrupted"?(l.ctx.resume().then(function(){l.state="running";for(var c=0;c<l._howls.length;c++)l._howls[c]._emit("resume")}),l._suspendTimer&&(clearTimeout(l._suspendTimer),l._suspendTimer=null)):l.state==="suspending"&&(l._resumeAfterSuspend=!0),l}};var e=new t,i=function(l){var c=this;if(!l.src||l.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}c.init(l)};i.prototype={init:function(l){var c=this;return e.ctx||d(),c._autoplay=l.autoplay||!1,c._format=typeof l.format!="string"?l.format:[l.format],c._html5=l.html5||!1,c._muted=l.mute||!1,c._loop=l.loop||!1,c._pool=l.pool||5,c._preload=typeof l.preload=="boolean"||l.preload==="metadata"?l.preload:!0,c._rate=l.rate||1,c._sprite=l.sprite||{},c._src=typeof l.src!="string"?l.src:[l.src],c._volume=l.volume!==void 0?l.volume:1,c._xhr={method:l.xhr&&l.xhr.method?l.xhr.method:"GET",headers:l.xhr&&l.xhr.headers?l.xhr.headers:null,withCredentials:l.xhr&&l.xhr.withCredentials?l.xhr.withCredentials:!1},c._duration=0,c._state="unloaded",c._sounds=[],c._endTimers={},c._queue=[],c._playLock=!1,c._onend=l.onend?[{fn:l.onend}]:[],c._onfade=l.onfade?[{fn:l.onfade}]:[],c._onload=l.onload?[{fn:l.onload}]:[],c._onloaderror=l.onloaderror?[{fn:l.onloaderror}]:[],c._onplayerror=l.onplayerror?[{fn:l.onplayerror}]:[],c._onpause=l.onpause?[{fn:l.onpause}]:[],c._onplay=l.onplay?[{fn:l.onplay}]:[],c._onstop=l.onstop?[{fn:l.onstop}]:[],c._onmute=l.onmute?[{fn:l.onmute}]:[],c._onvolume=l.onvolume?[{fn:l.onvolume}]:[],c._onrate=l.onrate?[{fn:l.onrate}]:[],c._onseek=l.onseek?[{fn:l.onseek}]:[],c._onunlock=l.onunlock?[{fn:l.onunlock}]:[],c._onresume=[],c._webAudio=e.usingWebAudio&&!c._html5,typeof e.ctx<"u"&&e.ctx&&e.autoUnlock&&e._unlockAudio(),e._howls.push(c),c._autoplay&&c._queue.push({event:"play",action:function(){c.play()}}),c._preload&&c._preload!=="none"&&c.load(),c},load:function(){var l=this,c=null;if(e.noAudio){l._emit("loaderror",null,"No audio support.");return}typeof l._src=="string"&&(l._src=[l._src]);for(var f=0;f<l._src.length;f++){var p,m;if(l._format&&l._format[f])p=l._format[f];else{if(m=l._src[f],typeof m!="string"){l._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}p=/^data:audio\/([^;,]+);/i.exec(m),p||(p=/\.([^.]+)$/.exec(m.split("?",1)[0])),p&&(p=p[1].toLowerCase())}if(p||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),p&&e.codecs(p)){c=l._src[f];break}}if(!c){l._emit("loaderror",null,"No codec support for selected audio sources.");return}return l._src=c,l._state="loading",window.location.protocol==="https:"&&c.slice(0,5)==="http:"&&(l._html5=!0,l._webAudio=!1),new r(l),l._webAudio&&a(l),l},play:function(l,c){var f=this,p=null;if(typeof l=="number")p=l,l=null;else{if(typeof l=="string"&&f._state==="loaded"&&!f._sprite[l])return null;if(typeof l>"u"&&(l="__default",!f._playLock)){for(var m=0,_=0;_<f._sounds.length;_++)f._sounds[_]._paused&&!f._sounds[_]._ended&&(m++,p=f._sounds[_]._id);m===1?l=null:p=null}}var g=p?f._soundById(p):f._inactiveSound();if(!g)return null;if(p&&!l&&(l=g._sprite||"__default"),f._state!=="loaded"){g._sprite=l,g._ended=!1;var x=g._id;return f._queue.push({event:"play",action:function(){f.play(x)}}),x}if(p&&!g._paused)return c||f._loadQueue("play"),g._id;f._webAudio&&e._autoResume();var y=Math.max(0,g._seek>0?g._seek:f._sprite[l][0]/1e3),v=Math.max(0,(f._sprite[l][0]+f._sprite[l][1])/1e3-y),b=v*1e3/Math.abs(g._rate),E=f._sprite[l][0]/1e3,w=(f._sprite[l][0]+f._sprite[l][1])/1e3;g._sprite=l,g._ended=!1;var A=function(){g._paused=!1,g._seek=y,g._start=E,g._stop=w,g._loop=!!(g._loop||f._sprite[l][2])};if(y>=w){f._ended(g);return}var T=g._node;if(f._webAudio){var P=function(){f._playLock=!1,A(),f._refreshBuffer(g);var C=g._muted||f._muted?0:g._volume;T.gain.setValueAtTime(C,e.ctx.currentTime),g._playStart=e.ctx.currentTime,typeof T.bufferSource.start>"u"?g._loop?T.bufferSource.noteGrainOn(0,y,86400):T.bufferSource.noteGrainOn(0,y,v):g._loop?T.bufferSource.start(0,y,86400):T.bufferSource.start(0,y,v),b!==1/0&&(f._endTimers[g._id]=setTimeout(f._ended.bind(f,g),b)),c||setTimeout(function(){f._emit("play",g._id),f._loadQueue()},0)};e.state==="running"&&e.ctx.state!=="interrupted"?P():(f._playLock=!0,f.once("resume",P),f._clearTimer(g._id))}else{var k=function(){T.currentTime=y,T.muted=g._muted||f._muted||e._muted||T.muted,T.volume=g._volume*e.volume(),T.playbackRate=g._rate;try{var C=T.play();if(C&&typeof Promise<"u"&&(C instanceof Promise||typeof C.then=="function")?(f._playLock=!0,A(),C.then(function(){f._playLock=!1,T._unlocked=!0,c?f._loadQueue():f._emit("play",g._id)}).catch(function(){f._playLock=!1,f._emit("playerror",g._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),g._ended=!0,g._paused=!0})):c||(f._playLock=!1,A(),f._emit("play",g._id)),T.playbackRate=g._rate,T.paused){f._emit("playerror",g._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}l!=="__default"||g._loop?f._endTimers[g._id]=setTimeout(f._ended.bind(f,g),b):(f._endTimers[g._id]=function(){f._ended(g),T.removeEventListener("ended",f._endTimers[g._id],!1)},T.addEventListener("ended",f._endTimers[g._id],!1))}catch(I){f._emit("playerror",g._id,I)}};T.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(T.src=f._src,T.load());var R=window&&window.ejecta||!T.readyState&&e._navigator.isCocoonJS;if(T.readyState>=3||R)k();else{f._playLock=!0,f._state="loading";var S=function(){f._state="loaded",k(),T.removeEventListener(e._canPlayEvent,S,!1)};T.addEventListener(e._canPlayEvent,S,!1),f._clearTimer(g._id)}}return g._id},pause:function(l){var c=this;if(c._state!=="loaded"||c._playLock)return c._queue.push({event:"pause",action:function(){c.pause(l)}}),c;for(var f=c._getSoundIds(l),p=0;p<f.length;p++){c._clearTimer(f[p]);var m=c._soundById(f[p]);if(m&&!m._paused&&(m._seek=c.seek(f[p]),m._rateSeek=0,m._paused=!0,c._stopFade(f[p]),m._node))if(c._webAudio){if(!m._node.bufferSource)continue;typeof m._node.bufferSource.stop>"u"?m._node.bufferSource.noteOff(0):m._node.bufferSource.stop(0),c._cleanBuffer(m._node)}else(!isNaN(m._node.duration)||m._node.duration===1/0)&&m._node.pause();arguments[1]||c._emit("pause",m?m._id:null)}return c},stop:function(l,c){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"stop",action:function(){f.stop(l)}}),f;for(var p=f._getSoundIds(l),m=0;m<p.length;m++){f._clearTimer(p[m]);var _=f._soundById(p[m]);_&&(_._seek=_._start||0,_._rateSeek=0,_._paused=!0,_._ended=!0,f._stopFade(p[m]),_._node&&(f._webAudio?_._node.bufferSource&&(typeof _._node.bufferSource.stop>"u"?_._node.bufferSource.noteOff(0):_._node.bufferSource.stop(0),f._cleanBuffer(_._node)):(!isNaN(_._node.duration)||_._node.duration===1/0)&&(_._node.currentTime=_._start||0,_._node.pause(),_._node.duration===1/0&&f._clearSound(_._node))),c||f._emit("stop",_._id))}return f},mute:function(l,c){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"mute",action:function(){f.mute(l,c)}}),f;if(typeof c>"u")if(typeof l=="boolean")f._muted=l;else return f._muted;for(var p=f._getSoundIds(c),m=0;m<p.length;m++){var _=f._soundById(p[m]);_&&(_._muted=l,_._interval&&f._stopFade(_._id),f._webAudio&&_._node?_._node.gain.setValueAtTime(l?0:_._volume,e.ctx.currentTime):_._node&&(_._node.muted=e._muted?!0:l),f._emit("mute",_._id))}return f},volume:function(){var l=this,c=arguments,f,p;if(c.length===0)return l._volume;if(c.length===1||c.length===2&&typeof c[1]>"u"){var m=l._getSoundIds(),_=m.indexOf(c[0]);_>=0?p=parseInt(c[0],10):f=parseFloat(c[0])}else c.length>=2&&(f=parseFloat(c[0]),p=parseInt(c[1],10));var g;if(typeof f<"u"&&f>=0&&f<=1){if(l._state!=="loaded"||l._playLock)return l._queue.push({event:"volume",action:function(){l.volume.apply(l,c)}}),l;typeof p>"u"&&(l._volume=f),p=l._getSoundIds(p);for(var x=0;x<p.length;x++)g=l._soundById(p[x]),g&&(g._volume=f,c[2]||l._stopFade(p[x]),l._webAudio&&g._node&&!g._muted?g._node.gain.setValueAtTime(f,e.ctx.currentTime):g._node&&!g._muted&&(g._node.volume=f*e.volume()),l._emit("volume",g._id))}else return g=p?l._soundById(p):l._sounds[0],g?g._volume:0;return l},fade:function(l,c,f,p){var m=this;if(m._state!=="loaded"||m._playLock)return m._queue.push({event:"fade",action:function(){m.fade(l,c,f,p)}}),m;l=Math.min(Math.max(0,parseFloat(l)),1),c=Math.min(Math.max(0,parseFloat(c)),1),f=parseFloat(f),m.volume(l,p);for(var _=m._getSoundIds(p),g=0;g<_.length;g++){var x=m._soundById(_[g]);if(x){if(p||m._stopFade(_[g]),m._webAudio&&!x._muted){var y=e.ctx.currentTime,v=y+f/1e3;x._volume=l,x._node.gain.setValueAtTime(l,y),x._node.gain.linearRampToValueAtTime(c,v)}m._startFadeInterval(x,l,c,f,_[g],typeof p>"u")}}return m},_startFadeInterval:function(l,c,f,p,m,_){var g=this,x=c,y=f-c,v=Math.abs(y/.01),b=Math.max(4,v>0?p/v:p),E=Date.now();l._fadeTo=f,l._interval=setInterval(function(){var w=(Date.now()-E)/p;E=Date.now(),x+=y*w,x=Math.round(x*100)/100,y<0?x=Math.max(f,x):x=Math.min(f,x),g._webAudio?l._volume=x:g.volume(x,l._id,!0),_&&(g._volume=x),(f<c&&x<=f||f>c&&x>=f)&&(clearInterval(l._interval),l._interval=null,l._fadeTo=null,g.volume(f,l._id),g._emit("fade",l._id))},b)},_stopFade:function(l){var c=this,f=c._soundById(l);return f&&f._interval&&(c._webAudio&&f._node.gain.cancelScheduledValues(e.ctx.currentTime),clearInterval(f._interval),f._interval=null,c.volume(f._fadeTo,l),f._fadeTo=null,c._emit("fade",l)),c},loop:function(){var l=this,c=arguments,f,p,m;if(c.length===0)return l._loop;if(c.length===1)if(typeof c[0]=="boolean")f=c[0],l._loop=f;else return m=l._soundById(parseInt(c[0],10)),m?m._loop:!1;else c.length===2&&(f=c[0],p=parseInt(c[1],10));for(var _=l._getSoundIds(p),g=0;g<_.length;g++)m=l._soundById(_[g]),m&&(m._loop=f,l._webAudio&&m._node&&m._node.bufferSource&&(m._node.bufferSource.loop=f,f&&(m._node.bufferSource.loopStart=m._start||0,m._node.bufferSource.loopEnd=m._stop,l.playing(_[g])&&(l.pause(_[g],!0),l.play(_[g],!0)))));return l},rate:function(){var l=this,c=arguments,f,p;if(c.length===0)p=l._sounds[0]._id;else if(c.length===1){var m=l._getSoundIds(),_=m.indexOf(c[0]);_>=0?p=parseInt(c[0],10):f=parseFloat(c[0])}else c.length===2&&(f=parseFloat(c[0]),p=parseInt(c[1],10));var g;if(typeof f=="number"){if(l._state!=="loaded"||l._playLock)return l._queue.push({event:"rate",action:function(){l.rate.apply(l,c)}}),l;typeof p>"u"&&(l._rate=f),p=l._getSoundIds(p);for(var x=0;x<p.length;x++)if(g=l._soundById(p[x]),g){l.playing(p[x])&&(g._rateSeek=l.seek(p[x]),g._playStart=l._webAudio?e.ctx.currentTime:g._playStart),g._rate=f,l._webAudio&&g._node&&g._node.bufferSource?g._node.bufferSource.playbackRate.setValueAtTime(f,e.ctx.currentTime):g._node&&(g._node.playbackRate=f);var y=l.seek(p[x]),v=(l._sprite[g._sprite][0]+l._sprite[g._sprite][1])/1e3-y,b=v*1e3/Math.abs(g._rate);(l._endTimers[p[x]]||!g._paused)&&(l._clearTimer(p[x]),l._endTimers[p[x]]=setTimeout(l._ended.bind(l,g),b)),l._emit("rate",g._id)}}else return g=l._soundById(p),g?g._rate:l._rate;return l},seek:function(){var l=this,c=arguments,f,p;if(c.length===0)l._sounds.length&&(p=l._sounds[0]._id);else if(c.length===1){var m=l._getSoundIds(),_=m.indexOf(c[0]);_>=0?p=parseInt(c[0],10):l._sounds.length&&(p=l._sounds[0]._id,f=parseFloat(c[0]))}else c.length===2&&(f=parseFloat(c[0]),p=parseInt(c[1],10));if(typeof p>"u")return 0;if(typeof f=="number"&&(l._state!=="loaded"||l._playLock))return l._queue.push({event:"seek",action:function(){l.seek.apply(l,c)}}),l;var g=l._soundById(p);if(g)if(typeof f=="number"&&f>=0){var x=l.playing(p);x&&l.pause(p,!0),g._seek=f,g._ended=!1,l._clearTimer(p),!l._webAudio&&g._node&&!isNaN(g._node.duration)&&(g._node.currentTime=f);var y=function(){x&&l.play(p,!0),l._emit("seek",p)};if(x&&!l._webAudio){var v=function(){l._playLock?setTimeout(v,0):y()};setTimeout(v,0)}else y()}else if(l._webAudio){var b=l.playing(p)?e.ctx.currentTime-g._playStart:0,E=g._rateSeek?g._rateSeek-g._seek:0;return g._seek+(E+b*Math.abs(g._rate))}else return g._node.currentTime;return l},playing:function(l){var c=this;if(typeof l=="number"){var f=c._soundById(l);return f?!f._paused:!1}for(var p=0;p<c._sounds.length;p++)if(!c._sounds[p]._paused)return!0;return!1},duration:function(l){var c=this,f=c._duration,p=c._soundById(l);return p&&(f=c._sprite[p._sprite][1]/1e3),f},state:function(){return this._state},unload:function(){for(var l=this,c=l._sounds,f=0;f<c.length;f++)c[f]._paused||l.stop(c[f]._id),l._webAudio||(l._clearSound(c[f]._node),c[f]._node.removeEventListener("error",c[f]._errorFn,!1),c[f]._node.removeEventListener(e._canPlayEvent,c[f]._loadFn,!1),c[f]._node.removeEventListener("ended",c[f]._endFn,!1),e._releaseHtml5Audio(c[f]._node)),delete c[f]._node,l._clearTimer(c[f]._id);var p=e._howls.indexOf(l);p>=0&&e._howls.splice(p,1);var m=!0;for(f=0;f<e._howls.length;f++)if(e._howls[f]._src===l._src||l._src.indexOf(e._howls[f]._src)>=0){m=!1;break}return n&&m&&delete n[l._src],e.noAudio=!1,l._state="unloaded",l._sounds=[],l=null,null},on:function(l,c,f,p){var m=this,_=m["_on"+l];return typeof c=="function"&&_.push(p?{id:f,fn:c,once:p}:{id:f,fn:c}),m},off:function(l,c,f){var p=this,m=p["_on"+l],_=0;if(typeof c=="number"&&(f=c,c=null),c||f)for(_=0;_<m.length;_++){var g=f===m[_].id;if(c===m[_].fn&&g||!c&&g){m.splice(_,1);break}}else if(l)p["_on"+l]=[];else{var x=Object.keys(p);for(_=0;_<x.length;_++)x[_].indexOf("_on")===0&&Array.isArray(p[x[_]])&&(p[x[_]]=[])}return p},once:function(l,c,f){var p=this;return p.on(l,c,f,1),p},_emit:function(l,c,f){for(var p=this,m=p["_on"+l],_=m.length-1;_>=0;_--)(!m[_].id||m[_].id===c||l==="load")&&(setTimeout((function(g){g.call(this,c,f)}).bind(p,m[_].fn),0),m[_].once&&p.off(l,m[_].fn,m[_].id));return p._loadQueue(l),p},_loadQueue:function(l){var c=this;if(c._queue.length>0){var f=c._queue[0];f.event===l&&(c._queue.shift(),c._loadQueue()),l||f.action()}return c},_ended:function(l){var c=this,f=l._sprite;if(!c._webAudio&&l._node&&!l._node.paused&&!l._node.ended&&l._node.currentTime<l._stop)return setTimeout(c._ended.bind(c,l),100),c;var p=!!(l._loop||c._sprite[f][2]);if(c._emit("end",l._id),!c._webAudio&&p&&c.stop(l._id,!0).play(l._id),c._webAudio&&p){c._emit("play",l._id),l._seek=l._start||0,l._rateSeek=0,l._playStart=e.ctx.currentTime;var m=(l._stop-l._start)*1e3/Math.abs(l._rate);c._endTimers[l._id]=setTimeout(c._ended.bind(c,l),m)}return c._webAudio&&!p&&(l._paused=!0,l._ended=!0,l._seek=l._start||0,l._rateSeek=0,c._clearTimer(l._id),c._cleanBuffer(l._node),e._autoSuspend()),!c._webAudio&&!p&&c.stop(l._id,!0),c},_clearTimer:function(l){var c=this;if(c._endTimers[l]){if(typeof c._endTimers[l]!="function")clearTimeout(c._endTimers[l]);else{var f=c._soundById(l);f&&f._node&&f._node.removeEventListener("ended",c._endTimers[l],!1)}delete c._endTimers[l]}return c},_soundById:function(l){for(var c=this,f=0;f<c._sounds.length;f++)if(l===c._sounds[f]._id)return c._sounds[f];return null},_inactiveSound:function(){var l=this;l._drain();for(var c=0;c<l._sounds.length;c++)if(l._sounds[c]._ended)return l._sounds[c].reset();return new r(l)},_drain:function(){var l=this,c=l._pool,f=0,p=0;if(!(l._sounds.length<c)){for(p=0;p<l._sounds.length;p++)l._sounds[p]._ended&&f++;for(p=l._sounds.length-1;p>=0;p--){if(f<=c)return;l._sounds[p]._ended&&(l._webAudio&&l._sounds[p]._node&&l._sounds[p]._node.disconnect(0),l._sounds.splice(p,1),f--)}}},_getSoundIds:function(l){var c=this;if(typeof l>"u"){for(var f=[],p=0;p<c._sounds.length;p++)f.push(c._sounds[p]._id);return f}else return[l]},_refreshBuffer:function(l){var c=this;return l._node.bufferSource=e.ctx.createBufferSource(),l._node.bufferSource.buffer=n[c._src],l._panner?l._node.bufferSource.connect(l._panner):l._node.bufferSource.connect(l._node),l._node.bufferSource.loop=l._loop,l._loop&&(l._node.bufferSource.loopStart=l._start||0,l._node.bufferSource.loopEnd=l._stop||0),l._node.bufferSource.playbackRate.setValueAtTime(l._rate,e.ctx.currentTime),c},_cleanBuffer:function(l){var c=this,f=e._navigator&&e._navigator.vendor.indexOf("Apple")>=0;if(!l.bufferSource)return c;if(e._scratchBuffer&&l.bufferSource&&(l.bufferSource.onended=null,l.bufferSource.disconnect(0),f))try{l.bufferSource.buffer=e._scratchBuffer}catch{}return l.bufferSource=null,c},_clearSound:function(l){var c=/MSIE |Trident\//.test(e._navigator&&e._navigator.userAgent);c||(l.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(l){this._parent=l,this.init()};r.prototype={init:function(){var l=this,c=l._parent;return l._muted=c._muted,l._loop=c._loop,l._volume=c._volume,l._rate=c._rate,l._seek=0,l._paused=!0,l._ended=!0,l._sprite="__default",l._id=++e._counter,c._sounds.push(l),l.create(),l},create:function(){var l=this,c=l._parent,f=e._muted||l._muted||l._parent._muted?0:l._volume;return c._webAudio?(l._node=typeof e.ctx.createGain>"u"?e.ctx.createGainNode():e.ctx.createGain(),l._node.gain.setValueAtTime(f,e.ctx.currentTime),l._node.paused=!0,l._node.connect(e.masterGain)):e.noAudio||(l._node=e._obtainHtml5Audio(),l._errorFn=l._errorListener.bind(l),l._node.addEventListener("error",l._errorFn,!1),l._loadFn=l._loadListener.bind(l),l._node.addEventListener(e._canPlayEvent,l._loadFn,!1),l._endFn=l._endListener.bind(l),l._node.addEventListener("ended",l._endFn,!1),l._node.src=c._src,l._node.preload=c._preload===!0?"auto":c._preload,l._node.volume=f*e.volume(),l._node.load()),l},reset:function(){var l=this,c=l._parent;return l._muted=c._muted,l._loop=c._loop,l._volume=c._volume,l._rate=c._rate,l._seek=0,l._rateSeek=0,l._paused=!0,l._ended=!0,l._sprite="__default",l._id=++e._counter,l},_errorListener:function(){var l=this;l._parent._emit("loaderror",l._id,l._node.error?l._node.error.code:0),l._node.removeEventListener("error",l._errorFn,!1)},_loadListener:function(){var l=this,c=l._parent;c._duration=Math.ceil(l._node.duration*10)/10,Object.keys(c._sprite).length===0&&(c._sprite={__default:[0,c._duration*1e3]}),c._state!=="loaded"&&(c._state="loaded",c._emit("load"),c._loadQueue()),l._node.removeEventListener(e._canPlayEvent,l._loadFn,!1)},_endListener:function(){var l=this,c=l._parent;c._duration===1/0&&(c._duration=Math.ceil(l._node.duration*10)/10,c._sprite.__default[1]===1/0&&(c._sprite.__default[1]=c._duration*1e3),c._ended(l)),l._node.removeEventListener("ended",l._endFn,!1)}};var n={},a=function(l){var c=l._src;if(n[c]){l._duration=n[c].duration,u(l);return}if(/^data:[^;]+;base64,/.test(c)){for(var f=atob(c.split(",")[1]),p=new Uint8Array(f.length),m=0;m<f.length;++m)p[m]=f.charCodeAt(m);h(p.buffer,l)}else{var _=new XMLHttpRequest;_.open(l._xhr.method,c,!0),_.withCredentials=l._xhr.withCredentials,_.responseType="arraybuffer",l._xhr.headers&&Object.keys(l._xhr.headers).forEach(function(g){_.setRequestHeader(g,l._xhr.headers[g])}),_.onload=function(){var g=(_.status+"")[0];if(g!=="0"&&g!=="2"&&g!=="3"){l._emit("loaderror",null,"Failed loading audio file with status: "+_.status+".");return}h(_.response,l)},_.onerror=function(){l._webAudio&&(l._html5=!0,l._webAudio=!1,l._sounds=[],delete n[c],l.load())},o(_)}},o=function(l){try{l.send()}catch{l.onerror()}},h=function(l,c){var f=function(){c._emit("loaderror",null,"Decoding audio data failed.")},p=function(m){m&&c._sounds.length>0?(n[c._src]=m,u(c,m)):f()};typeof Promise<"u"&&e.ctx.decodeAudioData.length===1?e.ctx.decodeAudioData(l).then(p).catch(f):e.ctx.decodeAudioData(l,p,f)},u=function(l,c){c&&!l._duration&&(l._duration=c.duration),Object.keys(l._sprite).length===0&&(l._sprite={__default:[0,l._duration*1e3]}),l._state!=="loaded"&&(l._state="loaded",l._emit("load"),l._loadQueue())},d=function(){if(e.usingWebAudio){try{typeof AudioContext<"u"?e.ctx=new AudioContext:typeof webkitAudioContext<"u"?e.ctx=new webkitAudioContext:e.usingWebAudio=!1}catch{e.usingWebAudio=!1}e.ctx||(e.usingWebAudio=!1);var l=/iP(hone|od|ad)/.test(e._navigator&&e._navigator.platform),c=e._navigator&&e._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),f=c?parseInt(c[1],10):null;if(l&&f&&f<9){var p=/safari/.test(e._navigator&&e._navigator.userAgent.toLowerCase());e._navigator&&!p&&(e.usingWebAudio=!1)}e.usingWebAudio&&(e.masterGain=typeof e.ctx.createGain>"u"?e.ctx.createGainNode():e.ctx.createGain(),e.masterGain.gain.setValueAtTime(e._muted?0:e._volume,e.ctx.currentTime),e.masterGain.connect(e.ctx.destination)),e._setup()}};s.Howler=e,s.Howl=i,typeof Je<"u"?(Je.HowlerGlobal=t,Je.Howler=e,Je.Howl=i,Je.Sound=r):typeof window<"u"&&(window.HowlerGlobal=t,window.Howler=e,window.Howl=i,window.Sound=r)})();/*!
|
|
1179
|
+
*/(function(i){(function(){var t=function(){this.init()};t.prototype={init:function(){var c=this||e;return c._counter=1e3,c._html5AudioPool=[],c.html5PoolSize=10,c._codecs={},c._howls=[],c._muted=!1,c._volume=1,c._canPlayEvent="canplaythrough",c._navigator=typeof window<"u"&&window.navigator?window.navigator:null,c.masterGain=null,c.noAudio=!1,c.usingWebAudio=!0,c.autoSuspend=!0,c.ctx=null,c.autoUnlock=!0,c._setup(),c},volume:function(c){var d=this||e;if(c=parseFloat(c),d.ctx||u(),typeof c<"u"&&c>=0&&c<=1){if(d._volume=c,d._muted)return d;d.usingWebAudio&&d.masterGain.gain.setValueAtTime(c,e.ctx.currentTime);for(var f=0;f<d._howls.length;f++)if(!d._howls[f]._webAudio)for(var p=d._howls[f]._getSoundIds(),m=0;m<p.length;m++){var g=d._howls[f]._soundById(p[m]);g&&g._node&&(g._node.volume=g._volume*c)}return d}return d._volume},mute:function(c){var d=this||e;d.ctx||u(),d._muted=c,d.usingWebAudio&&d.masterGain.gain.setValueAtTime(c?0:d._volume,e.ctx.currentTime);for(var f=0;f<d._howls.length;f++)if(!d._howls[f]._webAudio)for(var p=d._howls[f]._getSoundIds(),m=0;m<p.length;m++){var g=d._howls[f]._soundById(p[m]);g&&g._node&&(g._node.muted=c?!0:g._muted)}return d},stop:function(){for(var c=this||e,d=0;d<c._howls.length;d++)c._howls[d].stop();return c},unload:function(){for(var c=this||e,d=c._howls.length-1;d>=0;d--)c._howls[d].unload();return c.usingWebAudio&&c.ctx&&typeof c.ctx.close<"u"&&(c.ctx.close(),c.ctx=null,u()),c},codecs:function(c){return(this||e)._codecs[c.replace(/^x-/,"")]},_setup:function(){var c=this||e;if(c.state=c.ctx&&c.ctx.state||"suspended",c._autoSuspend(),!c.usingWebAudio)if(typeof Audio<"u")try{var d=new Audio;typeof d.oncanplaythrough>"u"&&(c._canPlayEvent="canplay")}catch{c.noAudio=!0}else c.noAudio=!0;try{var d=new Audio;d.muted&&(c.noAudio=!0)}catch{}return c.noAudio||c._setupCodecs(),c},_setupCodecs:function(){var c=this||e,d=null;try{d=typeof Audio<"u"?new Audio:null}catch{return c}if(!d||typeof d.canPlayType!="function")return c;var f=d.canPlayType("audio/mpeg;").replace(/^no$/,""),p=c._navigator?c._navigator.userAgent:"",m=p.match(/OPR\/(\d+)/g),g=m&&parseInt(m[0].split("/")[1],10)<33,_=p.indexOf("Safari")!==-1&&p.indexOf("Chrome")===-1,x=p.match(/Version\/(.*?) /),y=_&&x&&parseInt(x[1],10)<15;return c._codecs={mp3:!!(!g&&(f||d.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!f,opus:!!d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(d.canPlayType('audio/wav; codecs="1"')||d.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!d.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!d.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(d.canPlayType("audio/x-m4a;")||d.canPlayType("audio/m4a;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(d.canPlayType("audio/x-m4b;")||d.canPlayType("audio/m4b;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(d.canPlayType("audio/x-mp4;")||d.canPlayType("audio/mp4;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!y&&d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!y&&d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!d.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(d.canPlayType("audio/x-flac;")||d.canPlayType("audio/flac;")).replace(/^no$/,"")},c},_unlockAudio:function(){var c=this||e;if(!(c._audioUnlocked||!c.ctx)){c._audioUnlocked=!1,c.autoUnlock=!1,!c._mobileUnloaded&&c.ctx.sampleRate!==44100&&(c._mobileUnloaded=!0,c.unload()),c._scratchBuffer=c.ctx.createBuffer(1,1,22050);var d=function(f){for(;c._html5AudioPool.length<c.html5PoolSize;)try{var p=new Audio;p._unlocked=!0,c._releaseHtml5Audio(p)}catch{c.noAudio=!0;break}for(var m=0;m<c._howls.length;m++)if(!c._howls[m]._webAudio)for(var g=c._howls[m]._getSoundIds(),_=0;_<g.length;_++){var x=c._howls[m]._soundById(g[_]);x&&x._node&&!x._node._unlocked&&(x._node._unlocked=!0,x._node.load())}c._autoResume();var y=c.ctx.createBufferSource();y.buffer=c._scratchBuffer,y.connect(c.ctx.destination),typeof y.start>"u"?y.noteOn(0):y.start(0),typeof c.ctx.resume=="function"&&c.ctx.resume(),y.onended=function(){y.disconnect(0),c._audioUnlocked=!0,document.removeEventListener("touchstart",d,!0),document.removeEventListener("touchend",d,!0),document.removeEventListener("click",d,!0),document.removeEventListener("keydown",d,!0);for(var v=0;v<c._howls.length;v++)c._howls[v]._emit("unlock")}};return document.addEventListener("touchstart",d,!0),document.addEventListener("touchend",d,!0),document.addEventListener("click",d,!0),document.addEventListener("keydown",d,!0),c}},_obtainHtml5Audio:function(){var c=this||e;if(c._html5AudioPool.length)return c._html5AudioPool.pop();var d=new Audio().play();return d&&typeof Promise<"u"&&(d instanceof Promise||typeof d.then=="function")&&d.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(c){var d=this||e;return c._unlocked&&d._html5AudioPool.push(c),d},_autoSuspend:function(){var c=this;if(!(!c.autoSuspend||!c.ctx||typeof c.ctx.suspend>"u"||!e.usingWebAudio)){for(var d=0;d<c._howls.length;d++)if(c._howls[d]._webAudio){for(var f=0;f<c._howls[d]._sounds.length;f++)if(!c._howls[d]._sounds[f]._paused)return c}return c._suspendTimer&&clearTimeout(c._suspendTimer),c._suspendTimer=setTimeout(function(){if(c.autoSuspend){c._suspendTimer=null,c.state="suspending";var p=function(){c.state="suspended",c._resumeAfterSuspend&&(delete c._resumeAfterSuspend,c._autoResume())};c.ctx.suspend().then(p,p)}},3e4),c}},_autoResume:function(){var c=this;if(!(!c.ctx||typeof c.ctx.resume>"u"||!e.usingWebAudio))return c.state==="running"&&c.ctx.state!=="interrupted"&&c._suspendTimer?(clearTimeout(c._suspendTimer),c._suspendTimer=null):c.state==="suspended"||c.state==="running"&&c.ctx.state==="interrupted"?(c.ctx.resume().then(function(){c.state="running";for(var d=0;d<c._howls.length;d++)c._howls[d]._emit("resume")}),c._suspendTimer&&(clearTimeout(c._suspendTimer),c._suspendTimer=null)):c.state==="suspending"&&(c._resumeAfterSuspend=!0),c}};var e=new t,s=function(c){var d=this;if(!c.src||c.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}d.init(c)};s.prototype={init:function(c){var d=this;return e.ctx||u(),d._autoplay=c.autoplay||!1,d._format=typeof c.format!="string"?c.format:[c.format],d._html5=c.html5||!1,d._muted=c.mute||!1,d._loop=c.loop||!1,d._pool=c.pool||5,d._preload=typeof c.preload=="boolean"||c.preload==="metadata"?c.preload:!0,d._rate=c.rate||1,d._sprite=c.sprite||{},d._src=typeof c.src!="string"?c.src:[c.src],d._volume=c.volume!==void 0?c.volume:1,d._xhr={method:c.xhr&&c.xhr.method?c.xhr.method:"GET",headers:c.xhr&&c.xhr.headers?c.xhr.headers:null,withCredentials:c.xhr&&c.xhr.withCredentials?c.xhr.withCredentials:!1},d._duration=0,d._state="unloaded",d._sounds=[],d._endTimers={},d._queue=[],d._playLock=!1,d._onend=c.onend?[{fn:c.onend}]:[],d._onfade=c.onfade?[{fn:c.onfade}]:[],d._onload=c.onload?[{fn:c.onload}]:[],d._onloaderror=c.onloaderror?[{fn:c.onloaderror}]:[],d._onplayerror=c.onplayerror?[{fn:c.onplayerror}]:[],d._onpause=c.onpause?[{fn:c.onpause}]:[],d._onplay=c.onplay?[{fn:c.onplay}]:[],d._onstop=c.onstop?[{fn:c.onstop}]:[],d._onmute=c.onmute?[{fn:c.onmute}]:[],d._onvolume=c.onvolume?[{fn:c.onvolume}]:[],d._onrate=c.onrate?[{fn:c.onrate}]:[],d._onseek=c.onseek?[{fn:c.onseek}]:[],d._onunlock=c.onunlock?[{fn:c.onunlock}]:[],d._onresume=[],d._webAudio=e.usingWebAudio&&!d._html5,typeof e.ctx<"u"&&e.ctx&&e.autoUnlock&&e._unlockAudio(),e._howls.push(d),d._autoplay&&d._queue.push({event:"play",action:function(){d.play()}}),d._preload&&d._preload!=="none"&&d.load(),d},load:function(){var c=this,d=null;if(e.noAudio){c._emit("loaderror",null,"No audio support.");return}typeof c._src=="string"&&(c._src=[c._src]);for(var f=0;f<c._src.length;f++){var p,m;if(c._format&&c._format[f])p=c._format[f];else{if(m=c._src[f],typeof m!="string"){c._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}p=/^data:audio\/([^;,]+);/i.exec(m),p||(p=/\.([^.]+)$/.exec(m.split("?",1)[0])),p&&(p=p[1].toLowerCase())}if(p||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),p&&e.codecs(p)){d=c._src[f];break}}if(!d){c._emit("loaderror",null,"No codec support for selected audio sources.");return}return c._src=d,c._state="loading",window.location.protocol==="https:"&&d.slice(0,5)==="http:"&&(c._html5=!0,c._webAudio=!1),new r(c),c._webAudio&&a(c),c},play:function(c,d){var f=this,p=null;if(typeof c=="number")p=c,c=null;else{if(typeof c=="string"&&f._state==="loaded"&&!f._sprite[c])return null;if(typeof c>"u"&&(c="__default",!f._playLock)){for(var m=0,g=0;g<f._sounds.length;g++)f._sounds[g]._paused&&!f._sounds[g]._ended&&(m++,p=f._sounds[g]._id);m===1?c=null:p=null}}var _=p?f._soundById(p):f._inactiveSound();if(!_)return null;if(p&&!c&&(c=_._sprite||"__default"),f._state!=="loaded"){_._sprite=c,_._ended=!1;var x=_._id;return f._queue.push({event:"play",action:function(){f.play(x)}}),x}if(p&&!_._paused)return d||f._loadQueue("play"),_._id;f._webAudio&&e._autoResume();var y=Math.max(0,_._seek>0?_._seek:f._sprite[c][0]/1e3),v=Math.max(0,(f._sprite[c][0]+f._sprite[c][1])/1e3-y),b=v*1e3/Math.abs(_._rate),w=f._sprite[c][0]/1e3,E=(f._sprite[c][0]+f._sprite[c][1])/1e3;_._sprite=c,_._ended=!1;var T=function(){_._paused=!1,_._seek=y,_._start=w,_._stop=E,_._loop=!!(_._loop||f._sprite[c][2])};if(y>=E){f._ended(_);return}var A=_._node;if(f._webAudio){var I=function(){f._playLock=!1,T(),f._refreshBuffer(_);var P=_._muted||f._muted?0:_._volume;A.gain.setValueAtTime(P,e.ctx.currentTime),_._playStart=e.ctx.currentTime,typeof A.bufferSource.start>"u"?_._loop?A.bufferSource.noteGrainOn(0,y,86400):A.bufferSource.noteGrainOn(0,y,v):_._loop?A.bufferSource.start(0,y,86400):A.bufferSource.start(0,y,v),b!==1/0&&(f._endTimers[_._id]=setTimeout(f._ended.bind(f,_),b)),d||setTimeout(function(){f._emit("play",_._id),f._loadQueue()},0)};e.state==="running"&&e.ctx.state!=="interrupted"?I():(f._playLock=!0,f.once("resume",I),f._clearTimer(_._id))}else{var M=function(){A.currentTime=y,A.muted=_._muted||f._muted||e._muted||A.muted,A.volume=_._volume*e.volume(),A.playbackRate=_._rate;try{var P=A.play();if(P&&typeof Promise<"u"&&(P instanceof Promise||typeof P.then=="function")?(f._playLock=!0,T(),P.then(function(){f._playLock=!1,A._unlocked=!0,d?f._loadQueue():f._emit("play",_._id)}).catch(function(){f._playLock=!1,f._emit("playerror",_._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),_._ended=!0,_._paused=!0})):d||(f._playLock=!1,T(),f._emit("play",_._id)),A.playbackRate=_._rate,A.paused){f._emit("playerror",_._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}c!=="__default"||_._loop?f._endTimers[_._id]=setTimeout(f._ended.bind(f,_),b):(f._endTimers[_._id]=function(){f._ended(_),A.removeEventListener("ended",f._endTimers[_._id],!1)},A.addEventListener("ended",f._endTimers[_._id],!1))}catch(k){f._emit("playerror",_._id,k)}};A.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(A.src=f._src,A.load());var R=window&&window.ejecta||!A.readyState&&e._navigator.isCocoonJS;if(A.readyState>=3||R)M();else{f._playLock=!0,f._state="loading";var C=function(){f._state="loaded",M(),A.removeEventListener(e._canPlayEvent,C,!1)};A.addEventListener(e._canPlayEvent,C,!1),f._clearTimer(_._id)}}return _._id},pause:function(c){var d=this;if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"pause",action:function(){d.pause(c)}}),d;for(var f=d._getSoundIds(c),p=0;p<f.length;p++){d._clearTimer(f[p]);var m=d._soundById(f[p]);if(m&&!m._paused&&(m._seek=d.seek(f[p]),m._rateSeek=0,m._paused=!0,d._stopFade(f[p]),m._node))if(d._webAudio){if(!m._node.bufferSource)continue;typeof m._node.bufferSource.stop>"u"?m._node.bufferSource.noteOff(0):m._node.bufferSource.stop(0),d._cleanBuffer(m._node)}else(!isNaN(m._node.duration)||m._node.duration===1/0)&&m._node.pause();arguments[1]||d._emit("pause",m?m._id:null)}return d},stop:function(c,d){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"stop",action:function(){f.stop(c)}}),f;for(var p=f._getSoundIds(c),m=0;m<p.length;m++){f._clearTimer(p[m]);var g=f._soundById(p[m]);g&&(g._seek=g._start||0,g._rateSeek=0,g._paused=!0,g._ended=!0,f._stopFade(p[m]),g._node&&(f._webAudio?g._node.bufferSource&&(typeof g._node.bufferSource.stop>"u"?g._node.bufferSource.noteOff(0):g._node.bufferSource.stop(0),f._cleanBuffer(g._node)):(!isNaN(g._node.duration)||g._node.duration===1/0)&&(g._node.currentTime=g._start||0,g._node.pause(),g._node.duration===1/0&&f._clearSound(g._node))),d||f._emit("stop",g._id))}return f},mute:function(c,d){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"mute",action:function(){f.mute(c,d)}}),f;if(typeof d>"u")if(typeof c=="boolean")f._muted=c;else return f._muted;for(var p=f._getSoundIds(d),m=0;m<p.length;m++){var g=f._soundById(p[m]);g&&(g._muted=c,g._interval&&f._stopFade(g._id),f._webAudio&&g._node?g._node.gain.setValueAtTime(c?0:g._volume,e.ctx.currentTime):g._node&&(g._node.muted=e._muted?!0:c),f._emit("mute",g._id))}return f},volume:function(){var c=this,d=arguments,f,p;if(d.length===0)return c._volume;if(d.length===1||d.length===2&&typeof d[1]>"u"){var m=c._getSoundIds(),g=m.indexOf(d[0]);g>=0?p=parseInt(d[0],10):f=parseFloat(d[0])}else d.length>=2&&(f=parseFloat(d[0]),p=parseInt(d[1],10));var _;if(typeof f<"u"&&f>=0&&f<=1){if(c._state!=="loaded"||c._playLock)return c._queue.push({event:"volume",action:function(){c.volume.apply(c,d)}}),c;typeof p>"u"&&(c._volume=f),p=c._getSoundIds(p);for(var x=0;x<p.length;x++)_=c._soundById(p[x]),_&&(_._volume=f,d[2]||c._stopFade(p[x]),c._webAudio&&_._node&&!_._muted?_._node.gain.setValueAtTime(f,e.ctx.currentTime):_._node&&!_._muted&&(_._node.volume=f*e.volume()),c._emit("volume",_._id))}else return _=p?c._soundById(p):c._sounds[0],_?_._volume:0;return c},fade:function(c,d,f,p){var m=this;if(m._state!=="loaded"||m._playLock)return m._queue.push({event:"fade",action:function(){m.fade(c,d,f,p)}}),m;c=Math.min(Math.max(0,parseFloat(c)),1),d=Math.min(Math.max(0,parseFloat(d)),1),f=parseFloat(f),m.volume(c,p);for(var g=m._getSoundIds(p),_=0;_<g.length;_++){var x=m._soundById(g[_]);if(x){if(p||m._stopFade(g[_]),m._webAudio&&!x._muted){var y=e.ctx.currentTime,v=y+f/1e3;x._volume=c,x._node.gain.setValueAtTime(c,y),x._node.gain.linearRampToValueAtTime(d,v)}m._startFadeInterval(x,c,d,f,g[_],typeof p>"u")}}return m},_startFadeInterval:function(c,d,f,p,m,g){var _=this,x=d,y=f-d,v=Math.abs(y/.01),b=Math.max(4,v>0?p/v:p),w=Date.now();c._fadeTo=f,c._interval=setInterval(function(){var E=(Date.now()-w)/p;w=Date.now(),x+=y*E,x=Math.round(x*100)/100,y<0?x=Math.max(f,x):x=Math.min(f,x),_._webAudio?c._volume=x:_.volume(x,c._id,!0),g&&(_._volume=x),(f<d&&x<=f||f>d&&x>=f)&&(clearInterval(c._interval),c._interval=null,c._fadeTo=null,_.volume(f,c._id),_._emit("fade",c._id))},b)},_stopFade:function(c){var d=this,f=d._soundById(c);return f&&f._interval&&(d._webAudio&&f._node.gain.cancelScheduledValues(e.ctx.currentTime),clearInterval(f._interval),f._interval=null,d.volume(f._fadeTo,c),f._fadeTo=null,d._emit("fade",c)),d},loop:function(){var c=this,d=arguments,f,p,m;if(d.length===0)return c._loop;if(d.length===1)if(typeof d[0]=="boolean")f=d[0],c._loop=f;else return m=c._soundById(parseInt(d[0],10)),m?m._loop:!1;else d.length===2&&(f=d[0],p=parseInt(d[1],10));for(var g=c._getSoundIds(p),_=0;_<g.length;_++)m=c._soundById(g[_]),m&&(m._loop=f,c._webAudio&&m._node&&m._node.bufferSource&&(m._node.bufferSource.loop=f,f&&(m._node.bufferSource.loopStart=m._start||0,m._node.bufferSource.loopEnd=m._stop,c.playing(g[_])&&(c.pause(g[_],!0),c.play(g[_],!0)))));return c},rate:function(){var c=this,d=arguments,f,p;if(d.length===0)p=c._sounds[0]._id;else if(d.length===1){var m=c._getSoundIds(),g=m.indexOf(d[0]);g>=0?p=parseInt(d[0],10):f=parseFloat(d[0])}else d.length===2&&(f=parseFloat(d[0]),p=parseInt(d[1],10));var _;if(typeof f=="number"){if(c._state!=="loaded"||c._playLock)return c._queue.push({event:"rate",action:function(){c.rate.apply(c,d)}}),c;typeof p>"u"&&(c._rate=f),p=c._getSoundIds(p);for(var x=0;x<p.length;x++)if(_=c._soundById(p[x]),_){c.playing(p[x])&&(_._rateSeek=c.seek(p[x]),_._playStart=c._webAudio?e.ctx.currentTime:_._playStart),_._rate=f,c._webAudio&&_._node&&_._node.bufferSource?_._node.bufferSource.playbackRate.setValueAtTime(f,e.ctx.currentTime):_._node&&(_._node.playbackRate=f);var y=c.seek(p[x]),v=(c._sprite[_._sprite][0]+c._sprite[_._sprite][1])/1e3-y,b=v*1e3/Math.abs(_._rate);(c._endTimers[p[x]]||!_._paused)&&(c._clearTimer(p[x]),c._endTimers[p[x]]=setTimeout(c._ended.bind(c,_),b)),c._emit("rate",_._id)}}else return _=c._soundById(p),_?_._rate:c._rate;return c},seek:function(){var c=this,d=arguments,f,p;if(d.length===0)c._sounds.length&&(p=c._sounds[0]._id);else if(d.length===1){var m=c._getSoundIds(),g=m.indexOf(d[0]);g>=0?p=parseInt(d[0],10):c._sounds.length&&(p=c._sounds[0]._id,f=parseFloat(d[0]))}else d.length===2&&(f=parseFloat(d[0]),p=parseInt(d[1],10));if(typeof p>"u")return 0;if(typeof f=="number"&&(c._state!=="loaded"||c._playLock))return c._queue.push({event:"seek",action:function(){c.seek.apply(c,d)}}),c;var _=c._soundById(p);if(_)if(typeof f=="number"&&f>=0){var x=c.playing(p);x&&c.pause(p,!0),_._seek=f,_._ended=!1,c._clearTimer(p),!c._webAudio&&_._node&&!isNaN(_._node.duration)&&(_._node.currentTime=f);var y=function(){x&&c.play(p,!0),c._emit("seek",p)};if(x&&!c._webAudio){var v=function(){c._playLock?setTimeout(v,0):y()};setTimeout(v,0)}else y()}else if(c._webAudio){var b=c.playing(p)?e.ctx.currentTime-_._playStart:0,w=_._rateSeek?_._rateSeek-_._seek:0;return _._seek+(w+b*Math.abs(_._rate))}else return _._node.currentTime;return c},playing:function(c){var d=this;if(typeof c=="number"){var f=d._soundById(c);return f?!f._paused:!1}for(var p=0;p<d._sounds.length;p++)if(!d._sounds[p]._paused)return!0;return!1},duration:function(c){var d=this,f=d._duration,p=d._soundById(c);return p&&(f=d._sprite[p._sprite][1]/1e3),f},state:function(){return this._state},unload:function(){for(var c=this,d=c._sounds,f=0;f<d.length;f++)d[f]._paused||c.stop(d[f]._id),c._webAudio||(c._clearSound(d[f]._node),d[f]._node.removeEventListener("error",d[f]._errorFn,!1),d[f]._node.removeEventListener(e._canPlayEvent,d[f]._loadFn,!1),d[f]._node.removeEventListener("ended",d[f]._endFn,!1),e._releaseHtml5Audio(d[f]._node)),delete d[f]._node,c._clearTimer(d[f]._id);var p=e._howls.indexOf(c);p>=0&&e._howls.splice(p,1);var m=!0;for(f=0;f<e._howls.length;f++)if(e._howls[f]._src===c._src||c._src.indexOf(e._howls[f]._src)>=0){m=!1;break}return n&&m&&delete n[c._src],e.noAudio=!1,c._state="unloaded",c._sounds=[],c=null,null},on:function(c,d,f,p){var m=this,g=m["_on"+c];return typeof d=="function"&&g.push(p?{id:f,fn:d,once:p}:{id:f,fn:d}),m},off:function(c,d,f){var p=this,m=p["_on"+c],g=0;if(typeof d=="number"&&(f=d,d=null),d||f)for(g=0;g<m.length;g++){var _=f===m[g].id;if(d===m[g].fn&&_||!d&&_){m.splice(g,1);break}}else if(c)p["_on"+c]=[];else{var x=Object.keys(p);for(g=0;g<x.length;g++)x[g].indexOf("_on")===0&&Array.isArray(p[x[g]])&&(p[x[g]]=[])}return p},once:function(c,d,f){var p=this;return p.on(c,d,f,1),p},_emit:function(c,d,f){for(var p=this,m=p["_on"+c],g=m.length-1;g>=0;g--)(!m[g].id||m[g].id===d||c==="load")&&(setTimeout((function(_){_.call(this,d,f)}).bind(p,m[g].fn),0),m[g].once&&p.off(c,m[g].fn,m[g].id));return p._loadQueue(c),p},_loadQueue:function(c){var d=this;if(d._queue.length>0){var f=d._queue[0];f.event===c&&(d._queue.shift(),d._loadQueue()),c||f.action()}return d},_ended:function(c){var d=this,f=c._sprite;if(!d._webAudio&&c._node&&!c._node.paused&&!c._node.ended&&c._node.currentTime<c._stop)return setTimeout(d._ended.bind(d,c),100),d;var p=!!(c._loop||d._sprite[f][2]);if(d._emit("end",c._id),!d._webAudio&&p&&d.stop(c._id,!0).play(c._id),d._webAudio&&p){d._emit("play",c._id),c._seek=c._start||0,c._rateSeek=0,c._playStart=e.ctx.currentTime;var m=(c._stop-c._start)*1e3/Math.abs(c._rate);d._endTimers[c._id]=setTimeout(d._ended.bind(d,c),m)}return d._webAudio&&!p&&(c._paused=!0,c._ended=!0,c._seek=c._start||0,c._rateSeek=0,d._clearTimer(c._id),d._cleanBuffer(c._node),e._autoSuspend()),!d._webAudio&&!p&&d.stop(c._id,!0),d},_clearTimer:function(c){var d=this;if(d._endTimers[c]){if(typeof d._endTimers[c]!="function")clearTimeout(d._endTimers[c]);else{var f=d._soundById(c);f&&f._node&&f._node.removeEventListener("ended",d._endTimers[c],!1)}delete d._endTimers[c]}return d},_soundById:function(c){for(var d=this,f=0;f<d._sounds.length;f++)if(c===d._sounds[f]._id)return d._sounds[f];return null},_inactiveSound:function(){var c=this;c._drain();for(var d=0;d<c._sounds.length;d++)if(c._sounds[d]._ended)return c._sounds[d].reset();return new r(c)},_drain:function(){var c=this,d=c._pool,f=0,p=0;if(!(c._sounds.length<d)){for(p=0;p<c._sounds.length;p++)c._sounds[p]._ended&&f++;for(p=c._sounds.length-1;p>=0;p--){if(f<=d)return;c._sounds[p]._ended&&(c._webAudio&&c._sounds[p]._node&&c._sounds[p]._node.disconnect(0),c._sounds.splice(p,1),f--)}}},_getSoundIds:function(c){var d=this;if(typeof c>"u"){for(var f=[],p=0;p<d._sounds.length;p++)f.push(d._sounds[p]._id);return f}else return[c]},_refreshBuffer:function(c){var d=this;return c._node.bufferSource=e.ctx.createBufferSource(),c._node.bufferSource.buffer=n[d._src],c._panner?c._node.bufferSource.connect(c._panner):c._node.bufferSource.connect(c._node),c._node.bufferSource.loop=c._loop,c._loop&&(c._node.bufferSource.loopStart=c._start||0,c._node.bufferSource.loopEnd=c._stop||0),c._node.bufferSource.playbackRate.setValueAtTime(c._rate,e.ctx.currentTime),d},_cleanBuffer:function(c){var d=this,f=e._navigator&&e._navigator.vendor.indexOf("Apple")>=0;if(!c.bufferSource)return d;if(e._scratchBuffer&&c.bufferSource&&(c.bufferSource.onended=null,c.bufferSource.disconnect(0),f))try{c.bufferSource.buffer=e._scratchBuffer}catch{}return c.bufferSource=null,d},_clearSound:function(c){var d=/MSIE |Trident\//.test(e._navigator&&e._navigator.userAgent);d||(c.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(c){this._parent=c,this.init()};r.prototype={init:function(){var c=this,d=c._parent;return c._muted=d._muted,c._loop=d._loop,c._volume=d._volume,c._rate=d._rate,c._seek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++e._counter,d._sounds.push(c),c.create(),c},create:function(){var c=this,d=c._parent,f=e._muted||c._muted||c._parent._muted?0:c._volume;return d._webAudio?(c._node=typeof e.ctx.createGain>"u"?e.ctx.createGainNode():e.ctx.createGain(),c._node.gain.setValueAtTime(f,e.ctx.currentTime),c._node.paused=!0,c._node.connect(e.masterGain)):e.noAudio||(c._node=e._obtainHtml5Audio(),c._errorFn=c._errorListener.bind(c),c._node.addEventListener("error",c._errorFn,!1),c._loadFn=c._loadListener.bind(c),c._node.addEventListener(e._canPlayEvent,c._loadFn,!1),c._endFn=c._endListener.bind(c),c._node.addEventListener("ended",c._endFn,!1),c._node.src=d._src,c._node.preload=d._preload===!0?"auto":d._preload,c._node.volume=f*e.volume(),c._node.load()),c},reset:function(){var c=this,d=c._parent;return c._muted=d._muted,c._loop=d._loop,c._volume=d._volume,c._rate=d._rate,c._seek=0,c._rateSeek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++e._counter,c},_errorListener:function(){var c=this;c._parent._emit("loaderror",c._id,c._node.error?c._node.error.code:0),c._node.removeEventListener("error",c._errorFn,!1)},_loadListener:function(){var c=this,d=c._parent;d._duration=Math.ceil(c._node.duration*10)/10,Object.keys(d._sprite).length===0&&(d._sprite={__default:[0,d._duration*1e3]}),d._state!=="loaded"&&(d._state="loaded",d._emit("load"),d._loadQueue()),c._node.removeEventListener(e._canPlayEvent,c._loadFn,!1)},_endListener:function(){var c=this,d=c._parent;d._duration===1/0&&(d._duration=Math.ceil(c._node.duration*10)/10,d._sprite.__default[1]===1/0&&(d._sprite.__default[1]=d._duration*1e3),d._ended(c)),c._node.removeEventListener("ended",c._endFn,!1)}};var n={},a=function(c){var d=c._src;if(n[d]){c._duration=n[d].duration,l(c);return}if(/^data:[^;]+;base64,/.test(d)){for(var f=atob(d.split(",")[1]),p=new Uint8Array(f.length),m=0;m<f.length;++m)p[m]=f.charCodeAt(m);o(p.buffer,c)}else{var g=new XMLHttpRequest;g.open(c._xhr.method,d,!0),g.withCredentials=c._xhr.withCredentials,g.responseType="arraybuffer",c._xhr.headers&&Object.keys(c._xhr.headers).forEach(function(_){g.setRequestHeader(_,c._xhr.headers[_])}),g.onload=function(){var _=(g.status+"")[0];if(_!=="0"&&_!=="2"&&_!=="3"){c._emit("loaderror",null,"Failed loading audio file with status: "+g.status+".");return}o(g.response,c)},g.onerror=function(){c._webAudio&&(c._html5=!0,c._webAudio=!1,c._sounds=[],delete n[d],c.load())},h(g)}},h=function(c){try{c.send()}catch{c.onerror()}},o=function(c,d){var f=function(){d._emit("loaderror",null,"Decoding audio data failed.")},p=function(m){m&&d._sounds.length>0?(n[d._src]=m,l(d,m)):f()};typeof Promise<"u"&&e.ctx.decodeAudioData.length===1?e.ctx.decodeAudioData(c).then(p).catch(f):e.ctx.decodeAudioData(c,p,f)},l=function(c,d){d&&!c._duration&&(c._duration=d.duration),Object.keys(c._sprite).length===0&&(c._sprite={__default:[0,c._duration*1e3]}),c._state!=="loaded"&&(c._state="loaded",c._emit("load"),c._loadQueue())},u=function(){if(e.usingWebAudio){try{typeof AudioContext<"u"?e.ctx=new AudioContext:typeof webkitAudioContext<"u"?e.ctx=new webkitAudioContext:e.usingWebAudio=!1}catch{e.usingWebAudio=!1}e.ctx||(e.usingWebAudio=!1);var c=/iP(hone|od|ad)/.test(e._navigator&&e._navigator.platform),d=e._navigator&&e._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),f=d?parseInt(d[1],10):null;if(c&&f&&f<9){var p=/safari/.test(e._navigator&&e._navigator.userAgent.toLowerCase());e._navigator&&!p&&(e.usingWebAudio=!1)}e.usingWebAudio&&(e.masterGain=typeof e.ctx.createGain>"u"?e.ctx.createGainNode():e.ctx.createGain(),e.masterGain.gain.setValueAtTime(e._muted?0:e._volume,e.ctx.currentTime),e.masterGain.connect(e.ctx.destination)),e._setup()}};i.Howler=e,i.Howl=s,typeof Us<"u"?(Us.HowlerGlobal=t,Us.Howler=e,Us.Howl=s,Us.Sound=r):typeof window<"u"&&(window.HowlerGlobal=t,window.Howler=e,window.Howl=s,window.Sound=r)})();/*!
|
|
1178
1180
|
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
|
|
1179
1181
|
*
|
|
1180
1182
|
* howler.js v2.2.4
|
|
@@ -1184,7 +1186,7 @@ void main(void)\r
|
|
|
1184
1186
|
* goldfirestudios.com
|
|
1185
1187
|
*
|
|
1186
1188
|
* MIT License
|
|
1187
|
-
*/(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var i=this;if(!i.ctx||!i.ctx.listener)return i;for(var r=i._howls.length-1;r>=0;r--)i._howls[r].stereo(e);return i},HowlerGlobal.prototype.pos=function(e,i,r){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(i=typeof i!="number"?n._pos[1]:i,r=typeof r!="number"?n._pos[2]:r,typeof e=="number")n._pos=[e,i,r],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,i,r,n,a,o){var h=this;if(!h.ctx||!h.ctx.listener)return h;var u=h._orientation;if(i=typeof i!="number"?u[1]:i,r=typeof r!="number"?u[2]:r,n=typeof n!="number"?u[3]:n,a=typeof a!="number"?u[4]:a,o=typeof o!="number"?u[5]:o,typeof e=="number")h._orientation=[e,i,r,n,a,o],typeof h.ctx.listener.forwardX<"u"?(h.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),h.ctx.listener.forwardY.setTargetAtTime(i,Howler.ctx.currentTime,.1),h.ctx.listener.forwardZ.setTargetAtTime(r,Howler.ctx.currentTime,.1),h.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),h.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),h.ctx.listener.upZ.setTargetAtTime(o,Howler.ctx.currentTime,.1)):h.ctx.listener.setOrientation(e,i,r,n,a,o);else return u;return h},Howl.prototype.init=function(e){return function(i){var r=this;return r._orientation=i.orientation||[1,0,0],r._stereo=i.stereo||null,r._pos=i.pos||null,r._pannerAttr={coneInnerAngle:typeof i.coneInnerAngle<"u"?i.coneInnerAngle:360,coneOuterAngle:typeof i.coneOuterAngle<"u"?i.coneOuterAngle:360,coneOuterGain:typeof i.coneOuterGain<"u"?i.coneOuterGain:0,distanceModel:typeof i.distanceModel<"u"?i.distanceModel:"inverse",maxDistance:typeof i.maxDistance<"u"?i.maxDistance:1e4,panningModel:typeof i.panningModel<"u"?i.panningModel:"HRTF",refDistance:typeof i.refDistance<"u"?i.refDistance:1,rolloffFactor:typeof i.rolloffFactor<"u"?i.rolloffFactor:1},r._onstereo=i.onstereo?[{fn:i.onstereo}]:[],r._onpos=i.onpos?[{fn:i.onpos}]:[],r._onorientation=i.onorientation?[{fn:i.onorientation}]:[],e.call(this,i)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,i){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(e,i)}}),r;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof i>"u")if(typeof e=="number")r._stereo=e,r._pos=[e,0,0];else return r._stereo;for(var a=r._getSoundIds(i),o=0;o<a.length;o++){var h=r._soundById(a[o]);if(h)if(typeof e=="number")h._stereo=e,h._pos=[e,0,0],h._node&&(h._pannerAttr.panningModel="equalpower",(!h._panner||!h._panner.pan)&&t(h,n),n==="spatial"?typeof h._panner.positionX<"u"?(h._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),h._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),h._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):h._panner.setPosition(e,0,0):h._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),r._emit("stereo",h._id);else return h._stereo}return r},Howl.prototype.pos=function(e,i,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"pos",action:function(){a.pos(e,i,r,n)}}),a;if(i=typeof i!="number"?0:i,r=typeof r!="number"?-.5:r,typeof n>"u")if(typeof e=="number")a._pos=[e,i,r];else return a._pos;for(var o=a._getSoundIds(n),h=0;h<o.length;h++){var u=a._soundById(o[h]);if(u)if(typeof e=="number")u._pos=[e,i,r],u._node&&((!u._panner||u._panner.pan)&&t(u,"spatial"),typeof u._panner.positionX<"u"?(u._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(i,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setPosition(e,i,r)),a._emit("pos",u._id);else return u._pos}return a},Howl.prototype.orientation=function(e,i,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"orientation",action:function(){a.orientation(e,i,r,n)}}),a;if(i=typeof i!="number"?a._orientation[1]:i,r=typeof r!="number"?a._orientation[2]:r,typeof n>"u")if(typeof e=="number")a._orientation=[e,i,r];else return a._orientation;for(var o=a._getSoundIds(n),h=0;h<o.length;h++){var u=a._soundById(o[h]);if(u)if(typeof e=="number")u._orientation=[e,i,r],u._node&&(u._panner||(u._pos||(u._pos=a._pos||[0,0,-.5]),t(u,"spatial")),typeof u._panner.orientationX<"u"?(u._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(i,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setOrientation(e,i,r)),a._emit("orientation",u._id);else return u._orientation}return a},Howl.prototype.pannerAttr=function(){var e=this,i=arguments,r,n,a;if(!e._webAudio)return e;if(i.length===0)return e._pannerAttr;if(i.length===1)if(typeof i[0]=="object")r=i[0],typeof n>"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),e._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:e._panningModel});else return a=e._soundById(parseInt(i[0],10)),a?a._pannerAttr:e._pannerAttr;else i.length===2&&(r=i[0],n=parseInt(i[1],10));for(var o=e._getSoundIds(n),h=0;h<o.length;h++)if(a=e._soundById(o[h]),a){var u=a._pannerAttr;u={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:u.coneOuterAngle,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:u.coneOuterGain,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:u.distanceModel,maxDistance:typeof r.maxDistance<"u"?r.maxDistance:u.maxDistance,refDistance:typeof r.refDistance<"u"?r.refDistance:u.refDistance,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:u.rolloffFactor,panningModel:typeof r.panningModel<"u"?r.panningModel:u.panningModel};var d=a._panner;d||(a._pos||(a._pos=e._pos||[0,0,-.5]),t(a,"spatial"),d=a._panner),d.coneInnerAngle=u.coneInnerAngle,d.coneOuterAngle=u.coneOuterAngle,d.coneOuterGain=u.coneOuterGain,d.distanceModel=u.distanceModel,d.maxDistance=u.maxDistance,d.refDistance=u.refDistance,d.rolloffFactor=u.rolloffFactor,d.panningModel=u.panningModel}return e},Sound.prototype.init=function(e){return function(){var i=this,r=i._parent;i._orientation=r._orientation,i._stereo=r._stereo,i._pos=r._pos,i._pannerAttr=r._pannerAttr,e.call(this),i._stereo?r.stereo(i._stereo):i._pos&&r.pos(i._pos[0],i._pos[1],i._pos[2],i._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var i=this,r=i._parent;return i._orientation=r._orientation,i._stereo=r._stereo,i._pos=r._pos,i._pannerAttr=r._pannerAttr,i._stereo?r.stereo(i._stereo):i._pos?r.pos(i._pos[0],i._pos[1],i._pos[2],i._id):i._panner&&(i._panner.disconnect(0),i._panner=void 0,r._refreshBuffer(i)),e.call(this)}}(Sound.prototype.reset);var t=function(e,i){i=i||"spatial",i==="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)}})()})(Vu);let c_;function wE(s){return c_=s,s}function Pn(){return c_}let EE=0;const Xu=class extends ti{constructor(s){super(),this.id=EE++,this.init(s)}set(s,t){if(this[s]===void 0)throw new Error(`Property with name ${s} does not exist.`);switch(s){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:s}=this._source;return s/this._duration}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(s){this._playing=!1,this._duration=s.source.duration;const t=this._source=s.source.cloneNode(!1);t.src=s.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),s.context.on("refresh",this.refresh,this),s.context.on("refreshPaused",this.refreshPaused,this),this._media=s}_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(s){this._speed=s,this.refresh()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(s){console.warn("HTML Audio does not support filters")}refresh(){const s=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=s.volume*(s.muted?0:1),i=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*i,this._source.playbackRate=this._speed*s.speed*t.speed}refreshPaused(){const s=this._media.context,t=this._media.parent,e=this._paused||t.paused||s.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(s){const{start:t,end:e,speed:i,loop:r,volume:n,muted:a}=s;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=n,this._loop=!!r,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-Xu.PADDING),this._end=Math.min(this._end+Xu.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),ct.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(){ct.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){ct.shared.remove(this._onUpdate,this),this.removeAllListeners();const s=this._source;s&&(s.onended=null,s.onplay=null,s.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 d_=Xu;d_.PADDING=.1;class AE extends ti{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new d_(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,i=this.parent;if(e.readyState===4){i.isLoaded=!0;const h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h)},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;const r=()=>{o(),i.isLoaded=!0;const h=i.autoPlayStart();t&&t(null,i,h)},n=()=>{o(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{o();const h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h)},o=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class SE{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 _o=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],CE=["audio/mpeg","audio/ogg"],go={};function PE(s){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...s||{}},e=document.createElement("audio"),i={},r=/^no$/;_o.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),o=t[n]?e.canPlayType(t[n]).replace(r,""):"";i[n]=!!a||!!o}),Object.assign(go,i)}PE();class Wu{static setParamValue(t,e){if(t.setValueAtTime){const i=Pn().context;t.setValueAtTime(e,i.audioContext.currentTime)}else t.value=e;return e}}let IE=0;class RE extends ti{constructor(t){super(),this.id=IE++,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(i=>i).forEach(i=>i.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 i=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);Wu.setParamValue(this._gain.gain,n*r*i),Wu.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(i=>{e.connect(i.destination),e=i}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(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",i))}play(t){const{start:e,end:i,speed:r,loop:n,volume:a,muted:o,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=!1;const{source:u,gain:d}=this._media.nodes.cloneBufferSource();this._source=u,this._gain=d,this._speed=r,this._volume=a,this._loop=!!n,this._muted=o,this._filters=h,this.refresh();const l=this._source.buffer.duration;this._duration=l,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){ct.shared.remove(this._updateListener,this),t&&ct.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(),i=e-this._lastUpdate;if(i>0||t){const r=this._source.playbackRate.value;this._elapsed+=i*r,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const o=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%o)/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 f_{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(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const p_=class extends f_{constructor(s){const t=s.audioContext,e=t.createBufferSource(),i=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(i),i.connect(s.destination),super(r,i),this.context=s,this.bufferSource=e,this.gain=i,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(p_.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 s=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=s.buffer,Wu.setParamValue(t.playbackRate,s.playbackRate.value),t.loop=s.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 m_=p_;m_.BUFFER_SIZE=0;class ME{init(t){this.parent=t,this._nodes=new m_(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 RE(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,i=await H.ADAPTER.fetch(e);this._decode(await i.arrayBuffer(),t)}_decode(t,e){const i=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i)}}const Mr=class{static from(s){let t={};typeof s=="string"?t.url=s:s instanceof ArrayBuffer||s instanceof AudioBuffer||s instanceof HTMLAudioElement?t.source=s:Array.isArray(s)?t.url=s:t=s,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=Pn().useLegacy?new AE:new ME;return new Mr(e,t)}constructor(s,t){this.media=s,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(s){const[t]=s.map(e=>({url:e,ext:Ft.extname(e).slice(1)})).filter(({ext:e})=>go[e]).sort((e,i)=>_o.indexOf(e.ext)-_o.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return Pn().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(s){this._paused=s,this.refreshPaused()}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get filters(){return this.media.filters}set filters(s){this.media.filters=s}addSprites(s,t){if(typeof s=="object"){const i={};for(const r in s)i[r]=this.addSprites(r,s[r]);return i}console.assert(!this._sprites[s],`Alias ${s} is already taken`);const e=new SE(this,t);return this._sprites[s]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(s){if(s){const t=this._sprites[s];t!==void 0&&(t.destroy(),delete this._sprites[s])}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 s=this._instances.length-1;s>=0;s--)this._instances[s].stop();return this}play(s,t){let e;if(typeof s=="string"?e={sprite:s,loop:this.loop,complete:t}:typeof s=="function"?(e={},e.complete=s):e=s,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];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(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((a,o,h)=>{this._preloadQueue.forEach(u=>u()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,o,h),r(h))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const i=this._createInstance();return this._instances.push(i),this.isPlaying=!0,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i)}),i.once("stop",()=>{this._onComplete(i)}),i.play(e),i}refresh(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refresh()}refreshPaused(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}_preload(s){this.media.load(s)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let s;return this.autoPlay&&(s=this.play(this._autoPlayOptions)),s}_removeInstances(){for(let s=this._instances.length-1;s>=0;s--)this._poolInstance(this._instances[s]);this._instances.length=0}_onComplete(s){if(this._instances){const t=this._instances.indexOf(s);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(s)}_createInstance(){if(Mr._pool.length>0){const s=Mr._pool.pop();return s.init(this.media),s}return this.media.create()}_poolInstance(s){s.destroy(),Mr._pool.indexOf(s)<0&&Mr._pool.push(s)}};let yo=Mr;yo._pool=[];class DE extends ti{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 In extends f_{constructor(){const t=window,e=new In.AudioContext,i=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(i),i.connect(e.destination),super(r,i),this.autoPause=!0,this._ctx=e,this._offlineCtx=new In.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=r,this.events=new ti,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 i=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},i);r&&r.catch(i)}}class BE{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new In),this._htmlAudioContext=new DE,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 In.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const o=this._getOptions(t[a],e);n[a]=this.add(a,o)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof yo)return this._sounds[t]=e,e;const i=this._getOptions(e),r=yo.from(i);return this._sounds[t]=r,r}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}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 i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}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 i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){const i=this.find(t);return e!==void 0&&(i.speed=e),i.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 __=s=>{var e;const t=s.src;return((e=s==null?void 0:s.alias)==null?void 0:e[0])??Ft.basename(t,Ft.extname(t))},OE={extension:G.Asset,detection:{test:async()=>!0,add:async s=>[...s,..._o.filter(t=>go[t])],remove:async s=>s.filter(t=>s.includes(t))},loader:{extension:{type:[G.LoadParser],priority:Ie.High},test(s){const t=Ft.extname(s).slice(1);return!!go[t]||CE.some(e=>s.startsWith(`data:${e}`))},async load(s,t){const e=await new Promise((i,r)=>yo.from({...t.data,url:s,preload:!0,loaded(n,a){var o,h;n?r(n):i(a),(h=(o=t.data)==null?void 0:o.loaded)==null||h.call(o,n,a)}}));return Pn().add(__(t),e),e},async unload(s,t){Pn().remove(__(t))}}};z.add(OE),wE(new BE);class FE{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,i;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(i=this._musicPlayer)==null||i.pause(),this._playingList.forEach(r=>{t?r.audio.play():r.audio.pause()})},document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(i=>{const r=Math.random(),n=Zi.get(t).url,a=new Vu.Howl({src:n,mute:this._isBackground||!this.effectEnabled});if(a.play(),a.on("end",()=>{this._playingList=this._playingList.filter(o=>o.id!==r),i()}),e){const h=a.duration()-e;a.seek(h)}this._playingList.push({id:r,audio:a,url:n})})}async playMusic(t){const e=Zi.get(t).url;this._musicPlayer&&(ut.killTweensOf(this._musicPlayer),await ut.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),this._musicPlayer.stop()),this._musicPlayer=new Vu.Howl({src:e,loop:!0,volume:0,mute:this._isBackground||!this.musicEnabled}),this._musicPlayer.play(),this._isMusicPaused=!1,ut.killTweensOf(this._musicPlayer),ut.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=Zi.get(t).url;this._playingList.forEach(i=>{i.url===e&&i.audio.stop()}),this._playingList=this._playingList.filter(i=>i.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 kE=s=>{const{texture:t,dotWidth:e,width:i,height:r}=s;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new Y1(t,n[0],n[1],n[2],n[3]);return a.width=i,a.height=r,a},LE=(s,t,e)=>{let i=!1;return s.cursor="pointer",s.eventMode="static",s.on(t,r=>{i||r.button!==2&&e(r)}),()=>{i=!0}},NE=(s,t,e=0)=>parseFloat((Math.random()*(t-s)+s).toFixed(e)),UE=(s,t)=>{let e=0;const i=new ct,r=n=>{e+=n*i.deltaMS;let a=0;Array.isArray(t)?a=NE(t[0],t[1],2):a=t,e>=a&&(s(),e=0)};return i.add(r),i.start(),()=>{i.remove(r),i.stop()}},GE=(s,t,e)=>{const i=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=s.getBounds().contains(r.clientX,r.clientY);!n&&!a&&s.visible&&(e(),window.removeEventListener("pointerdown",i))};return window.addEventListener("pointerdown",i),()=>{window.removeEventListener("pointerdown",i)}},HE=(s=1,t)=>new Promise(e=>{let i=0;const r=new ct,n=()=>{i+=r.deltaMS,i>=s&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),VE=(s,t)=>{let e;if(s==="brightness")e=new or,e.brightness(t,!1);else if(s==="blur")e=new Vf;else if(s==="desaturate")e=new or,e.desaturate();else if(s==="contrast")e=new or,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var XE=`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 r=s._howls.length-1;r>=0;r--)s._howls[r].stereo(e);return s},HowlerGlobal.prototype.pos=function(e,s,r){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(s=typeof s!="number"?n._pos[1]:s,r=typeof r!="number"?n._pos[2]:r,typeof e=="number")n._pos=[e,s,r],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,r,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,r=typeof r!="number"?l[2]:r,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,r,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(r,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,r,n,a,h);else return l;return o},Howl.prototype.init=function(e){return function(s){var r=this;return r._orientation=s.orientation||[1,0,0],r._stereo=s.stereo||null,r._pos=s.pos||null,r._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},r._onstereo=s.onstereo?[{fn:s.onstereo}]:[],r._onpos=s.onpos?[{fn:s.onpos}]:[],r._onorientation=s.onorientation?[{fn:s.onorientation}]:[],e.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,s){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(e,s)}}),r;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u")if(typeof e=="number")r._stereo=e,r._pos=[e,0,0];else return r._stereo;for(var a=r._getSoundIds(s),h=0;h<a.length;h++){var o=r._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)),r._emit("stereo",o._id);else return o._stereo}return r},Howl.prototype.pos=function(e,s,r,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,r,n)}}),a;if(s=typeof s!="number"?0:s,r=typeof r!="number"?-.5:r,typeof n>"u")if(typeof e=="number")a._pos=[e,s,r];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,r],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(r,Howler.ctx.currentTime)):l._panner.setPosition(e,s,r)),a._emit("pos",l._id);else return l._pos}return a},Howl.prototype.orientation=function(e,s,r,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,r,n)}}),a;if(s=typeof s!="number"?a._orientation[1]:s,r=typeof r!="number"?a._orientation[2]:r,typeof n>"u")if(typeof e=="number")a._orientation=[e,s,r];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,r],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(r,Howler.ctx.currentTime)):l._panner.setOrientation(e,s,r)),a._emit("orientation",l._id);else return l._orientation}return a},Howl.prototype.pannerAttr=function(){var e=this,s=arguments,r,n,a;if(!e._webAudio)return e;if(s.length===0)return e._pannerAttr;if(s.length===1)if(typeof s[0]=="object")r=s[0],typeof n>"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),e._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:e._panningModel});else return a=e._soundById(parseInt(s[0],10)),a?a._pannerAttr:e._pannerAttr;else s.length===2&&(r=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 r.coneInnerAngle<"u"?r.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:l.coneOuterAngle,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:l.coneOuterGain,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:l.distanceModel,maxDistance:typeof r.maxDistance<"u"?r.maxDistance:l.maxDistance,refDistance:typeof r.refDistance<"u"?r.refDistance:l.refDistance,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:l.rolloffFactor,panningModel:typeof r.panningModel<"u"?r.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,r=s._parent;s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,e.call(this),s._stereo?r.stereo(s._stereo):s._pos&&r.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,r=s._parent;return s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,s._stereo?r.stereo(s._stereo):s._pos?r.pos(s._pos[0],s._pos[1],s._pos[2],s._id):s._panner&&(s._panner.disconnect(0),s._panner=void 0,r._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)}})()})(cd);let $0;function fI(i){return $0=i,i}function ko(){return $0}let pI=0;const ud=class extends Gs{constructor(i){super(),this.id=pI++,this.init(i)}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){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:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(i){this._playing=!1,this._duration=i.source.duration;const t=this._source=i.source.cloneNode(!1);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i}_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(i){this._speed=i,this.refresh()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters")}refresh(){const i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=i.volume*(i.muted?0:1),s=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*s,this._source.playbackRate=this._speed*i.speed*t.speed}refreshPaused(){const i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.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(i){const{start:t,end:e,speed:s,loop:r,volume:n,muted:a}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=n,this._loop=!!r,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-ud.PADDING),this._end=Math.min(this._end+ud.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 i=this._source;i&&(i.onended=null,i.onplay=null,i.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=ud;Y0.PADDING=.1;class mI extends Gs{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 r=()=>{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",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class gI{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 xl=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],_I=["audio/mpeg","audio/ogg"],vl={};function yI(i){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...i||{}},e=document.createElement("audio"),s={},r=/^no$/;xl.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),h=t[n]?e.canPlayType(t[n]).replace(r,""):"";s[n]=!!a||!!h}),Object.assign(vl,s)}yI();class dd{static setParamValue(t,e){if(t.setValueAtTime){const s=ko().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}let xI=0;class vI extends Gs{constructor(t){super(),this.id=xI++,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),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);dd.setParamValue(this._gain.gain,n*r*s),dd.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:r,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=r,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 r=this._source.playbackRate.value;this._elapsed+=s*r,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 H0{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 W0=class extends H0{constructor(i){const t=i.audioContext,e=t.createBufferSource(),s=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(s),s.connect(i.destination),super(r,s),this.context=i,this.bufferSource=e,this.gain=s,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(W0.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 i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,dd.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.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 z0=W0;z0.BUFFER_SIZE=0;class bI{init(t){this.parent=t,this._nodes=new z0(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 vI(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=(r,n)=>{if(r)e&&e(r);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(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,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 mI:new bI;return new Fn(e,t)}constructor(i,t){this.media=i,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(i){const[t]=i.map(e=>({url:e,ext:bt.extname(e).slice(1)})).filter(({ext:e})=>vl[e]).sort((e,s)=>xl.indexOf(e.ext)-xl.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(i){this._paused=i,this.refreshPaused()}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get filters(){return this.media.filters}set filters(i){this.media.filters=i}addSprites(i,t){if(typeof i=="object"){const s={};for(const r in i)s[r]=this.addSprites(r,i[r]);return s}console.assert(!this._sprites[i],`Alias ${i} is already taken`);const e=new gI(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(i){if(i){const t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i])}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 i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];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(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((a,h,o)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,h,o),r(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 i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh()}refreshPaused(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}_preload(i){this.media.load(i)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0}_onComplete(i){if(this._instances){const t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(i)}_createInstance(){if(Fn._pool.length>0){const i=Fn._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Fn._pool.indexOf(i)<0&&Fn._pool.push(i)}};let bl=Fn;bl._pool=[];class wI extends Gs{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 H0{constructor(){const t=window,e=new Bo.AudioContext,s=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(s),s.connect(e.destination),super(r,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=r,this.events=new Gs,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"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},s);r&&r.catch(s)}}class EI{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Bo),this._htmlAudioContext=new wI,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 bl)return this._sounds[t]=e,e;const s=this._getOptions(e),r=bl.from(s);return this._sounds[t]=r,r}_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 j0=i=>{var e;const t=i.src;return((e=i==null?void 0:i.alias)==null?void 0:e[0])??bt.basename(t,bt.extname(t))},TI={extension:Y.Asset,detection:{test:async()=>!0,add:async i=>[...i,...xl.filter(t=>vl[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{extension:{type:[Y.LoadParser],priority:Ne.High},test(i){const t=bt.extname(i).slice(1);return!!vl[t]||_I.some(e=>i.startsWith(`data:${e}`))},async load(i,t){const e=await new Promise((s,r)=>bl.from({...t.data,url:i,preload:!0,loaded(n,a){var h,o;n?r(n):s(a),(o=(h=t.data)==null?void 0:h.loaded)==null||o.call(h,n,a)}}));return ko().add(j0(t),e),e},async unload(i,t){ko().remove(j0(t))}}};K.add(TI),fI(new EI);class AI{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(r=>{t?r.audio.play():r.audio.pause()})},document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(s=>{const r=Math.random(),n=Gr.get(t).url,a=new cd.Howl({src:n,mute:this._isBackground||!this.effectEnabled});if(a.play(),a.on("end",()=>{this._playingList=this._playingList.filter(h=>h.id!==r),s()}),e){const o=a.duration()-e;a.seek(o)}this._playingList.push({id:r,audio:a,url:n})})}async playMusic(t){const e=Gr.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 cd.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=Gr.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 SI=i=>{const{texture:t,dotWidth:e,width:s,height:r}=i;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new PT(t,n[0],n[1],n[2],n[3]);return a.width=s,a.height=r,a},CI=(i,t,e)=>{let s=!1;return i.cursor="pointer",i.eventMode="static",i.on(t,r=>{s||r.button!==2&&e(r)}),()=>{s=!0}},II=(i,t,e=0)=>parseFloat((Math.random()*(t-i)+i).toFixed(e)),PI=(i,t)=>{let e=0;const s=new wt,r=n=>{e+=n*s.deltaMS;let a=0;Array.isArray(t)?a=II(t[0],t[1],2):a=t,e>=a&&(i(),e=0)};return s.add(r),s.start(),()=>{s.remove(r),s.stop()}},RI=(i,t,e)=>{const s=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=i.getBounds().contains(r.clientX,r.clientY);!n&&!a&&i.visible&&(e(),window.removeEventListener("pointerdown",s))};return window.addEventListener("pointerdown",s),()=>{window.removeEventListener("pointerdown",s)}},MI=(i=1,t)=>new Promise(e=>{let s=0;const r=new wt,n=()=>{s+=r.deltaMS,s>=i&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),FI=(i,t)=>{let e;if(i==="brightness")e=new hn,e.brightness(t,!1);else if(i==="blur")e=new um;else if(i==="desaturate")e=new hn,e.desaturate();else if(i==="contrast")e=new hn,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var kI=`attribute vec2 aVertexPosition;
|
|
1188
1190
|
attribute vec2 aTextureCoord;
|
|
1189
1191
|
|
|
1190
1192
|
uniform mat3 projectionMatrix;
|
|
@@ -1195,7 +1197,7 @@ void main(void)
|
|
|
1195
1197
|
{
|
|
1196
1198
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1197
1199
|
vTextureCoord = aTextureCoord;
|
|
1198
|
-
}`,
|
|
1200
|
+
}`,BI=`
|
|
1199
1201
|
varying vec2 vTextureCoord;
|
|
1200
1202
|
uniform sampler2D uSampler;
|
|
1201
1203
|
|
|
@@ -1221,7 +1223,7 @@ void main(void)
|
|
|
1221
1223
|
color *= 0.25;
|
|
1222
1224
|
|
|
1223
1225
|
gl_FragColor = color;
|
|
1224
|
-
}
|
|
1226
|
+
}`,DI=`
|
|
1225
1227
|
varying vec2 vTextureCoord;
|
|
1226
1228
|
uniform sampler2D uSampler;
|
|
1227
1229
|
|
|
@@ -1249,7 +1251,7 @@ void main(void)
|
|
|
1249
1251
|
|
|
1250
1252
|
gl_FragColor = color;
|
|
1251
1253
|
}
|
|
1252
|
-
`;let
|
|
1254
|
+
`;let q0=class extends pe{constructor(t=4,e=3,s=!1){super(kI,s?DI:BI),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,r){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,r);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,r),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 r=t;const n=t/e;for(let a=1;a<e;a++)r-=n,s.push(r)}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 OI=`attribute vec2 aVertexPosition;
|
|
1253
1255
|
attribute vec2 aTextureCoord;
|
|
1254
1256
|
|
|
1255
1257
|
uniform mat3 projectionMatrix;
|
|
@@ -1260,7 +1262,7 @@ void main(void)
|
|
|
1260
1262
|
{
|
|
1261
1263
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1262
1264
|
vTextureCoord = aTextureCoord;
|
|
1263
|
-
}`,
|
|
1265
|
+
}`,LI=`varying vec2 vTextureCoord;
|
|
1264
1266
|
uniform sampler2D uSampler;
|
|
1265
1267
|
uniform float alpha;
|
|
1266
1268
|
uniform vec3 color;
|
|
@@ -1278,4 +1280,4 @@ void main(void){
|
|
|
1278
1280
|
sample *= alpha;
|
|
1279
1281
|
|
|
1280
1282
|
gl_FragColor = sample;
|
|
1281
|
-
}`,
|
|
1283
|
+
}`,NI=Object.defineProperty,Z0=Object.getOwnPropertySymbols,VI=Object.prototype.hasOwnProperty,UI=Object.prototype.propertyIsEnumerable,K0=(i,t,e)=>t in i?NI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Q0=(i,t)=>{for(var e in t||(t={}))VI.call(t,e)&&K0(i,e,t[e]);if(Z0)for(var e of Z0(t))UI.call(t,e)&&K0(i,e,t[e]);return i};const fd=class extends pe{constructor(i){super(),this.angle=45,this._distance=5,this._resolution=z.FILTER_RESOLUTION;const t=i?Q0(Q0({},fd.defaults),i):fd.defaults,{kernels:e,blur:s,quality:r,pixelSize:n,resolution:a}=t;this._offset=new js(this._updatePadding,this),this._tintFilter=new pe(OI,LI),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=this._offset,this._tintFilter.resolution=a,this._blurFilter=e?new q0(e):new q0(s,r),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(i,t,e,s){const r=i.getFilterTexture();this._tintFilter.apply(i,t,r,1),this._blurFilter.apply(i,r,e,s),this.shadowOnly!==!0&&i.applyFilter(this,t,e,0),i.returnFilterTexture(r)}_updatePadding(){const i=Math.max(Math.abs(this._offset.x),Math.abs(this._offset.y));this.padding=i+this.blur*2}_updateShift(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))}set offset(i){this._offset.copyFrom(i),this._updatePadding()}get offset(){return this._offset}get resolution(){return this._resolution}set resolution(i){this._resolution=i,this._tintFilter&&(this._tintFilter.resolution=i),this._blurFilter&&(this._blurFilter.resolution=i)}get distance(){return this._distance}set distance(i){ot("5.3.0","DropShadowFilter distance is deprecated, use offset"),this._distance=i,this._updatePadding(),this._updateShift()}get rotation(){return this.angle/Oh}set rotation(i){ot("5.3.0","DropShadowFilter rotation is deprecated, use offset"),this.angle=i*Oh,this._updateShift()}get alpha(){return this._tintFilter.uniforms.alpha}set alpha(i){this._tintFilter.uniforms.alpha=i}get color(){return eo(this._tintFilter.uniforms.color)}set color(i){sp(i,this._tintFilter.uniforms.color)}get kernels(){return this._blurFilter.kernels}set kernels(i){this._blurFilter.kernels=i}get blur(){return this._blurFilter.blur}set blur(i){this._blurFilter.blur=i,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(i){this._blurFilter.quality=i}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(i){this._blurFilter.pixelSize=i}};let J0=fd;J0.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 GI=(i,t)=>{const{color:e="#000",alpha:s=.25,blur:r=1,distance:n=0,offset:a={x:0,y:0}}=t||{},h=new J0({color:e,alpha:s,blur:r,distance:n,offset:a});h.resolution=window.devicePixelRatio||1,i.filters=[h]},XI=(i,t=1)=>{let e=0;const s=new wt,r=()=>{if(e+=s.deltaMS,e>=t){i==null||i();try{s.destroy()}catch{}}};return s.add(r),s.start(),()=>{try{s.destroy()}catch{}}};class $I{constructor(t){this._isDragging=!1,this._moveX=0,this._lastMoveX=0,this._progress=0;const{app:e,clickArea:s,maxMoveDistance:r,onChange:n,onDown:a,onUp:h,sideArea:o}=t;this._app=e,this._maxMoveDistance=r,this._onChange=n,this._onDown=a,this._onUp=h,this._sideArea=o,s.forEach(l=>{Mr(l,"pointerdown",this._onDragStart.bind(this))}),Mr(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)}}const HI=Object.freeze(Object.defineProperty({__proto__:null,Components:{Base:{LibPixiBitText:lA,LibPixiContainer:Ao,LibPixiParticleMove:kS,LibPixiRectBgColor:du,LibPixiSpine:eI,LibPixiText:Nu},Custom:{LibPixiButtonHover:sI,LibPixiCloseBtn:rI,LibPixiDrawer:iI,LibPixiPerforMon:nI,LibPixiProgress:oI,LibPixiScrollContainer:aI,LibPixiScrollNum:lI,LibPixiSlider:hI,LibPixiSubAddMinMax:uI,LibPixiTable:dI}},Utils:{LibPixiAudio:AI,libPixiCreateNineGrid:SI,libPixiEvent:Mr,libPixiEventControlled:CI,libPixiFilter:FI,libPixiIntervalTrigger:PI,libPixiOutsideClick:RI,libPixiOverflowHidden:G0,libPixiPromiseTickerTimeout:MI,libPixiScaleContainer:X0,libPixiShadow:GI,libPixiTickerTimeout:XI,LibPixiSlideInput:$I,LibGlobalUpdater:YI}},Symbol.toStringTag,{value:"Module"}));window.LibPixiJs=HI});
|