/*! For license information please see 4052.1eecab13e0936b99cb6a.js.LICENSE.txt */ (self.webpackChunklauncher=self.webpackChunklauncher||[]).push([[4052],{8075:(t,e,s)=>{"use strict";var r=s(453),n=s(487),i=n(r("String.prototype.indexOf"));t.exports=function(t,e){var s=r(t,!!e);return"function"==typeof s&&i(t,".prototype.")>-1?n(s):s}},487:(t,e,s)=>{"use strict";var r=s(6743),n=s(453),i=s(6897),a=s(9675),o=n("%Function.prototype.apply%"),h=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||r.call(h,o),c=s(655),u=n("%Math.max%");t.exports=function(t){if("function"!=typeof t)throw new a("a function is required");var e=l(r,h,arguments);return i(e,1+u(0,t.length-(arguments.length-1)),!0)};var d=function(){return l(r,o,arguments)};c?c(t.exports,"apply",{value:d}):t.exports.apply=d},41:(t,e,s)=>{"use strict";var r=s(655),n=s(5687),i=s(9675),a=s(5795);t.exports=function(t,e,s){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new i("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var o=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],u=!!a&&a(t,e);if(r)r(t,e,{configurable:null===l&&u?u.configurable:!l,enumerable:null===o&&u?u.enumerable:!o,value:s,writable:null===h&&u?u.writable:!h});else{if(!c&&(o||h||l))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=s}}},6570:t=>{"use strict";function e(t,e,r){r=r||2;var i,a,o,h,u,d,p,m=e&&e.length,g=m?e[0]*r:t.length,x=s(t,0,g,r,!0),y=[];if(!x||x.next===x.prev)return y;if(m&&(x=function(t,e,r,n){var i,a,o,h=[];for(i=0,a=e.length;i80*r){i=o=t[0],a=h=t[1];for(var b=r;bo&&(o=u),d>h&&(h=d);p=0!==(p=Math.max(o-i,h-a))?32767/p:0}return n(x,y,r,i,a,p,0),y}function s(t,e,s,r,n){var i,a;if(n===S(t,e,s,r)>0)for(i=e;i=e;i-=r)a=v(i,t[i],t[i+1],a);return a&&x(a,a.next)&&(T(a),a=a.next),a}function r(t,e){if(!t)return t;e||(e=t);var s,r=t;do{if(s=!1,r.steiner||!x(r,r.next)&&0!==g(r.prev,r,r.next))r=r.next;else{if(T(r),(r=e=r.prev)===r.next)break;s=!0}}while(s||r!==e);return e}function n(t,e,s,l,c,u,f){if(t){!f&&u&&function(t,e,s,r){var n=t;do{0===n.z&&(n.z=d(n.x,n.y,e,s,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,s,r,n,i,a,o,h,l=1;do{for(s=t,t=null,i=null,a=0;s;){for(a++,r=s,o=0,e=0;e0||h>0&&r;)0!==o&&(0===h||!r||s.z<=r.z)?(n=s,s=s.nextZ,o--):(n=r,r=r.nextZ,h--),i?i.nextZ=n:t=n,n.prevZ=i,i=n;s=r}i.nextZ=null,l*=2}while(a>1)}(n)}(t,l,c,u);for(var p,m,g=t;t.prev!==t.next;)if(p=t.prev,m=t.next,u?a(t,l,c,u):i(t))e.push(p.i/s|0),e.push(t.i/s|0),e.push(m.i/s|0),T(t),t=m.next,g=m.next;else if((t=m)===g){f?1===f?n(t=o(r(t),e,s),e,s,l,c,u,2):2===f&&h(t,e,s,l,c,u):n(r(t),e,s,l,c,u,1);break}}}function i(t){var e=t.prev,s=t,r=t.next;if(g(e,s,r)>=0)return!1;for(var n=e.x,i=s.x,a=r.x,o=e.y,h=s.y,l=r.y,c=ni?n>a?n:a:i>a?i:a,f=o>h?o>l?o:l:h>l?h:l,m=r.next;m!==e;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=f&&p(n,o,i,h,a,l,m.x,m.y)&&g(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function a(t,e,s,r){var n=t.prev,i=t,a=t.next;if(g(n,i,a)>=0)return!1;for(var o=n.x,h=i.x,l=a.x,c=n.y,u=i.y,f=a.y,m=oh?o>l?o:l:h>l?h:l,b=c>u?c>f?c:f:u>f?u:f,_=d(m,x,e,s,r),E=d(y,b,e,s,r),w=t.prevZ,v=t.nextZ;w&&w.z>=_&&v&&v.z<=E;){if(w.x>=m&&w.x<=y&&w.y>=x&&w.y<=b&&w!==n&&w!==a&&p(o,c,h,u,l,f,w.x,w.y)&&g(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,v.x>=m&&v.x<=y&&v.y>=x&&v.y<=b&&v!==n&&v!==a&&p(o,c,h,u,l,f,v.x,v.y)&&g(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;w&&w.z>=_;){if(w.x>=m&&w.x<=y&&w.y>=x&&w.y<=b&&w!==n&&w!==a&&p(o,c,h,u,l,f,w.x,w.y)&&g(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;v&&v.z<=E;){if(v.x>=m&&v.x<=y&&v.y>=x&&v.y<=b&&v!==n&&v!==a&&p(o,c,h,u,l,f,v.x,v.y)&&g(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function o(t,e,s){var n=t;do{var i=n.prev,a=n.next.next;!x(i,a)&&y(i,n,n.next,a)&&E(i,a)&&E(a,i)&&(e.push(i.i/s|0),e.push(n.i/s|0),e.push(a.i/s|0),T(n),T(n.next),n=t=a),n=n.next}while(n!==t);return r(n)}function h(t,e,s,i,a,o){var h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&m(h,l)){var c=w(h,l);return h=r(h,h.next),c=r(c,c.next),n(h,e,s,i,a,o,0),void n(c,e,s,i,a,o,0)}l=l.next}h=h.next}while(h!==t)}function l(t,e){return t.x-e.x}function c(t,e){var s=function(t,e){var s,r=e,n=t.x,i=t.y,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var o=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=n&&o>a&&(a=o,s=r.x=r.x&&r.x>=c&&n!==r.x&&p(is.x||r.x===s.x&&u(s,r)))&&(s=r,f=h)),r=r.next}while(r!==l);return s}(t,e);if(!s)return e;var n=w(s,t);return r(n,n.next),r(s,s.next)}function u(t,e){return g(t.prev,t,e.prev)<0&&g(e.next,t,t.next)<0}function d(t,e,s,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function f(t){var e=t,s=t;do{(e.x=(t-a)*(i-o)&&(t-a)*(r-o)>=(s-a)*(e-o)&&(s-a)*(i-o)>=(n-a)*(r-o)}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var s=t;do{if(s.i!==t.i&&s.next.i!==t.i&&s.i!==e.i&&s.next.i!==e.i&&y(s,s.next,t,e))return!0;s=s.next}while(s!==t);return!1}(t,e)&&(E(t,e)&&E(e,t)&&function(t,e){var s=t,r=!1,n=(t.x+e.x)/2,i=(t.y+e.y)/2;do{s.y>i!=s.next.y>i&&s.next.y!==s.y&&n<(s.next.x-s.x)*(i-s.y)/(s.next.y-s.y)+s.x&&(r=!r),s=s.next}while(s!==t);return r}(t,e)&&(g(t.prev,t,e.prev)||g(t,e.prev,e))||x(t,e)&&g(t.prev,t,t.next)>0&&g(e.prev,e,e.next)>0)}function g(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function x(t,e){return t.x===e.x&&t.y===e.y}function y(t,e,s,r){var n=_(g(t,e,s)),i=_(g(t,e,r)),a=_(g(s,r,t)),o=_(g(s,r,e));return n!==i&&a!==o||!(0!==n||!b(t,s,e))||!(0!==i||!b(t,r,e))||!(0!==a||!b(s,t,r))||!(0!==o||!b(s,e,r))}function b(t,e,s){return e.x<=Math.max(t.x,s.x)&&e.x>=Math.min(t.x,s.x)&&e.y<=Math.max(t.y,s.y)&&e.y>=Math.min(t.y,s.y)}function _(t){return t>0?1:t<0?-1:0}function E(t,e){return g(t.prev,t,t.next)<0?g(t,e,t.next)>=0&&g(t,t.prev,e)>=0:g(t,e,t.prev)<0||g(t,t.next,e)<0}function w(t,e){var s=new A(t.i,t.x,t.y),r=new A(e.i,e.x,e.y),n=t.next,i=e.prev;return t.next=e,e.prev=t,s.next=n,n.prev=s,r.next=s,s.prev=r,i.next=r,r.prev=i,r}function v(t,e,s,r){var n=new A(t,e,s);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function T(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(t,e,s){this.i=t,this.x=e,this.y=s,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function S(t,e,s,r){for(var n=0,i=e,a=s-r;i0&&(r+=t[n-1].length,s.holes.push(r))}return s}},655:(t,e,s)=>{"use strict";var r=s(453)("%Object.defineProperty%",!0)||!1;if(r)try{r({},"a",{value:1})}catch(t){r=!1}t.exports=r},1237:t=>{"use strict";t.exports=EvalError},9383:t=>{"use strict";t.exports=Error},9290:t=>{"use strict";t.exports=RangeError},9538:t=>{"use strict";t.exports=ReferenceError},5687:t=>{"use strict";t.exports=SyntaxError},9675:t=>{"use strict";t.exports=TypeError},5345:t=>{"use strict";t.exports=URIError},228:t=>{"use strict";var e=Object.prototype.hasOwnProperty,s="~";function r(){}function n(t,e,s){this.fn=t,this.context=e,this.once=s||!1}function i(t,e,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new n(r,i||t,a),h=s?s+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(s=!1)),o.prototype.eventNames=function(){var t,r,n=[];if(0===this._eventsCount)return n;for(r in t=this._events)e.call(t,r)&&n.push(s?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=s?s+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,i=r.length,a=new Array(i);n{"use strict";var e=Object.prototype.toString,s=Math.max,r=function(t,e){for(var s=[],r=0;r{"use strict";var r=s(9353);t.exports=Function.prototype.bind||r},453:(t,e,s)=>{"use strict";var r,n=s(9383),i=s(1237),a=s(9290),o=s(9538),h=s(5687),l=s(9675),c=s(5345),u=Function,d=function(t){try{return u('"use strict"; return ('+t+").constructor;")()}catch(t){}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch(t){f=null}var p=function(){throw new l},m=f?function(){try{return p}catch(t){try{return f(arguments,"callee").get}catch(t){return p}}}():p,g=s(4039)(),x=s(24)(),y=Object.getPrototypeOf||(x?function(t){return t.__proto__}:null),b={},_="undefined"!=typeof Uint8Array&&y?y(Uint8Array):r,E={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":g&&y?y([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":b,"%AsyncGenerator%":b,"%AsyncGeneratorFunction%":b,"%AsyncIteratorPrototype%":b,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?r:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":i,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":u,"%GeneratorFunction%":b,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&y?y(y([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&y?y((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":a,"%ReferenceError%":o,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&y?y((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&y?y(""[Symbol.iterator]()):r,"%Symbol%":g?Symbol:r,"%SyntaxError%":h,"%ThrowTypeError%":m,"%TypedArray%":_,"%TypeError%":l,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":c,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(y)try{null.error}catch(t){var w=y(y(t));E["%Error.prototype%"]=w}var v=function t(e){var s;if("%AsyncFunction%"===e)s=d("async function () {}");else if("%GeneratorFunction%"===e)s=d("function* () {}");else if("%AsyncGeneratorFunction%"===e)s=d("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(s=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&y&&(s=y(n.prototype))}return E[e]=s,s},T={__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"]},A=s(6743),S=s(9957),I=A.call(Function.call,Array.prototype.concat),R=A.call(Function.apply,Array.prototype.splice),M=A.call(Function.call,String.prototype.replace),C=A.call(Function.call,String.prototype.slice),P=A.call(Function.call,RegExp.prototype.exec),k=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,D=/\\(\\)?/g,F=function(t,e){var s,r=t;if(S(T,r)&&(r="%"+(s=T[r])[0]+"%"),S(E,r)){var n=E[r];if(n===b&&(n=v(r)),void 0===n&&!e)throw new l("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:n}}throw new h("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new l('"allowMissing" argument must be a boolean');if(null===P(/^%?[^%]*%?$/,t))throw new h("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=function(t){var e=C(t,0,1),s=C(t,-1);if("%"===e&&"%"!==s)throw new h("invalid intrinsic syntax, expected closing `%`");if("%"===s&&"%"!==e)throw new h("invalid intrinsic syntax, expected opening `%`");var r=[];return M(t,k,(function(t,e,s,n){r[r.length]=s?M(n,D,"$1"):e||t})),r}(t),r=s.length>0?s[0]:"",n=F("%"+r+"%",e),i=n.name,a=n.value,o=!1,c=n.alias;c&&(r=c[0],R(s,I([0,1],c)));for(var u=1,d=!0;u=s.length){var x=f(a,p);a=(d=!!x)&&"get"in x&&!("originalValue"in x.get)?x.get:a[p]}else d=S(a,p),a=a[p];d&&!o&&(E[i]=a)}}return a}},5795:(t,e,s)=>{"use strict";var r=s(453)("%Object.getOwnPropertyDescriptor%",!0);if(r)try{r([],"length")}catch(t){r=null}t.exports=r},592:(t,e,s)=>{"use strict";var r=s(655),n=function(){return!!r};n.hasArrayLengthDefineBug=function(){if(!r)return null;try{return 1!==r([],"length",{value:1}).length}catch(t){return!0}},t.exports=n},24:t=>{"use strict";var e={__proto__:null,foo:{}},s=Object;t.exports=function(){return{__proto__:e}.foo===e.foo&&!(e instanceof s)}},4039:(t,e,s)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,n=s(1333);t.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&n()}},1333:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),s=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(s))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},9957:(t,e,s)=>{"use strict";var r=Function.prototype.call,n=Object.prototype.hasOwnProperty,i=s(6743);t.exports=i.call(r,n)},8859:(t,e,s)=>{var r="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=r&&n&&"function"==typeof n.get?n.get:null,a=r&&Map.prototype.forEach,o="function"==typeof Set&&Set.prototype,h=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=o&&h&&"function"==typeof h.get?h.get:null,c=o&&Set.prototype.forEach,u="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,f="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,x=String.prototype.match,y=String.prototype.slice,b=String.prototype.replace,_=String.prototype.toUpperCase,E=String.prototype.toLowerCase,w=RegExp.prototype.test,v=Array.prototype.concat,T=Array.prototype.join,A=Array.prototype.slice,S=Math.floor,I="function"==typeof BigInt?BigInt.prototype.valueOf:null,R=Object.getOwnPropertySymbols,M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,C="function"==typeof Symbol&&"object"==typeof Symbol.iterator,P="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,k=Object.prototype.propertyIsEnumerable,D=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function F(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||w.call(/e/,e))return e;var s=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var r=t<0?-S(-t):S(t);if(r!==t){var n=String(r),i=y.call(e,n.length+1);return b.call(n,s,"$&_")+"."+b.call(b.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return b.call(e,s,"$&_")}var B=s(2634),N=B.custom,O=Y(N)?N:null;function L(t,e,s){var r="double"===(s.quoteStyle||e)?'"':"'";return r+t+r}function U(t){return b.call(String(t),/"/g,""")}function V(t){return!("[object Array]"!==W(t)||P&&"object"==typeof t&&P in t)}function X(t){return!("[object RegExp]"!==W(t)||P&&"object"==typeof t&&P in t)}function Y(t){if(C)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(t){}return!1}t.exports=function t(e,r,n,o){var h=r||{};if(j(h,"quoteStyle")&&"single"!==h.quoteStyle&&"double"!==h.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(j(h,"maxStringLength")&&("number"==typeof h.maxStringLength?h.maxStringLength<0&&h.maxStringLength!==1/0:null!==h.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var m=!j(h,"customInspect")||h.customInspect;if("boolean"!=typeof m&&"symbol"!==m)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(j(h,"indent")&&null!==h.indent&&"\t"!==h.indent&&!(parseInt(h.indent,10)===h.indent&&h.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(j(h,"numericSeparator")&&"boolean"!=typeof h.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var _=h.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return H(e,h);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var w=String(e);return _?F(e,w):w}if("bigint"==typeof e){var S=String(e)+"n";return _?F(e,S):S}var R=void 0===h.depth?5:h.depth;if(void 0===n&&(n=0),n>=R&&R>0&&"object"==typeof e)return V(e)?"[Array]":"[Object]";var N,q=function(t,e){var s;if("\t"===t.indent)s="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;s=T.call(Array(t.indent+1)," ")}return{base:s,prev:T.call(Array(e+1),s)}}(h,n);if(void 0===o)o=[];else if(G(o,e)>=0)return"[Circular]";function z(e,s,r){if(s&&(o=A.call(o)).push(s),r){var i={depth:h.depth};return j(h,"quoteStyle")&&(i.quoteStyle=h.quoteStyle),t(e,i,n+1,o)}return t(e,h,n+1,o)}if("function"==typeof e&&!X(e)){var tt=function(t){if(t.name)return t.name;var e=x.call(g.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(e),et=J(e,z);return"[Function"+(tt?": "+tt:" (anonymous)")+"]"+(et.length>0?" { "+T.call(et,", ")+" }":"")}if(Y(e)){var st=C?b.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):M.call(e);return"object"!=typeof e||C?st:$(st)}if((N=e)&&"object"==typeof N&&("undefined"!=typeof HTMLElement&&N instanceof HTMLElement||"string"==typeof N.nodeName&&"function"==typeof N.getAttribute)){for(var rt="<"+E.call(String(e.nodeName)),nt=e.attributes||[],it=0;it"}if(V(e)){if(0===e.length)return"[]";var at=J(e,z);return q&&!function(t){for(var e=0;e=0)return!1;return!0}(at)?"["+K(at,q)+"]":"[ "+T.call(at,", ")+" ]"}if(function(t){return!("[object Error]"!==W(t)||P&&"object"==typeof t&&P in t)}(e)){var ot=J(e,z);return"cause"in Error.prototype||!("cause"in e)||k.call(e,"cause")?0===ot.length?"["+String(e)+"]":"{ ["+String(e)+"] "+T.call(ot,", ")+" }":"{ ["+String(e)+"] "+T.call(v.call("[cause]: "+z(e.cause),ot),", ")+" }"}if("object"==typeof e&&m){if(O&&"function"==typeof e[O]&&B)return B(e,{depth:R-n});if("symbol"!==m&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!i||!t||"object"!=typeof t)return!1;try{i.call(t);try{l.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var ht=[];return a&&a.call(e,(function(t,s){ht.push(z(s,e,!0)+" => "+z(t,e))})),Z("Map",i.call(e),ht,q)}if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t);try{i.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var lt=[];return c&&c.call(e,(function(t){lt.push(z(t,e))})),Z("Set",l.call(e),lt,q)}if(function(t){if(!u||!t||"object"!=typeof t)return!1;try{u.call(t,u);try{d.call(t,d)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return Q("WeakMap");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{d.call(t,d);try{u.call(t,u)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return Q("WeakSet");if(function(t){if(!f||!t||"object"!=typeof t)return!1;try{return f.call(t),!0}catch(t){}return!1}(e))return Q("WeakRef");if(function(t){return!("[object Number]"!==W(t)||P&&"object"==typeof t&&P in t)}(e))return $(z(Number(e)));if(function(t){if(!t||"object"!=typeof t||!I)return!1;try{return I.call(t),!0}catch(t){}return!1}(e))return $(z(I.call(e)));if(function(t){return!("[object Boolean]"!==W(t)||P&&"object"==typeof t&&P in t)}(e))return $(p.call(e));if(function(t){return!("[object String]"!==W(t)||P&&"object"==typeof t&&P in t)}(e))return $(z(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if(e===s.g)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==W(t)||P&&"object"==typeof t&&P in t)}(e)&&!X(e)){var ct=J(e,z),ut=D?D(e)===Object.prototype:e instanceof Object||e.constructor===Object,dt=e instanceof Object?"":"null prototype",ft=!ut&&P&&Object(e)===e&&P in e?y.call(W(e),8,-1):dt?"Object":"",pt=(ut||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(ft||dt?"["+T.call(v.call([],ft||[],dt||[]),": ")+"] ":"");return 0===ct.length?pt+"{}":q?pt+"{"+K(ct,q)+"}":pt+"{ "+T.call(ct,", ")+" }"}return String(e)};var q=Object.prototype.hasOwnProperty||function(t){return t in this};function j(t,e){return q.call(t,e)}function W(t){return m.call(t)}function G(t,e){if(t.indexOf)return t.indexOf(e);for(var s=0,r=t.length;se.maxStringLength){var s=t.length-e.maxStringLength,r="... "+s+" more character"+(s>1?"s":"");return H(y.call(t,0,e.maxStringLength),e)+r}return L(b.call(b.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,z),"single",e)}function z(t){var e=t.charCodeAt(0),s={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return s?"\\"+s:"\\x"+(e<16?"0":"")+_.call(e.toString(16))}function $(t){return"Object("+t+")"}function Q(t){return t+" { ? }"}function Z(t,e,s,r){return t+" ("+e+") {"+(r?K(s,r):T.call(s,", "))+"}"}function K(t,e){if(0===t.length)return"";var s="\n"+e.prev+e.base;return s+T.call(t,","+s)+"\n"+e.prev}function J(t,e){var s=V(t),r=[];if(s){r.length=t.length;for(var n=0;n{"use strict";var r=s(453),n=s(41),i=s(592)(),a=s(5795),o=s(9675),h=r("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new o("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||h(e)!==e)throw new o("`length` must be a positive 32-bit integer");var s=arguments.length>2&&!!arguments[2],r=!0,l=!0;if("length"in t&&a){var c=a(t,"length");c&&!c.configurable&&(r=!1),c&&!c.writable&&(l=!1)}return(r||l||!s)&&(i?n(t,"length",e,!0,!0):n(t,"length",e)),t}},920:(t,e,s)=>{"use strict";var r=s(453),n=s(8075),i=s(8859),a=s(9675),o=r("%WeakMap%",!0),h=r("%Map%",!0),l=n("WeakMap.prototype.get",!0),c=n("WeakMap.prototype.set",!0),u=n("WeakMap.prototype.has",!0),d=n("Map.prototype.get",!0),f=n("Map.prototype.set",!0),p=n("Map.prototype.has",!0),m=function(t,e){for(var s,r=t;null!==(s=r.next);r=s)if(s.key===e)return r.next=s.next,s.next=t.next,t.next=s,s};t.exports=function(){var t,e,s,r={assert:function(t){if(!r.has(t))throw new a("Side channel does not contain "+i(t))},get:function(r){if(o&&r&&("object"==typeof r||"function"==typeof r)){if(t)return l(t,r)}else if(h){if(e)return d(e,r)}else if(s)return function(t,e){var s=m(t,e);return s&&s.value}(s,r)},has:function(r){if(o&&r&&("object"==typeof r||"function"==typeof r)){if(t)return u(t,r)}else if(h){if(e)return p(e,r)}else if(s)return function(t,e){return!!m(t,e)}(s,r);return!1},set:function(r,n){o&&r&&("object"==typeof r||"function"==typeof r)?(t||(t=new o),c(t,r,n)):h?(e||(e=new h),f(e,r,n)):(s||(s={key:{},next:null}),function(t,e,s){var r=m(t,e);r?r.value=s:t.next={key:e,next:t.next,value:s}}(s,r,n))}};return r}},1270:function(t,e,s){var r;t=s.nmd(t),function(n){e&&e.nodeType,t&&t.nodeType;var i="object"==typeof s.g&&s.g;i.global!==i&&i.window!==i&&i.self;var a,o=2147483647,h=36,l=26,c=38,u=700,d=/^xn--/,f=/[^\x20-\x7E]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,m={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=h-1,x=Math.floor,y=String.fromCharCode;function b(t){throw new RangeError(m[t])}function _(t,e){for(var s=t.length,r=[];s--;)r[s]=e(t[s]);return r}function E(t,e){var s=t.split("@"),r="";return s.length>1&&(r=s[0]+"@",t=s[1]),r+_((t=t.replace(p,".")).split("."),e).join(".")}function w(t){for(var e,s,r=[],n=0,i=t.length;n=55296&&e<=56319&&n65535&&(e+=y((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+y(t)})).join("")}function T(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function A(t,e,s){var r=0;for(t=s?x(t/u):t>>1,t+=x(t/e);t>g*l>>1;r+=h)t=x(t/g);return x(r+(g+1)*t/(t+c))}function S(t){var e,s,r,n,i,a,c,u,d,f,p,m=[],g=t.length,y=0,_=128,E=72;for((s=t.lastIndexOf("-"))<0&&(s=0),r=0;r=128&&b("not-basic"),m.push(t.charCodeAt(r));for(n=s>0?s+1:0;n=g&&b("invalid-input"),((u=(p=t.charCodeAt(n++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:h)>=h||u>x((o-y)/a))&&b("overflow"),y+=u*a,!(u<(d=c<=E?1:c>=E+l?l:c-E));c+=h)a>x(o/(f=h-d))&&b("overflow"),a*=f;E=A(y-i,e=m.length+1,0==i),x(y/e)>o-_&&b("overflow"),_+=x(y/e),y%=e,m.splice(y++,0,_)}return v(m)}function I(t){var e,s,r,n,i,a,c,u,d,f,p,m,g,_,E,v=[];for(m=(t=w(t)).length,e=128,s=0,i=72,a=0;a=e&&px((o-s)/(g=r+1))&&b("overflow"),s+=(c-e)*g,e=c,a=0;ao&&b("overflow"),p==e){for(u=s,d=h;!(u<(f=d<=i?1:d>=i+l?l:d-i));d+=h)E=u-f,_=h-f,v.push(y(T(f+E%_,0))),u=x(E/_);v.push(y(T(u,0))),i=A(s,g,r==n),s=0,++r}++s,++e}return v.join("")}a={version:"1.4.1",ucs2:{decode:w,encode:v},decode:S,encode:I,toASCII:function(t){return E(t,(function(t){return f.test(t)?"xn--"+I(t):t}))},toUnicode:function(t){return E(t,(function(t){return d.test(t)?S(t.slice(4).toLowerCase()):t}))}},void 0===(r=function(){return a}.call(e,s,e,t))||(t.exports=r)}()},5902:t=>{"use strict";var e=String.prototype.replace,s=/%20/g,r="RFC3986";t.exports={default:r,formatters:{RFC1738:function(t){return e.call(t,s,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:r}},3098:(t,e,s)=>{"use strict";var r=s(1207),n=s(969),i=s(5902);t.exports={formats:i,parse:n,stringify:r}},969:(t,e,s)=>{"use strict";var r=s(2795),n=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!0,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},o=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},h=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},l=function(t,e,s,r){if(t){var i=s.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/g,o=s.depth>0&&/(\[[^[\]]*])/.exec(i),l=o?i.slice(0,o.index):i,c=[];if(l){if(!s.plainObjects&&n.call(Object.prototype,l)&&!s.allowPrototypes)return;c.push(l)}for(var u=0;s.depth>0&&null!==(o=a.exec(i))&&u=0;--i){var a,o=t[i];if("[]"===o&&s.parseArrays)a=s.allowEmptyArrays&&""===n?[]:[].concat(n);else{a=s.plainObjects?Object.create(null):{};var l="["===o.charAt(0)&&"]"===o.charAt(o.length-1)?o.slice(1,-1):o,c=s.decodeDotInKeys?l.replace(/%2E/g,"."):l,u=parseInt(c,10);s.parseArrays||""!==c?!isNaN(u)&&o!==c&&String(u)===c&&u>=0&&s.parseArrays&&u<=s.arrayLimit?(a=[])[u]=n:"__proto__"!==c&&(a[c]=n):a={0:n}}n=a}return n}(c,e,s,r)}};t.exports=function(t,e){var s=function(t){if(!t)return a;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?a.charset:t.charset,s=void 0===t.duplicates?a.duplicates:t.duplicates;if("combine"!==s&&"first"!==s&&"last"!==s)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||a.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:a.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:a.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:a.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:a.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:a.decoder,delimiter:"string"==typeof t.delimiter||r.isRegExp(t.delimiter)?t.delimiter:a.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:a.depth,duplicates:s,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:a.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:a.strictNullHandling}}(e);if(""===t||null==t)return s.plainObjects?Object.create(null):{};for(var c="string"==typeof t?function(t,e){var s,l={__proto__:null},c=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,u=e.parameterLimit===1/0?void 0:e.parameterLimit,d=c.split(e.delimiter,u),f=-1,p=e.charset;if(e.charsetSentinel)for(s=0;s-1&&(g=i(g)?[g]:g);var _=n.call(l,m);_&&"combine"===e.duplicates?l[m]=r.combine(l[m],g):_&&"last"!==e.duplicates||(l[m]=g)}return l}(t,s):t,u=s.plainObjects?Object.create(null):{},d=Object.keys(c),f=0;f{"use strict";var r=s(920),n=s(2795),i=s(5902),a=Object.prototype.hasOwnProperty,o={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},h=Array.isArray,l=Array.prototype.push,c=function(t,e){l.apply(t,h(e)?e:[e])},u=Date.prototype.toISOString,d=i.default,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:n.encode,encodeValuesOnly:!1,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(t){return u.call(t)},skipNulls:!1,strictNullHandling:!1},p={},m=function t(e,s,i,a,o,l,u,d,m,g,x,y,b,_,E,w,v,T){for(var A,S=e,I=T,R=0,M=!1;void 0!==(I=I.get(p))&&!M;){var C=I.get(e);if(R+=1,void 0!==C){if(C===R)throw new RangeError("Cyclic object value");M=!0}void 0===I.get(p)&&(R=0)}if("function"==typeof g?S=g(s,S):S instanceof Date?S=b(S):"comma"===i&&h(S)&&(S=n.maybeMap(S,(function(t){return t instanceof Date?b(t):t}))),null===S){if(l)return m&&!w?m(s,f.encoder,v,"key",_):s;S=""}if("string"==typeof(A=S)||"number"==typeof A||"boolean"==typeof A||"symbol"==typeof A||"bigint"==typeof A||n.isBuffer(S))return m?[E(w?s:m(s,f.encoder,v,"key",_))+"="+E(m(S,f.encoder,v,"value",_))]:[E(s)+"="+E(String(S))];var P,k=[];if(void 0===S)return k;if("comma"===i&&h(S))w&&m&&(S=n.maybeMap(S,m)),P=[{value:S.length>0?S.join(",")||null:void 0}];else if(h(g))P=g;else{var D=Object.keys(S);P=x?D.sort(x):D}var F=d?s.replace(/\./g,"%2E"):s,B=a&&h(S)&&1===S.length?F+"[]":F;if(o&&h(S)&&0===S.length)return B+"[]";for(var N=0;N0?_+b:""}},2795:(t,e,s)=>{"use strict";var r=s(5902),n=Object.prototype.hasOwnProperty,i=Array.isArray,a=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),o=function(t,e){for(var s=e&&e.plainObjects?Object.create(null):{},r=0;r1;){var e=t.pop(),s=e.obj[e.prop];if(i(s)){for(var r=[],n=0;n=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||i===r.RFC1738&&(40===c||41===c)?h+=o.charAt(l):c<128?h+=a[c]:c<2048?h+=a[192|c>>6]+a[128|63&c]:c<55296||c>=57344?h+=a[224|c>>12]+a[128|c>>6&63]+a[128|63&c]:(l+=1,c=65536+((1023&c)<<10|1023&o.charCodeAt(l)),h+=a[240|c>>18]+a[128|c>>12&63]+a[128|c>>6&63]+a[128|63&c])}return h},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(i(t)){for(var s=[],r=0;r{"use strict";var r=s(1270);function n(){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 i=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,o=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(h),c=["%","/","?",";","#"].concat(l),u=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=s(3098);function y(t,e,s){if(t&&"object"==typeof t&&t instanceof n)return t;var r=new n;return r.parse(t,e,s),r}n.prototype.parse=function(t,e,s){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),a=-1!==n&&n127?k+="x":k+=P[D];if(!k.match(d)){var B=M.slice(0,S),N=M.slice(S+1),O=P.match(f);O&&(B.push(O[1]),N.unshift(O[2])),N.length&&(y="/"+N.join(".")+y),this.hostname=B.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=r.toASCII(this.hostname));var L=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+L,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!p[E])for(S=0,C=l.length;S0)&&s.host.split("@"))&&(s.auth=R.shift(),s.hostname=R.shift(),s.host=s.hostname)),s.search=t.search,s.query=t.query,null===s.pathname&&null===s.search||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.href=s.format(),s;if(!w.length)return s.pathname=null,s.search?s.path="/"+s.search:s.path=null,s.href=s.format(),s;for(var T=w.slice(-1)[0],A=(s.host||t.host||w.length>1)&&("."===T||".."===T)||""===T,S=0,I=w.length;I>=0;I--)"."===(T=w[I])?w.splice(I,1):".."===T?(w.splice(I,1),S++):S&&(w.splice(I,1),S--);if(!_&&!E)for(;S--;S)w.unshift("..");!_||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),A&&"/"!==w.join("/").substr(-1)&&w.push("");var R,M=""===w[0]||w[0]&&"/"===w[0].charAt(0);return v&&(s.hostname=M?"":w.length?w.shift():"",s.host=s.hostname,(R=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=R.shift(),s.hostname=R.shift(),s.host=s.hostname)),(_=_||s.host&&w.length)&&!M&&w.unshift(""),w.length>0?s.pathname=w.join("/"):(s.pathname=null,s.path=null),null===s.pathname&&null===s.search||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.auth=t.auth||s.auth,s.slashes=s.slashes||t.slashes,s.href=s.format(),s},n.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},e.qg=y,e.hd=function(t,e){return y(t,!1,!0).resolve(e)},e.GP=function(t){return"string"==typeof t&&(t=y(t)),t instanceof n?t.format():n.prototype.format.call(t)}},5265:(t,e,s)=>{"use strict";s.d(e,{wh:()=>r,aG:()=>n,Q1:()=>v,ON:()=>_,cj:()=>A,qU:()=>i,mj:()=>a,bC:()=>P,pw:()=>o,Ff:()=>R,Dr:()=>h,S3:()=>D,bJ:()=>q,eE:()=>E,Lw:()=>g,_C:()=>l,Aq:()=>C,I9:()=>k,W0:()=>F});var r=(t=>(t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping",t))(r||{});class n{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=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){const t=this.readInt(!0);return 0==t?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>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}var i=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(i||{}),a=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(a||{}),o=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(o||{}),h=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(h||{}),l=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(l||{}),c=s(8626);function u(t){switch(t.toLowerCase()){case"nearest":return d.Nearest;case"linear":return d.Linear;case"mipmap":return d.MipMap;case"mipmapnearestnearest":return d.MipMapNearestNearest;case"mipmaplinearnearest":return d.MipMapLinearNearest;case"mipmapnearestlinear":return d.MipMapNearestLinear;case"mipmaplinearlinear":return d.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${t}`)}}var d=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(d||{}),f=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(f||{});class p{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 0!==this.texture.rotate}get degrees(){return(360-45*this.texture.rotate)%360}}class m{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 g{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 t=0;t{i.width=parseInt(n[1]),i.height=parseInt(n[2])},a.format=()=>{},a.filter=()=>{i.minFilter=u(n[1]),i.magFilter=u(n[2])},a.repeat=()=>{-1!=n[1].indexOf("x")&&(i.uWrap=f.Repeat),-1!=n[1].indexOf("y")&&(i.vWrap=f.Repeat)},a.pma=()=>{i.pma="true"==n[1]};const h={xy:()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2])},size:()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},bounds:()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2]),o.width=parseInt(n[3]),o.height=parseInt(n[4])},offset:()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2])},orig:()=>{o.originalWidth=parseInt(n[1]),o.originalHeight=parseInt(n[2])},offsets:()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2]),o.originalWidth=parseInt(n[3]),o.originalHeight=parseInt(n[4])},rotate:()=>{const t=n[1];let e=0;e="true"==t.toLocaleLowerCase()?6:"false"==t.toLocaleLowerCase()?0:(720-parseFloat(t))%360/45,o.rotate=e},index:()=>{o.index=parseInt(n[1])}};let l=r.readLine();for(;null!=l&&0==l.trim().length;)l=r.readLine();for(;null!=l&&0!=l.trim().length&&0!=r.readEntry(n,l);)l=r.readLine();const d=()=>{for(;;){if(null==l)return s&&s(this);if(0==l.trim().length)i=null,l=r.readLine();else{if(null===i){for(i=new y,i.name=l.trim();0!=r.readEntry(n,l=r.readLine());){const t=a[n[0]];t&&t()}this.pages.push(i),e(i.name,(t=>{if(null===t)return this.pages.splice(this.pages.indexOf(i),1),s&&s(null);i.baseTexture=t,i.pma&&(t.alphaMode=c.Gk.PMA),t.valid||t.setSize(i.width,i.height),i.setFilters(),i.width&&i.height||(i.width=t.realWidth,i.height=t.realHeight,i.width&&i.height||console.log(`ERROR spine atlas page ${i.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),d()}));break}{o=new m;const t=new b;t.name=l,t.page=i;let e=null,s=null;for(;;){const t=r.readEntry(n,l=r.readLine());if(0==t)break;const i=h[n[0]];if(i)i();else{null==e&&(e=[],s=[]),e.push(n[0]);const r=[];for(let e=0;e=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(null==e)return 0;if(0==(e=e.trim()).length)return 0;const s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let r=1,n=s+1;;r++){const s=e.indexOf(",",n);if(-1==s)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,s-n).trim(),n=s+1,4==r)return 4}}}class y{constructor(){this.minFilter=d.Nearest,this.magFilter=d.Nearest,this.uWrap=f.ClampToEdge,this.vWrap=f.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==d.Linear?t.scaleMode=c.M6.LINEAR:this.minFilter==d.Nearest?t.scaleMode=c.M6.NEAREST:(t.mipmap=c.E8.POW2,e==d.MipMapNearestNearest?t.scaleMode=c.M6.NEAREST:t.scaleMode=c.M6.LINEAR)}}class b extends p{}class _{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}}class E{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){const e=this.size;for(let e=0,s=t.length;e1&&(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(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}static fromString(t){return(new w).setFromString(t)}};let v=w;v.WHITE=new w(1,1,1,1),v.RED=new w(1,0,0,1),v.GREEN=new w(0,1,0,1),v.BLUE=new w(0,0,1,1),v.MAGENTA=new w(1,0,1,1);const T=class{static clamp(t,e,s){return ts?s:t}static cosDeg(t){return Math.cos(t*T.degRad)}static sinDeg(t){return Math.sin(t*T.degRad)}static signum(t){return Math.sign(t)}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){const e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return T.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){const r=Math.random(),n=e-t;return r<=(s-t)/n?t+Math.sqrt(r*n*(s-t)):e-Math.sqrt((1-r)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}};let A=T;A.PI=3.1415927,A.PI2=2*T.PI,A.radiansToDegrees=180/T.PI,A.radDeg=T.radiansToDegrees,A.degreesToRadians=T.PI/180,A.degRad=T.degreesToRadians;class S{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class I extends S{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class R extends I{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const M=class{static arrayCopy(t,e,s,r,n){for(let i=e,a=r;i=e?t:M.setArraySize(t,e,s)}static newArray(t,e){const s=new Array(t);for(let r=0;r0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;eC.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,a=t.slots,o=a.length;s.length=0,i.freeAll(n),n.length=0;for(let t=0;t=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){const n=this.minX,i=this.minY,a=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=i&&r<=i||t>=a&&s>=a||e>=o&&r>=o)return!1;const h=(r-e)/(s-t);let l=h*(n-t)+e;if(l>i&&li&&ln&&cn&&ct.minX&&this.minYt.minY}containsPoint(t,e){const s=this.polygons;for(let r=0,n=s.length;r=s||o=s){const h=r[t];h+(s-n)/(o-n)*(r[i]-h)=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){const t=(l*m-h*f)/g;if((t>=u&&t<=d||t>=d&&t<=u)&&(t>=s&&t<=n||t>=n&&t<=s))return!0}c=a,u=d}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}const F={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0};var B=s(6141),N=s(668),O=s(7424),L=s(4981);const U=[0,0,0];class V extends N.k{constructor(){super(...arguments),this.region=null,this.attachment=null}}class X extends O.g{constructor(t,e,s,r,n){super(t,e,s,r,n),this.region=null,this.attachment=null}}const Y=class extends B.mc{constructor(t){if(super(),!t)throw new Error("The spineData param is required.");if("string"==typeof t)throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=t,this.createSkeleton(t),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;te&&(t=e),this.state.update(t),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const s=this.skeleton.slots,n=this.color;let i=null,a=null;n?(i=n.light,a=n.dark):i=this.tintRgb;for(let t=0,e=s.length;t{"use strict";s.r(e),s.d(e,{Animation:()=>y,AnimationState:()=>H,AnimationStateAdapter:()=>J,AnimationStateData:()=>et,AtlasAttachmentLoader:()=>st,Attachment:()=>n,AttachmentTimeline:()=>k,Bone:()=>nt,BoneData:()=>it,BoundingBoxAttachment:()=>o,ClippingAttachment:()=>h,ColorTimeline:()=>M,ConstraintData:()=>at,CurveTimeline:()=>E,DeformTimeline:()=>F,DrawOrderTimeline:()=>N,Event:()=>ot,EventData:()=>ht,EventQueue:()=>Z,EventTimeline:()=>B,EventType:()=>K,IkConstraint:()=>lt,IkConstraintData:()=>ct,IkConstraintTimeline:()=>L,JitterEffect:()=>m,MeshAttachment:()=>l,PathAttachment:()=>c,PathConstraint:()=>pt,PathConstraintData:()=>ut,PathConstraintMixTimeline:()=>W,PathConstraintPositionTimeline:()=>Y,PathConstraintSpacingTimeline:()=>q,PointAttachment:()=>u,RegionAttachment:()=>p,RotateTimeline:()=>v,ScaleTimeline:()=>S,ShearTimeline:()=>I,Skeleton:()=>xt,SkeletonBinary:()=>Tt,SkeletonBounds:()=>It,SkeletonData:()=>yt,SkeletonJson:()=>Rt,Skin:()=>wt,SkinEntry:()=>Et,Slot:()=>d,SlotData:()=>bt,SpacingMode:()=>dt,Spine:()=>Ct,SwirlEffect:()=>x,TimelineType:()=>b,TrackEntry:()=>$,TransformConstraint:()=>mt,TransformConstraintData:()=>_t,TransformConstraintTimeline:()=>V,TranslateTimeline:()=>A,TwoColorTimeline:()=>P,VertexAttachment:()=>a});var r=s(5265);class n{constructor(t){if(null==t)throw new Error("name cannot be null.");this.name=t}}const i=class extends n{constructor(t){super(t),this.id=(65535&i.nextID++)<<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,i){s=n+(s>>1)*i;const a=t.bone.skeleton,o=t.deform;let h=this.vertices;const l=this.bones;if(null==l){o.length>0&&(h=o);const a=t.bone.matrix,l=a.tx,c=a.ty,u=a.a,d=a.c,f=a.b,p=a.d;for(let t=e,a=n;a0&&(e%=this.duration));const h=this.timelines;for(let r=0,l=h.length;r>>1;for(;;){if(t[(i+1)*s]<=e?r=i+1:n=i,r==n)return(r+1)*s;i=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}}var b=(t=>(t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor",t))(b||{});const _=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=r.Aq.newFloatArray((t-1)*_.BEZIER_SIZE)}getFrameCount(){return this.curves.length/_.BEZIER_SIZE+1}setLinear(t){this.curves[t*_.BEZIER_SIZE]=_.LINEAR}setStepped(t){this.curves[t*_.BEZIER_SIZE]=_.STEPPED}getCurveType(t){const e=t*_.BEZIER_SIZE;if(e==this.curves.length)return _.LINEAR;const s=this.curves[e];return s==_.LINEAR?_.LINEAR:s==_.STEPPED?_.STEPPED:_.BEZIER}setCurve(t,e,s,r,n){const i=.03*(2*-e+r),a=.03*(2*-s+n),o=.006*(3*(e-r)+1),h=.006*(3*(s-n)+1);let l=2*i+o,c=2*a+h,u=.3*e+i+.16666667*o,d=.3*s+a+.16666667*h,f=t*_.BEZIER_SIZE;const p=this.curves;p[f++]=_.BEZIER;let m=u,g=d;for(let t=f+_.BEZIER_SIZE-1;f=e){let r,i;return n==t?(r=0,i=0):(r=s[n-2],i=s[n-1]),i+(s[n+1]-i)*(e-r)/(a-r)}const o=s[n-1];return o+(1-o)*(e-a)/(1-a)}};let E=_;E.LINEAR=0,E.STEPPED=1,E.BEZIER=2,E.BEZIER_SIZE=19;const w=class extends E{constructor(t){super(t),this.frames=r.Aq.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+w.ROTATION]=s}apply(t,e,s,n,i,a,o){const h=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s=h[h.length-w.ENTRIES]){let t=h[h.length+w.PREV_ROTATION];switch(a){case r.qU.setup:l.rotation=l.data.rotation+t*i;break;case r.qU.first:case r.qU.replace:t+=l.data.rotation-l.rotation,t-=360*(16384-(16384.499999999996-t/360|0));case r.qU.add:l.rotation+=t*i}return}const c=y.binarySearch(h,s,w.ENTRIES),u=h[c+w.PREV_ROTATION],d=h[c],f=this.getCurvePercent((c>>1)-1,1-(s-d)/(h[c+w.PREV_TIME]-d));let p=h[c+w.ROTATION]-u;switch(p=u+(p-360*(16384-(16384.499999999996-p/360|0)))*f,a){case r.qU.setup:l.rotation=l.data.rotation+(p-360*(16384-(16384.499999999996-p/360|0)))*i;break;case r.qU.first:case r.qU.replace:p+=l.data.rotation-l.rotation;case r.qU.add:l.rotation+=(p-360*(16384-(16384.499999999996-p/360|0)))*i}}};let v=w;v.ENTRIES=2,v.PREV_TIME=-2,v.PREV_ROTATION=-1,v.ROTATION=1;const T=class extends E{constructor(t){super(t),this.frames=r.Aq.newFloatArray(t*T.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,r){t*=T.ENTRIES,this.frames[t]=e,this.frames[t+T.X]=s,this.frames[t+T.Y]=r}apply(t,e,s,n,i,a,o){const h=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s=h[h.length-T.ENTRIES])c=h[h.length+T.PREV_X],u=h[h.length+T.PREV_Y];else{const t=y.binarySearch(h,s,T.ENTRIES);c=h[t+T.PREV_X],u=h[t+T.PREV_Y];const e=h[t],r=this.getCurvePercent(t/T.ENTRIES-1,1-(s-e)/(h[t+T.PREV_TIME]-e));c+=(h[t+T.X]-c)*r,u+=(h[t+T.Y]-u)*r}switch(a){case r.qU.setup:l.x=l.data.x+c*i,l.y=l.data.y+u*i;break;case r.qU.first:case r.qU.replace:l.x+=(l.data.x+c-l.x)*i,l.y+=(l.data.y+u-l.y)*i;break;case r.qU.add:l.x+=c*i,l.y+=u*i}}};let A=T;A.ENTRIES=3,A.PREV_TIME=-3,A.PREV_X=-2,A.PREV_Y=-1,A.X=1,A.Y=2;class S extends A{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,n,i,a,o){const h=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s=h[h.length-S.ENTRIES])c=h[h.length+S.PREV_X]*l.data.scaleX,u=h[h.length+S.PREV_Y]*l.data.scaleY;else{const t=y.binarySearch(h,s,S.ENTRIES);c=h[t+S.PREV_X],u=h[t+S.PREV_Y];const e=h[t],r=this.getCurvePercent(t/S.ENTRIES-1,1-(s-e)/(h[t+S.PREV_TIME]-e));c=(c+(h[t+S.X]-c)*r)*l.data.scaleX,u=(u+(h[t+S.Y]-u)*r)*l.data.scaleY}if(1==i)a==r.qU.add?(l.scaleX+=c-l.data.scaleX,l.scaleY+=u-l.data.scaleY):(l.scaleX=c,l.scaleY=u);else{let t=0,e=0;if(o==r.mj.mixOut)switch(a){case r.qU.setup:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(c)*r.cj.signum(t)-t)*i,l.scaleY=e+(Math.abs(u)*r.cj.signum(e)-e)*i;break;case r.qU.first:case r.qU.replace:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(c)*r.cj.signum(t)-t)*i,l.scaleY=e+(Math.abs(u)*r.cj.signum(e)-e)*i;break;case r.qU.add:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(c)*r.cj.signum(t)-l.data.scaleX)*i,l.scaleY=e+(Math.abs(u)*r.cj.signum(e)-l.data.scaleY)*i}else switch(a){case r.qU.setup:t=Math.abs(l.data.scaleX)*r.cj.signum(c),e=Math.abs(l.data.scaleY)*r.cj.signum(u),l.scaleX=t+(c-t)*i,l.scaleY=e+(u-e)*i;break;case r.qU.first:case r.qU.replace:t=Math.abs(l.scaleX)*r.cj.signum(c),e=Math.abs(l.scaleY)*r.cj.signum(u),l.scaleX=t+(c-t)*i,l.scaleY=e+(u-e)*i;break;case r.qU.add:t=r.cj.signum(c),e=r.cj.signum(u),l.scaleX=Math.abs(l.scaleX)*t+(c-Math.abs(l.data.scaleX)*t)*i,l.scaleY=Math.abs(l.scaleY)*e+(u-Math.abs(l.data.scaleY)*e)*i}}}}class I extends A{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,n,i,a,o){const h=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s=h[h.length-I.ENTRIES])c=h[h.length+I.PREV_X],u=h[h.length+I.PREV_Y];else{const t=y.binarySearch(h,s,I.ENTRIES);c=h[t+I.PREV_X],u=h[t+I.PREV_Y];const e=h[t],r=this.getCurvePercent(t/I.ENTRIES-1,1-(s-e)/(h[t+I.PREV_TIME]-e));c+=(h[t+I.X]-c)*r,u+=(h[t+I.Y]-u)*r}switch(a){case r.qU.setup:l.shearX=l.data.shearX+c*i,l.shearY=l.data.shearY+u*i;break;case r.qU.first:case r.qU.replace:l.shearX+=(l.data.shearX+c-l.shearX)*i,l.shearY+=(l.data.shearY+u-l.shearY)*i;break;case r.qU.add:l.shearX+=c*i,l.shearY+=u*i}}}const R=class extends E{constructor(t){super(t),this.frames=r.Aq.newFloatArray(t*R.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,r,n,i){t*=R.ENTRIES,this.frames[t]=e,this.frames[t+R.R]=s,this.frames[t+R.G]=r,this.frames[t+R.B]=n,this.frames[t+R.A]=i}apply(t,e,s,n,i,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;const l=this.frames;if(s=l[l.length-R.ENTRIES]){const t=l.length;c=l[t+R.PREV_R],u=l[t+R.PREV_G],d=l[t+R.PREV_B],f=l[t+R.PREV_A]}else{const t=y.binarySearch(l,s,R.ENTRIES);c=l[t+R.PREV_R],u=l[t+R.PREV_G],d=l[t+R.PREV_B],f=l[t+R.PREV_A];const e=l[t],r=this.getCurvePercent(t/R.ENTRIES-1,1-(s-e)/(l[t+R.PREV_TIME]-e));c+=(l[t+R.R]-c)*r,u+=(l[t+R.G]-u)*r,d+=(l[t+R.B]-d)*r,f+=(l[t+R.A]-f)*r}if(1==i)h.color.set(c,u,d,f);else{const t=h.color;a==r.qU.setup&&t.setFromColor(h.data.color),t.add((c-t.r)*i,(u-t.g)*i,(d-t.b)*i,(f-t.a)*i)}}};let M=R;M.ENTRIES=5,M.PREV_TIME=-5,M.PREV_R=-4,M.PREV_G=-3,M.PREV_B=-2,M.PREV_A=-1,M.R=1,M.G=2,M.B=3,M.A=4;const C=class extends E{constructor(t){super(t),this.frames=r.Aq.newFloatArray(t*C.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,r,n,i,a,o,h){t*=C.ENTRIES,this.frames[t]=e,this.frames[t+C.R]=s,this.frames[t+C.G]=r,this.frames[t+C.B]=n,this.frames[t+C.A]=i,this.frames[t+C.R2]=a,this.frames[t+C.G2]=o,this.frames[t+C.B2]=h}apply(t,e,s,n,i,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;const l=this.frames;if(s=l[l.length-C.ENTRIES]){const t=l.length;c=l[t+C.PREV_R],u=l[t+C.PREV_G],d=l[t+C.PREV_B],f=l[t+C.PREV_A],p=l[t+C.PREV_R2],m=l[t+C.PREV_G2],g=l[t+C.PREV_B2]}else{const t=y.binarySearch(l,s,C.ENTRIES);c=l[t+C.PREV_R],u=l[t+C.PREV_G],d=l[t+C.PREV_B],f=l[t+C.PREV_A],p=l[t+C.PREV_R2],m=l[t+C.PREV_G2],g=l[t+C.PREV_B2];const e=l[t],r=this.getCurvePercent(t/C.ENTRIES-1,1-(s-e)/(l[t+C.PREV_TIME]-e));c+=(l[t+C.R]-c)*r,u+=(l[t+C.G]-u)*r,d+=(l[t+C.B]-d)*r,f+=(l[t+C.A]-f)*r,p+=(l[t+C.R2]-p)*r,m+=(l[t+C.G2]-m)*r,g+=(l[t+C.B2]-g)*r}if(1==i)h.color.set(c,u,d,f),h.darkColor.set(p,m,g,1);else{const t=h.color,e=h.darkColor;a==r.qU.setup&&(t.setFromColor(h.data.color),e.setFromColor(h.data.darkColor)),t.add((c-t.r)*i,(u-t.g)*i,(d-t.b)*i,(f-t.a)*i),e.add((p-e.r)*i,(m-e.g)*i,(g-e.b)*i,0)}}};let P=C;P.ENTRIES=8,P.PREV_TIME=-8,P.PREV_R=-7,P.PREV_G=-6,P.PREV_B=-5,P.PREV_A=-4,P.PREV_R2=-3,P.PREV_G2=-2,P.PREV_B2=-1,P.R=1,P.G=2,P.B=3,P.A=4,P.R2=5,P.G2=6,P.B2=7;class k{constructor(t){this.frames=r.Aq.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,n,i,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;if(o==r.mj.mixOut)return void(a==r.qU.setup&&this.setAttachment(t,h,h.data.attachmentName));const l=this.frames;if(s=l[l.length-1]?l.length-1:y.binarySearch(l,s,1)-1;const u=this.attachmentNames[c];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}setAttachment(t,e,s){e.setAttachment(null==s?null:t.getAttachment(this.slotIndex,s))}}let D=null;class F extends E{constructor(t){super(t),this.frames=r.Aq.newFloatArray(t),this.frameVertices=new Array(t),null==D&&(D=r.Aq.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,n,i,o,h){const l=t.slots[this.slotIndex];if(!l.bone.active)return;const c=l.getAttachment();if(!(c instanceof a)||c.deformAttachment!=this.attachment)return;const u=l.deform;0==u.length&&(o=r.qU.setup);const d=this.frameVertices,f=d[0].length,p=this.frames;if(s=p[p.length-1]){const t=d[p.length-1];if(1==i)if(o==r.qU.add){const e=c;if(null==e.bones){const s=e.vertices;for(let e=0;es)this.apply(t,e,Number.MAX_VALUE,r,n,i,a),e=-1;else if(e>=o[h-1])return;if(s0&&o[l-1]==t;)l--}for(;l=o[l];l++)r.push(this.events[l])}}class N{constructor(t){this.frames=r.Aq.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,n,i,a,o){const h=t.drawOrder,l=t.slots;if(o==r.mj.mixOut&&a==r.qU.setup)return void r.Aq.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);const c=this.frames;if(s=c[c.length-1]?c.length-1:y.binarySearch(c,s)-1;const d=this.drawOrders[u];if(null==d)r.Aq.arrayCopy(l,0,h,0,l.length);else for(let t=0,e=d.length;t=h[h.length-O.ENTRIES])return void(a==r.qU.setup?(l.mix=l.data.mix+(h[h.length+O.PREV_MIX]-l.data.mix)*i,l.softness=l.data.softness+(h[h.length+O.PREV_SOFTNESS]-l.data.softness)*i,o==r.mj.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[h.length+O.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+O.PREV_COMPRESS],l.stretch=0!=h[h.length+O.PREV_STRETCH])):(l.mix+=(h[h.length+O.PREV_MIX]-l.mix)*i,l.softness+=(h[h.length+O.PREV_SOFTNESS]-l.softness)*i,o==r.mj.mixIn&&(l.bendDirection=h[h.length+O.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+O.PREV_COMPRESS],l.stretch=0!=h[h.length+O.PREV_STRETCH])));const c=y.binarySearch(h,s,O.ENTRIES),u=h[c+O.PREV_MIX],d=h[c+O.PREV_SOFTNESS],f=h[c],p=this.getCurvePercent(c/O.ENTRIES-1,1-(s-f)/(h[c+O.PREV_TIME]-f));a==r.qU.setup?(l.mix=l.data.mix+(u+(h[c+O.MIX]-u)*p-l.data.mix)*i,l.softness=l.data.softness+(d+(h[c+O.SOFTNESS]-d)*p-l.data.softness)*i,o==r.mj.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[c+O.PREV_BEND_DIRECTION],l.compress=0!=h[c+O.PREV_COMPRESS],l.stretch=0!=h[c+O.PREV_STRETCH])):(l.mix+=(u+(h[c+O.MIX]-u)*p-l.mix)*i,l.softness+=(d+(h[c+O.SOFTNESS]-d)*p-l.softness)*i,o==r.mj.mixIn&&(l.bendDirection=h[c+O.PREV_BEND_DIRECTION],l.compress=0!=h[c+O.PREV_COMPRESS],l.stretch=0!=h[c+O.PREV_STRETCH]))}};let L=O;L.ENTRIES=6,L.PREV_TIME=-6,L.PREV_MIX=-5,L.PREV_SOFTNESS=-4,L.PREV_BEND_DIRECTION=-3,L.PREV_COMPRESS=-2,L.PREV_STRETCH=-1,L.MIX=1,L.SOFTNESS=2,L.BEND_DIRECTION=3,L.COMPRESS=4,L.STRETCH=5;const U=class extends E{constructor(t){super(t),this.frames=r.Aq.newFloatArray(t*U.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,i){t*=U.ENTRIES,this.frames[t]=e,this.frames[t+U.ROTATE]=s,this.frames[t+U.TRANSLATE]=r,this.frames[t+U.SCALE]=n,this.frames[t+U.SHEAR]=i}apply(t,e,s,n,i,a,o){const h=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s=h[h.length-U.ENTRIES]){const t=h.length;c=h[t+U.PREV_ROTATE],u=h[t+U.PREV_TRANSLATE],d=h[t+U.PREV_SCALE],f=h[t+U.PREV_SHEAR]}else{const t=y.binarySearch(h,s,U.ENTRIES);c=h[t+U.PREV_ROTATE],u=h[t+U.PREV_TRANSLATE],d=h[t+U.PREV_SCALE],f=h[t+U.PREV_SHEAR];const e=h[t],r=this.getCurvePercent(t/U.ENTRIES-1,1-(s-e)/(h[t+U.PREV_TIME]-e));c+=(h[t+U.ROTATE]-c)*r,u+=(h[t+U.TRANSLATE]-u)*r,d+=(h[t+U.SCALE]-d)*r,f+=(h[t+U.SHEAR]-f)*r}if(a==r.qU.setup){const t=l.data;l.rotateMix=t.rotateMix+(c-t.rotateMix)*i,l.translateMix=t.translateMix+(u-t.translateMix)*i,l.scaleMix=t.scaleMix+(d-t.scaleMix)*i,l.shearMix=t.shearMix+(f-t.shearMix)*i}else l.rotateMix+=(c-l.rotateMix)*i,l.translateMix+=(u-l.translateMix)*i,l.scaleMix+=(d-l.scaleMix)*i,l.shearMix+=(f-l.shearMix)*i}};let V=U;V.ENTRIES=5,V.PREV_TIME=-5,V.PREV_ROTATE=-4,V.PREV_TRANSLATE=-3,V.PREV_SCALE=-2,V.PREV_SHEAR=-1,V.ROTATE=1,V.TRANSLATE=2,V.SCALE=3,V.SHEAR=4;const X=class extends E{constructor(t){super(t),this.frames=r.Aq.newFloatArray(t*X.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=X.ENTRIES,this.frames[t]=e,this.frames[t+X.VALUE]=s}apply(t,e,s,n,i,a,o){const h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s=h[h.length-X.ENTRIES])c=h[h.length+X.PREV_VALUE];else{const t=y.binarySearch(h,s,X.ENTRIES);c=h[t+X.PREV_VALUE];const e=h[t],r=this.getCurvePercent(t/X.ENTRIES-1,1-(s-e)/(h[t+X.PREV_TIME]-e));c+=(h[t+X.VALUE]-c)*r}a==r.qU.setup?l.position=l.data.position+(c-l.data.position)*i:l.position+=(c-l.position)*i}};let Y=X;Y.ENTRIES=2,Y.PREV_TIME=-2,Y.PREV_VALUE=-1,Y.VALUE=1;class q extends Y{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,n,i,a,o){const h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s=h[h.length-q.ENTRIES])c=h[h.length+q.PREV_VALUE];else{const t=y.binarySearch(h,s,q.ENTRIES);c=h[t+q.PREV_VALUE];const e=h[t],r=this.getCurvePercent(t/q.ENTRIES-1,1-(s-e)/(h[t+q.PREV_TIME]-e));c+=(h[t+q.VALUE]-c)*r}a==r.qU.setup?l.spacing=l.data.spacing+(c-l.data.spacing)*i:l.spacing+=(c-l.spacing)*i}}const j=class extends E{constructor(t){super(t),this.frames=r.Aq.newFloatArray(t*j.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,r){t*=j.ENTRIES,this.frames[t]=e,this.frames[t+j.ROTATE]=s,this.frames[t+j.TRANSLATE]=r}apply(t,e,s,n,i,a,o){const h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s=h[h.length-j.ENTRIES])c=h[h.length+j.PREV_ROTATE],u=h[h.length+j.PREV_TRANSLATE];else{const t=y.binarySearch(h,s,j.ENTRIES);c=h[t+j.PREV_ROTATE],u=h[t+j.PREV_TRANSLATE];const e=h[t],r=this.getCurvePercent(t/j.ENTRIES-1,1-(s-e)/(h[t+j.PREV_TIME]-e));c+=(h[t+j.ROTATE]-c)*r,u+=(h[t+j.TRANSLATE]-u)*r}a==r.qU.setup?(l.rotateMix=l.data.rotateMix+(c-l.data.rotateMix)*i,l.translateMix=l.data.translateMix+(u-l.data.translateMix)*i):(l.rotateMix+=(c-l.rotateMix)*i,l.translateMix+=(u-l.translateMix)*i)}};let W=j;W.ENTRIES=3,W.PREV_TIME=-3,W.PREV_ROTATE=-2,W.PREV_TRANSLATE=-1,W.ROTATE=1,W.TRANSLATE=2;const G=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Z(this),this.propertyIDs=new r.ON,this.animationsChanged=!1,this.trackEntryPool=new r.bC((()=>new $)),this.data=t}update(t){t*=this.timeScale;const e=this.tracks;for(let s=0,r=e.length;s0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let i=r.next;if(null!=i){const e=r.trackLast-i.delay;if(e>=0){for(i.delay=0,i.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*i.timeScale,r.trackTime+=n,this.setCurrent(s,i,!0);null!=i.mixingFrom;)i.mixTime+=t,i=i.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&null==r.mixingFrom){e[s]=null,this.queue.end(r),this.disposeNext(r);continue}if(null!=r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,null!=t&&(t.mixingTo=null);null!=t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){const s=t.mixingFrom;if(null==s)return!0;const r=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(null==t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const e=this.events,s=this.tracks;let n=!1;for(let i=0,a=s.length;i0)continue;n=!0;const o=0==i?r.qU.first:a.mixBlend;let h=a.alpha;null!=a.mixingFrom?h*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&null==a.next&&(h=0);const l=a.animationLast,c=a.getAnimationTime(),u=a.animation.timelines.length,d=a.animation.timelines;if(0==i&&1==h||o==r.qU.add)for(let s=0;s1&&(i=1),s!=r.qU.first&&(s=n.mixBlend));const a=i0&&this.queueEvents(n,c),this.events.length=0,n.nextAnimationLast=c,n.nextTrackLast=n.trackTime,i}applyAttachmentTimeline(t,e,s,n,i){const a=e.slots[t.slotIndex];if(!a.bone.active)return;const o=t.frames;if(s=o[o.length-1]?o.length-1:y.binarySearch(o,s)-1,this.setAttachment(e,a,t.attachmentNames[r],i)}a.attachmentState<=this.unkeyedState&&(a.attachmentState=this.unkeyedState+G.SETUP)}setAttachment(t,e,s,r){e.setAttachment(null==s?null:t.getAttachment(e.data.index,s)),r&&(e.attachmentState=this.unkeyedState+G.CURRENT)}applyRotateTimeline(t,e,s,n,i,a,o,h){if(h&&(a[o]=0),1==n)return void t.apply(e,0,s,null,1,i,r.mj.mixIn);const l=t,c=l.frames,u=e.bones[l.boneIndex];if(!u.active)return;let d=0,f=0;if(s=c[c.length-v.ENTRIES])f=u.data.rotation+c[c.length+v.PREV_ROTATION];else{const t=y.binarySearch(c,s,v.ENTRIES),e=c[t+v.PREV_ROTATION],r=c[t],n=l.getCurvePercent((t>>1)-1,1-(s-r)/(c[t+v.PREV_TIME]-r));f=c[t+v.ROTATION]-e,f-=360*(16384-(16384.499999999996-f/360|0)),f=e+f*n+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}let p=0,m=f-d;if(m-=360*(16384-(16384.499999999996-m/360|0)),0==m)p=a[o];else{let t=0,e=0;h?(t=0,e=m):(t=a[o],e=a[o+1]);const s=m>0;let n=t>=0;r.cj.signum(e)!=r.cj.signum(m)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*r.cj.signum(t)),n=s),p=m+t-t%360,n!=s&&(p+=360*r.cj.signum(t)),a[o]=p}a[o+1]=m,d+=p*n,u.rotation=d-360*(16384-(16384.499999999996-d/360|0))}queueEvents(t,e){const s=t.animationStart,r=t.animationEnd,n=r-s,i=t.trackLast%n,a=this.events;let o=0;const h=a.length;for(;or||this.queue.event(t,e)}let l=!1;for(l=t.loop?0==n||i>t.trackTime%n:e>=r&&t.animationLast=this.tracks.length)return;const e=this.tracks[t];if(null==e)return;this.queue.end(e),this.disposeNext(e);let s=e;for(;;){const t=s.mixingFrom;if(null==t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){const r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s){const r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s){if(null==e)throw new Error("animation cannot be null.");let r=!0,n=this.expandToIndex(t);null!=n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.disposeNext(n),n=n.mixingFrom,r=!1):this.disposeNext(n));const i=this.trackEntry(t,e,s,n);return this.setCurrent(t,i,r),this.queue.drain(),i}addAnimation(t,e,s,r){const n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,n,s,r)}addAnimationWith(t,e,s,r){if(null==e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(null!=n)for(;null!=n.next;)n=n.next;const i=this.trackEntry(t,e,s,n);if(null==n)this.setCurrent(t,i,!0),this.queue.drain();else if(n.next=i,r<=0){const t=n.animationEnd-n.animationStart;0!=t?(n.loop?r+=t*(1+(n.trackTime/t|0)):r+=Math.max(t,n.trackTime),r-=this.data.getMix(n.animation,e)):r=n.trackTime}return i.delay=r,i}setEmptyAnimation(t,e){const s=this.setAnimationWith(t,G.emptyAnimation,!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e,s){s<=0&&(s-=e);const r=this.addAnimationWith(t,G.emptyAnimation,!1,s);return r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e0){i[r]=G.HOLD_MIX,a[r]=s;continue t}break}i[r]=G.HOLD_FIRST}else i[r]=G.SUBSEQUENT}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(t,e,s){G.deprecatedWarning1||(G.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,s)}addAnimationByName(t,e,s,r){G.deprecatedWarning2||(G.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,s,r)}hasAnimation(t){return null!==this.data.skeletonData.findAnimation(t)}hasAnimationByName(t){return G.deprecatedWarning3||(G.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let H=G;H.emptyAnimation=new y("",[],0),H.SUBSEQUENT=0,H.FIRST=1,H.HOLD_SUBSEQUENT=2,H.HOLD_FIRST=3,H.HOLD_MIX=4,H.SETUP=1,H.CURRENT=2,H.deprecatedWarning1=!1,H.deprecatedWarning2=!1,H.deprecatedWarning3=!1;const z=class{constructor(){this.mixBlend=r.qU.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 t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return z.deprecatedWarning1||(z.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){z.deprecatedWarning1||(z.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return z.deprecatedWarning2||(z.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){z.deprecatedWarning2||(z.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let $=z;$.deprecatedWarning1=!1,$.deprecatedWarning2=!1;const Q=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(K.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(K.interrupt),this.objects.push(t)}end(t){this.objects.push(K.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(K.dispose),this.objects.push(t)}complete(t){this.objects.push(K.complete),this.objects.push(t)}event(t,e){this.objects.push(K.event),this.objects.push(t),this.objects.push(e)}deprecateStuff(){return Q.deprecatedWarning1||(Q.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 t=this.objects,e=this.animState.listeners;for(let s=0;s(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(K||{});class J{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const tt=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){const r=this.skeletonData.findAnimation(t);if(null==r)throw new Error(`Animation not found: ${t}`);const n=this.skeletonData.findAnimation(e);if(null==n)throw new Error(`Animation not found: ${e}`);this.setMixWith(r,n,s)}setMixByName(t,e,s){tt.deprecatedWarning1||(tt.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(t,e,s)}setMixWith(t,e,s){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");const r=`${t.name}.${e.name}`;this.animationToMixTime[r]=s}getMix(t,e){const s=`${t.name}.${e.name}`,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}};let et=tt;et.deprecatedWarning1=!1;class st{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(null==r)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new p(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(null==r)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new l(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new o(e)}newPathAttachment(t,e){return new c(e)}newPointAttachment(t,e){return new u(e)}newClippingAttachment(t,e){return new h(e)}}var rt=s(8626);class nt{constructor(t,e,s){if(this.matrix=new rt.uq,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,null==t)throw new Error("data cannot be null.");if(null==e)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,n,i,a,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=n,this.ascaleY=i,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;const h=this.parent,l=this.matrix,c=this.skeleton.scaleX,u=r.W0.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(null==h){const h=this.skeleton,d=s+90+o;return l.a=r.cj.cosDeg(s+a)*n*c,l.c=r.cj.cosDeg(d)*i*c,l.b=r.cj.sinDeg(s+a)*n*u,l.d=r.cj.sinDeg(d)*i*u,l.tx=t*c+h.x,void(l.ty=e*u+h.y)}let d=h.matrix.a,f=h.matrix.c,p=h.matrix.b,m=h.matrix.d;switch(l.tx=d*t+f*e+h.matrix.tx,l.ty=p*t+m*e+h.matrix.ty,this.data.transformMode){case r._C.Normal:{const t=s+90+o,e=r.cj.cosDeg(s+a)*n,h=r.cj.cosDeg(t)*i,c=r.cj.sinDeg(s+a)*n,u=r.cj.sinDeg(t)*i;return l.a=d*e+f*c,l.c=d*h+f*u,l.b=p*e+m*c,void(l.d=p*h+m*u)}case r._C.OnlyTranslation:{const t=s+90+o;l.a=r.cj.cosDeg(s+a)*n,l.c=r.cj.cosDeg(t)*i,l.b=r.cj.sinDeg(s+a)*n,l.d=r.cj.sinDeg(t)*i;break}case r._C.NoRotationOrReflection:{let t=d*d+p*p,e=0;t>1e-4?(t=Math.abs(d*m-f*p)/t,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*t,m=d*t,e=Math.atan2(p,d)*r.cj.radDeg):(d=0,p=0,e=90-Math.atan2(m,f)*r.cj.radDeg);const h=s+a-e,c=s+o-e+90,u=r.cj.cosDeg(h)*n,g=r.cj.cosDeg(c)*i,x=r.cj.sinDeg(h)*n,y=r.cj.sinDeg(c)*i;l.a=d*u-f*x,l.c=d*g-f*y,l.b=p*u+m*x,l.d=p*g+m*y;break}case r._C.NoScale:case r._C.NoScaleOrReflection:{const t=r.cj.cosDeg(s),e=r.cj.sinDeg(s);let h=(d*t+f*e)/c,g=(p*t+m*e)/u,x=Math.sqrt(h*h+g*g);x>1e-5&&(x=1/x),h*=x,g*=x,x=Math.sqrt(h*h+g*g),this.data.transformMode==r._C.NoScale&&d*m-f*p<0!=(r.W0.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);const y=Math.PI/2+Math.atan2(g,h),b=Math.cos(y)*x,_=Math.sin(y)*x,E=r.cj.cosDeg(a)*n,w=r.cj.cosDeg(90+o)*i,v=r.cj.sinDeg(a)*n,T=r.cj.sinDeg(90+o)*i;l.a=h*E+b*v,l.c=h*w+b*T,l.b=g*E+_*v,l.d=g*w+_*T;break}}l.a*=c,l.c*=c,l.b*=u,l.d*=u}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)*r.cj.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*r.cj.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(null==t)return this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*r.cj.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,void(this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*r.cj.radDeg);const s=t.matrix,n=1/(s.a*s.d-s.b*s.c),i=e.tx-s.tx,a=e.ty-s.ty;this.ax=i*s.d*n-a*s.c*n,this.ay=a*s.a*n-i*s.b*n;const o=n*s.d,h=n*s.a,l=n*s.c,c=n*s.b,u=o*e.a-l*e.b,d=o*e.c-l*e.d,f=h*e.b-c*e.a,p=h*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){const t=u*p-d*f;this.ascaleY=t/this.ascaleX,this.ashearY=Math.atan2(u*d+f*p,t)*r.cj.radDeg,this.arotation=Math.atan2(f,u)*r.cj.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*r.cj.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,i=e.d,a=1/(s*i-r*n),o=t.x-e.tx,h=t.y-e.ty;return t.x=o*i*a-h*r*a,t.y=h*s*a-o*n*a,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=r.cj.sinDeg(t),s=r.cj.cosDeg(t),n=this.matrix;return Math.atan2(n.a*e-n.b*s,n.d*s-n.c*e)*r.cj.radDeg}localToWorldRotation(t){const e=r.cj.sinDeg(t),s=r.cj.cosDeg(t),n=this.matrix;return Math.atan2(s*n.b+e*n.d,s*n.a+e*n.c)*r.cj.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,n=e.c,i=e.b,a=e.d,o=r.cj.cosDeg(t),h=r.cj.sinDeg(t);e.a=o*s-h*i,e.c=o*n-h*a,e.b=h*s+o*i,e.d=h*n+o*a,this.appliedValid=!1}}class it{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=r._C.Normal,this.skinRequired=!1,this.color=new r.Q1,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class at{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class ot{constructor(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class ht{constructor(t){this.name=t}}class lt{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)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;s180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,x=t.ascaleY;if(n||i){switch(t.data.transformMode){case r._C.NoScale:case r._C.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const h=t.data.length*g,l=Math.sqrt(p*p+m*m);if(n&&lh&&h>1e-4){const t=(l/h-1)*o+1;g*=t,a&&(x*=t)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,g,x,t.ashearX,t.ashearY)}apply2(t,e,s,n,i,a,o,h){if(0==h)return void e.updateWorldTransform();t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,c=t.ay;let u=t.ascaleX,d=u,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,x=0,y=0;u<0?(u=-u,g=180,y=-1):(g=0,y=1),f<0&&(f=-f,y=-y),p<0?(p=-p,x=180):x=0;const b=e.ax;let _=0,E=0,w=0,v=m.a,T=m.c,A=m.b,S=m.d;const I=Math.abs(u-f)<=1e-4;I?(_=e.ay,E=v*b+T*_+m.tx,w=A*b+S*_+m.ty):(_=0,E=v*b+m.tx,w=A*b+m.ty);const R=t.parent.matrix;v=R.a,T=R.c,A=R.b,S=R.d;const M=1/(v*S-T*A);let C=E-R.tx,P=w-R.ty;const k=(C*S-P*T)*M-l,D=(P*v-C*A)*M-c,F=Math.sqrt(k*k+D*D);let B,N,O=e.data.length*p;if(F<1e-4)return this.apply1(t,s,n,!1,a,!1,h),void e.updateWorldTransformWith(b,_,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);C=s-R.tx,P=n-R.ty;let L=(C*S-P*T)*M-l,U=(P*v-C*A)*M-c,V=L*L+U*U;if(0!=o){o*=u*(p+1)/2;const t=Math.sqrt(V),e=t-F-O*u+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,L-=s*L,U-=s*U,V=L*L+U*U}}t:if(I){O*=u;let t=(V-F*F-O*O)/(2*F*O);t<-1?t=-1:t>1&&(t=1,a&&(d*=(Math.sqrt(V)/(F+O)-1)*h+1)),N=Math.acos(t)*i,v=F+O*t,T=O*Math.sin(N),B=Math.atan2(U*v-L*T,L*v+U*T)}else{v=u*O,T=f*O;const t=v*v,e=T*T,s=Math.atan2(U,L);A=e*F*F+t*V-t*e;const n=-2*e*F,a=e-t;if(S=n*n-4*a*A,S>=0){let t=Math.sqrt(S);n<0&&(t=-t),t=-(n+t)/2;const e=t/a,r=A/t,o=Math.abs(e)=-1&&A<=1&&(A=Math.acos(A),C=v*Math.cos(A)+F,P=T*Math.sin(A),S=C*C+P*P,Sm&&(d=A,m=S,p=C,g=P)),V<=(l+m)/2?(B=s-Math.atan2(c*i,h),N=o*i):(B=s-Math.atan2(g*i,p),N=d*i)}const X=Math.atan2(_,b)*y;let Y=t.arotation;B=(B-X)*r.cj.radDeg+g-Y,B>180?B-=360:B<-180&&(B+=360),t.updateWorldTransformWith(l,c,Y+B*h,d,t.ascaleY,0,0),Y=e.arotation,N=((N+X)*r.cj.radDeg-e.ashearX)*y+x-Y,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(b,_,Y+N*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class ct extends at{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}}class ut extends at{constructor(t){super(t,0,!1),this.bones=new Array}}var dt=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t))(dt||{});const ft=class{constructor(t,e){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,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,r=t.bones.length;s0;if(!(s>0||n))return;const i=this.data,a=i.spacingMode,o=a==dt.Length,h=i.rotateMode,l=h==r.Dr.Tangent,u=h==r.Dr.ChainScale,d=this.bones.length,f=l?d:d+1,p=this.bones,m=r.Aq.setArraySize(this.spaces,f);let g=null;const x=this.spacing;if(u||o){u&&(g=r.Aq.setArraySize(this.lengths,d));for(let t=0,e=f-1;t0?r.cj.degRad:-r.cj.degRad}for(let t=0,i=3;tr.cj.PI?u-=r.cj.PI2:u<-r.cj.PI&&(u+=r.cj.PI2),u*=e,p=Math.cos(u),g=Math.sin(u),o.a=p*s-g*h,o.c=p*n-g*c,o.b=g*s+p*h,o.d=g*n+p*c}a.appliedValid=!1}}computeWorldPositions(t,e,s,n,i){const a=this.target;let o=this.position;const h=this.spaces,l=r.Aq.setArraySize(this.positions,3*e+2);let c=null;const u=t.closed;let d=t.worldVerticesLength,f=d/6,p=ft.NONE;if(!t.constantSpeed){const m=t.lengths;f-=u?1:2;const g=m[f];if(n&&(o*=g),i)for(let t=0;tg){p!=ft.AFTER&&(p=ft.AFTER,t.computeWorldVertices(a,d-6,4,c,0,2)),this.addAfterPosition(x-g,c,0,l,n);continue}}for(;;i++){const t=m[i];if(!(x>t)){if(0==i)x/=t;else{const e=m[i-1];x=(x-e)/(t-e)}break}}i!=p&&(p=i,u&&i==f?(t.computeWorldVertices(a,d-4,4,c,0,2),t.computeWorldVertices(a,0,4,c,4,2)):t.computeWorldVertices(a,6*i+2,8,c,0,2)),this.addCurvePosition(x,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],l,n,s||r>0&&0==e)}return l}u?(d+=2,c=r.Aq.setArraySize(this.world,d),t.computeWorldVertices(a,2,d-4,c,0,2),t.computeWorldVertices(a,0,2,c,d-4,2),c[d-2]=c[0],c[d-1]=c[1]):(f--,d-=4,c=r.Aq.setArraySize(this.world,d),t.computeWorldVertices(a,2,d,c,0,2));const m=r.Aq.setArraySize(this.curves,f);let g=0,x=c[0],y=c[1],b=0,_=0,E=0,w=0,v=0,T=0,A=0,S=0,I=0,R=0,M=0,C=0,P=0,k=0;for(let t=0,e=2;tg){this.addAfterPosition(a-g,c,d-4,l,r);continue}}for(;;n++){const t=m[n];if(!(a>t)){if(0==n)a/=t;else{const e=m[n-1];a=(a-e)/(t-e)}break}}if(n!=p){p=n;let t=6*n;for(x=c[t],y=c[t+1],b=c[t+2],_=c[t+3],E=c[t+4],w=c[t+5],v=c[t+6],T=c[t+7],A=.03*(x-2*b+E),S=.03*(y-2*_+w),I=.006*(3*(b-E)-x+v),R=.006*(3*(_-w)-y+T),M=2*A+I,C=2*S+R,P=.3*(b-x)+A+.16666667*I,k=.3*(_-y)+S+.16666667*R,F=Math.sqrt(P*P+k*k),D[0]=F,t=1;t<8;t++)P+=M,k+=C,M+=I,C+=R,F+=Math.sqrt(P*P+k*k),D[t]=F;P+=M,k+=C,F+=Math.sqrt(P*P+k*k),D[8]=F,P+=M+I,k+=C+R,F+=Math.sqrt(P*P+k*k),D[9]=F,i=0}for(a*=F;;i++){const t=D[i];if(!(a>t)){if(0==i)a/=t;else{const e=D[i-1];a=i+(a-e)/(t-e)}break}}this.addCurvePosition(.1*a,x,y,b,_,E,w,v,T,l,r,s||t>0&&0==e)}return l}addBeforePosition(t,e,s,r,n){const i=e[s],a=e[s+1],o=e[s+2]-i,h=e[s+3]-a,l=Math.atan2(h,o);r[n]=i+t*Math.cos(l),r[n+1]=a+t*Math.sin(l),r[n+2]=l}addAfterPosition(t,e,s,r,n){const i=e[s+2],a=e[s+3],o=i-e[s],h=a-e[s+1],l=Math.atan2(h,o);r[n]=i+t*Math.cos(l),r[n+1]=a+t*Math.sin(l),r[n+2]=l}addCurvePosition(t,e,s,r,n,i,a,o,h,l,c,u){(0==t||isNaN(t))&&(t=1e-4);const d=t*t,f=d*t,p=1-t,m=p*p,g=m*p,x=p*t,y=3*x,b=p*y,_=y*t,E=e*g+r*b+i*_+o*f,w=s*g+n*b+a*_+h*f;l[c]=E,l[c+1]=w,u&&(l[c+2]=Math.atan2(w-(s*m+n*x*2+a*d),E-(e*m+r*x*2+i*d)))}};let pt=ft;pt.NONE=-1,pt.BEFORE=-2,pt.AFTER=-3,pt.epsilon=1e-5;class mt{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new r.I9,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)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;s0?r.cj.degRad:-r.cj.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let a=0,u=p.length;ar.cj.PI?a-=r.cj.PI2:a<-r.cj.PI&&(a+=r.cj.PI2),a*=t;const h=Math.cos(a),c=Math.sin(a);g.a=h*e-c*n,g.c=h*s-c*i,g.b=c*e+h*n,g.d=c*s+h*i,m=!0}if(0!=e){const t=this.temp;i.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.tx+=(t.x-g.tx)*e,g.ty+=(t.y-g.ty)*e,m=!0}if(s>0){let t=Math.sqrt(g.a*g.a+g.b*g.b),e=Math.sqrt(o*o+l*l);t>1e-5&&(t=(t+(e-t+this.data.offsetScaleX)*s)/t),g.a*=t,g.b*=t,t=Math.sqrt(g.c*g.c+g.d*g.d),e=Math.sqrt(h*h+c*c),t>1e-5&&(t=(t+(e-t+this.data.offsetScaleY)*s)/t),g.c*=t,g.d*=t,m=!0}if(n>0){const t=g.c,e=g.d,s=Math.atan2(e,t);let i=Math.atan2(c,h)-Math.atan2(l,o)-(s-Math.atan2(g.b,g.a));i>r.cj.PI?i-=r.cj.PI2:i<-r.cj.PI&&(i+=r.cj.PI2),i=s+(i+f)*n;const a=Math.sqrt(t*t+e*e);g.c=Math.cos(i)*a,g.d=Math.sin(i)*a,m=!0}m&&(u.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,n=this.shearMix,i=this.target,a=i.matrix,o=a.a,h=a.c,l=a.b,c=a.d,u=o*c-h*l>0?r.cj.degRad:-r.cj.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let a=0,u=p.length;ar.cj.PI?a-=r.cj.PI2:a<-r.cj.PI&&(a+=r.cj.PI2),a*=t;const h=Math.cos(a),c=Math.sin(a);g.a=h*e-c*n,g.c=h*s-c*i,g.b=c*e+h*n,g.d=c*s+h*i,m=!0}if(0!=e){const t=this.temp;i.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.tx+=t.x*e,g.ty+=t.y*e,m=!0}if(s>0){let t=(Math.sqrt(o*o+l*l)-1+this.data.offsetScaleX)*s+1;g.a*=t,g.b*=t,t=(Math.sqrt(h*h+c*c)-1+this.data.offsetScaleY)*s+1,g.c*=t,g.d*=t,m=!0}if(n>0){let t=Math.atan2(c,h)-Math.atan2(l,o);t>r.cj.PI?t-=r.cj.PI2:t<-r.cj.PI&&(t+=r.cj.PI2);const e=g.c,s=g.d;t=Math.atan2(s,e)+(t-r.cj.PI/2+f)*n;const i=Math.sqrt(e*e+s*s);g.c=Math.cos(t)*i,g.d=Math.sin(t)*i,m=!0}m&&(u.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const i=this.bones;for(let a=0,o=i.length;a0&&(u>1e-5&&(u=(u+(n.ascaleX-u+this.data.offsetScaleX)*s)/u),d>1e-5&&(d=(d+(n.ascaleY-d+this.data.offsetScaleY)*s)/d));const f=o.ashearY;if(r>0){let t=n.ashearY-f+this.data.offsetShearY;t-=360*(16384-(16384.499999999996-t/360|0)),o.shearY+=t*r}o.updateWorldTransformWith(l,c,h,u,d,o.ashearX,f)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const i=this.bones;for(let a=0,o=i.length;a0&&(u>1e-5&&(u*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),d>1e-5&&(d*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let f=o.ashearY;r>0&&(f+=(n.ashearY+this.data.offsetShearY)*r),o.updateWorldTransformWith(l,c,h,u,d,o.ashearX,f)}}}const gt=class{constructor(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e1){const t=s[s.length-1];this._updateCache.indexOf(t)>-1||this.updateCacheReset.push(t)}this._updateCache.push(t),this.sortReset(n.children),s[s.length-1].sorted=!0}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&r.Aq.contains(this.skin.constraints,t.data,!0)),!t.active)return;const e=t.target,s=e.data.index,n=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,s,n),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,n);for(let t=0,e=this.data.skins.length;t-1||this.updateCacheReset.push(s)}else for(let t=0;t= 0.");if(null==e)throw new Error("name cannot be null.");if(null==s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class _t extends at{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}}class Et{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class wt{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(null==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 e=0;e0){const e=new N(l),i=s.slots.length;for(let s=0;s=0;t--)o[t]=-1;const h=r.Aq.newArray(i-a,0);let l=0,c=0;for(let e=0;e=0;t--)-1==o[t]&&(o[t]=h[--c]);e.setFrame(s,n,o)}n.push(e),a=Math.max(a,e.frames[l-1])}const c=t.readInt(!0);if(c>0){const e=new B(c);for(let r=0;r=0;s--)-1==h[s]&&(h[s]=t[--i])}t.setFrame(n++,this.getValue(a,"time",0),h)}i.push(t),a=Math.max(a,t.frames[t.getFrameCount()-1])}if(t.events){const e=new B(t.events.length);let n=0;for(let i=0;i{"use strict";s.d(e,{sP:()=>d,T9:()=>m,WO:()=>I,sZ:()=>R});var r=s(8626);class n{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach((t=>{this._assetList.push(t)})),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t?e(t):t)):t),a=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){return this._cache.get(t)}set(t,e){const s=i(t);let n;for(let t=0;t{n[t]=e})));const a=Object.keys(n),o={cacheKeys:a,keys:s};if(s.forEach((t=>{this._cacheMap.set(t,o)})),a.forEach((t=>{this._cache.has(t)&&this._cache.get(t),this._cache.set(t,n[t])})),e instanceof r.gP){const t=e;s.forEach((e=>{t.baseTexture!==r.gP.EMPTY.baseTexture&&r.t5.addToCache(t.baseTexture,e),r.gP.addToCache(t,e)}))}}remove(t){if(this._cacheMap.get(t),!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}},o=t=>!Array.isArray(t);class h{constructor(){this._parsers=[],this.promiseCache={}}reset(){this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{let r=null;for(let n=0;n({src:t}))),l=h.length,c=h.map((async t=>{const i=r.Wp.path.toAbsolute(t.src);if(!n[t.src])try{this.promiseCache[i]||(this.promiseCache[i]=this._getLoadPromiseAndParser(i,t)),n[t.src]=await this.promiseCache[i].promise,e&&e(++s/l)}catch(e){throw delete this.promiseCache[i],delete n[t.src],new Error(`[Loader.load] Failed to load ${i}.\n${e}`)}}));return await Promise.all(c),a?n[h[0].src]:n}async unload(t){const e=i(t,(t=>({src:t}))).map((async t=>{const e=r.Wp.path.toAbsolute(t.src),s=this.promiseCache[e];if(s){const r=await s.promise;s.parser?.unload?.(r,t,this),delete this.promiseCache[e]}}));await Promise.all(e)}get parsers(){return this._parsers}}function l(t,e,s,r,n){const i=e[s];for(let a=0;a{const e=t.substring(1,t.length-1).split(",");r.push(e)})),l(t,r,0,e,s)}else s.push(t);return s}class u{constructor(){this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.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._preferredOrder=[],this._resolverHash={},this._assetMap={},this._rootPath=null,this._basePath=null,this._manifest=null}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach((t=>{"string"==typeof t.name?s.push(t.name):s.push(...t.name),this.add(t.name,t.srcs)})):Object.keys(e).forEach((t=>{s.push(t),this.add(t,e[t])})),this._bundles[t]=s}add(t,e,s){const n=i(t);n.forEach((t=>{this._assetMap[t]})),Array.isArray(e)||(e="string"==typeof e?c(e):[e]);const a=e.map((t=>{let e=t;if("string"==typeof t){let s=!1;for(let r=0;r{this._assetMap[t]=a}))}resolveBundle(t){const e=o(t);t=i(t);const s={};return t.forEach((t=>{const e=this._bundles[t];e&&(s[t]=this.resolve(e))})),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const s in e)t[s]=e[s].src;return t}return e.src}resolve(t){const e=o(t);t=i(t);const s={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const s=this._getPreferredOrder(e),r=e[0];s?.priority.forEach((t=>{s.params[t].forEach((s=>{const r=e.filter((e=>!!e[t]&&e[t]===s));r.length&&(e=r)}))})),this._resolverHash[t]=e[0]??r}else{let e=t;(this._basePath||this._rootPath)&&(e=r.Wp.path.toAbsolute(e,this._basePath,this._rootPath)),this._resolverHash[t]={src:e}}s[t]=this._resolverHash[t]})),e?s[t[0]]:s}_getPreferredOrder(t){for(let e=0;et.params.format.includes(e.format)));if(s)return s}return this._preferredOrder[0]}}const d=new class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new u,this.loader=new h,this.cache=a,this._backgroundLoader=new n(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized)return;if(this._initialized=!0,t.basePath&&(this.resolver.basePath=t.basePath),t.manifest){let e=t.manifest;"string"==typeof e&&(e=await this.load(e)),this.resolver.addManifest(e)}const e=t.texturePreference?.resolution??1,s="number"==typeof e?[e]:e;let r=[];if(t.texturePreference?.format){const e=t.texturePreference?.format;r="string"==typeof e?[e]:e;for(const t of this._detections)await t.test()||(r=await t.remove(r))}else for(const t of this._detections)await t.test()&&(r=await t.add(r));this.resolver.prefer({params:{format:r,resolution:s}})}add(t,e,s){this.resolver.add(t,e,s)}async load(t,e){this._initialized||await this.init();const s=o(t),r=i(t).map((t=>"string"!=typeof t?(this.resolver.add(t.src,t),t.src):t)),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;"string"==typeof t&&(s=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},i=Object.keys(r);let a=0,o=0;const h=()=>{e?.(++a/o)},l=i.map((t=>{const e=r[t];return o+=Object.keys(e).length,this._mapLoadToResolve(e,h).then((e=>{n[t]=e}))}));return await Promise.all(l),s?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach((t=>{this._backgroundLoader.add(Object.values(t))}))}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return a.get(t);const e={};for(let s=0;s{const s=n[t.src],o=[t.src];t.alias&&o.push(...t.alias),i[r[e]]=s,a.set(o,s)})),i}async unload(t){this._initialized||await this.init();const e=i(t).map((t=>"string"!=typeof t?t.src:t)),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=i(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map((t=>this._unloadFromResolved(e[t])));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach((t=>{a.remove(t.src)})),await this.loader.unload(e)}get detections(){return this._detections}};r.XO.handleByList(r.Ag.LoadParser,d.loader.parsers).handleByList(r.Ag.ResolveParser,d.resolver.parsers).handleByList(r.Ag.CacheParser,d.cache.parsers).handleByList(r.Ag.DetectionParser,d.detections);const f={loader:r.Ag.LoadParser,resolver:r.Ag.ResolveParser,cache:r.Ag.CacheParser,detection:r.Ag.DetectionParser};r.XO.handle(r.Ag.Asset,(t=>{const e=t.ref;Object.entries(f).filter((([t])=>!!e[t])).forEach((([t,s])=>r.XO.add(Object.assign(e[t],{extension:e[t].extension??s}))))}),(t=>{const e=t.ref;Object.keys(f).filter((t=>!!e[t])).forEach((t=>r.XO.remove(e[t])))}));const p={extension:r.Ag.CacheParser,test:t=>Array.isArray(t)&&t.every((t=>t instanceof r.gP)),getCacheableAssets:(t,e)=>{const s={};return t.forEach((t=>{e.forEach(((e,r)=>{s[t+(0===r?"":r+1)]=e}))})),s}};r.XO.add(p);var m=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(m||{});const g={extension:{type:r.Ag.LoadParser,priority:m.Low},test:t=>r.Wp.path.extname(t).includes(".json"),async load(t){const e=await r.W0.ADAPTER.fetch(t);return await e.json()}};r.XO.add(g);const x={extension:{type:r.Ag.LoadParser,priority:m.Low},test:t=>r.Wp.path.extname(t).includes(".txt"),async load(t){const e=await r.W0.ADAPTER.fetch(t);return await e.text()}};r.XO.add(x);const y=["normal","bold","100","200","300","400","500","600","700","800","900"],b=["woff","woff2","ttf","otf"],_={extension:{type:r.Ag.LoadParser,priority:m.Low},test(t){const e=t.split("?")[0].split(".").pop();return b.includes(e)},async load(t,e){if(!globalThis.navigator.onLine)throw new Error("[loadWebFont] Cannot load font - navigator is offline");const s=r.W0.ADAPTER.getFontFaceSet();if(s){const n=[],i=e.data?.family??function(t){const e=r.Wp.path.extname(t);return r.Wp.path.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join(" ")}(t),a=e.data?.weights?.filter((t=>y.includes(t)))??["normal"],o=e.data??{};for(let e=0;er.W0.ADAPTER.getFontFaceSet().delete(t)))}};r.XO.add(_);let E,w=0;const v="\n async function checkImageBitmap()\n {\n try\n {\n if (typeof createImageBitmap !== 'function') return false;\n\n const response = await fetch('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=');\n const imageBlob = await response.blob();\n const imageBitmap = await createImageBitmap(imageBlob);\n\n return imageBitmap.width === 1 && imageBitmap.height === 1;\n }\n catch (e)\n {\n return false;\n }\n }\n checkImageBitmap().then((result) => { self.postMessage(result); });\n ",T="\n async function loadImageBitmap(url)\n {\n const response = await fetch(url);\n\n if (!response.ok)\n {\n throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${url}: `\n + `${response.status} ${response.statusText}`);\n }\n\n const imageBlob = await response.blob();\n const imageBitmap = await createImageBitmap(imageBlob);\n\n return imageBitmap;\n }\n self.onmessage = async (event) =>\n {\n try\n {\n const imageBitmap = await loadImageBitmap(event.data.data[0]);\n\n self.postMessage({\n data: imageBitmap,\n uuid: event.data.uuid,\n id: event.data.id,\n }, [imageBitmap]);\n }\n catch(e)\n {\n self.postMessage({\n error: e,\n uuid: event.data.uuid,\n id: event.data.id,\n });\n }\n };";let A;const S=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise((t=>{const e=URL.createObjectURL(new Blob([v],{type:"application/javascript"})),s=new Worker(e);s.addEventListener("message",(r=>{s.terminate(),URL.revokeObjectURL(e),t(r.data)}))}))),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===E&&(E=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers{this.complete(t.data),this.returnWorker(t.target),this.next()}))),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise(((s,r)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:r})}));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[w]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:w++,id:s})}};function I(t,e){const s=t.split("?")[0],n=r.Wp.path.extname(s).toLowerCase();return Array.isArray(e)?e.includes(n.toLowerCase()):n.toLowerCase()===e}function R(t,e,s){const n=new r.gP(t);return n.baseTexture.on("dispose",(()=>{delete e.promiseCache[s]})),n}const M=[".jpg",".png",".jpeg",".avif",".webp"],C={extension:{type:r.Ag.LoadParser,priority:m.High},config:{preferWorkers:!0},test(t){let e=!1;for(let s=0;s{n=new Image,n.crossOrigin="anonymous",n.src=t,n.complete?e(n):n.onload=()=>{e(n)}}));const i=new r.t5(n,{resolution:r.Wp.getResolutionOfUrl(t),...e.data});return i.resource.src=t,R(i,s,t)},unload(t){t.destroy(!0)}};r.XO.add(C),r.Ag.LoadParser,m.High;const P={extension:r.Ag.ResolveParser,test:C.test,parse:t=>({resolution:parseFloat(r.W0.RETINA_PREFIX.exec(t)?.[1]??"1"),format:t.split(".").pop(),src:t})};r.XO.add(P);const k={extension:{type:r.Ag.DetectionParser,priority:1},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await r.W0.ADAPTER.fetch("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=").then((t=>t.blob()));return createImageBitmap(t).then((()=>!0),(()=>!1))},add:async t=>[...t,"avif"],remove:async t=>t.filter((t=>"avif"!==t))};r.XO.add(k);const D={extension:{type:r.Ag.DetectionParser,priority:0},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await r.W0.ADAPTER.fetch("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=").then((t=>t.blob()));return createImageBitmap(t).then((()=>!0),(()=>!1))},add:async t=>[...t,"webp"],remove:async t=>t.filter((t=>"webp"!==t))};r.XO.add(D);const F=["png","jpg","jpeg"],B={extension:{type:r.Ag.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...F],remove:async t=>t.filter((t=>!F.includes(t)))};r.XO.add(B)},8626:(t,e,s)=>{"use strict";s.d(e,{Gk:()=>m,B9:()=>a,t5:()=>ge,hq:()=>br,JH:()=>vr,cc:()=>_r,hp:()=>Le,dZ:()=>fe,fr:()=>g,jl:()=>Z,Td:()=>G,_4:()=>o,Pp:()=>K,Ag:()=>X,hR:()=>h,dJ:()=>Is,V2:()=>qe,vg:()=>b,E8:()=>p,uq:()=>st,Pt:()=>Ke,oA:()=>et,TO:()=>j,bR:()=>z,tS:()=>J,BP:()=>Ts,X1:()=>We,bO:()=>W,M_:()=>Q,Y7:()=>Fe,TE:()=>tt,M6:()=>d,HY:()=>H,$f:()=>ve,Mt:()=>As,Uw:()=>Ss,QE:()=>c,gP:()=>De,NW:()=>Ms,Rv:()=>gt,dL:()=>dt,dQ:()=>pt,k2:()=>He,u3:()=>Er,uR:()=>f,q5:()=>pr,Eo:()=>gr,MT:()=>mr,XO:()=>q,W0:()=>V,Wp:()=>r});var r={};s.r(r),s.d(r,{BaseTextureCache:()=>te,CanvasRenderTarget:()=>re,DATA_URI:()=>ie,EventEmitter:()=>yt,ProgramCache:()=>Kt,TextureCache:()=>Jt,clearTextureCache:()=>se,correctBlendMode:()=>Bt,createIndicesForQuads:()=>Ut,decomposeDataUri:()=>ae,deprecation:()=>Zt,destroyTextureCache:()=>ee,determineCrossOrigin:()=>he,earcut:()=>bt,getBufferType:()=>Vt,getResolutionOfUrl:()=>le,hex2rgb:()=>Ct,hex2string:()=>Pt,interleaveTypedArrays:()=>Yt,isMobile:()=>U,isPow2:()=>jt,isWebGLSupported:()=>Rt,log2:()=>Wt,nextPow2:()=>qt,path:()=>Tt,premultiplyBlendMode:()=>Ft,premultiplyRgba:()=>Nt,premultiplyTint:()=>Ot,premultiplyTintToRgba:()=>Lt,removeItems:()=>Gt,rgb2hex:()=>Dt,sayHello:()=>St,sign:()=>Ht,skipHello:()=>At,string2hex:()=>kt,trimCanvas:()=>ne,uid:()=>$t,url:()=>Et});var n=(t=>(t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2",t))(n||{}),i=(t=>(t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL",t))(i||{}),a=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR",t))(a||{}),o=(t=>(t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t))(o||{}),h=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(h||{}),l=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(l||{}),c=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(c||{}),u=(t=>(t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t))(u||{}),d=(t=>(t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t))(d||{}),f=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(f||{}),p=(t=>(t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL",t))(p||{}),m=(t=>(t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",t))(m||{}),g=(t=>(t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT",t))(g||{}),x=(t=>(t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL",t))(x||{}),y=(t=>(t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp",t))(y||{}),b=(t=>(t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR",t))(b||{}),_=(t=>(t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH",t))(_||{}),E=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(E||{});const w={createCanvas:(t,e)=>{const s=document.createElement("canvas");return s.width=t,s.height=e,s},getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e)};var v=/iPhone/i,T=/iPod/i,A=/iPad/i,S=/\biOS-universal(?:.+)Mac\b/i,I=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,M=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,C=/Silk/i,P=/Windows Phone/i,k=/\bWindows(?:.+)ARM\b/i,D=/BlackBerry/i,F=/BB10/i,B=/Opera Mini/i,N=/\b(CriOS|Chrome)(?:.+)Mobile/i,O=/Mobile(?:.+)Firefox\b/i,L=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};const U=function(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var s=e.userAgent,r=s.split("[FBAN");void 0!==r[1]&&(s=r[0]),void 0!==(r=s.split("Twitter"))[1]&&(s=r[0]);var n=function(t){return function(e){return e.test(t)}}(s),i={apple:{phone:n(v)&&!n(P),ipod:n(T),tablet:!n(v)&&(n(A)||L(e))&&!n(P),universal:n(S),device:(n(v)||n(T)||n(A)||n(S)||L(e))&&!n(P)},amazon:{phone:n(M),tablet:!n(M)&&n(C),device:n(M)||n(C)},android:{phone:!n(P)&&n(M)||!n(P)&&n(I),tablet:!n(P)&&!n(M)&&!n(I)&&(n(C)||n(R)),device:!n(P)&&(n(M)||n(C)||n(I)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(P),tablet:n(k),device:n(P)||n(k)},other:{blackberry:n(D),blackberry10:n(F),opera:n(B),firefox:n(O),chrome:n(N),device:n(D)||n(F)||n(B)||n(O)||n(N)},any:!1,phone:!1,tablet:!1};return i.any=i.apple.device||i.android.device||i.windows.device||i.other.device,i.phone=i.apple.phone||i.android.phone||i.windows.phone,i.tablet=i.apple.tablet||i.android.tablet||i.windows.tablet,i}(globalThis.navigator),V={ADAPTER:w,MIPMAP_TEXTURES:p.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:_.NONE,SPRITE_MAX_TEXTURES:function(t){let e=!0;if(U.tablet||U.phone){if(U.apple.device){const t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);t&&parseInt(t[1],10)<11&&(e=!1)}if(U.android.device){const t=navigator.userAgent.match(/Android\s([0-9.]*)/);t&&parseInt(t[1],10)<7&&(e=!1)}}return e?32:4}(),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1,hello:!1},GC_MODE:x.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:f.CLAMP,SCALE_MODE:d.LINEAR,PRECISION_VERTEX:y.HIGH,PRECISION_FRAGMENT:U.apple.device?y.HIGH:y.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!U.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};V.PREFER_ENV=n.WEBGL2,V.STRICT_TEXTURE_CACHE=!1;var X=(t=>(t.Renderer="renderer",t.Application="application",t.RendererSystem="renderer-webgl-system",t.RendererPlugin="renderer-webgl-plugin",t.CanvasRendererSystem="renderer-canvas-system",t.CanvasRendererPlugin="renderer-canvas-plugin",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t))(X||{});const Y=t=>{if(("function"==typeof t||"object"==typeof t&&t.extension)&&(t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}),"object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t={...t}).type&&(t.type=[t.type]),t},q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Y).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(Y).forEach((t=>{t.type.forEach((e=>{const s=this._addHandlers,r=this._queue;s[e]?s[e](t):(r[e]=r[e]||[],r[e].push(t))}))})),this},handle(t,e,s){const r=this._addHandlers,n=this._removeHandlers;r[t]=e,n[t]=s;const i=this._queue;return i[t]&&(i[t].forEach((t=>e(t))),delete i[t]),this},handleByMap(t,e){return this.handle(t,(t=>{e[t.name]=t.ref}),(t=>{delete e[t.name]}))},handleByList(t,e){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>(e.priority??-1)-(t.priority??-1))))}),(t=>{const s=e.indexOf(t.ref);-1!==s&&e.splice(s,1)}))}},j=2*Math.PI,W=180/Math.PI,G=Math.PI/180;var H=(t=>(t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC",t))(H||{});class z{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new z(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}}const $=[new z,new z,new z,new z];class Q{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=H.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 Q(0,0,0,0)}clone(){return new Q(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return!(this.width<=0||this.height<=0)&&t>=this.x&&t=this.y&&et.right?t.right:this.right)<=e)return!1;const s=this.yt.bottom?t.bottom:this.bottom)>s}const s=this.left,r=this.right,n=this.top,i=this.bottom;if(r<=s||i<=n)return!1;const a=$[0].set(t.left,t.top),o=$[1].set(t.left,t.bottom),h=$[2].set(t.right,t.top),l=$[3].set(t.right,t.bottom);if(h.x<=a.x||o.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(0===c)return!1;if(e.apply(a,a),e.apply(o,o),e.apply(h,h),e.apply(l,l),Math.max(a.x,o.x,h.x,l.x)<=s||Math.min(a.x,o.x,h.x,l.x)>=r||Math.max(a.y,o.y,h.y,l.y)<=n||Math.min(a.y,o.y,h.y,l.y)>=i)return!1;const u=c*(o.y-a.y),d=c*(a.x-o.x),f=u*s+d*n,p=u*r+d*n,m=u*s+d*i,g=u*r+d*i;if(Math.max(f,p,m,g)<=u*a.x+d*a.y||Math.min(f,p,m,g)>=u*l.x+d*l.y)return!1;const x=c*(a.y-h.y),y=c*(h.x-a.x),b=x*s+y*n,_=x*r+y*n,E=x*s+y*i,w=x*r+y*i;return!(Math.max(b,_,E,w)<=x*a.x+y*a.y||Math.min(b,_,E,w)>=x*l.x+y*l.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}}class Z{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=H.CIRC}clone(){return new Z(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 Q(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}}class K{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=H.ELIP}clone(){return new K(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 Q(this.x-this.width,this.y-this.height,this.width,this.height)}}class J{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let s=0,r=e.length;se!=h>e&&t<(e-a)/(h-a)*(o-r)+r&&(s=!s)}return s}}class tt{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=H.RREC}clone(){return new tt(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 i=s*s;if(r*r+n*n<=i)return!0;if(r=t-(this.x+this.width-s),r*r+n*n<=i)return!0;if(n=e-(this.y+this.height-s),r*r+n*n<=i)return!0;if(r=t-(this.x+s),r*r+n*n<=i)return!0}return!1}}class et{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 et(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))}}class st{constructor(t=1,e=0,s=0,r=1,n=0,i=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=i}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,i){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=i,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 z;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 z;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,i=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=i*e-this.ty*s,this.ty=i*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,i,a,o,h){return this.a=Math.cos(a+h)*n,this.b=Math.sin(a+h)*n,this.c=-Math.sin(a-o)*i,this.d=Math.cos(a-o)*i,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(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,s=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,r=this.c,n=this.d,i=t.pivot,a=-Math.atan2(-r,n),o=Math.atan2(s,e),h=Math.abs(a+o);return h<1e-5||Math.abs(j-h)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=o),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(i.x*e+i.y*r),t.position.y=this.ty+(i.x*s+i.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,i=t*r-e*s;return this.a=r/i,this.b=-e/i,this.c=-s/i,this.d=t/i,this.tx=(s*this.ty-r*n)/i,this.ty=-(t*this.ty-e*n)/i,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 st;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 st}static get TEMP_MATRIX(){return new st}}const rt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],nt=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],it=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],at=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ot=[],ht=[],lt=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];ot.push(e);for(let s=0;s<16;s++){const r=lt(rt[t]*rt[s]+it[t]*nt[s]),n=lt(nt[t]*rt[s]+at[t]*nt[s]),i=lt(rt[t]*it[s]+it[t]*at[s]),a=lt(nt[t]*it[s]+at[t]*at[s]);for(let t=0;t<16;t++)if(rt[t]===r&&nt[t]===n&&it[t]===i&&at[t]===a){e.push(t);break}}}for(let t=0;t<16;t++){const e=new st;e.set(rt[t],nt[t],it[t],at[t],0,0),ht.push(e)}}();const ct={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>rt[t],uY:t=>nt[t],vX:t=>it[t],vY:t=>at[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>ot[t][e],sub:(t,e)=>ot[t][ct.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?ct.S:ct.N:2*Math.abs(e)<=Math.abs(t)?t>0?ct.E:ct.W:e>0?t>0?ct.SE:ct.SW:t>0?ct.NE:ct.NW,matrixAppendRotationInv:(t,e,s=0,r=0)=>{const n=ht[ct.inv(e)];n.tx=s,n.ty=r,t.append(n)}},ut=class{constructor(){this.worldTransform=new st,this.localTransform=new st,this.position=new et(this.onChange,this,0,0),this.scale=new et(this.onChange,this,1,1),this.pivot=new et(this.onChange,this,0,0),this.skew=new et(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const s=t.worldTransform,r=this.worldTransform;r.a=e.a*s.a+e.b*s.c,r.b=e.a*s.b+e.b*s.d,r.c=e.c*s.a+e.d*s.c,r.d=e.c*s.b+e.d*s.d,r.tx=e.tx*s.a+e.ty*s.c+s.tx,r.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};let dt=ut;dt.IDENTITY=new ut;class ft{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,i,a,o){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:l}=this;this._aliasCount++;for(let c=0,u=l.length;c0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}Object.defineProperties(ft.prototype,{dispatch:{value:ft.prototype.emit},run:{value:ft.prototype.emit}}),V.TARGET_FPMS=.06;var pt=(t=>(t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(pt||{});class mt{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}}class gt{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 mt(null,null,1/0),this.deltaMS=1/V.TARGET_FPMS,this.elapsedMS=1/V.TARGET_FPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=pt.NORMAL){return this._addListener(new mt(t,e,s))}addOnce(t,e,s=pt.NORMAL){return this._addListener(new mt(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}else t.connect(s);return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s=s.match(t,e)?s.destroy():s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(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 e=t-this._lastFrame|0;if(e{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?gt.shared:new gt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}xt.extension=X.Application,q.add(xt);var yt=s(228),bt=s(6570),_t=s(8835);const Et={parse:_t.qg,format:_t.GP,resolve:_t.hd};function wt(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function vt(t){return t.split("?")[0].split("#")[0]}const Tt={toPosix:t=>("\\","/",t.replace(new RegExp("\\".replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),"/")),isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),hasProtocol(t){return/^[^/:]+:\//.test(this.toPosix(t))},getProtocol(t){wt(t),t=this.toPosix(t);let e="";const s=/^file:\/\/\//.exec(t),r=/^[^/:]+:\/\//.exec(t),n=/^[^/:]+:\//.exec(t);if(s||r||n){const i=s?.[0]||r?.[0]||n?.[0];e=i,t=t.slice(i.length)}return e},toAbsolute(t,e,s){if(this.isDataUrl(t))return t;const r=vt(this.toPosix(e??V.ADAPTER.getBaseUrl())),n=vt(this.toPosix(s??this.rootname(r)));return wt(t),(t=this.toPosix(t)).startsWith("/")?Tt.join(n,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(wt(t=this.toPosix(t)),0===t.length)return".";let e="";const s=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const r=t.endsWith("/");return(t=function(t,e){let s,r="",n=0,i=-1,a=0;for(let e=0;e<=t.length;++e){if(e2){const t=r.lastIndexOf("/");if(t!==r.length-1){-1===t?(r="",n=0):(r=r.slice(0,t),n=r.length-1-r.lastIndexOf("/")),i=e,a=0;continue}}else if(2===r.length||1===r.length){r="",n=0,i=e,a=0;continue}}else r.length>0?r+=`/${t.slice(i+1,e)}`:r=t.slice(i+1,e),n=e-i-1;i=e,a=0}else 46===s&&-1!==a?++a:a=-1}return r}(t)).length>0&&r&&(t+="/"),s?`/${t}`:e+t},isAbsolute(t){return wt(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let s=0;s0)if(void 0===e)e=r;else{const n=t[s-1]??"";this.extname(n)?e+=`/../${r}`:e+=`/${r}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(wt(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const s=47===e;let r=-1,n=!0;const i=this.getProtocol(t),a=t;for(let s=(t=t.slice(i.length)).length-1;s>=1;--s)if(e=t.charCodeAt(s),47===e){if(!n){r=s;break}}else n=!1;return-1===r?s?"/":this.isUrl(a)?i+t:i:s&&1===r?"//":i+t.slice(0,r)},rootname(t){wt(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const s=t.indexOf("/",e.length);e=-1!==s?t.slice(0,s):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){wt(t),e&&wt(e),t=this.toPosix(t);let s,r=0,n=-1,i=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(s=t.length-1;s>=0;--s){const h=t.charCodeAt(s);if(47===h){if(!i){r=s+1;break}}else-1===o&&(i=!1,o=s+1),a>=0&&(h===e.charCodeAt(a)?-1==--a&&(n=s):(a=-1,n=o))}return r===n?n=o:-1===n&&(n=t.length),t.slice(r,n)}for(s=t.length-1;s>=0;--s)if(47===t.charCodeAt(s)){if(!i){r=s+1;break}}else-1===n&&(i=!1,n=s+1);return-1===n?"":t.slice(r,n)},extname(t){wt(t);let e=-1,s=0,r=-1,n=!0,i=0;for(let a=(t=this.toPosix(t)).length-1;a>=0;--a){const o=t.charCodeAt(a);if(47!==o)-1===r&&(n=!1,r=a+1),46===o?-1===e?e=a:1!==i&&(i=1):-1!==e&&(i=-1);else if(!n){s=a+1;break}}return-1===e||-1===r||0===i||1===i&&e===r-1&&e===s+1?"":t.slice(e,r)},parse(t){wt(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let s=(t=this.toPosix(t)).charCodeAt(0);const r=this.isAbsolute(t);let n;e.root=this.rootname(t),n=r||this.hasProtocol(t)?1:0;let i=-1,a=0,o=-1,h=!0,l=t.length-1,c=0;for(;l>=n;--l)if(s=t.charCodeAt(l),47!==s)-1===o&&(h=!1,o=l+1),46===s?-1===i?i=l:1!==c&&(c=1):-1!==i&&(c=-1);else if(!h){a=l+1;break}return-1===i||-1===o||0===c||1===c&&i===o-1&&i===a+1?-1!==o&&(e.base=e.name=0===a&&r?t.slice(1,o):t.slice(a,o)):(0===a&&r?(e.name=t.slice(1,i),e.base=t.slice(1,o)):(e.name=t.slice(a,i),e.base=t.slice(a,o)),e.ext=t.slice(i,o)),e.dir=this.dirname(t),e},sep:"/",delimiter:":"};function At(){}function St(){}let It;function Rt(){return void 0===It&&(It=function(){const t={stencil:!0,failIfMajorPerformanceCaveat:V.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!V.ADAPTER.getWebGLRenderingContext())return!1;const e=V.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const r=!(!s||!s.getContextAttributes().stencil);if(s){const t=s.getExtension("WEBGL_lose_context");t&&t.loseContext()}return s=null,r}catch(t){return!1}}()),It}V.RETINA_PREFIX=/@([0-9\.]+)x/,V.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Mt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Ct(t,e=[]){return e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function Pt(t){let e=t.toString(16);return e="000000".substring(0,6-e.length)+e,`#${e}`}function kt(t){if("string"==typeof t&&("#"===(t=Mt[t.toLowerCase()]||t)[0]&&(t=t.slice(1)),3===t.length)){const[e,s,r]=t;t=e+e+s+s+r+r}return parseInt(t,16)}function Dt(t){return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)}const Ft=function(){const t=[],e=[];for(let s=0;s<32;s++)t[s]=s,e[s]=s;t[a.NORMAL_NPM]=a.NORMAL,t[a.ADD_NPM]=a.ADD,t[a.SCREEN_NPM]=a.SCREEN,e[a.NORMAL]=a.NORMAL_NPM,e[a.ADD]=a.ADD_NPM,e[a.SCREEN]=a.SCREEN_NPM;const s=[];return s.push(e),s.push(t),s}();function Bt(t,e){return Ft[e?1:0][t]}function Nt(t,e,s,r){return s=s||new Float32Array(4),r||void 0===r?(s[0]=t[0]*e,s[1]=t[1]*e,s[2]=t[2]*e):(s[0]=t[0],s[1]=t[1],s[2]=t[2]),s[3]=e,s}function Ot(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;let s=t>>16&255,r=t>>8&255,n=255&t;return s=s*e+.5|0,r=r*e+.5|0,n=n*e+.5|0,(255*e<<24)+(s<<16)+(r<<8)+n}function Lt(t,e,s,r){return(s=s||new Float32Array(4))[0]=(t>>16&255)/255,s[1]=(t>>8&255)/255,s[2]=(255&t)/255,(r||void 0===r)&&(s[0]*=e,s[1]*=e,s[2]*=e),s[3]=e,s}function Ut(t,e=null){const s=6*t;if((e=e||new Uint16Array(s)).length!==s)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${s}`);for(let t=0,r=0;t>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}function jt(t){return!(t&t-1||!t)}function Wt(t){let e=(t>65535?1:0)<<4,s=((t>>>=e)>255?1:0)<<3;return e|=s,s=((t>>>=s)>15?1:0)<<2,e|=s,s=((t>>>=s)>3?1:0)<<1,e|=s,e|(t>>>=s)>>1}function Gt(t,e,s){const r=t.length;let n;if(e>=r||0===s)return;const i=r-(s=e+s>r?r-e:s);for(n=e;n=0;--r){const n=ce[r];if(n.test&&n.test(t,s))return new n(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class de{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ft("setRealSize"),this.onUpdate=new ft("update"),this.onError=new ft("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 fe extends de{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}upload(t,e,s){const r=t.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===m.UNPACK);const n=e.realWidth,i=e.realHeight;return s.width===n&&s.height===i?r.texSubImage2D(e.target,0,0,0,n,i,e.format,s.type,this.data):(s.width=n,s.height=i,r.texImage2D(e.target,0,s.internalFormat,n,i,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array}}const pe={scaleMode:d.NEAREST,format:h.RGBA,alphaMode:m.NPM},me=class extends yt{constructor(t=null,e=null){super(),e=e||{};const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:i,width:a,height:o,wrapMode:u,format:d,type:f,target:p,resolution:g,resourceOptions:x}=e;!t||t instanceof de||((t=ue(t,x)).internal=!0),this.resolution=g||V.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((o||0)*this.resolution)/this.resolution,this._mipmap=r??V.MIPMAP_TEXTURES,this.anisotropicLevel=n??V.ANISOTROPIC_LEVEL,this._wrapMode=u||V.WRAP_MODE,this._scaleMode=i??V.SCALE_MODE,this.format=d||h.RGBA,this.type=f||c.UNSIGNED_BYTE,this.target=p||l.TEXTURE_2D,this.alphaMode=s??m.UNPACK,this.uid=$t(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>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 void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),void 0!==e&&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=jt(this.realWidth)&&jt(this.realHeight)}setResolution(t){const e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete te[this.cacheId],delete Jt[this.cacheId],this.cacheId=null),this.dispose(),me.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,s=V.STRICT_TEXTURE_CACHE){const r="string"==typeof t;let n=null;if(r)n=t;else{if(!t._pixiId){const s=e?.pixiIdPrefix||"pixiid";t._pixiId=`${s}_${$t()}`}n=t._pixiId}let i=te[n];if(r&&s&&!i)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return i||(i=new me(t,e),i.cacheId=n,me.addToCache(i,n)),i}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new fe(t,{width:e,height:s}),i=t instanceof Float32Array?c.FLOAT:c.UNSIGNED_BYTE;return new me(n,Object.assign({},pe,r||{width:e,height:s,type:i}))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),te[e]&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),te[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=te[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete te[t],e}}else if(t?.textureCacheIds){for(let e=0;et.resource)).filter((t=>t)).map((t=>t.load()));return this._load=Promise.all(t).then((()=>{const{realWidth:t,realHeight:e}=this.items[0];return this.resize(t,e),Promise.resolve(this)})),this._load}}class ye extends de{constructor(t){const e=t;super(e.naturalWidth||e.videoWidth||e.width,e.naturalHeight||e.videoHeight||e.height),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){void 0!==s||e.startsWith("data:")?!1!==s&&(t.crossOrigin="string"==typeof s?s:"anonymous"):t.crossOrigin=he(e)}upload(t,e,s,r){const n=t.gl,i=e.realWidth,a=e.realHeight;if(r=r||this.source,"undefined"!=typeof HTMLImageElement&&r instanceof HTMLImageElement){if(!r.complete||0===r.naturalWidth)return!1}else if("undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement&&r.readyState<=1&&0===r.buffered.length)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===m.UNPACK),this.noSubImage||e.target!==n.TEXTURE_2D||s.width!==i||s.height!==a?(s.width=i,s.height=a,n.texImage2D(e.target,0,s.internalFormat,e.format,s.type,r)):n.texSubImage2D(n.TEXTURE_2D,0,0,0,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}}const be=class extends xe{constructor(t,e){const{width:s,height:r,autoLoad:n,linkBaseTexture:i}=e||{};if(t&&t.length!==be.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:r});for(let t=0;t0){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=l.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const r=this.itemDirtyIds;for(let n=0;n{const s=this.source;this.url=s.src;const r=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.resize(s.width,s.height),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?r():(s.onload=r,s.onerror=t=>{e(t),this.onError.emit(t)})}))),this._load}process(){const t=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||"anonymous"===t.crossOrigin;return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then((t=>t.blob())).then((s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===m.UNPACK?"premultiply":"none"}))).then((t=>this.destroyed?Promise.reject():(this.bitmap=t,this.update(),this._process=null,Promise.resolve(this)))),this._process}upload(t,e,s){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let t=!0;const r=e._glTextures;for(const n in r){const i=r[n];if(i!==s&&i.dirtyId!==e.dirtyId){t=!1;break}}t&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return"undefined"!=typeof HTMLImageElement&&("string"==typeof t||t instanceof HTMLImageElement)}}const we=class extends ye{constructor(t,e){e=e||{},super(V.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise((t=>{if(this._resolve=()=>{this.resize(this.source.width,this.source.height),t(this)},we.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;ye.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 i=this.source;i.width=r,i.height=n,i._pixiId=`canvas_${$t()}`,i.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=we.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"svg"===e||"string"==typeof t&&t.startsWith("data:image/svg+xml")||"string"==typeof t&&we.SVG_XML.test(t)}};let ve=we;ve.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;const Te=class extends ye{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),"string"==typeof t&&(t=[t]);const r=t[0].src||t[0];ye.crossOrigin(s,r,e.crossorigin);for(let e=0;e{this.valid?e(this):(this._resolve=e,t.load())})),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(gt.shared.add(this.update,this),this._isConnectedToTicker=!0)}_onPlayStop(){this._isConnectedToTicker&&(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._isConnectedToTicker&&(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1);const t=this.source;t&&(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._autoUpdate&&this._isConnectedToTicker?(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(gt.shared.add(this.update,this),this._isConnectedToTicker=!0))}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t)}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Te.TYPES.includes(e)}};let Ae=Te;Ae.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ae.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};class Se extends ye{constructor(t,e){var s=(...t)=>{super(...t)};e=e||{},"string"==typeof t?(s(Se.EMPTY),this.url=t):(s(t),this.url=null),this.crossOrigin=e.crossOrigin??!0,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise((async(t,e)=>{if(null!==this.url)try{const e=await V.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await e.blob();if(this.destroyed)return;const r=await createImageBitmap(s,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===m.UNPACK?"premultiply":"none"});if(this.destroyed)return;this.source=r,this.update(),t(this)}catch(t){if(this.destroyed)return;e(t),this.onError.emit(t)}else t(this)}))),this._load}upload(t,e,s){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&("string"==typeof t||t instanceof ImageBitmap)}static get EMPTY(){return Se._EMPTY=Se._EMPTY??V.ADAPTER.createCanvas(0,0),Se._EMPTY}}ce.push(Se,Ee,class extends ye{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return!!(e&&t instanceof e)||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}},Ae,ve,fe,_e,class extends xe{constructor(t,e){const{width:s,height:r}=e||{};let n,i;Array.isArray(t)?(n=t,i=t.length):i=t,super(i,{width:s,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this}bind(t){super.bind(t),t.target=l.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:i}=this,{gl:a}=t;s.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let t=0;tPromise.resolve(r)))}static fromBuffer(t,e,s,r){return new De(ge.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new ge(t,Object.assign({scaleMode:V.SCALE_MODE,resolution:le(e)},r)),{resource:i}=n;i instanceof Ee&&(i.url=e);const a=new De(n);return s||(s=e),ge.addToCache(a.baseTexture,s),De.addToCache(a,s),s!==e&&(ge.addToCache(a.baseTexture,e),De.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise((t=>{a.baseTexture.once("loaded",(()=>t(a)))}))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Jt[e]&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Jt[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=Jt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Jt[t],e}}else if(t?.textureCacheIds){for(let e=0;ethis.baseTexture.width,a=s+n>this.baseTexture.height;if(i||a){const t=i&&a?"and":"or",o=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,h=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${o} ${t} ${h}`)}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 De._EMPTY||(De._EMPTY=new De(new ge),ke(De._EMPTY),ke(De._EMPTY.baseTexture)),De._EMPTY}static get WHITE(){if(!De._WHITE){const t=V.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),De._WHITE=new De(ge.from(t)),ke(De._WHITE),ke(De._WHITE.baseTexture)}return De._WHITE}}class Fe extends De{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,i=Math.round(e*r)/r;this.valid=n>0&&i>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=i,s&&this.baseTexture.resize(n,i),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 Fe(new Me(t))}}class Be{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=_.NONE){const r=new Me(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Fe(r)}getOptimalTexture(t,e,s=1,r=_.NONE){let n;t=Math.ceil(t*s-1e-6),e=Math.ceil(e*s-1e-6),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?n=r>1?-r:-1:(n=((65535&(t=qt(t)))<<16|65535&(e=qt(e)))>>>0,r>1&&(n+=4294967296*r)),this.texturePool[n]||(this.texturePool[n]=[]);let i=this.texturePool[n].pop();return i||(i=this.createTexture(t,e,r)),i.filterPoolKey=n,i.setResolution(s),i}getFilterTexture(t,e,s){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||_.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=!1!==t)for(const t in this.texturePool){const e=this.texturePool[t];if(e)for(let t=0;t0&&t.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const e=this.texturePool[t];if(e)for(let t=0;t1){for(let t=0;t1&&(r=this.getOptimalFilterTexture(t.width,t.height,e.resolution),r.filterFrame=t.filterFrame),s[n].apply(this,t,r,g.CLEAR,e);const i=t;t=r,r=i}s[n].apply(this,t,o.renderTexture,g.BLEND,e),n>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(t),this.returnFilterTexture(r)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=g.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?.filterFrame){const e=this.tempRect;e.x=0,e.y=0,e.width=t.filterFrame.width,e.height=t.filterFrame.height,s.bind(t,t.filterFrame,e)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=1&r.stateId||this.forceClear;(e===g.CLEAR||e===g.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(o.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(o.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:r}=this.activeState,{orig:n}=e._texture,i=t.set(r.width,0,0,r.height,s.x,s.y),a=e.worldTransform.copyTo(st.TEMP_MATRIX);return a.invert(),i.prepend(a),i.scale(1/n.width,1/n.height),i.translate(e.anchor.x,e.anchor.y),i}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,r=_.NONE){return this.texturePool.getOptimalTexture(t,e,s,r)}getFilterTexture(t,e,s){if("number"==typeof t){const s=t;t=e,e=s}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||_.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=$e[0],r=$e[1],n=$e[2],i=$e[3];s.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),i.set(e.right,e.bottom),t.apply(s,s),t.apply(r,r),t.apply(n,n),t.apply(i,i);const a=Math.min(s.x,r.x,n.x,i.x),o=Math.min(s.y,r.y,n.y,i.y),h=Math.max(s.x,r.x,n.x,i.x),l=Math.max(s.y,r.y,n.y,i.y);e.x=a,e.y=o,e.width=h-a,e.height=l-o}roundFrame(t,e,s,r,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a:t,b:e,c:s,d:r}=n;if((Math.abs(e)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(r)>1e-4))return}(n=n?Qe.copyFrom(n):Qe.identity()).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)}}}Ze.extension={type:X.RendererSystem,name:"filter"},q.add(Ze);class Ke{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}class Je{constructor(t){this.renderer=t,this.emptyRenderer=new Ke(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:i,count:a}=t;let o=0;for(let t=0;t=0&&h=n.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={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")};1===this.webGLVersion?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault()}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,void 0!==t.removeEventListener&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const 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")}}es.extension={type:X.RendererSystem,name:"context"},q.add(es);class ss{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=_.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const rs=new Q;class ns{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Re(10,10),this.msaaSamples=null}contextChange(){const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Q,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;V.PREFER_ENV===n.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=t=>e.drawBuffersWEBGL(t):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl: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 e=0;e>s,r=e.height>>s,n=t/e.width;this.setViewport(e.x*n,e.y*n,t,r)}else{const e=t.width>>s,r=t.height>>s;this.setViewport(0,0,e,r)}}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=i.COLOR|i.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new ss(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];s.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,s.stencil),s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let i=0;i1&&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 a=[];for(let o=0;o1&&s.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const r=t.depthTexture;this.renderer.texture.bind(r,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,r._glTextures[this.CONTEXT_UID].texture,e)}!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture?r.stencil&&(s.deleteRenderbuffer(r.stencil),r.stencil=null):(r.stencil=r.stencil||s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,r.stencil),r.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,s.DEPTH24_STENCIL8,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,r.stencil))}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=_.NONE;if(t<=1||null===e)return s;for(let r=0;r=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&r.deleteRenderbuffer(s.msaaBuffer),s.stencil&&r.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&s.blitFramebuffer.dispose()}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;se.createVertexArrayOES(),t.bindVertexArray=t=>e.bindVertexArrayOES(t),t.deleteVertexArray=t=>e.deleteVertexArrayOES(t)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(2!==e.webGLVersion){const e=t.getExtension("ANGLE_instanced_arrays");e?(t.vertexAttribDivisor=(t,s)=>e.vertexAttribDivisorANGLE(t,s),t.drawElementsInstanced=(t,s,r,n,i)=>e.drawElementsInstancedANGLE(t,s,r,n,i),t.drawArraysInstanced=(t,s,r,n)=>e.drawArraysInstancedANGLE(t,s,r,n)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let 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 i=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==i&&(this._activeVao=i,this.hasVao?s.bindVertexArray(i):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s"float"===t.type&&1===t.size&&!t.isArray,code:t=>`\n if(uv["${t}"] !== ud["${t}"].value)\n {\n ud["${t}"].value = uv["${t}"]\n gl.uniform1f(ud["${t}"].location, uv["${t}"])\n }\n `},{test:(t,e)=>!("sampler2D"!==t.type&&"samplerCube"!==t.type&&"sampler2DArray"!==t.type||1!==t.size||t.isArray||null!=e&&void 0===e.castToBaseTexture),code:t=>`t = syncData.textureCount++;\n\n renderer.texture.bind(uv["${t}"], t);\n\n if(ud["${t}"].value !== t)\n {\n ud["${t}"].value = t;\n gl.uniform1i(ud["${t}"].location, t);\n; // eslint-disable-line max-len\n }`},{test:(t,e)=>"mat3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.a,code:t=>`\n gl.uniformMatrix3fv(ud["${t}"].location, false, uv["${t}"].toArray(true));\n `,codeUbo:t=>`\n var ${t}_matrix = uv.${t}.toArray(true);\n\n data[offset] = ${t}_matrix[0];\n data[offset+1] = ${t}_matrix[1];\n data[offset+2] = ${t}_matrix[2];\n \n data[offset + 4] = ${t}_matrix[3];\n data[offset + 5] = ${t}_matrix[4];\n data[offset + 6] = ${t}_matrix[5];\n \n data[offset + 8] = ${t}_matrix[6];\n data[offset + 9] = ${t}_matrix[7];\n data[offset + 10] = ${t}_matrix[8];\n `},{test:(t,e)=>"vec2"===t.type&&1===t.size&&!t.isArray&&void 0!==e.x,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["${t}"].location, v.x, v.y);\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `},{test:t=>"vec2"===t.type&&1===t.size&&!t.isArray,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["${t}"].location, v[0], v[1]);\n }\n `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.width,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["${t}"].location, v.x, v.y, v.width, v.height)\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `},{test:t=>"vec4"===t.type&&1===t.size&&!t.isArray,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["${t}"].location, v[0], v[1], v[2], v[3])\n }`}],ys={float:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }",vec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }",int:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",ivec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",ivec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",ivec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",uint:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }",uvec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }",uvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }",uvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }",bool:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }",bvec2:"\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",bvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",bvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",samplerCube:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",sampler2DArray:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }"},bs={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)"},_s=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Es(t){let e="";for(let s=0;s0&&(e+="\nelse "),s=n.WEBGL2&&(e=t.getContext("webgl2",{})),e||(e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),cs=e}return cs}();if(t&&t.getShaderPrecisionFormat){const e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);ls=e.precision?y.HIGH:y.MEDIUM}}return ls}())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"}static from(t,e,s){const r=t+e;let n=Kt[r];return n||(Kt[r]=n=new Ts(t,e,s)),n}}class As{constructor(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof He?e:new He(e):new He({}),this.disposeRunner=new ft("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const r=e.uniforms[s];if(r.group&&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=Ts.from(t,e);return new As(r,s)}}class Ss{constructor(){this.data=0,this.blendMode=a.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==a.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ss;return t.depthTest=!1,t.blend=!0,t}}class Is extends As{constructor(t,e,s){super(Ts.from(t||Is.defaultVertexSrc,e||Is.defaultFragmentSrc),s),this.padding=0,this.resolution=V.FILTER_RESOLUTION,this.multisample=V.FILTER_MULTISAMPLE,this.enabled=!0,this.autoFit=!0,this.state=new Ss}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"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"}}const Rs=new st;class Ms{constructor(t,e){this._texture=t,this.mapCoord=new st,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){void 0===e&&(e=t);const s=this.mapCoord;for(let r=0;r0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask(!!(1&s),!!(2&s),!!(4&s),!!(8&s))}destroy(){this.renderer=null}}Ps.extension={type:X.RendererSystem,name:"mask"},q.add(Ps);class ks{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&&(0===r?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Ds=new st,Fs=[],Bs=class extends ks{constructor(t){super(t),this.glConst=V.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,i=s.getBounds(!0,Fs.pop()??new Q);this.roundFrameToPixels(i,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),e&&i.fit(e),t._scissorRectLocal=i}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())return!1;if(Bs.isMatrixRotated(e.worldTransform))return!1;if(Bs.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){Bs.isMatrixRotated(n)||((n=n?Ds.copyFrom(n):Ds.identity()).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&&Fs.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;e=this.renderer.renderTexture.current?t.y:this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};let Ns=Bs;Ns.extension={type:X.RendererSystem,name:"scissor"},q.add(Ns);class Os extends ks{constructor(t){super(t),this.glConst=V.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;0===r&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;0!==n&&(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,0!==n&&(t._colorMask=n,s.colorMask(!!(1&n),!!(2&n),!!(4&n),!!(8&n))),this._useCurrent()}pop(t){const e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{const s=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,r=s?s._colorMask:15;0!==r&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==r&&(s._colorMask=r,e.colorMask(!!(1&r),!!(2&r),!!(4&r),!!(8&r))),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Os.extension={type:X.RendererSystem,name:"stencil"},q.add(Os);class Ls{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new st,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,i=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=i*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-i-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Ls.extension={type:X.RendererSystem,name:"projection"},q.add(Ls);const Us=new Q,Vs=new Q;class Xs{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Q,this.destinationFrame=new Q,this.viewportFrame=new Q}bind(t=null,e,s){const r=this.renderer;let n,i,a;this.current=t,t?(n=t.baseTexture,a=n.resolution,e||(Us.width=t.frame.width,Us.height=t.frame.height,e=Us),s||(Vs.x=t.frame.x,Vs.y=t.frame.y,Vs.width=e.width,Vs.height=e.height,s=Vs),i=n.framebuffer):(a=r.resolution,e||(Us.width=r._view.screen.width,Us.height=r._view.screen.height,e=Us),s||((s=Us).width=e.width,s.height=e.height));const o=this.viewportFrame;o.x=s.x*a,o.y=s.y*a,o.width=s.width*a,o.height=s.height*a,t||(o.y=r.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(i,o),this.renderer.projection.update(s,e,a,!i),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){t=this.current?t||this.current.baseTexture.clearColor:t||this.renderer.background.colorRgba;const s=this.destinationFrame,r=this.current?this.current.baseTexture:this.renderer._view.screen,n=s.width!==r.width||s.height!==r.height;if(n){let{x:t,y:e,width:s,height:r}=this.viewportFrame;t=Math.round(t),e=Math.round(e),s=Math.round(s),r=Math.round(r),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(t,e,s,r)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),n&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}function Ys(t,e,s,r,n){s.buffer.update(n)}Xs.extension={type:X.RendererSystem,name:"renderTexture"},q.add(Xs);const qs={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},js={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};class Ws{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 Gs(t,e,s){const r=t.createShader(e);return t.shaderSource(r,s),t.compileShader(r),r}function Hs(t){const e=new Array(t);for(let t=0;t`${e}: ${t}`)),r=t.getShaderInfoLog(e),n=r.split("\n"),i={},a=n.map((t=>parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1")))).filter((t=>!(!t||i[t]||(i[t]=!0,0)))),o=[""];a.forEach((t=>{s[t-1]=`%c${s[t-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));const h=s.join("\n");o[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}let Qs,Zs=0;const Ks={textureCount:0,uboCount:0};class Js{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=Zs++}systemCheck(){if(!function(){if("boolean"==typeof Qs)return Qs;try{const t=new Function("param1","param2","param3","return param1[param2] === param3;");Qs=!0===t({a:"b"},"a","b")}catch(t){Qs=!1}return Qs}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,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||(Ks.textureCount=0,Ks.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ks)),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]=function(t,e){const s=["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "];for(const r in t.uniforms){const n=e[r];if(!n){t.uniforms[r]?.group&&(t.uniforms[r].ubo?s.push(`\n renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');\n `):s.push(`\n renderer.shader.syncUniformGroup(uv.${r}, syncData);\n `));continue}const i=t.uniforms[r];let a=!1;for(let t=0;tt.index-e.index)),s}(t.uniforms,e),{uboElements:r,size:n}=function(t){const e=t.map((t=>({data:t,offset:0,dataLen:0,dirty:0})));let s=0,r=0,n=0;for(let t=0;t1&&(s=Math.max(s,16)*i.data.size),i.dataLen=s,r%s!=0&&r<16){const t=r%s%16;r+=t,n+=t}r+s>16?(n=16*Math.ceil(n/16),i.offset=n,n+=s,r=s):(i.offset=n,r+=s,n+=s)}return n=16*Math.ceil(n/16),{uboElements:e,size:n}}(s),i=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "];for(let e=0;e1){const t=fs(s.data.type),e=Math.max(js[s.data.type]/16,1),r=t/e,n=(4-r%4)%4;i.push(`\n cv = ud.${a}.value;\n v = uv.${a};\n offset = ${s.offset/4};\n\n t = 0;\n\n for(var i=0; i < ${s.data.size*e}; i++)\n {\n for(var j = 0; j < ${r}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${n};\n }\n\n `)}else{const t=qs[s.data.type];i.push(`\n cv = ud.${a}.value;\n v = uv.${a};\n offset = ${s.offset/4};\n ${t};\n `)}}return i.push("\n renderer.buffer.update(buffer);\n "),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",i.join("\n"))}}(t,this.shader.program.uniformData)),t.autoManage){const e=new Float32Array(a.size/4);t.buffer.update(e)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const r=t.uniforms,n=[`${s}-`];for(const t in r)n.push(t),e[t]&&n.push(e[t].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=function(t,e){const s=Gs(t,t.VERTEX_SHADER,e.vertexSrc),r=Gs(t,t.FRAGMENT_SHADER,e.fragmentSrc),n=t.createProgram();t.attachShader(n,s),t.attachShader(n,r);const i=e.extra?.transformFeedbackVaryings;if(i&&("function"!=typeof t.transformFeedbackVaryings||t.transformFeedbackVaryings(n,i.names,"separate"===i.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||function(t,e,s,r){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(s,t.COMPILE_STATUS)||$s(t,s),t.getShaderParameter(r,t.COMPILE_STATUS)||$s(t,r),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,n,s,r),e.attributeData=function(t,e){const s={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let n=0;nt>e?1:-1));for(let r=0;r>=1,s++;this.stateId=t.data}for(let e=0;ethis.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let r=0;rthis.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,s=!0)}if(s){let t=0;for(let s=0;s=0;e--)this.unload(t.children[e])}destroy(){this.renderer=null}}sr.extension={type:X.RendererSystem,name:"textureGC"},q.add(sr);class rr{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=c.UNSIGNED_BYTE,this.internalFormat=h.RGBA,this.samplerType=0}}class nr{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ge,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(t){let e;return e="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?{[c.UNSIGNED_BYTE]:{[h.RGBA]:t.RGBA8,[h.RGB]:t.RGB8,[h.RG]:t.RG8,[h.RED]:t.R8,[h.RGBA_INTEGER]:t.RGBA8UI,[h.RGB_INTEGER]:t.RGB8UI,[h.RG_INTEGER]:t.RG8UI,[h.RED_INTEGER]:t.R8UI,[h.ALPHA]:t.ALPHA,[h.LUMINANCE]:t.LUMINANCE,[h.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[c.BYTE]:{[h.RGBA]:t.RGBA8_SNORM,[h.RGB]:t.RGB8_SNORM,[h.RG]:t.RG8_SNORM,[h.RED]:t.R8_SNORM,[h.RGBA_INTEGER]:t.RGBA8I,[h.RGB_INTEGER]:t.RGB8I,[h.RG_INTEGER]:t.RG8I,[h.RED_INTEGER]:t.R8I},[c.UNSIGNED_SHORT]:{[h.RGBA_INTEGER]:t.RGBA16UI,[h.RGB_INTEGER]:t.RGB16UI,[h.RG_INTEGER]:t.RG16UI,[h.RED_INTEGER]:t.R16UI,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT16},[c.SHORT]:{[h.RGBA_INTEGER]:t.RGBA16I,[h.RGB_INTEGER]:t.RGB16I,[h.RG_INTEGER]:t.RG16I,[h.RED_INTEGER]:t.R16I},[c.UNSIGNED_INT]:{[h.RGBA_INTEGER]:t.RGBA32UI,[h.RGB_INTEGER]:t.RGB32UI,[h.RG_INTEGER]:t.RG32UI,[h.RED_INTEGER]:t.R32UI,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT24},[c.INT]:{[h.RGBA_INTEGER]:t.RGBA32I,[h.RGB_INTEGER]:t.RGB32I,[h.RG_INTEGER]:t.RG32I,[h.RED_INTEGER]:t.R32I},[c.FLOAT]:{[h.RGBA]:t.RGBA32F,[h.RGB]:t.RGB32F,[h.RG]:t.RG32F,[h.RED]:t.R32F,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT32F},[c.HALF_FLOAT]:{[h.RGBA]:t.RGBA16F,[h.RGB]:t.RGB16F,[h.RG]:t.RG16F,[h.RED]:t.R16F},[c.UNSIGNED_SHORT_5_6_5]:{[h.RGB]:t.RGB565},[c.UNSIGNED_SHORT_4_4_4_4]:{[h.RGBA]:t.RGBA4},[c.UNSIGNED_SHORT_5_5_5_1]:{[h.RGBA]:t.RGB5_A1},[c.UNSIGNED_INT_2_10_10_10_REV]:{[h.RGBA]:t.RGB10_A2,[h.RGBA_INTEGER]:t.RGB10_A2UI},[c.UNSIGNED_INT_10F_11F_11F_REV]:{[h.RGB]:t.R11F_G11F_B10F},[c.UNSIGNED_INT_5_9_9_9_REV]:{[h.RGB]:t.RGB9_E5},[c.UNSIGNED_INT_24_8]:{[h.DEPTH_STENCIL]:t.DEPTH24_STENCIL8},[c.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[h.DEPTH_STENCIL]:t.DEPTH32F_STENCIL8}}:{[c.UNSIGNED_BYTE]:{[h.RGBA]:t.RGBA,[h.RGB]:t.RGB,[h.ALPHA]:t.ALPHA,[h.LUMINANCE]:t.LUMINANCE,[h.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[c.UNSIGNED_SHORT_5_6_5]:{[h.RGB]:t.RGB},[c.UNSIGNED_SHORT_4_4_4_4]:{[h.RGBA]:t.RGBA},[c.UNSIGNED_SHORT_5_5_5_1]:{[h.RGBA]:t.RGBA}},e}(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let t=0;t=0;--s){const t=e[s];t&&t._glTextures[r].samplerType!==u.FLOAT&&this.renderer.texture.unbind(t)}}initTexture(t){const e=new rr(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,2===this.webGLVersion&&t.type===c.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const s=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(s,t,e))e.samplerType!==u.FLOAT&&(this.hasIntegerTextures=!0);else{const r=t.realWidth,n=t.realHeight,i=s.gl;(e.width!==r||e.height!==n||e.dirtyId<0)&&(e.width=r,e.height=n,i.texImage2D(t.target,0,e.internalFormat,r,n,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const e=this.managedTextures.indexOf(t);-1!==e&&Gt(this.managedTextures,e,1)}}updateTextureStyle(t){const e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==p.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=f.CLAMP,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==p.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===d.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const e=this.renderer.context.extensions.anisotropicFiltering;if(e&&t.anisotropicLevel>0&&t.scaleMode===d.LINEAR){const r=Math.min(t.anisotropicLevel,s.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===d.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===d.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}nr.extension={type:X.RendererSystem,name:"texture"},q.add(nr);const ir=new dt;class ar{constructor(t){this.renderer=t,this._tempMatrix=new st}generateTexture(t,e){const{region:s,...r}=e||{},n=s||t.getLocalBounds(null,!0);0===n.width&&(n.width=1),0===n.height&&(n.height=1);const i=Fe.create({width:n.width,height:n.height,...r});this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const a=t.transform;return t.transform=ir,this.renderer.render(t,{renderTexture:i,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=a,i}destroy(){}}ar.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"textureGenerator"},q.add(ar);class or{constructor(){this.clearBeforeRender=!0,this._backgroundColor=0,this._backgroundColorRgba=[0,0,0,1],this._backgroundColorString="#000000",this.color=this._backgroundColor,this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender,t.color&&(this.color="string"==typeof t.color?kt(t.color):t.color),this.alpha=t.alpha}get color(){return this._backgroundColor}set color(t){this._backgroundColor=t,this._backgroundColorString=Pt(t),Ct(t,this._backgroundColorRgba)}get alpha(){return this._backgroundColorRgba[3]}set alpha(t){this._backgroundColorRgba[3]=t}get colorRgba(){return this._backgroundColorRgba}get colorString(){return this._backgroundColorString}destroy(){}}or.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"background"},q.add(or);class hr{constructor(t){this.renderer=t}init(t){this.screen=new Q(0,0,t.width,t.height),this.element=t.view||V.ADAPTER.createCanvas(),this.resolution=t.resolution||V.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){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}}hr.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"_view"},q.add(hr);class lr{constructor(t){this.renderer=t,this.plugins={}}init(t){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}}lr.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"_plugin"},q.add(lr);class cr extends yt{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter((e=>t.systems[e])),s=[...e,...Object.keys(t.systems).filter((t=>!e.includes(t)))];for(const e of s)this.addSystem(t.systems[e],e)}addRunners(...t){t.forEach((t=>{this.runners[t]=new ft(t)}))}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const t in this.runners)this.runners[t].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach((r=>{const n=s.find((t=>this._systemsHash[t]===r));r[t.name](e[n])}))}destroy(){Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash={}}}class ur{constructor(t){this.renderer=t}run(t){const e=this.renderer;e.emitWithCustomOptions(e.runners.init,t),t.hello&&console.log(`PixiJS 7.0.4 - ${e.rendererLogId} - https://pixijs.com`),e.resize(this.renderer.screen.width,this.renderer.screen.height)}destroy(){}}ur.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"startup"},q.add(ur);class dr{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 n=0;n0&&(e+="\nelse "),sthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,MAX_TEXTURES:e}=this,s=Tr._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,i=this.renderer.textureGC.count;let a=++ge._globalBatch,o=0,h=s[0],l=0;r.copyBoundTextures(n,e);for(let c=0;c=e&&(r.boundArray(h,n,a,e),this.buildDrawCalls(h,l,c),l=c,h=s[++o],++a),u._batchEnabled=a,u.touched=i,h.elements[h.count++]=u)}h.count>0&&(r.boundArray(h,n,a,e),this.buildDrawCalls(h,l,this._bufferSize),++o,++a);for(let t=0;t=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const s=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,s)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],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=_.HIGH?this.multisample=_.HIGH:e>=_.MEDIUM?this.multisample=_.MEDIUM:e>=_.LOW?this.multisample=_.LOW:this.multisample=_.NONE}destroy(){}}Rr.extension={type:X.RendererSystem,name:"_multisample"},q.add(Rr);class Mr{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let r,n,i,a;if(e&&(r=e.renderTexture,n=e.clear,i=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!r,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=i,!s.context.isLost){if(r||(this.lastObjectRendered=t),!a){const e=t.enableTempParent();t.updateTransform(),t.disableTempParent(e)}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}}Mr.extension={type:X.RendererSystem,name:"objectRenderer"},q.add(Mr)},6141:(t,e,s)=>{"use strict";s.d(e,{cz:()=>n,mc:()=>h,q9:()=>i});var r=s(8626);r.W0.SORTABLE_CHILDREN=!1;class n{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?r.M_.EMPTY:((t=t||new r.M_(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:s,b:r,c:n,d:i,tx:a,ty:o}=t,h=s*e.x+n*e.y+a,l=r*e.x+i*e.y+o;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)}addQuad(t){let e=this.minX,s=this.minY,r=this.maxX,n=this.maxY,i=t[0],a=t[1];e=ir?i:r,n=a>n?a:n,i=t[2],a=t[3],e=ir?i:r,n=a>n?a:n,i=t[4],a=t[5],e=ir?i:r,n=a>n?a:n,i=t[6],a=t[7],e=ir?i:r,n=a>n?a: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 i=t.a,a=t.b,o=t.c,h=t.d,l=t.tx,c=t.ty;let u=this.minX,d=this.minY,f=this.maxX,p=this.maxY,m=i*e+o*s+l,g=a*e+h*s+c;u=mf?m:f,p=g>p?g:p,m=i*r+o*s+l,g=a*r+h*s+c,u=mf?m:f,p=g>p?g:p,m=i*e+o*n+l,g=a*e+h*n+c,u=mf?m:f,p=g>p?g:p,m=i*r+o*n+l,g=a*r+h*n+c,u=mf?m:f,p=g>p?g:p,this.minX=u,this.minY=d,this.maxX=f,this.maxY=p}addVertexData(t,e,s){let r=this.minX,n=this.minY,i=this.maxX,a=this.maxY;for(let o=e;oi?e:i,a=s>a?s:a}this.minX=r,this.minY=n,this.maxX=i,this.maxY=a}addVertices(t,e,s,r){this.addVerticesMatrix(t.worldTransform,e,s,r)}addVerticesMatrix(t,e,s,r,n=0,i=n){const a=t.a,o=t.b,h=t.c,l=t.d,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY;for(let t=s;tr?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.maxXa?n:a,this.maxY=i>o?i:o}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const s=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxXa?n:a,this.maxY=i>o?i:o}}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,i){t-=n,e-=i,s+=n,r+=i,this.minX=this.minXs?this.maxX:s,this.minY=this.minYr?this.maxY:r}}class i extends r.Wp.EventEmitter{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new r.dL,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 n,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s1)for(let e=0;ethis.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),r=this.getChildIndex(e);this.children[s]=e,this.children[r]=t,this.onChildrenChange(s=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);r.Wp.removeItems(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e0&&r<=e){n=this.children.splice(s,r);for(let t=0;t1&&this.children.sort(o),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t0&&e.height>0))return;let s,r;if(this.cullArea?(s=this.cullArea,r=this.worldTransform):this._render!==h.prototype._render&&(s=this.getBounds(!0)),s&&e.intersects(s,r))this._render(t);else if(this.cullArea)return;for(let e=0,s=this.children.length;e{"use strict";s.d(e,{A1:()=>k});var r=(t=>(t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t))(r||{}),n=(t=>(t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t))(n||{});const i={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let s=Math.ceil(t/this.maxLength);return sthis.maxSegments&&(s=this.maxSegments),s}};var a=s(8626);class o{constructor(){this.color=16777215,this.alpha=1,this.texture=a.gP.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new o;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=a.gP.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}function h(t,e=!1){const s=t.length;if(s<6)return;let r=0;for(let e=0,n=t[s-2],i=t[s-1];e0||e&&r<=0){const e=s/2;for(let r=e+e%2;r=6){h(s,!1);const t=[];for(let e=0;e=0&&h>=0&&n>=0&&i>=0))return void(e.length=0);const l=Math.ceil(2.3*Math.sqrt(o+h)),c=8*l+(n?4:0)+(i?4:0);if(e.length=c,0===c)return;if(0===l)return e.length=8,e[0]=e[6]=s+n,e[1]=e[3]=r+i,e[2]=e[4]=s-n,void(e[5]=e[7]=r-i);let u=0,d=4*l+(n?2:0)+2,f=d,p=c;{const t=n+o,a=i,h=s+t,l=s-t,c=r+a;if(e[u++]=h,e[u++]=c,e[--d]=c,e[--d]=l,i){const t=r-a;e[f++]=l,e[f++]=t,e[--p]=t,e[--p]=h}}for(let t=1;t=0&&i>=0&&a.push(s,r,s+n,r,s+n,r+i,s,r+i)},triangulate(t,e){const s=t.points,r=e.points;if(0===s.length)return;const n=r.length/2;r.push(s[0],s[1],s[2],s[3],s[6],s[7],s[4],s[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},d={build(t){c.build(t)},triangulate(t,e){c.triangulate(t,e)}};function f(t,e,s,r,n,i,a,o){let h,l;a?(h=r,l=-s):(h=-r,l=s);const c=t-s*n+h,u=e-r*n+l,d=t+s*i+h,f=e+r*i+l;return o.push(c,u),o.push(d,f),2}function p(t,e,s,r,n,i,a,o){const h=s-t,l=r-e;let c=Math.atan2(h,l),u=Math.atan2(n-t,i-e);o&&cu&&(u+=2*Math.PI);let d=c;const f=u-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=1+(15*p*Math.sqrt(m)/Math.PI|0),x=f/g;if(d+=x,o){a.push(t,e),a.push(s,r);for(let s=1,r=d;s=0&&(l.join===r.ROUND?y+=p(A,S,A-M*B,S-C*B,A-P*B,S-k*B,g,!1)+4:y+=2,g.push(A-P*N,S-k*N),g.push(A+P*B,S+k*B));continue}const u=(-M+v)*(-C+S)-(-M+A)*(-C+T),d=(-P+I)*(-k+S)-(-P+A)*(-k+R),f=(e*d-n*u)/h,m=(i*u-s*d)/h,x=(f-A)*(f-A)+(m-S)*(m-S),b=A+(f-A)*B,F=S+(m-S)*B,O=A-(f-A)*N,L=S-(m-S)*N,U=c?B:N;x<=Math.min(e*e+s*s,n*n+i*i)+U*U*E?l.join===r.BEVEL||x/E>w?(c?(g.push(b,F),g.push(A+M*N,S+C*N),g.push(b,F),g.push(A+P*N,S+k*N)):(g.push(A-M*B,S-C*B),g.push(O,L),g.push(A-P*B,S-k*B),g.push(O,L)),y+=2):l.join===r.ROUND?c?(g.push(b,F),g.push(A+M*N,S+C*N),y+=p(A,S,A+M*N,S+C*N,A+P*N,S+k*N,g,!0)+4,g.push(b,F),g.push(A+P*N,S+k*N)):(g.push(A-M*B,S-C*B),g.push(O,L),y+=p(A,S,A-M*B,S-C*B,A-P*B,S-k*B,g,!1)+4,g.push(A-P*B,S-k*B),g.push(O,L)):(g.push(b,F),g.push(O,L)):(g.push(A-M*B,S-C*B),g.push(A+M*N,S+C*N),l.join===r.ROUND?y+=c?p(A,S,A+M*N,S+C*N,A+P*N,S+k*N,g,!0)+2:p(A,S,A-M*B,S-C*B,A-P*B,S-k*B,g,!1)+2:l.join===r.MITER&&x/E<=w&&(c?(g.push(O,L),g.push(O,L)):(g.push(b,F),g.push(b,F)),y+=2),g.push(A-P*B,S-k*B),g.push(A+P*N,S+k*N),y+=2)}v=o[2*(x-2)],T=o[2*(x-2)+1],A=o[2*(x-1)],S=o[2*(x-1)+1],M=-(T-S),C=v-A,D=Math.sqrt(M*M+C*C),M/=D,C/=D,M*=_,C*=_,g.push(A-M*B,S-C*B),g.push(A+M*N,S+C*N),d||(l.cap===n.ROUND?y+=p(A-M*(B-N)*.5,S-C*(B-N)*.5,A-M*B,S-C*B,A+M*N,S+C*N,g,!1)+2:l.cap===n.SQUARE&&(y+=f(A,S,M,C,B,N,!1,g)));const O=e.indices,L=i.epsilon*i.epsilon;for(let t=b;tc*o}}static arc(t,e,s,r,n,o,h,l,c){const u=h-o,d=i._segmentsCount(Math.abs(u)*n,40*Math.ceil(Math.abs(u)/a.TO)),f=u/(2*d),p=2*f,m=Math.cos(f),g=Math.sin(f),x=d-1,y=x%1/x;for(let t=0;t<=x;++t){const e=f+o+p*(t+y*t),i=Math.cos(e),a=-Math.sin(e);c.push((m*i+g*a)*n+s,(m*-a+g*i)*n+r)}}}class x{static curveLength(t,e,s,r,n,i,a,o){let h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0,x=0,y=0,b=t,_=e;for(let E=1;E<=10;++E)l=E/10,c=l*l,u=c*l,d=1-l,f=d*d,p=f*d,m=p*t+3*f*l*s+3*d*c*n+u*a,g=p*e+3*f*l*r+3*d*c*i+u*o,x=b-m,y=_-g,b=m,_=g,h+=Math.sqrt(x*x+y*y);return h}static curveTo(t,e,s,r,n,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const c=i._segmentsCount(x.curveLength(h,l,t,e,s,r,n,a));let u=0,d=0,f=0,p=0,m=0;o.push(h,l);for(let i=1,g=0;i<=c;++i)g=i/c,u=1-g,d=u*u,f=d*u,p=g*g,m=p*g,o.push(f*h+3*d*g*t+3*u*p*s+m*n,f*l+3*d*g*e+3*u*p*r+m*a)}}class y{static curveLength(t,e,s,r,n,i){const a=t-2*s+n,o=e-2*r+i,h=2*s-2*t,l=2*r-2*e,c=4*(a*a+o*o),u=4*(a*h+o*l),d=h*h+l*l,f=2*Math.sqrt(c+u+d),p=Math.sqrt(c),m=2*c*p,g=2*Math.sqrt(d),x=u/p;return(m*f+p*u*(f-g)+(4*d*c-u*u)*Math.log((2*p+x+f)/(x+g)))/(4*m)}static curveTo(t,e,s,r,n){const a=n[n.length-2],o=n[n.length-1],h=i._segmentsCount(y.curveLength(a,o,t,e,s,r));let l=0,c=0;for(let i=1;i<=h;++i){const u=i/h;l=a+(t-a)*u,c=o+(e-o)*u,n.push(l+(t+(s-t)*u-l)*u,c+(e+(r-e)*u-c)*u)}}}const b={[a.HY.POLY]:l,[a.HY.CIRC]:c,[a.HY.ELIP]:c,[a.HY.RECT]:u,[a.HY.RREC]:d},_=[],E=[];class w{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 w(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}}var v=s(6141);class T{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}const A=new a.bR,S=class extends a.JH{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 v.cz,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;t0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,r=null){const n=new w(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 w(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=r.lineStyle,r.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t0&&(s=this.batches[this.batches.length-1],r=s.style);for(let n=this.shapeIndex;n65535;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;t131070)return!1;const t=this.batches;for(let e=0;e0&&(r=E.pop(),r||(r=new a.hq,r.texArray=new a.cc),this.drawCalls.push(r)),r.start=c,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=a.uR.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,c+=d.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,o,d.attribSize,d.attribStart)}a.t5._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),i=new Float32Array(n),a=new Uint32Array(n);let o=0;for(let n=0;n>16)+(65280&e)+((255&e)<<16),o=a.Wp.premultiplyTint(i,s);t.length=Math.max(t.length,n+r);for(let e=0;e0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},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 a.tS,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new a.tS,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?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,r){this._initCurve();const n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),y.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,i){return this._initCurve(),x.curveTo(t,e,s,r,n,i,this.currentPath.points),this}arcTo(t,e,s,r,n){this._initCurve(t,e);const i=this.currentPath.points,a=g.curveTo(t,e,s,r,n,i);if(a){const{cx:t,cy:e,radius:s,startAngle:r,endAngle:n,anticlockwise:i}=a;this.arc(t,e,s,r,n,i)}return this}arc(t,e,s,r,n,i=!1){if(r===n)return this;if(!i&&n<=r?n+=a.TO:i&&r<=n&&(r+=a.TO),0==n-r)return this;const o=t+Math.cos(r)*s,h=e+Math.sin(r)*s,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const t=Math.abs(c[c.length-2]-o),e=Math.abs(c[c.length-1]-h);t0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,r){return this.drawShape(new a.M_(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new a.TE(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new a.jl(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new a.Pp(t,e,s,r))}drawPolygon(...t){let e,s=!0;const r=t[0];r.points?(s=r.closeStroke,e=r.points):e=Array.isArray(t[0])?t[0]:t;const n=new a.tS(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!(1!==t.length||t[0].shape.type!==a.HY.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>16&255)/255*n,i.tint[1]=(r>>8&255)/255*n,i.tint[2]=(255&r)/255*n,i.tint[3]=n,t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let e=0,r=a.length;e>16)+(65280&n)+((255&n)<<16)}}}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,i=e.d,a=e.tx,o=e.ty,h=this._geometry.points,l=this.vertexData;let c=0;for(let t=0;t{"use strict";s.d(e,{g:()=>i});var r=s(4593);r.u,r.u;var n=s(8626);r.e,r.e;class i extends r.e{constructor(t=n.gP.EMPTY,e,s,i,a){const o=new r.u(e,s,i);o.getBuffer("aVertexPosition").static=!1,super(o,new r.PX(t),null,a),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)}}},4593:(t,e,s)=>{"use strict";s.d(e,{e:()=>l,u:()=>u,PX:()=>c});var r=s(8626),n=s(6141);class i{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 a=new r.bR,o=new r.tS,h=class extends n.mc{constructor(t,e,s,n=r._4.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||r.Uw.for2d(),this.drawMode=n,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=r.W0.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get 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===r._4.TRIANGLES&&e.length<2*h.BATCHABLE_SIZE?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 n=this.transform.worldTransform,i=n.a,a=n.b,o=n.c,h=n.d,l=n.tx,c=n.ty,u=this.vertexData;for(let t=0;t>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)}get tint(){return this._tint}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture;r.Wp.premultiplyTintToRgba(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class u extends r.V2{constructor(t,e,s){super();const n=new r.hp(t),i=new r.hp(e,!0),a=new r.hp(s,!0,!0);this.addAttribute("aVertexPosition",n,2,!1,r.QE.FLOAT).addAttribute("aTextureCoord",i,2,!1,r.QE.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}},668:(t,e,s)=>{"use strict";s.d(e,{k:()=>o});var r=s(8626),n=s(6141);const i=new r.bR,a=new Uint16Array([0,1,2,0,2,3]);class o extends n.mc{constructor(t){super(),this._anchor=new r.oA(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tint=null,this._tintRGB=null,this.tint=16777215,this.blendMode=r.B9.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||r.gP.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=a,this.pluginName="batch",this.isSprite=!0,this._roundPixels=r.W0.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=r.Wp.sign(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=r.Wp.sign(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,n=e.b,i=e.c,a=e.d,o=e.tx,h=e.ty,l=this.vertexData,c=t.trim,u=t.orig,d=this._anchor;let f=0,p=0,m=0,g=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,g=c.y-d._y*u.height,m=g+c.height):(p=-d._x*u.width,f=p+u.width,g=-d._y*u.height,m=g+u.height),l[0]=s*p+i*g+o,l[1]=a*g+n*p+h,l[2]=s*f+i*g+o,l[3]=a*g+n*f+h,l[4]=s*f+i*m+o,l[5]=a*m+n*f+h,l[6]=s*p+i*m+o,l[7]=a*m+n*p+h,this._roundPixels){const t=r.W0.RESOLUTION;for(let e=0;e=r&&i.x=n&&i.y>16)+(65280&t)+((255&t)<<16)}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||r.gP.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}},6424:(t,e,s)=>{"use strict";s.d(e,{yE:()=>$s});var r={};s.r(r),s.d(r,{Animation:()=>I,AnimationState:()=>st,AnimationStateAdapter2:()=>ht,AnimationStateData:()=>ct,AtlasAttachmentLoader:()=>ut,Attachment:()=>f,AttachmentTimeline:()=>X,Bone:()=>dt,BoneData:()=>ft,BoundingBoxAttachment:()=>g,ClippingAttachment:()=>x,ColorTimeline:()=>L,CurveTimeline:()=>C,DeformTimeline:()=>q,DrawOrderTimeline:()=>W,Event:()=>pt,EventData:()=>mt,EventQueue:()=>at,EventTimeline:()=>j,EventType:()=>ot,IkConstraint:()=>gt,IkConstraintData:()=>xt,IkConstraintTimeline:()=>H,JitterEffect:()=>T,MeshAttachment:()=>y,PathAttachment:()=>b,PathConstraint:()=>Et,PathConstraintData:()=>yt,PathConstraintMixTimeline:()=>tt,PathConstraintPositionTimeline:()=>Z,PathConstraintSpacingTimeline:()=>K,PointAttachment:()=>_,RegionAttachment:()=>v,RotateTimeline:()=>k,ScaleTimeline:()=>B,ShearTimeline:()=>N,Skeleton:()=>Tt,SkeletonBounds:()=>At,SkeletonData:()=>St,SkeletonJson:()=>Ct,Skin:()=>Mt,Slot:()=>E,SlotData:()=>It,SpacingMode:()=>bt,Spine:()=>kt,SwirlEffect:()=>S,TimelineType:()=>R,TrackEntry:()=>nt,TransformConstraint:()=>wt,TransformConstraintData:()=>Rt,TransformConstraintTimeline:()=>$,TranslateTimeline:()=>F,TwoColorTimeline:()=>V,VertexAttachment:()=>m});var n={};s.r(n),s.d(n,{AlphaTimeline:()=>ce,Animation:()=>Ht,AnimationState:()=>Ie,AnimationStateAdapter:()=>ke,AnimationStateData:()=>Ve,AtlasAttachmentLoader:()=>Xe,Attachment:()=>Dt,AttachmentTimeline:()=>fe,Bone:()=>Ye,BoneData:()=>qe,BoundingBoxAttachment:()=>Nt,ClippingAttachment:()=>Ot,ConstraintData:()=>je,CurveTimeline:()=>$t,CurveTimeline1:()=>Qt,CurveTimeline2:()=>Zt,DeformTimeline:()=>pe,DrawOrderTimeline:()=>ye,Event:()=>We,EventData:()=>Ge,EventQueue:()=>Ce,EventTimeline:()=>ge,EventType:()=>Pe,IkConstraint:()=>He,IkConstraintData:()=>ze,IkConstraintTimeline:()=>be,MeshAttachment:()=>Lt,PathAttachment:()=>Ut,PathConstraint:()=>Ke,PathConstraintData:()=>$e,PathConstraintMixTimeline:()=>ve,PathConstraintPositionTimeline:()=>Ee,PathConstraintSpacingTimeline:()=>we,PointAttachment:()=>Vt,RGB2Timeline:()=>de,RGBA2Timeline:()=>ue,RGBATimeline:()=>he,RGBTimeline:()=>le,RegionAttachment:()=>Yt,RotateTimeline:()=>Kt,ScaleTimeline:()=>se,ScaleXTimeline:()=>re,ScaleYTimeline:()=>ne,Sequence:()=>jt,SequenceMode:()=>Wt,SequenceModeValues:()=>Gt,SequenceTimeline:()=>Ae,ShearTimeline:()=>ie,ShearXTimeline:()=>ae,ShearYTimeline:()=>oe,Skeleton:()=>ss,SkeletonBinary:()=>hs,SkeletonBounds:()=>Os,SkeletonData:()=>rs,SkeletonJson:()=>Ls,Skin:()=>os,SkinEntry:()=>as,Slot:()=>Je,SlotData:()=>ns,SpacingMode:()=>Qe,Spine:()=>js,Timeline:()=>zt,TrackEntry:()=>Me,TransformConstraint:()=>ts,TransformConstraintData:()=>is,TransformConstraintTimeline:()=>_e,TranslateTimeline:()=>Jt,TranslateXTimeline:()=>te,TranslateYTimeline:()=>ee,VertexAttachment:()=>Bt});var i=s(5265),a=s(3912),o=s(8626);const h={extension:o.Ag.Asset,loader:{extension:{type:o.Ag.LoadParser,priority:a.T9.Normal},test:t=>(0,a.WO)(t,".atlas"),async load(t){const e=await o.W0.ADAPTER.fetch(t);return await e.text()},testParse(t,e){const s=(0,a.WO)(e.src,".atlas"),r="string"==typeof t;return Promise.resolve(s&&r)},async parse(t,e,s){const r=e.data;let n=o.Wp.path.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a=null,h=null;const c=new Promise(((t,e)=>{a=t,h=e}));let u;const d=t=>{t||h("Something went terribly wrong loading a spine .atlas file\nMost likely your texture failed to load."),a(u)};if(r.image||r.images){const e=Object.assign(r.image?{default:r.image}:{},r.images);u=new i.Lw(t,((t,s)=>{const r=e[t]||e.default;r&&r.baseTexture?s(r.baseTexture):s(r)}),d)}else u=new i.Lw(t,l(s,n,r.imageMetadata),d);return await c},unload(t){t.dispose()}}},l=(t,e,s)=>async(r,n)=>{const i=o.Wp.path.normalize([...e.split(o.Wp.path.sep),r].join(o.Wp.path.sep));n((await t.load({src:i,data:s})).baseTexture)};function c(t){return t.hasOwnProperty("bones")}o.XO.add(h);class u{constructor(){}installLoader(){const t=this,e={extension:o.Ag.Asset,loader:{extension:{type:o.Ag.LoadParser,priority:a.T9.Normal},test:t=>(0,a.WO)(t,".skel"),async load(t){const e=await o.W0.ADAPTER.fetch(t);return await e.arrayBuffer()},testParse(t,e){const s=(0,a.WO)(e.src,".json")&&c(t),r=(0,a.WO)(e.src,".skel")&&t instanceof ArrayBuffer,n=!1===e.data?.spineAtlas;return Promise.resolve(s&&!n||r)},async parse(e,s,r){const n=o.Wp.path.extname(s.src).toLowerCase(),h=o.Wp.path.basename(s.src,n);let u=o.Wp.path.dirname(s.src);u&&u.lastIndexOf("/")!==u.length-1&&(u+="/");let d=null,f=e;(0,a.WO)(s.src,".json")&&c(e)?d=t.createJsonParser():(d=t.createBinaryParser(),f=new Uint8Array(e));const p=s.data||{},m=p?.spineSkeletonScale??null;m&&(d.scale=m);const g=p.spineAtlas;if(g&&g.pages)return t.parseData(d,g,f);const x=p.atlasRawData;if(x){let e=null,s=null;const n=new Promise(((t,r)=>{e=t,s=r})),a=new i.Lw(x,l(r,u,p.imageMetadata),(t=>{t||s("Something went terribly wrong loading a spine .atlas file\nMost likely your texture failed to load."),e(a)})),o=await n;return t.parseData(d,o,f)}let y=p.spineAtlasFile;y||(y=`${u+h}.atlas`);const b=await r.load({src:y,data:p,alias:p.spineAtlasAlias});return t.parseData(d,b,f)}}};return o.XO.add(e),e}}var d=s(5315);class f{constructor(t){if(null==t)throw new Error("name cannot be null.");this.name=t}}const p=class extends f{constructor(t){super(t),this.id=(65535&p.nextID++)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,i){s=n+(s>>1)*i;const a=t.bone.skeleton,o=t.attachmentVertices;let h=this.vertices;const l=this.bones;if(null==l){o.length>0&&(h=o);const a=t.bone.matrix,l=a.tx,c=a.ty,u=a.a,d=a.c,f=a.b,p=a.d;for(let t=e,a=n;a0&&(e%=this.duration));const h=this.timelines;for(let r=0,l=h.length;r>>1;for(;;){if(t[(i+1)*s]<=e?r=i+1:n=i,r==n)return(r+1)*s;i=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}}var R=(t=>(t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor",t))(R||{});const M=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=i.Aq.newFloatArray((t-1)*M.BEZIER_SIZE)}getFrameCount(){return this.curves.length/M.BEZIER_SIZE+1}setLinear(t){this.curves[t*M.BEZIER_SIZE]=M.LINEAR}setStepped(t){this.curves[t*M.BEZIER_SIZE]=M.STEPPED}getCurveType(t){const e=t*M.BEZIER_SIZE;if(e==this.curves.length)return M.LINEAR;const s=this.curves[e];return s==M.LINEAR?M.LINEAR:s==M.STEPPED?M.STEPPED:M.BEZIER}setCurve(t,e,s,r,n){const i=.03*(2*-e+r),a=.03*(2*-s+n),o=.006*(3*(e-r)+1),h=.006*(3*(s-n)+1);let l=2*i+o,c=2*a+h,u=.3*e+i+.16666667*o,d=.3*s+a+.16666667*h,f=t*M.BEZIER_SIZE;const p=this.curves;p[f++]=M.BEZIER;let m=u,g=d;for(let t=f+M.BEZIER_SIZE-1;f=e){let n,i;return r==t?(n=0,i=0):(n=s[r-2],i=s[r-1]),i+(s[r+1]-i)*(e-n)/(a-n)}const o=s[r-1];return o+(1-o)*(e-a)/(1-a)}};let C=M;C.LINEAR=0,C.STEPPED=1,C.BEZIER=2,C.BEZIER_SIZE=19;const P=class extends C{constructor(t){super(t),this.frames=i.Aq.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+P.ROTATION]=s}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.bones[this.boneIndex];if(s=h[h.length-P.ENTRIES]){let t=h[h.length+P.PREV_ROTATION];switch(a){case i.qU.setup:l.rotation=l.data.rotation+t*n;break;case i.qU.first:case i.qU.replace:t+=l.data.rotation-l.rotation,t-=360*(16384-(16384.499999999996-t/360|0));case i.qU.add:l.rotation+=t*n}return}const c=I.binarySearch(h,s,P.ENTRIES),u=h[c+P.PREV_ROTATION],d=h[c],f=this.getCurvePercent((c>>1)-1,1-(s-d)/(h[c+P.PREV_TIME]-d));let p=h[c+P.ROTATION]-u;switch(p=u+(p-360*(16384-(16384.499999999996-p/360|0)))*f,a){case i.qU.setup:l.rotation=l.data.rotation+(p-360*(16384-(16384.499999999996-p/360|0)))*n;break;case i.qU.first:case i.qU.replace:p+=l.data.rotation-l.rotation;case i.qU.add:l.rotation+=(p-360*(16384-(16384.499999999996-p/360|0)))*n}}};let k=P;k.ENTRIES=2,k.PREV_TIME=-2,k.PREV_ROTATION=-1,k.ROTATION=1;const D=class extends C{constructor(t){super(t),this.frames=i.Aq.newFloatArray(t*D.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,r){t*=D.ENTRIES,this.frames[t]=e,this.frames[t+D.X]=s,this.frames[t+D.Y]=r}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.bones[this.boneIndex];if(s=h[h.length-D.ENTRIES])c=h[h.length+D.PREV_X],u=h[h.length+D.PREV_Y];else{const t=I.binarySearch(h,s,D.ENTRIES);c=h[t+D.PREV_X],u=h[t+D.PREV_Y];const e=h[t],r=this.getCurvePercent(t/D.ENTRIES-1,1-(s-e)/(h[t+D.PREV_TIME]-e));c+=(h[t+D.X]-c)*r,u+=(h[t+D.Y]-u)*r}switch(a){case i.qU.setup:l.x=l.data.x+c*n,l.y=l.data.y+u*n;break;case i.qU.first:case i.qU.replace:l.x+=(l.data.x+c-l.x)*n,l.y+=(l.data.y+u-l.y)*n;break;case i.qU.add:l.x+=c*n,l.y+=u*n}}};let F=D;F.ENTRIES=3,F.PREV_TIME=-3,F.PREV_X=-2,F.PREV_Y=-1,F.X=1,F.Y=2;class B extends F{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.bones[this.boneIndex];if(s=h[h.length-B.ENTRIES])c=h[h.length+B.PREV_X]*l.data.scaleX,u=h[h.length+B.PREV_Y]*l.data.scaleY;else{const t=I.binarySearch(h,s,B.ENTRIES);c=h[t+B.PREV_X],u=h[t+B.PREV_Y];const e=h[t],r=this.getCurvePercent(t/B.ENTRIES-1,1-(s-e)/(h[t+B.PREV_TIME]-e));c=(c+(h[t+B.X]-c)*r)*l.data.scaleX,u=(u+(h[t+B.Y]-u)*r)*l.data.scaleY}if(1==n)a==i.qU.add?(l.scaleX+=c-l.data.scaleX,l.scaleY+=u-l.data.scaleY):(l.scaleX=c,l.scaleY=u);else{let t=0,e=0;if(o==i.mj.mixOut)switch(a){case i.qU.setup:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(c)*i.cj.signum(t)-t)*n,l.scaleY=e+(Math.abs(u)*i.cj.signum(e)-e)*n;break;case i.qU.first:case i.qU.replace:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(c)*i.cj.signum(t)-t)*n,l.scaleY=e+(Math.abs(u)*i.cj.signum(e)-e)*n;break;case i.qU.add:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(c)*i.cj.signum(t)-l.data.scaleX)*n,l.scaleY=e+(Math.abs(u)*i.cj.signum(e)-l.data.scaleY)*n}else switch(a){case i.qU.setup:t=Math.abs(l.data.scaleX)*i.cj.signum(c),e=Math.abs(l.data.scaleY)*i.cj.signum(u),l.scaleX=t+(c-t)*n,l.scaleY=e+(u-e)*n;break;case i.qU.first:case i.qU.replace:t=Math.abs(l.scaleX)*i.cj.signum(c),e=Math.abs(l.scaleY)*i.cj.signum(u),l.scaleX=t+(c-t)*n,l.scaleY=e+(u-e)*n;break;case i.qU.add:t=i.cj.signum(c),e=i.cj.signum(u),l.scaleX=Math.abs(l.scaleX)*t+(c-Math.abs(l.data.scaleX)*t)*n,l.scaleY=Math.abs(l.scaleY)*e+(u-Math.abs(l.data.scaleY)*e)*n}}}}class N extends F{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.bones[this.boneIndex];if(s=h[h.length-N.ENTRIES])c=h[h.length+N.PREV_X],u=h[h.length+N.PREV_Y];else{const t=I.binarySearch(h,s,N.ENTRIES);c=h[t+N.PREV_X],u=h[t+N.PREV_Y];const e=h[t],r=this.getCurvePercent(t/N.ENTRIES-1,1-(s-e)/(h[t+N.PREV_TIME]-e));c+=(h[t+N.X]-c)*r,u+=(h[t+N.Y]-u)*r}switch(a){case i.qU.setup:l.shearX=l.data.shearX+c*n,l.shearY=l.data.shearY+u*n;break;case i.qU.first:case i.qU.replace:l.shearX+=(l.data.shearX+c-l.shearX)*n,l.shearY+=(l.data.shearY+u-l.shearY)*n;break;case i.qU.add:l.shearX+=c*n,l.shearY+=u*n}}}const O=class extends C{constructor(t){super(t),this.frames=i.Aq.newFloatArray(t*O.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,r,n,i){t*=O.ENTRIES,this.frames[t]=e,this.frames[t+O.R]=s,this.frames[t+O.G]=r,this.frames[t+O.B]=n,this.frames[t+O.A]=i}apply(t,e,s,r,n,a,o){const h=t.slots[this.slotIndex],l=this.frames;if(s=l[l.length-O.ENTRIES]){const t=l.length;c=l[t+O.PREV_R],u=l[t+O.PREV_G],d=l[t+O.PREV_B],f=l[t+O.PREV_A]}else{const t=I.binarySearch(l,s,O.ENTRIES);c=l[t+O.PREV_R],u=l[t+O.PREV_G],d=l[t+O.PREV_B],f=l[t+O.PREV_A];const e=l[t],r=this.getCurvePercent(t/O.ENTRIES-1,1-(s-e)/(l[t+O.PREV_TIME]-e));c+=(l[t+O.R]-c)*r,u+=(l[t+O.G]-u)*r,d+=(l[t+O.B]-d)*r,f+=(l[t+O.A]-f)*r}if(1==n)h.color.set(c,u,d,f);else{const t=h.color;a==i.qU.setup&&t.setFromColor(h.data.color),t.add((c-t.r)*n,(u-t.g)*n,(d-t.b)*n,(f-t.a)*n)}}};let L=O;L.ENTRIES=5,L.PREV_TIME=-5,L.PREV_R=-4,L.PREV_G=-3,L.PREV_B=-2,L.PREV_A=-1,L.R=1,L.G=2,L.B=3,L.A=4;const U=class extends C{constructor(t){super(t),this.frames=i.Aq.newFloatArray(t*U.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,r,n,i,a,o,h){t*=U.ENTRIES,this.frames[t]=e,this.frames[t+U.R]=s,this.frames[t+U.G]=r,this.frames[t+U.B]=n,this.frames[t+U.A]=i,this.frames[t+U.R2]=a,this.frames[t+U.G2]=o,this.frames[t+U.B2]=h}apply(t,e,s,r,n,a,o){const h=t.slots[this.slotIndex],l=this.frames;if(s=l[l.length-U.ENTRIES]){const t=l.length;c=l[t+U.PREV_R],u=l[t+U.PREV_G],d=l[t+U.PREV_B],f=l[t+U.PREV_A],p=l[t+U.PREV_R2],m=l[t+U.PREV_G2],g=l[t+U.PREV_B2]}else{const t=I.binarySearch(l,s,U.ENTRIES);c=l[t+U.PREV_R],u=l[t+U.PREV_G],d=l[t+U.PREV_B],f=l[t+U.PREV_A],p=l[t+U.PREV_R2],m=l[t+U.PREV_G2],g=l[t+U.PREV_B2];const e=l[t],r=this.getCurvePercent(t/U.ENTRIES-1,1-(s-e)/(l[t+U.PREV_TIME]-e));c+=(l[t+U.R]-c)*r,u+=(l[t+U.G]-u)*r,d+=(l[t+U.B]-d)*r,f+=(l[t+U.A]-f)*r,p+=(l[t+U.R2]-p)*r,m+=(l[t+U.G2]-m)*r,g+=(l[t+U.B2]-g)*r}if(1==n)h.color.set(c,u,d,f),h.darkColor.set(p,m,g,1);else{const t=h.color,e=h.darkColor;a==i.qU.setup&&(t.setFromColor(h.data.color),e.setFromColor(h.data.darkColor)),t.add((c-t.r)*n,(u-t.g)*n,(d-t.b)*n,(f-t.a)*n),e.add((p-e.r)*n,(m-e.g)*n,(g-e.b)*n,0)}}};let V=U;V.ENTRIES=8,V.PREV_TIME=-8,V.PREV_R=-7,V.PREV_G=-6,V.PREV_B=-5,V.PREV_A=-4,V.PREV_R2=-3,V.PREV_G2=-2,V.PREV_B2=-1,V.R=1,V.G=2,V.B=3,V.A=4,V.R2=5,V.G2=6,V.B2=7;class X{constructor(t){this.frames=i.Aq.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,o){const h=t.slots[this.slotIndex];if(o==i.mj.mixOut&&a==i.qU.setup){const e=h.data.attachmentName;return void h.setAttachment(null==e?null:t.getAttachment(this.slotIndex,e))}const l=this.frames;if(s=l[l.length-1]?l.length-1:I.binarySearch(l,s,1)-1;const u=this.attachmentNames[c];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}let Y=null;class q extends C{constructor(t){super(t),this.frames=i.Aq.newFloatArray(t),this.frameVertices=new Array(t),null==Y&&(Y=i.Aq.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,o){const h=t.slots[this.slotIndex],l=h.getAttachment();if(!(l instanceof m&&l.applyDeform(this.attachment)))return;const c=h.attachmentVertices;0==c.length&&(a=i.qU.setup);const u=this.frameVertices,d=u[0].length,f=this.frames;if(s=f[f.length-1]){const t=u[f.length-1];if(1==n)if(a==i.qU.add){const e=l;if(null==e.bones){const s=e.vertices;for(let e=0;es)this.apply(t,e,Number.MAX_VALUE,r,n,i,a),e=-1;else if(e>=o[h-1])return;if(s0&&o[l-1]==t;)l--}for(;l=o[l];l++)r.push(this.events[l])}}class W{constructor(t){this.frames=i.Aq.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,o){const h=t.drawOrder,l=t.slots;if(o==i.mj.mixOut&&a==i.qU.setup)return void i.Aq.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);const c=this.frames;if(s=c[c.length-1]?c.length-1:I.binarySearch(c,s)-1;const d=this.drawOrders[u];if(null==d)i.Aq.arrayCopy(l,0,h,0,l.length);else for(let t=0,e=d.length;t=h[h.length-G.ENTRIES])return void(a==i.qU.setup?(l.mix=l.data.mix+(h[h.length+G.PREV_MIX]-l.data.mix)*n,o==i.mj.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[h.length+G.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+G.PREV_COMPRESS],l.stretch=0!=h[h.length+G.PREV_STRETCH])):(l.mix+=(h[h.length+G.PREV_MIX]-l.mix)*n,o==i.mj.mixIn&&(l.bendDirection=h[h.length+G.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+G.PREV_COMPRESS],l.stretch=0!=h[h.length+G.PREV_STRETCH])));const c=I.binarySearch(h,s,G.ENTRIES),u=h[c+G.PREV_MIX],d=h[c],f=this.getCurvePercent(c/G.ENTRIES-1,1-(s-d)/(h[c+G.PREV_TIME]-d));a==i.qU.setup?(l.mix=l.data.mix+(u+(h[c+G.MIX]-u)*f-l.data.mix)*n,o==i.mj.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[c+G.PREV_BEND_DIRECTION],l.compress=0!=h[c+G.PREV_COMPRESS],l.stretch=0!=h[c+G.PREV_STRETCH])):(l.mix+=(u+(h[c+G.MIX]-u)*f-l.mix)*n,o==i.mj.mixIn&&(l.bendDirection=h[c+G.PREV_BEND_DIRECTION],l.compress=0!=h[c+G.PREV_COMPRESS],l.stretch=0!=h[c+G.PREV_STRETCH]))}};let H=G;H.ENTRIES=5,H.PREV_TIME=-5,H.PREV_MIX=-4,H.PREV_BEND_DIRECTION=-3,H.PREV_COMPRESS=-2,H.PREV_STRETCH=-1,H.MIX=1,H.BEND_DIRECTION=2,H.COMPRESS=3,H.STRETCH=4;const z=class extends C{constructor(t){super(t),this.frames=i.Aq.newFloatArray(t*z.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,i){t*=z.ENTRIES,this.frames[t]=e,this.frames[t+z.ROTATE]=s,this.frames[t+z.TRANSLATE]=r,this.frames[t+z.SCALE]=n,this.frames[t+z.SHEAR]=i}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(s=h[h.length-z.ENTRIES]){const t=h.length;c=h[t+z.PREV_ROTATE],u=h[t+z.PREV_TRANSLATE],d=h[t+z.PREV_SCALE],f=h[t+z.PREV_SHEAR]}else{const t=I.binarySearch(h,s,z.ENTRIES);c=h[t+z.PREV_ROTATE],u=h[t+z.PREV_TRANSLATE],d=h[t+z.PREV_SCALE],f=h[t+z.PREV_SHEAR];const e=h[t],r=this.getCurvePercent(t/z.ENTRIES-1,1-(s-e)/(h[t+z.PREV_TIME]-e));c+=(h[t+z.ROTATE]-c)*r,u+=(h[t+z.TRANSLATE]-u)*r,d+=(h[t+z.SCALE]-d)*r,f+=(h[t+z.SHEAR]-f)*r}if(a==i.qU.setup){const t=l.data;l.rotateMix=t.rotateMix+(c-t.rotateMix)*n,l.translateMix=t.translateMix+(u-t.translateMix)*n,l.scaleMix=t.scaleMix+(d-t.scaleMix)*n,l.shearMix=t.shearMix+(f-t.shearMix)*n}else l.rotateMix+=(c-l.rotateMix)*n,l.translateMix+=(u-l.translateMix)*n,l.scaleMix+=(d-l.scaleMix)*n,l.shearMix+=(f-l.shearMix)*n}};let $=z;$.ENTRIES=5,$.PREV_TIME=-5,$.PREV_ROTATE=-4,$.PREV_TRANSLATE=-3,$.PREV_SCALE=-2,$.PREV_SHEAR=-1,$.ROTATE=1,$.TRANSLATE=2,$.SCALE=3,$.SHEAR=4;const Q=class extends C{constructor(t){super(t),this.frames=i.Aq.newFloatArray(t*Q.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Q.ENTRIES,this.frames[t]=e,this.frames[t+Q.VALUE]=s}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s=h[h.length-Q.ENTRIES])c=h[h.length+Q.PREV_VALUE];else{const t=I.binarySearch(h,s,Q.ENTRIES);c=h[t+Q.PREV_VALUE];const e=h[t],r=this.getCurvePercent(t/Q.ENTRIES-1,1-(s-e)/(h[t+Q.PREV_TIME]-e));c+=(h[t+Q.VALUE]-c)*r}a==i.qU.setup?l.position=l.data.position+(c-l.data.position)*n:l.position+=(c-l.position)*n}};let Z=Q;Z.ENTRIES=2,Z.PREV_TIME=-2,Z.PREV_VALUE=-1,Z.VALUE=1;class K extends Z{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s=h[h.length-K.ENTRIES])c=h[h.length+K.PREV_VALUE];else{const t=I.binarySearch(h,s,K.ENTRIES);c=h[t+K.PREV_VALUE];const e=h[t],r=this.getCurvePercent(t/K.ENTRIES-1,1-(s-e)/(h[t+K.PREV_TIME]-e));c+=(h[t+K.VALUE]-c)*r}a==i.qU.setup?l.spacing=l.data.spacing+(c-l.data.spacing)*n:l.spacing+=(c-l.spacing)*n}}const J=class extends C{constructor(t){super(t),this.frames=i.Aq.newFloatArray(t*J.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,r){t*=J.ENTRIES,this.frames[t]=e,this.frames[t+J.ROTATE]=s,this.frames[t+J.TRANSLATE]=r}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s=h[h.length-J.ENTRIES])c=h[h.length+J.PREV_ROTATE],u=h[h.length+J.PREV_TRANSLATE];else{const t=I.binarySearch(h,s,J.ENTRIES);c=h[t+J.PREV_ROTATE],u=h[t+J.PREV_TRANSLATE];const e=h[t],r=this.getCurvePercent(t/J.ENTRIES-1,1-(s-e)/(h[t+J.PREV_TIME]-e));c+=(h[t+J.ROTATE]-c)*r,u+=(h[t+J.TRANSLATE]-u)*r}a==i.qU.setup?(l.rotateMix=l.data.rotateMix+(c-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(u-l.data.translateMix)*n):(l.rotateMix+=(c-l.rotateMix)*n,l.translateMix+=(u-l.translateMix)*n)}};let tt=J;tt.ENTRIES=3,tt.PREV_TIME=-3,tt.PREV_ROTATE=-2,tt.PREV_TRANSLATE=-1,tt.ROTATE=1,tt.TRANSLATE=2;const et=class{constructor(t){this.tracks=new Array,this.events=new Array,this.listeners=new Array,this.queue=new at(this),this.propertyIDs=new i.ON,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new i.bC((()=>new nt)),this.data=t}update(t){t*=this.timeScale;const e=this.tracks;for(let s=0,r=e.length;s0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let i=r.next;if(null!=i){const e=r.trackLast-i.delay;if(e>=0){for(i.delay=0,i.trackTime=0==r.timeScale?0:(e/r.timeScale+t)*i.timeScale,r.trackTime+=n,this.setCurrent(s,i,!0);null!=i.mixingFrom;)i.mixTime+=t,i=i.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&null==r.mixingFrom){e[s]=null,this.queue.end(r),this.disposeNext(r);continue}if(null!=r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,null!=t&&(t.mixingTo=null);null!=t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){const s=t.mixingFrom;if(null==s)return!0;const r=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(null==t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const e=this.events,s=this.tracks;let r=!1;for(let n=0,a=s.length;n0)continue;r=!0;const o=0==n?i.qU.first:a.mixBlend;let h=a.alpha;null!=a.mixingFrom?h*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&null==a.next&&(h=0);const l=a.animationLast,c=a.getAnimationTime(),u=a.animation.timelines.length,d=a.animation.timelines;if(0==n&&1==h||o==i.qU.add)for(let s=0;s1&&(n=1),s!=i.qU.first&&(s=r.mixBlend));const a=n0&&this.queueEvents(r,c),this.events.length=0,r.nextAnimationLast=c,r.nextTrackLast=r.trackTime,n}applyRotateTimeline(t,e,s,r,n,a,o,h){if(h&&(a[o]=0),1==r)return void t.apply(e,0,s,null,1,n,i.mj.mixIn);const l=t,c=l.frames,u=e.bones[l.boneIndex];let d=0,f=0;if(s=c[c.length-k.ENTRIES])f=u.data.rotation+c[c.length+k.PREV_ROTATION];else{const t=I.binarySearch(c,s,k.ENTRIES),e=c[t+k.PREV_ROTATION],r=c[t],n=l.getCurvePercent((t>>1)-1,1-(s-r)/(c[t+k.PREV_TIME]-r));f=c[t+k.ROTATION]-e,f-=360*(16384-(16384.499999999996-f/360|0)),f=e+f*n+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}let p=0,m=f-d;if(m-=360*(16384-(16384.499999999996-m/360|0)),0==m)p=a[o];else{let t=0,e=0;h?(t=0,e=m):(t=a[o],e=a[o+1]);const s=m>0;let r=t>=0;i.cj.signum(e)!=i.cj.signum(m)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*i.cj.signum(t)),r=s),p=m+t-t%360,r!=s&&(p+=360*i.cj.signum(t)),a[o]=p}a[o+1]=m,d+=p*r,u.rotation=d-360*(16384-(16384.499999999996-d/360|0))}queueEvents(t,e){const s=t.animationStart,r=t.animationEnd,n=r-s,i=t.trackLast%n,a=this.events;let o=0;const h=a.length;for(;or||this.queue.event(t,e)}let l=!1;for(l=t.loop?0==n||i>t.trackTime%n:e>=r&&t.animationLast=this.tracks.length)return;const e=this.tracks[t];if(null==e)return;this.queue.end(e),this.disposeNext(e);let s=e;for(;;){const t=s.mixingFrom;if(null==t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){const r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s){const r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s){if(null==e)throw new Error("animation cannot be null.");let r=!0,n=this.expandToIndex(t);null!=n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.disposeNext(n),n=n.mixingFrom,r=!1):this.disposeNext(n));const i=this.trackEntry(t,e,s,n);return this.setCurrent(t,i,r),this.queue.drain(),i}addAnimation(t,e,s,r){const n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,n,s,r)}addAnimationWith(t,e,s,r){if(null==e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(null!=n)for(;null!=n.next;)n=n.next;const i=this.trackEntry(t,e,s,n);if(null==n)this.setCurrent(t,i,!0),this.queue.drain();else if(n.next=i,r<=0){const t=n.animationEnd-n.animationStart;0!=t?(n.loop?r+=t*(1+(n.trackTime/t|0)):r+=Math.max(t,n.trackTime),r-=this.data.getMix(n.animation,e)):r=n.trackTime}return i.delay=r,i}setEmptyAnimation(t,e){const s=this.setAnimationWith(t,et.emptyAnimation,!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e,s){s<=0&&(s-=e);const r=this.addAnimationWith(t,et.emptyAnimation,!1,s);return r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e0){n[i]=et.HOLD_MIX,a[i]=s;continue t}break}n[i]=et.HOLD}else n[i]=et.FIRST;else n[i]=et.SUBSEQUENT}}hasTimeline(t,e){const s=t.animation.timelines;for(let t=0,r=s.length;t=this.tracks.length?null:this.tracks[t]}addListener(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(t,e,s){et.deprecatedWarning1||(et.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,s)}addAnimationByName(t,e,s,r){et.deprecatedWarning2||(et.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,s,r)}hasAnimation(t){return null!==this.data.skeletonData.findAnimation(t)}hasAnimationByName(t){return et.deprecatedWarning3||(et.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let st=et;st.emptyAnimation=new I("",[],0),st.SUBSEQUENT=0,st.FIRST=1,st.HOLD=2,st.HOLD_MIX=3,st.deprecatedWarning1=!1,st.deprecatedWarning2=!1,st.deprecatedWarning3=!1;const rt=class{constructor(){this.mixBlend=i.qU.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 t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return rt.deprecatedWarning1||(rt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){rt.deprecatedWarning1||(rt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return rt.deprecatedWarning2||(rt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){rt.deprecatedWarning2||(rt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let nt=rt;nt.deprecatedWarning1=!1,nt.deprecatedWarning2=!1;const it=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(ot.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(ot.interrupt),this.objects.push(t)}end(t){this.objects.push(ot.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(ot.dispose),this.objects.push(t)}complete(t){this.objects.push(ot.complete),this.objects.push(t)}event(t,e){this.objects.push(ot.event),this.objects.push(t),this.objects.push(e)}deprecateStuff(){return it.deprecatedWarning1||(it.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 t=this.objects,e=this.animState.listeners;for(let s=0;s(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(ot||{});class ht{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const lt=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){const r=this.skeletonData.findAnimation(t);if(null==r)throw new Error(`Animation not found: ${t}`);const n=this.skeletonData.findAnimation(e);if(null==n)throw new Error(`Animation not found: ${e}`);this.setMixWith(r,n,s)}setMixByName(t,e,s){lt.deprecatedWarning1||(lt.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(t,e,s)}setMixWith(t,e,s){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");const r=`${t.name}.${e.name}`;this.animationToMixTime[r]=s}getMix(t,e){const s=`${t.name}.${e.name}`,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}};let ct=lt;ct.deprecatedWarning1=!1;class ut{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(null==r)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new v(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(null==r)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new y(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new g(e)}newPathAttachment(t,e){return new b(e)}newPointAttachment(t,e){return new _(e)}newClippingAttachment(t,e){return new x(e)}}class dt{constructor(t,e,s){if(this.matrix=new o.uq,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=!0,null==t)throw new Error("data cannot be null.");if(null==e)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}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,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;const h=this.parent,l=this.matrix,c=this.skeleton.scaleX,u=i.W0.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(null==h){const h=this.skeleton,d=s+90+o;return l.a=i.cj.cosDeg(s+a)*r*c,l.c=i.cj.cosDeg(d)*n*c,l.b=i.cj.sinDeg(s+a)*r*u,l.d=i.cj.sinDeg(d)*n*u,l.tx=t*c+h.x,void(l.ty=e*u+h.y)}let d=h.matrix.a,f=h.matrix.c,p=h.matrix.b,m=h.matrix.d;switch(l.tx=d*t+f*e+h.matrix.tx,l.ty=p*t+m*e+h.matrix.ty,this.data.transformMode){case i._C.Normal:{const t=s+90+o,e=i.cj.cosDeg(s+a)*r,h=i.cj.cosDeg(t)*n,c=i.cj.sinDeg(s+a)*r,u=i.cj.sinDeg(t)*n;return l.a=d*e+f*c,l.c=d*h+f*u,l.b=p*e+m*c,void(l.d=p*h+m*u)}case i._C.OnlyTranslation:{const t=s+90+o;l.a=i.cj.cosDeg(s+a)*r,l.c=i.cj.cosDeg(t)*n,l.b=i.cj.sinDeg(s+a)*r,l.d=i.cj.sinDeg(t)*n;break}case i._C.NoRotationOrReflection:{let t=d*d+p*p,e=0;t>1e-4?(t=Math.abs(d*m-f*p)/t,f=p*t,m=d*t,e=Math.atan2(p,d)*i.cj.radDeg):(d=0,p=0,e=90-Math.atan2(m,f)*i.cj.radDeg);const h=s+a-e,c=s+o-e+90,u=i.cj.cosDeg(h)*r,g=i.cj.cosDeg(c)*n,x=i.cj.sinDeg(h)*r,y=i.cj.sinDeg(c)*n;l.a=d*u-f*x,l.c=d*g-f*y,l.b=p*u+m*x,l.d=p*g+m*y;break}case i._C.NoScale:case i._C.NoScaleOrReflection:{const t=i.cj.cosDeg(s),e=i.cj.sinDeg(s);let h=(d*t+f*e)/c,g=(p*t+m*e)/u,x=Math.sqrt(h*h+g*g);x>1e-5&&(x=1/x),h*=x,g*=x,x=Math.sqrt(h*h+g*g),this.data.transformMode==i._C.NoScale&&d*m-f*p<0!=(i.W0.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);const y=Math.PI/2+Math.atan2(g,h),b=Math.cos(y)*x,_=Math.sin(y)*x,E=i.cj.cosDeg(a)*r,w=i.cj.cosDeg(90+o)*n,v=i.cj.sinDeg(a)*r,T=i.cj.sinDeg(90+o)*n;l.a=h*E+b*v,l.c=h*w+b*T,l.b=g*E+_*v,l.d=g*w+_*T;break}}l.a*=c,l.c*=c,l.b*=u,l.d*=u}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)*i.cj.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*i.cj.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(null==t)return this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*i.cj.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,void(this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*i.cj.radDeg);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 o=r*s.d,h=r*s.a,l=r*s.c,c=r*s.b,u=o*e.a-l*e.b,d=o*e.c-l*e.d,f=h*e.b-c*e.a,p=h*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){const t=u*p-d*f;this.ascaleY=t/this.ascaleX,this.ashearY=Math.atan2(u*d+f*p,t)*i.cj.radDeg,this.arotation=Math.atan2(f,u)*i.cj.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*i.cj.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,i=e.d,a=1/(s*i-r*n),o=t.x-e.tx,h=t.y-e.ty;return t.x=o*i*a-h*r*a,t.y=h*s*a-o*n*a,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=i.cj.sinDeg(t),s=i.cj.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*i.cj.radDeg}localToWorldRotation(t){const e=i.cj.sinDeg(t),s=i.cj.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*i.cj.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,o=i.cj.cosDeg(t),h=i.cj.sinDeg(t);e.a=o*s-h*n,e.c=o*r-h*a,e.b=h*s+o*n,e.d=h*r+o*a,this.appliedValid=!1}}class ft{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=i._C.Normal,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class pt{constructor(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class mt{constructor(t){this.name=t}}class gt{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s180?p-=360:p<-180&&(p+=360);let m=t.ascaleX,g=t.ascaleY;if(r||n){const e=t.data.length*m,s=Math.sqrt(d*d+f*f);if(r&&se&&e>1e-4){const t=(s/e-1)*o+1;m*=t,a&&(g*=t)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+p*o,m,g,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,a,o){if(0==o)return void e.updateWorldTransform();t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const h=t.ax,l=t.ay;let c=t.ascaleX,u=c,d=t.ascaleY,f=e.ascaleX;const p=t.matrix;let m=0,g=0,x=0;c<0?(c=-c,m=180,x=-1):(m=0,x=1),d<0&&(d=-d,x=-x),f<0?(f=-f,g=180):g=0;const y=e.ax;let b=0,_=0,E=0,w=p.a,v=p.c,T=p.b,A=p.d;const S=Math.abs(c-d)<=1e-4;S?(b=e.ay,_=w*y+v*b+p.tx,E=T*y+A*b+p.ty):(b=0,_=w*y+p.tx,E=T*y+p.ty);const I=t.parent.matrix;w=I.a,v=I.c,T=I.b,A=I.d;const R=1/(w*A-v*T);let M=s-I.tx,C=r-I.ty;const P=(M*A-C*v)*R-h,k=(C*w-M*T)*R-l,D=P*P+k*k;M=_-I.tx,C=E-I.ty;const F=(M*A-C*v)*R-h,B=(C*w-M*T)*R-l,N=Math.sqrt(F*F+B*B);let O=e.data.length*f,L=0,U=0;t:if(S){O*=c;let t=(D-N*N-O*O)/(2*N*O);t<-1?t=-1:t>1&&(t=1,a&&N+O>1e-4&&(u*=(Math.sqrt(D)/(N+O)-1)*o+1)),U=Math.acos(t)*n,w=N+O*t,v=O*Math.sin(U),L=Math.atan2(k*w-P*v,P*w+k*v)}else{w=c*O,v=d*O;const t=w*w,e=v*v,s=Math.atan2(k,P);T=e*N*N+t*D-t*e;const r=-2*e*N,a=e-t;if(A=r*r-4*a*T,A>=0){let t=Math.sqrt(A);r<0&&(t=-t),t=-(r+t)/2;const e=t/a,i=T/t,o=Math.abs(e)=-1&&T<=1&&(T=Math.acos(T),M=w*Math.cos(T)+N,C=v*Math.sin(T),A=M*M+C*C,Am&&(f=T,m=A,p=M,g=C)),D<=(l+m)/2?(L=s-Math.atan2(u*n,h),U=o*n):(L=s-Math.atan2(g*n,p),U=f*n)}const V=Math.atan2(b,y)*x;let X=t.arotation;L=(L-V)*i.cj.radDeg+m-X,L>180?L-=360:L<-180&&(L+=360),t.updateWorldTransformWith(h,l,X+L*o,u,t.ascaleY,0,0),X=e.arotation,U=((U+V)*i.cj.radDeg-e.ashearX)*x+g-X,U>180?U-=360:U<-180&&(U+=360),e.updateWorldTransformWith(y,b,X+U*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class xt{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}}class yt{constructor(t){this.order=0,this.bones=new Array,this.name=t}}var bt=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t))(bt||{});const _t=class{constructor(t,e){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,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,r=t.bones.length;s0;if(!(s>0||r))return;const n=this.data,a=n.spacingMode,o=a==bt.Length,h=n.rotateMode,l=h==i.Dr.Tangent,c=h==i.Dr.ChainScale,u=this.bones.length,d=l?u:u+1,f=this.bones,p=i.Aq.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(c||o){c&&(m=i.Aq.setArraySize(this.lengths,u));for(let t=0,e=d-1;t0?i.cj.degRad:-i.cj.degRad}for(let t=0,n=3;ti.cj.PI?u-=i.cj.PI2:u<-i.cj.PI&&(u+=i.cj.PI2),u*=e,f=Math.cos(u),m=Math.sin(u),o.a=f*s-m*h,o.c=f*r-m*c,o.b=m*s+f*h,o.d=m*r+f*c}a.appliedValid=!1}}computeWorldPositions(t,e,s,r,n){const a=this.target;let o=this.position;const h=this.spaces,l=i.Aq.setArraySize(this.positions,3*e+2);let c=null;const u=t.closed;let d=t.worldVerticesLength,f=d/6,p=_t.NONE;if(!t.constantSpeed){const m=t.lengths;f-=u?1:2;const g=m[f];if(r&&(o*=g),n)for(let t=0;tg){p!=_t.AFTER&&(p=_t.AFTER,t.computeWorldVertices(a,d-6,4,c,0,2)),this.addAfterPosition(x-g,c,0,l,n);continue}}for(;;i++){const t=m[i];if(!(x>t)){if(0==i)x/=t;else{const e=m[i-1];x=(x-e)/(t-e)}break}}i!=p&&(p=i,u&&i==f?(t.computeWorldVertices(a,d-4,4,c,0,2),t.computeWorldVertices(a,0,4,c,4,2)):t.computeWorldVertices(a,6*i+2,8,c,0,2)),this.addCurvePosition(x,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],l,n,s||r>0&&0==e)}return l}u?(d+=2,c=i.Aq.setArraySize(this.world,d),t.computeWorldVertices(a,2,d-4,c,0,2),t.computeWorldVertices(a,0,2,c,d-4,2),c[d-2]=c[0],c[d-1]=c[1]):(f--,d-=4,c=i.Aq.setArraySize(this.world,d),t.computeWorldVertices(a,2,d,c,0,2));const m=i.Aq.setArraySize(this.curves,f);let g=0,x=c[0],y=c[1],b=0,_=0,E=0,w=0,v=0,T=0,A=0,S=0,I=0,R=0,M=0,C=0,P=0,k=0;for(let t=0,e=2;tg){this.addAfterPosition(a-g,c,d-4,l,r);continue}}for(;;n++){const t=m[n];if(!(a>t)){if(0==n)a/=t;else{const e=m[n-1];a=(a-e)/(t-e)}break}}if(n!=p){p=n;let t=6*n;for(x=c[t],y=c[t+1],b=c[t+2],_=c[t+3],E=c[t+4],w=c[t+5],v=c[t+6],T=c[t+7],A=.03*(x-2*b+E),S=.03*(y-2*_+w),I=.006*(3*(b-E)-x+v),R=.006*(3*(_-w)-y+T),M=2*A+I,C=2*S+R,P=.3*(b-x)+A+.16666667*I,k=.3*(_-y)+S+.16666667*R,F=Math.sqrt(P*P+k*k),D[0]=F,t=1;t<8;t++)P+=M,k+=C,M+=I,C+=R,F+=Math.sqrt(P*P+k*k),D[t]=F;P+=M,k+=C,F+=Math.sqrt(P*P+k*k),D[8]=F,P+=M+I,k+=C+R,F+=Math.sqrt(P*P+k*k),D[9]=F,i=0}for(a*=F;;i++){const t=D[i];if(!(a>t)){if(0==i)a/=t;else{const e=D[i-1];a=i+(a-e)/(t-e)}break}}this.addCurvePosition(.1*a,x,y,b,_,E,w,v,T,l,r,s||t>0&&0==e)}return l}addBeforePosition(t,e,s,r,n){const i=e[s],a=e[s+1],o=e[s+2]-i,h=e[s+3]-a,l=Math.atan2(h,o);r[n]=i+t*Math.cos(l),r[n+1]=a+t*Math.sin(l),r[n+2]=l}addAfterPosition(t,e,s,r,n){const i=e[s+2],a=e[s+3],o=i-e[s],h=a-e[s+1],l=Math.atan2(h,o);r[n]=i+t*Math.cos(l),r[n+1]=a+t*Math.sin(l),r[n+2]=l}addCurvePosition(t,e,s,r,n,i,a,o,h,l,c,u){(0==t||isNaN(t))&&(t=1e-4);const d=t*t,f=d*t,p=1-t,m=p*p,g=m*p,x=p*t,y=3*x,b=p*y,_=y*t,E=e*g+r*b+i*_+o*f,w=s*g+n*b+a*_+h*f;l[c]=E,l[c+1]=w,u&&(l[c+2]=Math.atan2(w-(s*m+n*x*2+a*d),E-(e*m+r*x*2+i*d)))}getOrder(){return this.data.order}};let Et=_t;Et.NONE=-1,Et.BEFORE=-2,Et.AFTER=-3,Et.epsilon=1e-5;class wt{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new i.I9,null==t)throw new Error("data cannot be null.");if(null==e)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;s0?i.cj.degRad:-i.cj.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let a=0,u=p.length;ai.cj.PI?a-=i.cj.PI2:a<-i.cj.PI&&(a+=i.cj.PI2),a*=t;const h=Math.cos(a),c=Math.sin(a);g.a=h*e-c*r,g.c=h*s-c*n,g.b=c*e+h*r,g.d=c*s+h*n,m=!0}if(0!=e){const t=this.temp;n.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.tx+=(t.x-g.tx)*e,g.ty+=(t.y-g.ty)*e,m=!0}if(s>0){let t=Math.sqrt(g.a*g.a+g.b*g.b),e=Math.sqrt(o*o+l*l);t>1e-5&&(t=(t+(e-t+this.data.offsetScaleX)*s)/t),g.a*=t,g.b*=t,t=Math.sqrt(g.c*g.c+g.d*g.d),e=Math.sqrt(h*h+c*c),t>1e-5&&(t=(t+(e-t+this.data.offsetScaleY)*s)/t),g.c*=t,g.d*=t,m=!0}if(r>0){const t=g.c,e=g.d,s=Math.atan2(e,t);let n=Math.atan2(c,h)-Math.atan2(l,o)-(s-Math.atan2(g.b,g.a));n>i.cj.PI?n-=i.cj.PI2:n<-i.cj.PI&&(n+=i.cj.PI2),n=s+(n+f)*r;const a=Math.sqrt(t*t+e*e);g.c=Math.cos(n)*a,g.d=Math.sin(n)*a,m=!0}m&&(u.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,l=a.b,c=a.d,u=o*c-h*l>0?i.cj.degRad:-i.cj.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let a=0,u=p.length;ai.cj.PI?a-=i.cj.PI2:a<-i.cj.PI&&(a+=i.cj.PI2),a*=t;const h=Math.cos(a),c=Math.sin(a);g.a=h*e-c*r,g.c=h*s-c*n,g.b=c*e+h*r,g.d=c*s+h*n,m=!0}if(0!=e){const t=this.temp;n.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.tx+=t.x*e,g.ty+=t.y*e,m=!0}if(s>0){let t=(Math.sqrt(o*o+l*l)-1+this.data.offsetScaleX)*s+1;g.a*=t,g.b*=t,t=(Math.sqrt(h*h+c*c)-1+this.data.offsetScaleY)*s+1,g.c*=t,g.d*=t,m=!0}if(r>0){let t=Math.atan2(c,h)-Math.atan2(l,o);t>i.cj.PI?t-=i.cj.PI2:t<-i.cj.PI&&(t+=i.cj.PI2);const e=g.c,s=g.d;t=Math.atan2(s,e)+(t-i.cj.PI/2+f)*r;const n=Math.sqrt(e*e+s*s);g.c=Math.cos(t)*n,g.d=Math.sin(t)*n,m=!0}m&&(u.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const i=this.bones;for(let a=0,o=i.length;a0&&(u>1e-5&&(u=(u+(n.ascaleX-u+this.data.offsetScaleX)*s)/u),d>1e-5&&(d=(d+(n.ascaleY-d+this.data.offsetScaleY)*s)/d));const f=o.ashearY;if(r>0){let t=n.ashearY-f+this.data.offsetShearY;t-=360*(16384-(16384.499999999996-t/360|0)),o.shearY+=t*r}o.updateWorldTransformWith(l,c,h,u,d,o.ashearX,f)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const i=this.bones;for(let a=0,o=i.length;a0&&(u>1e-5&&(u*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),d>1e-5&&(d*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let f=o.ashearY;r>0&&(f+=(n.ashearY+this.data.offsetShearY)*r),o.updateWorldTransformWith(l,c,h,u,d,o.ashearX,f)}}getOrder(){return this.data.order}}const vt=class{constructor(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e1){const t=s[s.length-1];this._updateCache.indexOf(t)>-1||this.updateCacheReset.push(t)}this._updateCache.push(t),this.sortReset(r.children),s[s.length-1].sorted=!0}sortPathConstraint(t){const e=t.target,s=e.data.index,r=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let t=0,e=this.data.skins.length;t-1||this.updateCacheReset.push(s)}else for(let t=0;t= 0.");if(null==e)throw new Error("name cannot be null.");if(null==s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class Rt{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,null==t)throw new Error("name cannot be null.");this.name=t}}class Mt{constructor(t){if(this.attachments=new Array,null==t)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(null==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}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let r=0;r=0;s--)-1==h[s]&&(h[s]=t[--n])}t.setFrame(r++,a.time,h)}n.push(t),a=Math.max(a,t.frames[t.getFrameCount()-1])}if(t.events){const e=new j(t.events.length);let r=0;for(let n=0;n>1)*i;const a=t.bone.skeleton,o=t.deform;let h=this.vertices;const l=this.bones;if(!l){o.length>0&&(h=o);const a=t.bone.matrix,l=a.tx,c=a.ty,u=a.a,d=a.c,f=a.b,p=a.d;for(let t=e,a=n;a=this.regions.length&&(s=this.regions.length-1);const r=this.regions[s];e.region!=r&&(e.region=r)}getPath(t,e){let s=t;const r=(this.start+e).toString();for(let t=this.digits-r.length;t>0;t--)s+="0";return s+=r,s}static nextID(){return qt._nextID++}};let jt=qt;jt._nextID=0;var Wt=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(Wt||{});const Gt=[0,1,2,3,4,5,6];class Ht{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new i.eE,!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;e0&&(e%=this.duration));const h=this.timelines;for(let r=0,l=h.length;re)return r-1;return s-1}static search(t,e,s){const r=t.length;for(let n=s;ne)return n-s;return r-s}}class $t extends zt{constructor(t,e,s){super(t,s),this.curves=i.Aq.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+18*t;if(this.curves.length>e){const t=i.Aq.newFloatArray(e);i.Aq.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,r,n,i,a,o,h,l,c){const u=this.curves;let d=this.getFrameCount()+18*t;0==s&&(u[e]=2+d);const f=.03*(r-2*i+o),p=.03*(n-2*a+h),m=.006*(3*(i-o)-r+l),g=.006*(3*(a-h)-n+c);let x=2*f+m,y=2*p+g,b=.3*(i-r)+f+.16666667*m,_=.3*(a-n)+p+.16666667*g,E=r+b,w=n+_;for(let t=d+18;dt){const i=this.frames[e],a=this.frames[e+s];return a+(t-i)/(n[r]-i)*(n[r+1]-a)}const i=r+18;for(r+=2;r=t){const e=n[r-2],s=n[r-1];return s+(t-e)/(n[r]-e)*(n[r+1]-s)}e+=this.getFrameEntries();const a=n[i-2],o=n[i-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}}class Qt extends $t{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 r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}const r=this.curves[s>>1];switch(r){case 0:const r=e[s],n=e[s+1];return n+(t-r)/(e[s+2]-r)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}}class Zt extends $t{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 Kt extends Qt{constructor(t,e,s){super(t,e,`0|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,o){const h=t.bones[this.boneIndex];if(!h.active)return;if(s>2];switch(m){case 0:const t=l[p];u=l[p+1],d=l[p+2],f=l[p+3];const e=(s-t)/(l[p+4]-t);u+=(l[p+4+1]-u)*e,d+=(l[p+4+2]-d)*e,f+=(l[p+4+3]-f)*e;break;case 1:u=l[p+1],d=l[p+2],f=l[p+3];break;default:u=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+36-2)}if(1==n)c.r=u,c.g=d,c.b=f;else{if(a==i.qU.setup){const t=h.data.color;c.r=t.r,c.g=t.g,c.b=t.b}c.r+=(u-c.r)*n,c.g+=(d-c.g)*n,c.b+=(f-c.b)*n}}}class ce extends Qt{constructor(t,e,s){super(t,e,`8|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,r,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;const l=h.color;if(s>3];switch(_){case 0:const t=l[b];d=l[b+1],f=l[b+2],p=l[b+3],m=l[b+4],g=l[b+5],x=l[b+6],y=l[b+7];const e=(s-t)/(l[b+8]-t);d+=(l[b+8+1]-d)*e,f+=(l[b+8+2]-f)*e,p+=(l[b+8+3]-p)*e,m+=(l[b+8+4]-m)*e,g+=(l[b+8+5]-g)*e,x+=(l[b+8+6]-x)*e,y+=(l[b+8+7]-y)*e;break;case 1:d=l[b+1],f=l[b+2],p=l[b+3],m=l[b+4],g=l[b+5],x=l[b+6],y=l[b+7];break;default:d=this.getBezierValue(s,b,1,_-2),f=this.getBezierValue(s,b,2,_+18-2),p=this.getBezierValue(s,b,3,_+36-2),m=this.getBezierValue(s,b,4,_+54-2),g=this.getBezierValue(s,b,5,_+72-2),x=this.getBezierValue(s,b,6,_+90-2),y=this.getBezierValue(s,b,7,_+108-2)}if(1==n)c.set(d,f,p,m),u.r=g,u.g=x,u.b=y;else{if(a==i.qU.setup){c.setFromColor(h.data.color);const t=h.data.darkColor;u.r=t.r,u.g=t.g,u.b=t.b}c.add((d-c.r)*n,(f-c.g)*n,(p-c.b)*n,(m-c.a)*n),u.r+=(g-u.r)*n,u.g+=(x-u.g)*n,u.b+=(y-u.b)*n}}}class de extends $t{constructor(t,e,s){super(t,e,[`7|${s}`,`9|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,i,a,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]=i,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,r,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;const l=this.frames,c=h.color,u=h.darkColor;if(st){const n=this.frames[e];return s[r+1]*(t-n)/(s[r]-n)}const n=r+18;for(r+=2;r=t){const e=s[r-2],n=s[r-1];return n+(t-e)/(s[r]-e)*(s[r+1]-n)}const i=s[n-2],a=s[n-1];return a+(1-a)*(t-i)/(this.frames[e+this.getFrameEntries()]-i)}apply(t,e,s,r,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;const l=h.getAttachment();if(!l)return;if(!(l instanceof Bt)||l.timelineAttachment!=this.attachment)return;const c=h.deform;0==c.length&&(a=i.qU.setup);const u=this.vertices,d=u[0].length,f=this.frames;if(s=f[f.length-1]){const t=u[f.length-1];if(1==n)if(a==i.qU.add){const e=l;if(e.bones)for(let e=0;es)this.apply(t,e,Number.MAX_VALUE,r,n,i,a),e=-1;else if(e>=o[h-1])return;if(s0&&o[l-1]==t;)l--}for(;l=o[l];l++)r.push(this.events[l])}};let ge=me;ge.propertyIds=["12"];const xe=class extends zt{constructor(t){super(t,xe.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,o){if(o==i.mj.mixOut)return void(a==i.qU.setup&&i.Aq.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s>2];switch(p){case 0:const t=l[f];c=l[f+1],u=l[f+2],d=l[f+3];const e=(s-t)/(l[f+4]-t);c+=(l[f+4+1]-c)*e,u+=(l[f+4+2]-u)*e,d+=(l[f+4+3]-d)*e;break;case 1:c=l[f+1],u=l[f+2],d=l[f+3];break;default:c=this.getBezierValue(s,f,1,p-2),u=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+36-2)}if(a==i.qU.setup){const t=h.data;h.mixRotate=t.mixRotate+(c-t.mixRotate)*n,h.mixX=t.mixX+(u-t.mixX)*n,h.mixY=t.mixY+(d-t.mixY)*n}else h.mixRotate+=(c-h.mixRotate)*n,h.mixX+=(u-h.mixX)*n,h.mixY+=(d-h.mixY)*n}}const Te=class extends zt{constructor(t,e,s){super(t,[`19|${e}|${s.sequence.id}`]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Te.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,r,n){const i=this.frames;i[t*=Te.ENTRIES]=e,i[t+Te.MODE]=s|r<<4,i[t+Te.DELAY]=n}apply(t,e,s,r,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;const l=h.attachment,c=this.attachment;if(!(l==c||l instanceof Bt&&l.timelineAttachment==c))return;const u=this.frames;if(s>4;const x=this.attachment.sequence.regions.length,y=Gt[15&p];if(y!=Wt.hold)switch(g+=(s-f)/m+1e-5|0,y){case Wt.once:g=Math.min(x-1,g);break;case Wt.loop:g%=x;break;case Wt.pingpong:{const t=(x<<1)-2;g=0==t?0:g%t,g>=x&&(g=t-g);break}case Wt.onceReverse:g=Math.max(x-1-g,0);break;case Wt.loopReverse:g=x-1-g%x;break;case Wt.pingpongReverse:{const t=(x<<1)-2;g=0==t?0:(g+x-1)%t,g>=x&&(g=t-g)}}h.sequenceIndex=g}};let Ae=Te;Ae.ENTRIES=3,Ae.MODE=1,Ae.DELAY=2;const Se=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Ce(this),this.propertyIDs=new i.eE,this.animationsChanged=!1,this.trackEntryPool=new i.bC((()=>new Me)),this.data=t}static emptyAnimation(){return Se._emptyAnimation}update(t){t*=this.timeScale;const e=this.tracks;for(let s=0,r=e.length;s0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let i=r.next;if(i){const e=r.trackLast-i.delay;if(e>=0){for(i.delay=0,i.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*i.timeScale,r.trackTime+=n,this.setCurrent(s,i,!0);i.mixingFrom;)i.mixTime+=t,i=i.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){const s=t.mixingFrom;if(!s)return!0;const r=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const e=this.events,s=this.tracks;let r=!1;for(let n=0,a=s.length;n0)continue;r=!0;const o=0==n?i.qU.first:a.mixBlend;let h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(h=0);const l=a.animationLast,c=a.getAnimationTime();let u=c,d=e;a.reverse&&(u=a.animation.duration-u,d=null);const f=a.animation.timelines,p=f.length;if(0==n&&1==h||o==i.qU.add)for(let e=0;e1&&(n=1),s!=i.qU.first&&(s=r.mixBlend));const a=n0&&this.queueEvents(r,f),this.events.length=0,r.nextAnimationLast=f,r.nextTrackLast=r.trackTime,n}applyAttachmentTimeline(t,e,s,r,n){const a=e.slots[t.slotIndex];a.bone.active&&(s0;let r=t>=0;i.cj.signum(e)!=i.cj.signum(f)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*i.cj.signum(t)),r=s),d=f+t-t%360,r!=s&&(d+=360*i.cj.signum(t)),a[o]=d}a[o+1]=f,l.rotation=c+d*r}queueEvents(t,e){const s=t.animationStart,r=t.animationEnd,n=r-s,i=t.trackLast%n,a=this.events;let o=0;const h=a.length;for(;or||this.queue.event(t,e)}let l=!1;for(l=t.loop?0==n||i>t.trackTime%n:e>=r&&t.animationLast=this.tracks.length)return;const e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){const t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){const r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){const r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,r=!1):this.clearNext(n));const i=this.trackEntry(t,e,s,n);return this.setCurrent(t,i,r),this.queue.drain(),i}addAnimation(t,e,s=!1,r=0){const n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,n,s,r)}addAnimationWith(t,e,s=!1,r=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;const i=this.trackEntry(t,e,s,n);return n?(n.next=i,i.previous=n,r<=0&&(r+=n.getTrackComplete()-i.mixDuration)):(this.setCurrent(t,i,!0),this.queue.drain()),i.delay=r,i}setEmptyAnimation(t,e=0){const s=this.setAnimationWith(t,Se.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){const r=this.addAnimationWith(t,Se.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-e),r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t=0){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e0){n[o]=Oe,i[o]=s;continue t}break}n[o]=Ne}else n[o]=De}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(t,e,s){Se.deprecatedWarning1||(Se.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,s)}addAnimationByName(t,e,s,r){Se.deprecatedWarning2||(Se.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,s,r)}hasAnimation(t){return null!==this.data.skeletonData.findAnimation(t)}hasAnimationByName(t){return Se.deprecatedWarning3||(Se.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let Ie=Se;Ie._emptyAnimation=new Ht("",[],0),Ie.deprecatedWarning1=!1,Ie.deprecatedWarning2=!1,Ie.deprecatedWarning3=!1;const Re=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=i.qU.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.previous=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 t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(Pe||{});class ke{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const De=0,Fe=1,Be=2,Ne=3,Oe=4,Le=1,Ue=2;class Ve{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){const r=this.skeletonData.findAnimation(t);if(!r)throw new Error(`Animation not found: ${t}`);const n=this.skeletonData.findAnimation(e);if(!n)throw new Error(`Animation not found: ${e}`);this.setMixWith(r,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const r=`${t.name}.${e.name}`;this.animationToMixTime[r]=s}getMix(t,e){const s=`${t.name}.${e.name}`,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}}class Xe{constructor(t){this.atlas=t}loadSequence(t,e,s){const r=s.regions;for(let n=0,i=r.length;n1e-4?(t=Math.abs(d*m-f*p)/t,d/=c,p/=u,f=p*t,m=d*t,e=Math.atan2(p,d)*i.cj.radDeg):(d=0,p=0,e=90-Math.atan2(m,f)*i.cj.radDeg);const h=s+a-e,g=s+o-e+90,x=i.cj.cosDeg(h)*r,y=i.cj.cosDeg(g)*n,b=i.cj.sinDeg(h)*r,_=i.cj.sinDeg(g)*n;l.a=d*x-f*b,l.c=d*y-f*_,l.b=p*x+m*b,l.d=p*y+m*_;break}case i._C.NoScale:case i._C.NoScaleOrReflection:{const t=i.cj.cosDeg(s),e=i.cj.sinDeg(s);let h=(d*t+f*e)/c,g=(p*t+m*e)/u,x=Math.sqrt(h*h+g*g);x>1e-5&&(x=1/x),h*=x,g*=x,x=Math.sqrt(h*h+g*g),this.data.transformMode==i._C.NoScale&&d*m-f*p<0!=(c<0!=u<0)&&(x=-x);const y=Math.PI/2+Math.atan2(g,h),b=Math.cos(y)*x,_=Math.sin(y)*x,E=i.cj.cosDeg(a)*r,w=i.cj.cosDeg(90+o)*n,v=i.cj.sinDeg(a)*r,T=i.cj.sinDeg(90+o)*n;l.a=h*E+b*v,l.c=h*w+b*T,l.b=g*E+_*v,l.d=g*w+_*T;break}}l.a*=c,l.c*=c,l.b*=u,l.d*=u}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)*i.cj.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*i.cj.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.b*t.b)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.c*t.c+t.d*t.d)}updateAppliedTransform(){const t=this.parent,e=this.matrix;if(!t)return this.ax=e.tx-this.skeleton.x,this.ay=e.ty-this.skeleton.y,this.arotation=Math.atan2(e.b,e.a)*i.cj.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,void(this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*i.cj.radDeg);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 o=r*s.d,h=r*s.a,l=r*s.c,c=r*s.b,u=o*e.a-l*e.b,d=o*e.c-l*e.d,f=h*e.b-c*e.a,p=h*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){const t=u*p-d*f;this.ascaleY=t/this.ascaleX,this.ashearY=Math.atan2(u*d+f*p,t)*i.cj.radDeg,this.arotation=Math.atan2(f,u)*i.cj.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*i.cj.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,i=e.d,a=1/(s*i-r*n),o=t.x-e.tx,h=t.y-e.ty;return t.x=o*i*a-h*r*a,t.y=h*s*a-o*n*a,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=i.cj.sinDeg(t),s=i.cj.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*i.cj.radDeg}localToWorldRotation(t){t-=this.rotation-this.shearX;const e=i.cj.sinDeg(t),s=i.cj.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*i.cj.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,o=i.cj.cosDeg(t),h=i.cj.sinDeg(t);e.a=o*s-h*n,e.c=o*r-h*a,e.b=h*s+o*n,e.d=h*r+o*a}}class qe{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=i._C.Normal,this.skinRequired=!1,this.color=new i.Q1,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 je{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class We{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 Ge{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}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)throw new Error("data cannot be null.");if(!e)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;s180?f-=360:f<-180&&(f+=360);let y=t.ascaleX,b=t.ascaleY;if(r||n){switch(t.data.transformMode){case i._C.NoScale:case i._C.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const h=t.data.length*y,l=Math.sqrt(p*p+m*m);if(r&&lh&&h>1e-4){const t=(l/h-1)*o+1;y*=t,a&&(b*=t)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,y,b,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,a,o,h,l){const c=t.ax,u=t.ay;let d=t.ascaleX,f=t.ascaleY,p=d,m=f,g=e.ascaleX;const x=t.matrix;let y=0,b=0,_=0;d<0?(d=-d,y=180,_=-1):(y=0,_=1),f<0&&(f=-f,_=-_),g<0?(g=-g,b=180):b=0;const E=e.ax;let w=0,v=0,T=0,A=x.a,S=x.c,I=x.b,R=x.d;const M=Math.abs(d-f)<=1e-4;!M||a?(w=0,v=A*E+x.tx,T=I*E+x.ty):(w=e.ay,v=A*E+S*w+x.tx,T=I*E+R*w+x.ty);const C=t.parent.matrix;if(!C)throw new Error("IK parent must itself have a parent.");A=C.a,S=C.c,I=C.b,R=C.d;const P=1/(A*R-S*I);let k=v-C.tx,D=T-C.ty;const F=(k*R-D*S)*P-c,B=(D*A-k*I)*P-u,N=Math.sqrt(F*F+B*B);let O,L,U=e.data.length*g;if(N<1e-4)return this.apply1(t,s,r,!1,a,!1,l),void e.updateWorldTransformWith(E,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);k=s-C.tx,D=r-C.ty;let V=(k*R-D*S)*P-c,X=(D*A-k*I)*P-u,Y=V*V+X*X;if(0!=h){h*=d*(g+1)*.5;const t=Math.sqrt(Y),e=t-N-U*d+h;if(e>0){let s=Math.min(1,e/(2*h))-1;s=(e-h*(1-s*s))/t,V-=s*V,X-=s*X,Y=V*V+X*X}}t:if(M){U*=d;let t=(Y-N*N-U*U)/(2*N*U);t<-1?(t=-1,L=Math.PI*n):t>1?(t=1,L=0,a&&(A=(Math.sqrt(Y)/(N+U)-1)*l+1,p*=A,o&&(m*=A))):L=Math.acos(t)*n,A=N+U*t,S=U*Math.sin(L),O=Math.atan2(X*A-V*S,V*A+X*S)}else{A=d*U,S=f*U;const t=A*A,e=S*S,s=Math.atan2(X,V);I=e*N*N+t*Y-t*e;const r=-2*e*N,a=e-t;if(R=r*r-4*a*I,R>=0){let t=Math.sqrt(R);r<0&&(t=-t),t=.5*-(r+t);const e=t/a,i=I/t,o=Math.abs(e)=-1&&I<=1&&(I=Math.acos(I),k=A*Math.cos(I)+N,D=S*Math.sin(I),R=k*k+D*D,Rm&&(u=I,m=R,p=k,g=D)),Y<=.5*(l+m)?(O=s-Math.atan2(c*n,h),L=o*n):(O=s-Math.atan2(g*n,p),L=u*n)}const q=Math.atan2(w,E)*_;let j=t.arotation;O=(O-q)*i.cj.radDeg+y-j,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(c,u,j+O*l,p,m,0,0),j=e.arotation,L=((L+q)*i.cj.radDeg-e.ashearX)*_+b-j,L>180?L-=360:L<-180&&(L+=360),e.updateWorldTransformWith(E,w,j+L*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class ze extends je{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 $e extends je{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=i.pw.Fixed,this.spacingMode=Qe.Fixed,this.rotateMode=i.Dr.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 Qe=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Qe||{});const Ze=class{constructor(t,e){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=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,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,r=t.bones.length;s0){t=c/t*f;for(let e=1;e0?i.cj.degRad:-i.cj.degRad}for(let t=0,n=3;t0){const s=c.a,r=c.c,o=c.b,h=c.d;let d=0,f=0,b=0;if(d=a?p[n-1]:0==u[t+1]?p[n+2]:Math.atan2(E,_),d-=Math.atan2(o,s),y){f=Math.cos(d),b=Math.sin(d);const t=l.data.length;m+=(t*(f*s-b*o)-_)*e,g+=(t*(b*s+f*o)-E)*e}else d+=x;d>i.cj.PI?d-=i.cj.PI2:d<-i.cj.PI&&(d+=i.cj.PI2),d*=e,f=Math.cos(d),b=Math.sin(d),c.a=f*s-b*o,c.c=f*r-b*h,c.b=b*s+f*o,c.d=b*r+f*h}l.updateAppliedTransform()}}computeWorldPositions(t,e,s){const r=this.target;let n=this.position;const a=this.spaces,o=i.Aq.setArraySize(this.positions,3*e+2);let h=this.world;const l=t.closed;let c=t.worldVerticesLength,u=c/6,d=Ze.NONE;if(!t.constantSpeed){const f=t.lengths;u-=l?1:2;const p=f[u];let m;switch(this.data.positionMode==i.pw.Percent&&(n*=p),this.data.spacingMode){case Qe.Percent:m=p;break;case Qe.Proportional:m=p/e;break;default:m=1}h=i.Aq.setArraySize(this.world,8);for(let i=0,g=0,x=0;ip){d!=Ze.AFTER&&(d=Ze.AFTER,t.computeWorldVertices(r,c-6,4,h,0,2)),this.addAfterPosition(y-p,h,0,o,g);continue}}for(;;x++){const t=f[x];if(!(y>t)){if(0==x)y/=t;else{const e=f[x-1];y=(y-e)/(t-e)}break}}x!=d&&(d=x,l&&x==u?(t.computeWorldVertices(r,c-4,4,h,0,2),t.computeWorldVertices(r,0,4,h,4,2)):t.computeWorldVertices(r,6*x+2,8,h,0,2)),this.addCurvePosition(y,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],o,g,s||i>0&&0==e)}return o}l?(c+=2,h=i.Aq.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,h,0,2),t.computeWorldVertices(r,0,2,h,c-4,2),h[c-2]=h[0],h[c-1]=h[1]):(u--,c-=4,h=i.Aq.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,h,0,2));const f=i.Aq.setArraySize(this.curves,u);let p,m=0,g=h[0],x=h[1],y=0,b=0,_=0,E=0,w=0,v=0,T=0,A=0,S=0,I=0,R=0,M=0,C=0,P=0;for(let t=0,e=2;tm){this.addAfterPosition(F-m,h,c-4,o,r);continue}}for(;;i++){const t=f[i];if(!(F>t)){if(0==i)F/=t;else{const e=f[i-1];F=(F-e)/(t-e)}break}}if(i!=d){d=i;let t=6*i;for(g=h[t],x=h[t+1],y=h[t+2],b=h[t+3],_=h[t+4],E=h[t+5],w=h[t+6],v=h[t+7],T=.03*(g-2*y+_),A=.03*(x-2*b+E),S=.006*(3*(y-_)-g+w),I=.006*(3*(b-E)-x+v),R=2*T+S,M=2*A+I,C=.3*(y-g)+T+.16666667*S,P=.3*(b-x)+A+.16666667*I,D=Math.sqrt(C*C+P*P),k[0]=D,t=1;t<8;t++)C+=R,P+=M,R+=S,M+=I,D+=Math.sqrt(C*C+P*P),k[t]=D;C+=R,P+=M,D+=Math.sqrt(C*C+P*P),k[8]=D,C+=R+S,P+=M+I,D+=Math.sqrt(C*C+P*P),k[9]=D,u=0}for(F*=D;;u++){const t=k[u];if(!(F>t)){if(0==u)F/=t;else{const e=k[u-1];F=u+(F-e)/(t-e)}break}}this.addCurvePosition(.1*F,g,x,y,b,_,E,w,v,o,r,s||t>0&&0==e)}return o}addBeforePosition(t,e,s,r,n){const i=e[s],a=e[s+1],o=e[s+2]-i,h=e[s+3]-a,l=Math.atan2(h,o);r[n]=i+t*Math.cos(l),r[n+1]=a+t*Math.sin(l),r[n+2]=l}addAfterPosition(t,e,s,r,n){const i=e[s+2],a=e[s+3],o=i-e[s],h=a-e[s+1],l=Math.atan2(h,o);r[n]=i+t*Math.cos(l),r[n+1]=a+t*Math.sin(l),r[n+2]=l}addCurvePosition(t,e,s,r,n,i,a,o,h,l,c,u){if(0==t||isNaN(t))return l[c]=e,l[c+1]=s,void(l[c+2]=Math.atan2(n-s,r-e));const d=t*t,f=d*t,p=1-t,m=p*p,g=m*p,x=p*t,y=3*x,b=p*y,_=y*t,E=e*g+r*b+i*_+o*f,w=s*g+n*b+a*_+h*f;l[c]=E,l[c+1]=w,u&&(l[c+2]=t<.001?Math.atan2(n-s,r-e):Math.atan2(w-(s*m+n*x*2+a*d),E-(e*m+r*x*2+i*d)))}};let Ke=Ze;Ke.NONE=-1,Ke.BEFORE=-2,Ke.AFTER=-3,Ke.epsilon=1e-5;class Je{constructor(t,e){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new i.Q1,this.darkColor=t.darkColor?new i.Q1:null,this.setToSetupPose(),this.blendMode=this.data.blendMode}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof Bt&&this.attachment instanceof Bt&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class ts{constructor(t,e){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new i.I9,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY,this.bones=new Array;for(let s=0;s0?i.cj.degRad:-i.cj.degRad,m=this.data.offsetRotation*p,g=this.data.offsetShearY*p,x=this.bones;for(let l=0,p=x.length;li.cj.PI?a-=i.cj.PI2:a<-i.cj.PI&&(a+=i.cj.PI2),a*=t;const o=Math.cos(a),h=Math.sin(a);y.a=o*e-h*r,y.c=o*s-h*n,y.b=h*e+o*r,y.d=h*s+o*n}if(o){const t=this.temp;h.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),y.tx+=(t.x-y.tx)*e,y.ty+=(t.y-y.ty)*s}if(0!=r){let t=Math.sqrt(y.a*y.a+y.b*y.b);0!=t&&(t=(t+(Math.sqrt(c*c+d*d)-t+this.data.offsetScaleX)*r)/t),y.a*=t,y.b*=t}if(0!=n){let t=Math.sqrt(y.c*y.c+y.d*y.d);0!=t&&(t=(t+(Math.sqrt(u*u+f*f)-t+this.data.offsetScaleY)*n)/t),y.c*=t,y.d*=t}if(a>0){const t=y.c,e=y.d,s=Math.atan2(e,t);let r=Math.atan2(f,u)-Math.atan2(d,c)-(s-Math.atan2(y.b,y.a));r>i.cj.PI?r-=i.cj.PI2:r<-i.cj.PI&&(r+=i.cj.PI2),r=s+(r+g)*a;const n=Math.sqrt(t*t+e*e);y.c=Math.cos(r)*n,y.d=Math.sin(r)*n}p.updateAppliedTransform()}}applyRelativeWorld(){const t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,a=this.mixShearY,o=0!=e||0!=s,h=this.target,l=h.matrix,c=l.a,u=l.c,d=l.b,f=l.d,p=c*f-u*d>0?i.cj.degRad:-i.cj.degRad,m=this.data.offsetRotation*p,g=this.data.offsetShearY*p,x=this.bones;for(let l=0,p=x.length;li.cj.PI?a-=i.cj.PI2:a<-i.cj.PI&&(a+=i.cj.PI2),a*=t;const o=Math.cos(a),h=Math.sin(a);y.a=o*e-h*r,y.c=o*s-h*n,y.b=h*e+o*r,y.d=h*s+o*n}if(o){const t=this.temp;h.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),y.tx+=t.x*e,y.ty+=t.y*s}if(0!=r){const t=(Math.sqrt(c*c+d*d)-1+this.data.offsetScaleX)*r+1;y.a*=t,y.b*=t}if(0!=n){const t=(Math.sqrt(u*u+f*f)-1+this.data.offsetScaleY)*n+1;y.c*=t,y.d*=t}if(a>0){let t=Math.atan2(f,u)-Math.atan2(d,c);t>i.cj.PI?t-=i.cj.PI2:t<-i.cj.PI&&(t+=i.cj.PI2);const e=y.c,s=y.d;t=Math.atan2(s,e)+(t-i.cj.PI/2+g)*a;const r=Math.sqrt(e*e+s*s);y.c=Math.cos(t)*r,y.d=Math.sin(t)*r}p.updateAppliedTransform()}}applyAbsoluteLocal(){const t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,i=this.mixShearY,a=this.target,o=this.bones;for(let h=0,l=o.length;h= 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 is extends je{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 as{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class os{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 e=0;e>4,t.readFloat())}r.push(e);break}}}}}const a=t.readInt(!0);if(a>0){const e=new ye(a),n=s.slots.length;for(let s=0;s=0;t--)o[t]=-1;const h=i.Aq.newArray(n-a,0);let l=0,c=0;for(let e=0;e=0;t--)-1==o[t]&&(o[t]=h[--c]);e.setFrame(s,r,o)}r.push(e)}const o=t.readInt(!0);if(o>0){const e=new ge(o);for(let r=0;r=0;e--)-1==h[e]&&(h[e]=t[--n])}e.setFrame(a,qs(o,"time",0),h)}n.push(e)}if(t.events){const e=new ge(t.events.length);let r=0;for(let n=0;n(t[t.UNKNOWN=0]="UNKNOWN",t[t.VER37=37]="VER37",t[t.VER38=38]="VER38",t[t.VER40=40]="VER40",t[t.VER41=41]="VER41",t))(Ws||{});function Gs(t){const e=t.substr(0,3),s=Math.floor(10*Number(e)+.001);return"3.7"===e?37:"3.8"===e?38:"4.0"===e?40:"4.1"===e?41:s<37?37:0}class Hs{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=Gs(r);if(n===Ws.VER38&&(s=new d.SkeletonBinary(new d.AtlasAttachmentLoader(t))),r=this.readVersionNewFormat(e),n=Gs(r),n!==Ws.VER40&&n!==Ws.VER41||(s=new hs(new Xe(t))),!s){const t=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(t)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new i.aG(t);let s;try{e.readString(),s=e.readString()}catch(t){s=""}return s||""}readVersionNewFormat(t){const e=new i.aG(t);let s;e.readInt32(),e.readInt32();try{s=e.readString()}catch(t){s=""}return s||""}}class zs{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=Gs(s);let n=null;if(r===Ws.VER37&&(n=new Ct(new ut(t))),r===Ws.VER38&&(n=new d.SkeletonJson(new d.AtlasAttachmentLoader(t))),r!==Ws.VER40&&r!==Ws.VER41||(n=new Ls(new Xe(t))),!n){const t=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(t)}return n.scale=this.scale,n.readSkeletonData(e)}}class $s extends i.bJ{createSkeleton(t){const e=Gs(t.version);let s=null;if(e===Ws.VER37&&(s=r),e===Ws.VER38&&(s=d),e!==Ws.VER40&&e!==Ws.VER41||(s=n),!s){const e=`Cant detect version of spine model ${t.version}`;console.error(e)}this.skeleton=new s.Skeleton(t),this.skeleton.updateWorldTransform(),this.stateData=new s.AnimationStateData(t),this.state=new s.AnimationState(this.stateData)}}(new class extends u{createBinaryParser(){return new Hs}createJsonParser(){return new zs}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}).installLoader()},455:(t,e,s)=>{"use strict";s.d(e,{Dl5:()=>At,sP:()=>v.sP,mcf:()=>a.mc,A1g:()=>W.A1,kxk:()=>i.k,EYj:()=>at,t9Q:()=>It,q5F:()=>r.q5});var r=s(8626);r.dJ,["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join("\n"),r.dJ,r.dJ;class n extends r.dJ{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(r.Eo,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const s=[(t>>16&255)/255,0,0,0,0,0,(t>>8&255)/255,0,0,0,0,0,(255&t)/255,0,0,0,0,0,1,0];this._loadMatrix(s,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),r=Math.sin(t),n=1/3,i=(0,Math.sqrt)(n),a=[s+(1-s)*n,n*(1-s)-i*r,n*(1-s)+i*r,0,0,n*(1-s)+i*r,s+n*(1-s),n*(1-s)-i*r,0,0,n*(1-s)-i*r,n*(1-s)+i*r,s+n*(1-s),0,0,0,0,0,1,0];this._loadMatrix(a,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=2*t/3+1,r=-.5*(s-1),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){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,s,r,n){const i=((s=s||16770432)>>16&255)/255,a=(s>>8&255)/255,o=(255&s)/255,h=((r=r||3375104)>>16&255)/255,l=(r>>8&255)/255,c=(255&r)/255,u=[.3,.59,.11,0,0,i,a,o,t=t||.2,0,h,l,c,e=e||.15,0,i-h,a-l,o-c,0,0];this._loadMatrix(u,n)}night(t,e){const s=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}predator(t,e){const s=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(s,e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}n.prototype.grayscale=n.prototype.greyscale,r.dJ,r.dJ,r.dJ;var i=s(668),a=s(6141);const o=new r.uq;a.q9.prototype._cacheAsBitmap=!1,a.q9.prototype._cacheData=null,a.q9.prototype._cacheAsBitmapResolution=null,a.q9.prototype._cacheAsBitmapMultisample=null;class h{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(a.q9.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(t){if(this._cacheAsBitmap===t)return;let e;this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new h),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}),a.q9.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},a.q9.prototype._initCachedDisplayObject=function(t){if(this._cacheData?.sprite)return;const e=this.alpha;this.alpha=1,t.batch.flush();const s=this.getLocalBounds(null,!0).clone();if(this.filters?.length){const t=this.filters[0].padding;s.pad(t)}s.ceil(r.W0.RESOLUTION);const n=t.renderTexture.current,a=t.renderTexture.sourceFrame.clone(),h=t.renderTexture.destinationFrame.clone(),l=t.projection.transform,c=r.Y7.create({width:s.width,height:s.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:this.cacheAsBitmapMultisample??t.multisample}),u=`cacheAsBitmap_${r.Wp.uid()}`;this._cacheData.textureCacheId=u,r.t5.addToCache(c.baseTexture,u),r.gP.addToCache(c,u);const d=this.transform.localTransform.copyTo(o).invert().translate(-s.x,-s.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:c,clear:!0,transform:d,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=l,t.renderTexture.bind(n,a,h),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const f=new i.k(c);f.transform.worldTransform=this.transform.worldTransform,f.anchor.x=-s.x/s.width,f.anchor.y=-s.y/s.height,f.alpha=e,f._bounds=this._bounds,this._cacheData.sprite=f,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=f.containsPoint.bind(f)},a.q9.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},a.q9.prototype._initCachedDisplayObjectCanvas=function(t){if(this._cacheData?.sprite)return;const e=this.getLocalBounds(null,!0),s=this.alpha;this.alpha=1;const n=t.canvasContext.activeContext,a=t._projTransform;e.ceil(r.W0.RESOLUTION);const h=r.Y7.create({width:e.width,height:e.height}),l=`cacheAsBitmap_${r.Wp.uid()}`;this._cacheData.textureCacheId=l,r.t5.addToCache(h.baseTexture,l),r.gP.addToCache(h,l);const c=o;this.transform.localTransform.copyTo(c),c.invert(),c.tx-=e.x,c.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),t.canvasContext.activeContext=n,t._projTransform=a,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=s;const u=new i.k(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-e.x/e.width,u.anchor.y=-e.y/e.height,u.alpha=s,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)},a.q9.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},a.q9.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},a.q9.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,r.t5.removeFromCache(this._cacheData.textureCacheId),r.gP.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},a.q9.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},a.q9.prototype.name=null,a.mc.prototype.getChildByName=function(t,e){for(let e=0,s=this.children.length;et.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,r=e.length;s=0;r--)if(t.currentTarget=s[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this.rootTarget){t.eventPhase=t.BUBBLING_PHASE;const r=s.children;if(r)for(let s=0;s=0;a--){const o=i[a],h=this.hitTestRecursive(o,e||o.interactive,s,r,n);if(h){if(h.length>0&&!h[h.length-1].parent)continue;return(h.length>0||t.interactive)&&h.push(t),h}}}return e&&r(t,s)?t.interactive?[t]:[]:null}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,p),!t.hitArea.contains(p.x,p.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!s.containsPoint?.(e))return!0}return!1}hitTestFn(t,e){return!!t.hitArea||!!t.containsPoint&&t.containsPoint(e)}notifyTarget(t,e){e=e??t.type;const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof u))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){const t=2===e.button;this.dispatchEvent(e,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof u))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.createPointerEvent(t),s="mouse"===e.pointerType||"pen"===e.pointerType,r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(r.overTargets&&n!==e.target){const r="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,r,n);if(this.dispatchEvent(i,"pointerout"),s&&this.dispatchEvent(i,"mouseout"),!e.composedPath().includes(n)){const r=this.createPointerEvent(t,"pointerleave",n);for(r.eventPhase=r.AT_TARGET;r.target&&!e.composedPath().includes(r.target);)r.currentTarget=r.target,this.notifyTarget(r),s&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;this.freeEvent(r)}this.freeEvent(i)}if(n!==e.target){const r="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(e,r);this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover");let a=n?.parent;for(;a&&a!==this.rootTarget.parent&&a!==e.target;)a=a.parent;if(!a||a===this.rootTarget.parent){const t=this.clonePointerEvent(e,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==n&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),s&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}const i=this.moveOnAll?"all":"dispatchEvent";this[i](e,"pointermove"),"touch"===e.pointerType&&this[i](e,"touchmove"),s&&(this[i](e,"mousemove"),this.cursor=e.target?.cursor),r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof u))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),r="mouse"===s.pointerType||"pen"===s.pointerType;this.dispatchEvent(s,"pointerover"),r&&this.dispatchEvent(s,"mouseover"),"mouse"===s.pointerType&&(this.cursor=s.target?.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 u))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId);if(e.overTargets){const s="mouse"===t.pointerType||"pen"===t.pointerType,r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const i=this.createPointerEvent(t,"pointerleave",r);for(i.eventPhase=i.AT_TARGET;i.target&&i.target!==this.rootTarget.parent;)i.currentTarget=i.target,this.notifyTarget(i),s&&this.notifyTarget(i,"mouseleave"),i.target=i.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(i)}this.cursor=null}mapPointerUp(t){if(!(t instanceof u))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if("mouse"===s.pointerType||"pen"===s.pointerType){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let i=n;if(n&&!s.composedPath().includes(n)){let e=n;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if("mouse"===s.pointerType||"pen"===s.pointerType){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],i=e}if(i){const n=this.clonePointerEvent(s,"click");n.target=i,n.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:n.target,timeStamp:e});const a=r.clicksByButton[t.button];a.target===n.target&&e-a.timeStamp<200?++a.clickCount:a.clickCount=1,a.target=n.target,a.timeStamp=e,n.detail=a.clickCount,"mouse"===n.pointerType?this.dispatchEvent(n,"click"):"touch"===n.pointerType&&this.dispatchEvent(n,"tap"),this.dispatchEvent(n,"pointertap"),this.freeEvent(n)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof u))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(s){let n=s;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType?this.notifyTarget(r,"touchendoutside"):"mouse"!==r.pointerType&&"pen"!==r.pointerType||this.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof d))return void console.warn("EventBoundary cannot map a non-wheel event as a wheel event");const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;s0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let t=0,e=r.length;t{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()})),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode?.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.interactive&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let t=0;t title : ${t.title}
tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new l(r),{target:s});r.rootTarget=this.renderer.lastObjectRendered,e.forEach((t=>r.dispatchEvent(n,t)))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this.activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}b.extension={name:"accessibility",type:[r.Ag.RendererPlugin,r.Ag.CanvasRendererPlugin]},r.XO.add(b);const _=class{constructor(t){this.stage=new a.mc,t=Object.assign({forceCanvas:!1},t),this.renderer=(0,r.q5)(t),_._plugins.forEach((e=>{e.init.call(this,t)}))}render(){this.renderer.render(this.stage)}get view(){return this.renderer.view}get screen(){return this.renderer.screen}destroy(t,e){const s=_._plugins.slice(0);s.reverse(),s.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};let E=_;E._plugins=[],r.XO.handleByList(r.Ag.Application,E._plugins);class w{static init(t){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame((()=>this.resize())))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let t,e;if(this.cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:r}=this._resizeTo;t=s,e=r}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}w.extension=r.Ag.Application,r.XO.add(w);var v=s(3912),T=(t=>(t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t))(T||{});const A={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,35986:1,34798:1,37808:1};class S extends r.dZ{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,n;"string"==typeof t?(s=t,n=new Uint8Array):(s=null,n=t),super(n,e),this.origin=s,this.buffer=n?new r.u3(n):null,this.origin&&!1!==e.autoLoad&&this.load(),n?.length&&(this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}async load(){const t=await fetch(this.origin),e=await t.blob(),s=await e.arrayBuffer();return this.data=new Uint32Array(s),this.buffer=new r.u3(s),this.loaded=!0,this.onBlobLoaded(s),this.update(),this}}class I extends S{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=I._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||I._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;for(let t=0,e=this.levels;t=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,s,r,n,i,a){const o=new Array(s);let h=t.byteOffset,l=i,c=a,u=l+r-1&~(r-1),d=c+n-1&~(n-1),f=u*d*A[e];for(let i=0;i1?l:u,levelHeight:s>1?c:d,levelBuffer:new Uint8Array(t.buffer,h,f)},h+=f,l=l>>1||1,c=c>>1||1,u=l+r-1&~(r-1),d=c+n-1&~(n-1),f=u*d*A[e];return o}}let R,M;function C(){M={s3tc:R.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:R.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:R.getExtension("WEBGL_compressed_texture_etc"),etc1:R.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:R.getExtension("WEBGL_compressed_texture_pvrtc")||R.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:R.getExtension("WEBGL_compressed_texture_atc"),astc:R.getExtension("WEBGL_compressed_texture_astc")}}const P={extension:{type:r.Ag.DetectionParser,priority:2},test:async()=>{const t=r.W0.ADAPTER.createCanvas().getContext("webgl");return!!t&&(R=t,!0)},add:async t=>{M||C();const e=[];for(const t in M)M[t]&&e.push(t);return[...e,...t]},remove:async t=>(M||C(),t.filter((t=>!(t in M))))};r.XO.add(P);const k={827611204:T.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:T.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:T.COMPRESSED_RGBA_S3TC_DXT5_EXT},D={70:T.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:T.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:T.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:T.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:T.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:T.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:T.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:T.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:T.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT},F=[171,75,84,88,32,49,49,187,13,10,26,10],B={[r.QE.UNSIGNED_BYTE]:1,[r.QE.UNSIGNED_SHORT]:2,[r.QE.INT]:4,[r.QE.UNSIGNED_INT]:4,[r.QE.FLOAT]:4,[r.QE.HALF_FLOAT]:8},N={[r.hR.RGBA]:4,[r.hR.RGB]:3,[r.hR.RG]:2,[r.hR.RED]:1,[r.hR.LUMINANCE]:1,[r.hR.LUMINANCE_ALPHA]:2,[r.hR.ALPHA]:1},O={[r.QE.UNSIGNED_SHORT_4_4_4_4]:2,[r.QE.UNSIGNED_SHORT_5_5_5_1]:2,[r.QE.UNSIGNED_SHORT_5_6_5]:2};function L(t){switch(t){case r.hR.RGBA:return r.hR.RGBA_INTEGER;case r.hR.RGB:return r.hR.RGB_INTEGER;case r.hR.RG:return r.hR.RG_INTEGER;case r.hR.RED:return r.hR.RED_INTEGER;default:return t}}const U={extension:{type:r.Ag.LoadParser,priority:v.T9.High},test:t=>(0,v.WO)(t,".dds"),async load(t,e,s){const n=await r.W0.ADAPTER.fetch(t),i=function(t){const e=new Uint32Array(t);if(542327876!==e[0])throw new Error("Invalid DDS file magic word");const s=new Uint32Array(t,0,124/Uint32Array.BYTES_PER_ELEMENT),r=s[3],n=s[4],i=s[7],a=new Uint32Array(t,19*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),o=a[1];if(4&o){const s=a[2];if(808540228!==s){const e=k[s],a=new Uint8Array(t,128);return[new I(a,{format:e,width:n,height:r,levels:i})]}const o=128,h=new Uint32Array(e.buffer,o,20/Uint32Array.BYTES_PER_ELEMENT),l=h[0],c=h[1],u=h[2],d=h[3],f=D[l];if(void 0===f)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(4===u)throw new Error("DDSParser does not support cubemap textures");if(6===c)throw new Error("DDSParser does not supported 3D texture data");const p=new Array,m=148;if(1===d)p.push(new Uint8Array(t,m));else{const e=A[f];let s=0,a=n,o=r;for(let t=0;t>>=1,o>>>=1;let h=m;for(let e=0;enew I(t,{format:f,width:n,height:r,levels:i})))}if(64&o)throw new Error("DDSParser does not support uncompressed texture data.");if(512&o)throw new Error("DDSParser does not supported YUV uncompressed texture data.");if(131072&o)throw new Error("DDSParser does not support single-channel (lumninance) texture data!");if(2&o)throw new Error("DDSParser does not support single-channel (alpha) texture data!");throw new Error("DDSParser failed to load a texture file due to an unknown reason!")}(await n.arrayBuffer()).map((n=>{const i=new r.t5(n,{mipmap:r.E8.OFF,alphaMode:r.Gk.NO_PREMULTIPLIED_ALPHA,resolution:r.Wp.getResolutionOfUrl(t),...e.data});return(0,v.sZ)(i,s,t)}));return 1===i.length?i[0]:i},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};r.XO.add(U);const V={extension:{type:r.Ag.LoadParser,priority:v.T9.High},test:t=>(0,v.WO)(t,".ktx"),async load(t,e,s){const n=await r.W0.ADAPTER.fetch(t),i=await n.arrayBuffer(),{compressed:a,uncompressed:o,kvData:h}=function(t,e,s=!1){const n=new DataView(e);if(!function(t,e){for(let t=0;te-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h1||0!==a?v:S,levelHeight:p>1||0!==a?T:R,levelBuffer:new Uint8Array(e,r,w)},r+=w}M+=s+4,M=M%4!=0?M+4-M%4:M,v=v>>1||1,T=T>>1||1,S=v+4-1&-4,R=T+4-1&-4,w=S*R*b}return 0!==a?{uncompressed:y.map((t=>{let e=t[0].levelBuffer,s=!1;return a===r.QE.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):a===r.QE.UNSIGNED_INT?(s=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):a===r.QE.INT&&(s=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new r.dZ(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:a,format:s?L(o):o}})),kvData:E}:{compressed:y.map((t=>new I(null,{format:h,width:l,height:c,levels:p,levelBuffers:t}))),kvData:E}}(0,i),l=a??o,c={mipmap:r.E8.OFF,alphaMode:r.Gk.NO_PREMULTIPLIED_ALPHA,resolution:r.Wp.getResolutionOfUrl(t),...e.data},u=l.map((e=>{l===o&&Object.assign(c,{type:e.type,format:e.format});const n=new r.t5(e,c);return n.ktxKeyValueData=h,(0,v.sZ)(n,s,t)}));return 1===u.length?u[0]:u},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};r.XO.add(V);const X={extension:r.Ag.ResolveParser,test:t=>{const e=t.split("?")[0].split(".").pop();return["basis","ktx","dds"].includes(e)},parse:t=>{if("ktx"===t.split("?")[0].split(".").pop()){const e=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(e.some((e=>t.endsWith(e))))return{resolution:parseFloat(r.W0.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e.find((e=>t.endsWith(e))),src:t}}return{resolution:parseFloat(r.W0.RETINA_PREFIX.exec(t)?.[1]??"1"),format:t.split(".").pop(),src:t}}};r.XO.add(X);const Y=new r.M_,q=class{constructor(t){this.renderer=t}async image(t,e,s){const r=new Image;return r.src=await this.base64(t,e,s),r}async base64(t,e,s){const r=this.canvas(t);if(void 0!==r.toDataURL)return r.toDataURL(e,s);if(void 0!==r.convertToBlob){const t=await r.convertToBlob({type:e,quality:s});return await new Promise((e=>{const s=new FileReader;s.onload=()=>e(s.result),s.readAsDataURL(t)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL or ICanvas.convertToBlob to be implemented")}canvas(t,e){const s=this.renderer;let n,i,a=!1,o=!1;t&&(t instanceof r.Y7?i=t:(i=this.renderer.generateTexture(t),o=!0)),i?(n=i.baseTexture.resolution,e=e??i.frame,a=!1,s.renderTexture.bind(i)):(n=s.resolution,e||((e=Y).width=s.width,e.height=s.height),a=!0,s.renderTexture.bind(null));const h=Math.round(e.width*n),l=Math.round(e.height*n);let c=new r.Wp.CanvasRenderTarget(h,l,1);const u=new Uint8Array(4*h*l),d=s.gl;d.readPixels(Math.round(e.x*n),Math.round(e.y*n),h,l,d.RGBA,d.UNSIGNED_BYTE,u);const f=c.context.getImageData(0,0,h,l);if(q.arrayPostDivide(u,f.data),c.context.putImageData(f,0,0),a){const t=new r.Wp.CanvasRenderTarget(c.width,c.height,1);t.context.scale(1,-1),t.context.drawImage(c.canvas,0,-l),c.destroy(),c=t}return o&&i.destroy(!0),c.canvas}pixels(t,e){const s=this.renderer;let n,i,a=!1;t&&(t instanceof r.Y7?i=t:(i=this.renderer.generateTexture(t),a=!0)),i?(n=i.baseTexture.resolution,e=e??i.frame,s.renderTexture.bind(i)):(n=s.resolution,e||((e=Y).width=s.width,e.height=s.height),s.renderTexture.bind(null));const o=Math.round(e.width*n),h=Math.round(e.height*n),l=new Uint8Array(4*o*h),c=s.gl;return c.readPixels(Math.round(e.x*n),Math.round(e.y*n),o,h,c.RGBA,c.UNSIGNED_BYTE,l),a&&i.destroy(!0),q.arrayPostDivide(l,l),l}destroy(){this.renderer=null}static arrayPostDivide(t,e){for(let s=0;ss&&!t.autoResize&&(a=s);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=r.Wp.correctBlendMode(t.blendMode,l),i.state.set(this.state);const c=i.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(i.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=r.Wp.premultiplyRgba(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,l),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let s=0,r=0;sn&&(h=n),r>=o.length&&o.push(this._generateOneMoreBuffer(t));const l=o[r];l.uploadDynamic(e,s,h);const u=t._bufferUpdateIDs[r]||0;d=d||l._updateID0,l=s.alpha,c=l<1&&h?r.Wp.premultiplyTint(s._tintRGB,l):s._tintRGB+(255*l<<24);n[a]=c,n[a+i]=c,n[a+2*i]=c,n[a+3*i]=c,a+=4*i}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}z.extension={name:"particle",type:r.Ag.RendererPlugin},r.XO.add(z),r.W0.UPLOADS_PER_FRAME=4;var $=(t=>(t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",t))($||{});const Q={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:$.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},Z=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];class K{constructor(t){this.styleID=0,this.reset(),et(this,t,t)}clone(){const t={};return et(t,this,Q),new K(t)}reset(){et(this,Q,Q)}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=tt(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=tt(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(let s=0;s=0;t--){let s=e[t].trim();/([\"\'])[^\'\"]+\1/.test(s)||Z.includes(s)||(s=`"${s}"`),e[t]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}}function J(t){return"number"==typeof t?r.Wp.hex2string(t):("string"==typeof t&&t.startsWith("0x")&&(t=t.replace("0x","#")),t)}function tt(t){if(Array.isArray(t)){for(let e=0;ef)if(""!==i&&(a+=rt.addLine(i),i="",n=0),rt.canBreakWords(s,e.breakWords)){const t=rt.wordWrapSplit(s);for(let l=0;lf&&(a+=rt.addLine(i),d=!1,i="",n=0),i+=c,n+=p}}else{i.length>0&&(a+=rt.addLine(i),i="",n=0);const e=t===p.length-1;a+=rt.addLine(s,!e),d=!1,i="",n=0}else l+n>f&&(d=!1,a+=rt.addLine(i),i="",n=0),(i.length>0||!rt.isBreakingSpace(s)||d)&&(i+=s,n+=l)}return a+=rt.addLine(i,!1),a}static addLine(t,e=!0){return t=rt.trimRight(t),e?`${t}\n`:t}static getFromCache(t,e,s,r){let n=s[t];if("number"!=typeof n){const i=t.length*e;n=r.measureText(t).width+i,s[t]=n}return n}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(t){if("string"!=typeof t)return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!rt.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return"string"==typeof t&&rt._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return"string"==typeof t&&rt._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if("string"!=typeof t)return e;for(let r=0;ra;--u){for(let t=0;t0&&i>a&&(o=(a+i)/2);const u=a+r,d=s.lineHeight*(t+1);let f=u;t+10}}function ht(t,e){let s=!1;if(t?._textures?.length)for(let n=0;n{this.queue&&this.prepareItems()},this.registerFindHook(ft),this.registerFindHook(pt),this.registerFindHook(ht),this.registerFindHook(lt),this.registerFindHook(ct),this.registerUploadHook(ut),this.registerUploadHook(dt)}upload(t){return new Promise((e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,r.Rv.system.addOnce(this.tick,this,r.dQ.UTILITY))):e()}))}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed)for(let s=0,r=this.uploadHooks.length;s=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&r.Rv.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}}function gt(t,e){return e instanceof r.t5&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function xt(t,e){if(!(e instanceof W.A1))return!1;const{geometry:s}=e;e.finishPoly(),s.updateBatches();const{batches:r}=s;for(let e=0;e{this._callback=t,this._batchIndex=0,this._frameKeys.length<=_t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}_processFrames(t){let e=t;const s=_t.BATCH_SIZE;for(;e-t{this._batchIndex*_t.BATCH_SIZE{n[t]=e})),Object.keys(e.textures).forEach((t=>{n[t]=e.textures[t]})),!s){const s=r.Wp.path.dirname(t[0]);e.linkedSheets.forEach(((t,r)=>{const i=vt([`${s}/${e.data.meta.related_multi_packs[r]}`],t,!0);Object.assign(n,i)}))}return n}const Tt={extension:r.Ag.Asset,cache:{test:t=>t instanceof Et,getCacheableAssets:(t,e)=>vt(t,e,!1)},resolver:{test:t=>{const e=t.split("?")[0].split("."),s=e.pop(),r=e.pop();return"json"===s&&wt.includes(r)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(r.W0.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{extension:{type:r.Ag.LoadParser,priority:v.T9.Normal},testParse:async(t,e)=>r.Wp.path.extname(e.src).includes(".json")&&!!t.frames,async parse(t,e,s){let n=r.Wp.path.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");const i=n+t.meta.image,a=(await s.load([i]))[i],o=new Et(a.baseTexture,t,e.src);await o.parse();const h=t?.meta?.related_multi_packs;if(Array.isArray(h)){const t=[];for(const r of h){if("string"!=typeof r)continue;const i=n+r;e.data?.ignoreMultiPack||t.push(s.load({src:i,data:{ignoreMultiPack:!0}}))}const r=await Promise.all(t);o.linkedSheets=r,r.forEach((t=>{t.linkedSheets=[o].concat(o.linkedSheets.filter((e=>e!==t)))}))}return o},unload(t){t.destroy(!0)}}};r.XO.add(Tt);class At extends i.k{constructor(t,e=!0){super(t[0]instanceof r.gP?t[0]:t[0].texture),this._textures=null,this._durations=null,this._autoUpdate=e,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=t}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(r.Rv.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(r.Rv.shared.add(this.update,this,r.dQ.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=this.animationSpeed*t,s=this.currentFrame;if(null!==this._durations){let s=this._currentTime%1*this._durations[this.currentFrame];for(s+=e/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];const r=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*r,this._currentTime+=r;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this.updateTexture())}updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;sthis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(r.Rv.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(r.Rv.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const St=new r.bR;class It extends i.k{constructor(t,e=100,s=100){super(t),this.tileTransform=new r.dL,this._width=e,this._height=s,this.uvMatrix=this.texture.uvMatrix||new r.NW(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(t){const e=this._texture;e&&e.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){const t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,s=this._width*(1-this._anchor._x),r=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,s,r)}getLocalBounds(t){return 0===this.children.length?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new r.M_),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,St);const e=this._width,s=this._height,r=-e*this.anchor._x;if(St.x>=r&&St.x=t&&St.y1?r.Mt.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",e):r.Mt.from(Rt,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",e)}render(t){const e=this.renderer,s=this.quad;let n=s.vertices;n[0]=n[6]=t._width*-t.anchor.x,n[1]=n[3]=t._height*-t.anchor.y,n[2]=n[4]=t._width*(1-t.anchor.x),n[5]=n[7]=t._height*(1-t.anchor.y);const i=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;n=s.uvs,n[0]=n[6]=-i,n[1]=n[3]=-a,n[2]=n[4]=1-i,n[5]=n[7]=1-a,s.invalidate();const o=t._texture,h=o.baseTexture,l=h.alphaMode>0,c=t.tileTransform.localTransform,u=t.uvMatrix;let d=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==r.uR.CLAMP:h.wrapMode===r.uR.CLAMP&&(h.wrapMode=r.uR.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,x=t._height;Mt.set(c.a*p/g,c.b*p/x,c.c*m/g,c.d*m/x,c.tx/g,c.ty/x),Mt.invert(),d?Mt.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=Mt.toArray(!0),f.uniforms.uColor=r.Wp.premultiplyTintToRgba(t.tint,t.worldAlpha,f.uniforms.uColor,l),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=r.Wp.correctBlendMode(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Ct.extension={name:"tilingSprite",type:r.Ag.RendererPlugin},r.XO.add(Ct);class Pt{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class kt{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const t in e){const r=e[t].match(/^[a-z]+/gm)[0],n=e[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),i={};for(const t in n){const e=n[t].split("="),s=e[0],r=e[1].replace(/"/gm,""),a=parseFloat(r),o=isNaN(a)?r:a;i[s]=o}s[r].push(i)}const r=new Pt;return s.info.forEach((t=>r.info.push({face:t.face,size:parseInt(t.size,10)}))),s.common.forEach((t=>r.common.push({lineHeight:parseInt(t.lineHeight,10)}))),s.page.forEach((t=>r.page.push({id:parseInt(t.id,10),file:t.file}))),s.char.forEach((t=>r.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)}))),s.kerning.forEach((t=>r.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)}))),s.distanceField.forEach((t=>r.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType}))),r}}class Dt{static test(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){const e=new Pt,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),i=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let t=0;t")){const e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return Dt.test(e)}return!1}static parse(t){const e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return Dt.parse(e)}}const Bt=[kt,Dt,Ft];function Nt(t,e,s,n,i,a,o){const h=s.text,l=s.fontProperties;e.translate(n,i),e.scale(a,a);const c=o.strokeThickness/2,u=-o.strokeThickness/2;if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=function(t,e,s,r,n,i){const a=s.fill;if(!Array.isArray(a))return a;if(1===a.length)return a[0];let o;const h=s.dropShadow?s.dropShadowDistance:0,l=s.padding||0,c=t.width/r-h-2*l,u=t.height/r-h-2*l,d=a.slice(),f=s.fillGradientStops.slice();if(!f.length){const t=d.length+1;for(let e=1;e=h-w*a){if(0===y)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${e}')`);--t,p=null,m=null,g=null,y=0,x=0,b=0;continue}if(b=Math.max(w+s.fontProperties.descent,b),v*a+x>=d){if(0===x)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${e}')`);--t,y+=b*a,y=Math.ceil(y),x=0,b=0;continue}Nt(p,m,s,x,y,a,u);const T=Lt(s.text);f.char.push({id:T,page:E.length-1,x:x/a,y:y/a,width:v,height:w,xoffset:0,yoffset:0,xadvance:Math.ceil(n-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0))}),x+=(v+2*i)*a,x=Math.ceil(x)}for(let t=0,e=c.length;t{this.dirty=!0}),this,0,0),this._roundPixels=r.W0.ROUND_PIXELS,this.dirty=!0,this._resolution=r.W0.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const t=Vt.available[this._fontName],e=this.fontSize,s=e/t.size,n=new r.bR,i=[],a=[],o=[],h=Ot(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),l=this._maxWidth*t.size/e,c="none"===t.distanceFieldType?Xt:Yt;let u=null,d=0,f=0,p=0,m=-1,g=0,x=0,y=0,b=0;for(let e=0;e0&&n.x>l&&(++x,r.Wp.removeItems(i,1+m-x,1+e-m),e=m,m=-1,a.push(g),o.push(i.length>0?i[i.length-1].prevSpaces:0),f=Math.max(f,g),p++,n.x=0,n.y+=t.lineHeight,u=null,b=0)}const _=h[h.length-1];"\r"!==_&&"\n"!==_&&(/(?:\s)/.test(_)&&(d=g),a.push(d),f=Math.max(f,d),o.push(-1));const E=[];for(let t=0;t<=p;t++){let e=0;"right"===this._align?e=f-a[t]:"center"===this._align?e=(f-a[t])/2:"justify"===this._align&&(e=o[t]<0?0:(f-a[t])/o[t]),E.push(e)}const w=i.length,v={},T=[],A=this._activePagesMeshData;c.push(...A);for(let e=0;e 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),i=r.B9.NORMAL_NPM);const a=new G.e(s,n);a.blendMode=i,e={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:a,vertices:null,uvs:null,indices:null}}e.index=0,e.indexCount=0,e.vertexCount=0,e.uvsCount=0,e.total=0;const{_textureCache:i}=this;i[n]=i[n]||new r.gP(s.baseTexture),e.mesh.texture=i[n],e.mesh.tint=this._tint,T.push(e),v[n]=e}v[n].total++}for(let t=0;t6*s)||e.vertices.length<2*G.e.BATCHABLE_SIZE)e.vertices=new Float32Array(8*s),e.uvs=new Float32Array(8*s),e.indices=new Uint16Array(6*s);else{const t=e.total,s=e.vertices;for(let e=4*t*2;ee[t.mesh.texture.baseTexture.uid])).forEach((t=>{t.mesh.texture=r.gP.EMPTY}));for(const t in e)e[t].destroy(),delete e[t];this._font=null,this._textureCache=null,super.destroy(t)}};jt.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const Wt=[".xml",".fnt"],Gt={extension:{type:r.Ag.LoadParser,priority:v.T9.Normal},test:t=>Wt.includes(r.Wp.path.extname(t)),testParse:async t=>kt.test(t)||Ft.test(t),async parse(t,e,s){const n=kt.test(t)?kt.parse(t):Ft.parse(t),{src:i}=e,{page:a}=n,o=[];for(let t=0;th[t]));return Vt.install(n,l,!0)},load:async(t,e)=>(await r.W0.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};r.XO.add(Gt)}}]);