/*! For license information please see 8885.0c71f46a41b12625e9f7.js.LICENSE.txt */ (self.webpackChunklauncher=self.webpackChunklauncher||[]).push([[8885],{1924:(t,e,s)=>{"use strict";var r=s(210),n=s(5559),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}},5559:(t,e,s)=>{"use strict";var r=s(8612),n=s(210),i=n("%Function.prototype.apply%"),a=n("%Function.prototype.call%"),o=n("%Reflect.apply%",!0)||r.call(a,i),h=n("%Object.getOwnPropertyDescriptor%",!0),l=n("%Object.defineProperty%",!0),c=n("%Math.max%");if(l)try{l({},"a",{value:1})}catch(t){l=null}t.exports=function(t){var e=o(r,a,arguments);return h&&l&&h(e,"length").configurable&&l(e,"length",{value:1+c(0,t.length-(arguments.length-1))}),e};var u=function(){return o(r,i,arguments)};l?l(t.exports,"apply",{value:u}):t.exports.apply=u},9187: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,E=d(m,x,e,s,r),_=d(y,b,e,s,r),w=t.prevZ,v=t.nextZ;w&&w.z>=E&&v&&v.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;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>=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;w=w.prevZ}for(;v&&v.z<=_;){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)&&_(i,a)&&_(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)&&(_(t,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=E(g(t,e,s)),i=E(g(t,e,r)),a=E(g(s,r,t)),o=E(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 E(t){return t>0?1:t<0?-1:0}function _(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}},6729: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=Array.prototype.slice,s=Object.prototype.toString;t.exports=function(t){var r=this;if("function"!=typeof r||"[object Function]"!==s.call(r))throw new TypeError("Function.prototype.bind called on incompatible "+r);for(var n,i=e.call(arguments,1),a=Math.max(0,r.length-i.length),o=[],h=0;h{"use strict";var r=s(7648);t.exports=Function.prototype.bind||r},210:(t,e,s)=>{"use strict";var r,n=SyntaxError,i=Function,a=TypeError,o=function(t){try{return i('"use strict"; return ('+t+").constructor;")()}catch(t){}},h=Object.getOwnPropertyDescriptor;if(h)try{h({},"")}catch(t){h=null}var l=function(){throw new a},c=h?function(){try{return l}catch(t){try{return h(arguments,"callee").get}catch(t){return l}}}():l,u=s(1405)(),d=s(8185)(),f=Object.getPrototypeOf||(d?function(t){return t.__proto__}:null),p={},m="undefined"!=typeof Uint8Array&&f?f(Uint8Array):r,g={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":u&&f?f([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%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%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u&&f?f(f([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u&&f?f((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%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u&&f?f((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":u&&f?f(""[Symbol.iterator]()):r,"%Symbol%":u?Symbol:r,"%SyntaxError%":n,"%ThrowTypeError%":c,"%TypedArray%":m,"%TypeError%":a,"%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%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(f)try{null.error}catch(t){var x=f(f(t));g["%Error.prototype%"]=x}var y=function t(e){var s;if("%AsyncFunction%"===e)s=o("async function () {}");else if("%GeneratorFunction%"===e)s=o("function* () {}");else if("%AsyncGeneratorFunction%"===e)s=o("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(s=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&f&&(s=f(n.prototype))}return g[e]=s,s},b={"%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"]},E=s(8612),_=s(7642),w=E.call(Function.call,Array.prototype.concat),v=E.call(Function.apply,Array.prototype.splice),T=E.call(Function.call,String.prototype.replace),A=E.call(Function.call,String.prototype.slice),S=E.call(Function.call,RegExp.prototype.exec),M=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,I=/\\(\\)?/g,R=function(t,e){var s,r=t;if(_(b,r)&&(r="%"+(s=b[r])[0]+"%"),_(g,r)){var i=g[r];if(i===p&&(i=y(r)),void 0===i&&!e)throw new a("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:i}}throw new n("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new a('"allowMissing" argument must be a boolean');if(null===S(/^%?[^%]*%?$/,t))throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=function(t){var e=A(t,0,1),s=A(t,-1);if("%"===e&&"%"!==s)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===s&&"%"!==e)throw new n("invalid intrinsic syntax, expected opening `%`");var r=[];return T(t,M,(function(t,e,s,n){r[r.length]=s?T(n,I,"$1"):e||t})),r}(t),r=s.length>0?s[0]:"",i=R("%"+r+"%",e),o=i.name,l=i.value,c=!1,u=i.alias;u&&(r=u[0],v(s,w([0,1],u)));for(var d=1,f=!0;d=s.length){var y=h(l,p);l=(f=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:l[p]}else f=_(l,p),l=l[p];f&&!c&&(g[o]=l)}}return l}},8185:t=>{"use strict";var e={foo:{}},s=Object;t.exports=function(){return{__proto__:e}.foo===e.foo&&!({__proto__:null}instanceof s)}},1405:(t,e,s)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,n=s(5419);t.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&n()}},5419: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}},7642:(t,e,s)=>{"use strict";var r=s(8612);t.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},631:(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,E=String.prototype.toUpperCase,_=String.prototype.toLowerCase,w=RegExp.prototype.test,v=Array.prototype.concat,T=Array.prototype.join,A=Array.prototype.slice,S=Math.floor,M="function"==typeof BigInt?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,R="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 N=s(4654),B=N.custom,O=Y(B)?B:null;function L(t,e,s){var r="double"===(s.quoteStyle||e)?'"':"'";return r+t+r}function V(t){return b.call(String(t),/"/g,""")}function X(t){return!("[object Array]"!==W(t)||P&&"object"==typeof t&&P in t)}function U(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||!R)return!1;try{return R.call(t),!0}catch(t){}return!1}t.exports=function t(e,s,r,n){var o=s||{};if(q(o,"quoteStyle")&&"single"!==o.quoteStyle&&"double"!==o.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(q(o,"maxStringLength")&&("number"==typeof o.maxStringLength?o.maxStringLength<0&&o.maxStringLength!==1/0:null!==o.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var h=!q(o,"customInspect")||o.customInspect;if("boolean"!=typeof h&&"symbol"!==h)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(q(o,"indent")&&null!==o.indent&&"\t"!==o.indent&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(q(o,"numericSeparator")&&"boolean"!=typeof o.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var m=o.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 j(e,o);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var E=String(e);return m?F(e,E):E}if("bigint"==typeof e){var w=String(e)+"n";return m?F(e,w):w}var S=void 0===o.depth?5:o.depth;if(void 0===r&&(r=0),r>=S&&S>0&&"object"==typeof e)return X(e)?"[Array]":"[Object]";var I,B=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)}}(o,r);if(void 0===n)n=[];else if(H(n,e)>=0)return"[Circular]";function G(e,s,i){if(s&&(n=A.call(n)).push(s),i){var a={depth:o.depth};return q(o,"quoteStyle")&&(a.quoteStyle=o.quoteStyle),t(e,a,r+1,n)}return t(e,o,r+1,n)}if("function"==typeof e&&!U(e)){var $=function(t){if(t.name)return t.name;var e=x.call(g.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(e),tt=J(e,G);return"[Function"+($?": "+$:" (anonymous)")+"]"+(tt.length>0?" { "+T.call(tt,", ")+" }":"")}if(Y(e)){var et=C?b.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):R.call(e);return"object"!=typeof e||C?et:z(et)}if((I=e)&&"object"==typeof I&&("undefined"!=typeof HTMLElement&&I instanceof HTMLElement||"string"==typeof I.nodeName&&"function"==typeof I.getAttribute)){for(var st="<"+_.call(String(e.nodeName)),rt=e.attributes||[],nt=0;nt"}if(X(e)){if(0===e.length)return"[]";var it=J(e,G);return B&&!function(t){for(var e=0;e=0)return!1;return!0}(it)?"["+Z(it,B)+"]":"[ "+T.call(it,", ")+" ]"}if(function(t){return!("[object Error]"!==W(t)||P&&"object"==typeof t&&P in t)}(e)){var at=J(e,G);return"cause"in Error.prototype||!("cause"in e)||k.call(e,"cause")?0===at.length?"["+String(e)+"]":"{ ["+String(e)+"] "+T.call(at,", ")+" }":"{ ["+String(e)+"] "+T.call(v.call("[cause]: "+G(e.cause),at),", ")+" }"}if("object"==typeof e&&h){if(O&&"function"==typeof e[O]&&N)return N(e,{depth:S-r});if("symbol"!==h&&"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 ot=[];return a&&a.call(e,(function(t,s){ot.push(G(s,e,!0)+" => "+G(t,e))})),K("Map",i.call(e),ot,B)}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 ht=[];return c&&c.call(e,(function(t){ht.push(G(t,e))})),K("Set",l.call(e),ht,B)}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(G(Number(e)));if(function(t){if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(t){}return!1}(e))return z(G(M.call(e)));if(function(t){return!("[object Boolean]"!==W(t)||P&&"object"==typeof t&&P in t)}(e))return z(p.call(e));if(function(t){return!("[object String]"!==W(t)||P&&"object"==typeof t&&P in t)}(e))return z(G(String(e)));if(!function(t){return!("[object Date]"!==W(t)||P&&"object"==typeof t&&P in t)}(e)&&!U(e)){var lt=J(e,G),ct=D?D(e)===Object.prototype:e instanceof Object||e.constructor===Object,ut=e instanceof Object?"":"null prototype",dt=!ct&&P&&Object(e)===e&&P in e?y.call(W(e),8,-1):ut?"Object":"",ft=(ct||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(dt||ut?"["+T.call(v.call([],dt||[],ut||[]),": ")+"] ":"");return 0===lt.length?ft+"{}":B?ft+"{"+Z(lt,B)+"}":ft+"{ "+T.call(lt,", ")+" }"}return String(e)};var G=Object.prototype.hasOwnProperty||function(t){return t in this};function q(t,e){return G.call(t,e)}function W(t){return m.call(t)}function H(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 j(y.call(t,0,e.maxStringLength),e)+r}return L(b.call(b.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$),"single",e)}function $(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":"")+E.call(e.toString(16))}function z(t){return"Object("+t+")"}function Q(t){return t+" { ? }"}function K(t,e,s,r){return t+" ("+e+") {"+(r?Z(s,r):T.call(s,", "))+"}"}function Z(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=X(t),r=[];if(s){r.length=t.length;for(var n=0;n{"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}},129:(t,e,s)=>{"use strict";var r=s(4924),n=s(5235),i=s(5798);t.exports={formats:i,parse:n,stringify:r}},5235:(t,e,s)=>{"use strict";var r=s(2769),n=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,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=[].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=parseInt(l,10);s.parseArrays||""!==l?!isNaN(c)&&o!==l&&String(c)===l&&c>=0&&s.parseArrays&&c<=s.arrayLimit?(a=[])[c]=n:"__proto__"!==l&&(a[l]=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(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;return{allowDots:void 0===t.allowDots?a.allowDots:!!t.allowDots,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,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,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),n.call(l,m)?l[m]=r.combine(l[m],g):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(7478),n=s(2769),i=s(5798),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,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,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){for(var v,T=e,A=w,S=0,M=!1;void 0!==(A=A.get(p))&&!M;){var I=A.get(e);if(S+=1,void 0!==I){if(I===S)throw new RangeError("Cyclic object value");M=!0}void 0===A.get(p)&&(S=0)}if("function"==typeof d?T=d(s,T):T instanceof Date?T=x(T):"comma"===i&&h(T)&&(T=n.maybeMap(T,(function(t){return t instanceof Date?x(t):t}))),null===T){if(o)return u&&!E?u(s,f.encoder,_,"key",y):s;T=""}if("string"==typeof(v=T)||"number"==typeof v||"boolean"==typeof v||"symbol"==typeof v||"bigint"==typeof v||n.isBuffer(T))return u?[b(E?s:u(s,f.encoder,_,"key",y))+"="+b(u(T,f.encoder,_,"value",y))]:[b(s)+"="+b(String(T))];var R,C=[];if(void 0===T)return C;if("comma"===i&&h(T))E&&u&&(T=n.maybeMap(T,u)),R=[{value:T.length>0?T.join(",")||null:void 0}];else if(h(d))R=d;else{var P=Object.keys(T);R=m?P.sort(m):P}for(var k=a&&h(T)&&1===T.length?s+"[]":s,D=0;D0?_+E:""}},2769:(t,e,s)=>{"use strict";var r=s(5798),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(210),n=s(1924),i=s(631),a=r("%TypeError%"),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}},2511: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 E(t,e){for(var s=t.length,r=[];s--;)r[s]=e(t[s]);return r}function _(t,e){var s=t.split("@"),r="";return s.length>1&&(r=s[0]+"@",t=s[1]),r+E((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,E=128,_=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<=_?1:c>=_+l?l:c-_));c+=h)a>x(o/(f=h-d))&&b("overflow"),a*=f;_=A(y-i,e=m.length+1,0==i),x(y/e)>o-E&&b("overflow"),E+=x(y/e),y%=e,m.splice(y++,0,E)}return v(m)}function M(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)_=u-f,E=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:M,toASCII:function(t){return _(t,(function(t){return f.test(t)?"xn--"+M(t):t}))},toUnicode:function(t){return _(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)}()},8575:(t,e,s)=>{"use strict";var r=s(2511);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(129);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 N=R.slice(0,S),B=R.slice(S+1),O=P.match(f);O&&(N.push(O[1]),B.unshift(O[2])),B.length&&(y="/"+B.join(".")+y),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var L=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+L,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!p[_])for(S=0,C=l.length;S0)&&s.host.split("@"))&&(s.auth=I.shift(),s.hostname=I.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,M=w.length;M>=0;M--)"."===(T=w[M])?w.splice(M,1):".."===T?(w.splice(M,1),S++):S&&(w.splice(M,1),S--);if(!E&&!_)for(;S--;S)w.unshift("..");!E||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),A&&"/"!==w.join("/").substr(-1)&&w.push("");var I,R=""===w[0]||w[0]&&"/"===w[0].charAt(0);return v&&(s.hostname=R?"":w.length?w.shift():"",s.host=s.hostname,(I=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=I.shift(),s.hostname=I.shift(),s.host=s.hostname)),(E=E||s.host&&w.length)&&!R&&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.Qc=y,e.DB=function(t,e){return y(t,!1,!0).resolve(e)},e.WU=function(t){return"string"==typeof t&&(t=y(t)),t instanceof n?t.format():n.prototype.format.call(t)}},8766:(t,e,s)=>{"use strict";s.d(e,{sf:()=>r,YT:()=>n,Il:()=>v,JS:()=>E,M8:()=>A,bq:()=>i,mJ:()=>a,Kg:()=>P,T:()=>o,RN:()=>I,YK:()=>h,o$:()=>D,Ww:()=>G,PA:()=>_,Yi:()=>g,Qe:()=>l,cQ:()=>C,FM:()=>k,Xd:()=>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 0!=(128&e)&&(e=this.readByte(),s|=(127&e)<<7,0!=(128&e)&&(e=this.readByte(),s|=(127&e)<<14,0!=(128&e)&&(e=this.readByte(),s|=(127&e)<<21,0!=(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(6043);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.iw.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.aH.LINEAR:this.minFilter==d.Nearest?t.scaleMode=c.aH.NEAREST:(t.mipmap=c.KI.POW2,e==d.MipMapNearestNearest?t.scaleMode=c.aH.NEAREST:t.scaleMode=c.aH.LINEAR)}}class b extends p{}class E{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 _{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&&0==(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 M 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 I extends M{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const R=class{static arrayCopy(t,e,s,r,n){for(let i=e,a=r;i=e?t:R.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 N=s(8820),B=s(2274),O=s(5638),L=s(3879);const V=[0,0,0];class X extends B.j{constructor(){super(...arguments),this.region=null,this.attachment=null}}class U extends O.AL{constructor(t,e,s,r,n){super(t,e,s,r,n),this.region=null,this.attachment=null}}const Y=class extends N.W2{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:()=>j,AnimationStateAdapter:()=>J,AnimationStateData:()=>et,AtlasAttachmentLoader:()=>st,Attachment:()=>n,AttachmentTimeline:()=>k,Bone:()=>nt,BoneData:()=>it,BoundingBoxAttachment:()=>o,ClippingAttachment:()=>h,ColorTimeline:()=>R,ConstraintData:()=>at,CurveTimeline:()=>_,DeformTimeline:()=>F,DrawOrderTimeline:()=>B,Event:()=>ot,EventData:()=>ht,EventQueue:()=>K,EventTimeline:()=>N,EventType:()=>Z,IkConstraint:()=>lt,IkConstraintData:()=>ct,IkConstraintTimeline:()=>L,JitterEffect:()=>m,MeshAttachment:()=>l,PathAttachment:()=>c,PathConstraint:()=>pt,PathConstraintData:()=>ut,PathConstraintMixTimeline:()=>W,PathConstraintPositionTimeline:()=>Y,PathConstraintSpacingTimeline:()=>G,PointAttachment:()=>u,RegionAttachment:()=>p,RotateTimeline:()=>v,ScaleTimeline:()=>S,ShearTimeline:()=>M,Skeleton:()=>xt,SkeletonBinary:()=>Tt,SkeletonBounds:()=>Mt,SkeletonData:()=>yt,SkeletonJson:()=>It,Skin:()=>wt,SkinEntry:()=>_t,Slot:()=>d,SlotData:()=>bt,SpacingMode:()=>dt,Spine:()=>Ct,SwirlEffect:()=>x,TimelineType:()=>b,TrackEntry:()=>z,TransformConstraint:()=>mt,TransformConstraintData:()=>Et,TransformConstraintTimeline:()=>X,TranslateTimeline:()=>A,TwoColorTimeline:()=>P,VertexAttachment:()=>a});var r=s(8766);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 E=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=r.cQ.newFloatArray((t-1)*E.BEZIER_SIZE)}getFrameCount(){return this.curves.length/E.BEZIER_SIZE+1}setLinear(t){this.curves[t*E.BEZIER_SIZE]=E.LINEAR}setStepped(t){this.curves[t*E.BEZIER_SIZE]=E.STEPPED}getCurveType(t){const e=t*E.BEZIER_SIZE;if(e==this.curves.length)return E.LINEAR;const s=this.curves[e];return s==E.LINEAR?E.LINEAR:s==E.STEPPED?E.STEPPED:E.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*E.BEZIER_SIZE;const p=this.curves;p[f++]=E.BEZIER;let m=u,g=d;for(let t=f+E.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;_.LINEAR=0,_.STEPPED=1,_.BEZIER=2,_.BEZIER_SIZE=19;const w=class extends _{constructor(t){super(t),this.frames=r.cQ.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.bq.setup:l.rotation=l.data.rotation+t*i;break;case r.bq.first:case r.bq.replace:t+=l.data.rotation-l.rotation,t-=360*(16384-(16384.499999999996-t/360|0));case r.bq.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.bq.setup:l.rotation=l.data.rotation+(p-360*(16384-(16384.499999999996-p/360|0)))*i;break;case r.bq.first:case r.bq.replace:p+=l.data.rotation-l.rotation;case r.bq.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 _{constructor(t){super(t),this.frames=r.cQ.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.bq.setup:l.x=l.data.x+c*i,l.y=l.data.y+u*i;break;case r.bq.first:case r.bq.replace:l.x+=(l.data.x+c-l.x)*i,l.y+=(l.data.y+u-l.y)*i;break;case r.bq.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.bq.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.bq.setup:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(c)*r.M8.signum(t)-t)*i,l.scaleY=e+(Math.abs(u)*r.M8.signum(e)-e)*i;break;case r.bq.first:case r.bq.replace:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(c)*r.M8.signum(t)-t)*i,l.scaleY=e+(Math.abs(u)*r.M8.signum(e)-e)*i;break;case r.bq.add:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(c)*r.M8.signum(t)-l.data.scaleX)*i,l.scaleY=e+(Math.abs(u)*r.M8.signum(e)-l.data.scaleY)*i}else switch(a){case r.bq.setup:t=Math.abs(l.data.scaleX)*r.M8.signum(c),e=Math.abs(l.data.scaleY)*r.M8.signum(u),l.scaleX=t+(c-t)*i,l.scaleY=e+(u-e)*i;break;case r.bq.first:case r.bq.replace:t=Math.abs(l.scaleX)*r.M8.signum(c),e=Math.abs(l.scaleY)*r.M8.signum(u),l.scaleX=t+(c-t)*i,l.scaleY=e+(u-e)*i;break;case r.bq.add:t=r.M8.signum(c),e=r.M8.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 M 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-M.ENTRIES])c=h[h.length+M.PREV_X],u=h[h.length+M.PREV_Y];else{const t=y.binarySearch(h,s,M.ENTRIES);c=h[t+M.PREV_X],u=h[t+M.PREV_Y];const e=h[t],r=this.getCurvePercent(t/M.ENTRIES-1,1-(s-e)/(h[t+M.PREV_TIME]-e));c+=(h[t+M.X]-c)*r,u+=(h[t+M.Y]-u)*r}switch(a){case r.bq.setup:l.shearX=l.data.shearX+c*i,l.shearY=l.data.shearY+u*i;break;case r.bq.first:case r.bq.replace:l.shearX+=(l.data.shearX+c-l.shearX)*i,l.shearY+=(l.data.shearY+u-l.shearY)*i;break;case r.bq.add:l.shearX+=c*i,l.shearY+=u*i}}}const I=class extends _{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*I.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,r,n,i){t*=I.ENTRIES,this.frames[t]=e,this.frames[t+I.R]=s,this.frames[t+I.G]=r,this.frames[t+I.B]=n,this.frames[t+I.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-I.ENTRIES]){const t=l.length;c=l[t+I.PREV_R],u=l[t+I.PREV_G],d=l[t+I.PREV_B],f=l[t+I.PREV_A]}else{const t=y.binarySearch(l,s,I.ENTRIES);c=l[t+I.PREV_R],u=l[t+I.PREV_G],d=l[t+I.PREV_B],f=l[t+I.PREV_A];const e=l[t],r=this.getCurvePercent(t/I.ENTRIES-1,1-(s-e)/(l[t+I.PREV_TIME]-e));c+=(l[t+I.R]-c)*r,u+=(l[t+I.G]-u)*r,d+=(l[t+I.B]-d)*r,f+=(l[t+I.A]-f)*r}if(1==i)h.color.set(c,u,d,f);else{const t=h.color;a==r.bq.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 R=I;R.ENTRIES=5,R.PREV_TIME=-5,R.PREV_R=-4,R.PREV_G=-3,R.PREV_B=-2,R.PREV_A=-1,R.R=1,R.G=2,R.B=3,R.A=4;const C=class extends _{constructor(t){super(t),this.frames=r.cQ.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.bq.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.cQ.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.bq.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 _{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t),this.frameVertices=new Array(t),null==D&&(D=r.cQ.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.bq.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.bq.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 B{constructor(t){this.frames=r.cQ.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.bq.setup)return void r.cQ.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.cQ.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.bq.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.bq.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 V=class extends _{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*V.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,i){t*=V.ENTRIES,this.frames[t]=e,this.frames[t+V.ROTATE]=s,this.frames[t+V.TRANSLATE]=r,this.frames[t+V.SCALE]=n,this.frames[t+V.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-V.ENTRIES]){const t=h.length;c=h[t+V.PREV_ROTATE],u=h[t+V.PREV_TRANSLATE],d=h[t+V.PREV_SCALE],f=h[t+V.PREV_SHEAR]}else{const t=y.binarySearch(h,s,V.ENTRIES);c=h[t+V.PREV_ROTATE],u=h[t+V.PREV_TRANSLATE],d=h[t+V.PREV_SCALE],f=h[t+V.PREV_SHEAR];const e=h[t],r=this.getCurvePercent(t/V.ENTRIES-1,1-(s-e)/(h[t+V.PREV_TIME]-e));c+=(h[t+V.ROTATE]-c)*r,u+=(h[t+V.TRANSLATE]-u)*r,d+=(h[t+V.SCALE]-d)*r,f+=(h[t+V.SHEAR]-f)*r}if(a==r.bq.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 X=V;X.ENTRIES=5,X.PREV_TIME=-5,X.PREV_ROTATE=-4,X.PREV_TRANSLATE=-3,X.PREV_SCALE=-2,X.PREV_SHEAR=-1,X.ROTATE=1,X.TRANSLATE=2,X.SCALE=3,X.SHEAR=4;const U=class extends _{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*U.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=U.ENTRIES,this.frames[t]=e,this.frames[t+U.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-U.ENTRIES])c=h[h.length+U.PREV_VALUE];else{const t=y.binarySearch(h,s,U.ENTRIES);c=h[t+U.PREV_VALUE];const e=h[t],r=this.getCurvePercent(t/U.ENTRIES-1,1-(s-e)/(h[t+U.PREV_TIME]-e));c+=(h[t+U.VALUE]-c)*r}a==r.bq.setup?l.position=l.data.position+(c-l.data.position)*i:l.position+=(c-l.position)*i}};let Y=U;Y.ENTRIES=2,Y.PREV_TIME=-2,Y.PREV_VALUE=-1,Y.VALUE=1;class G 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-G.ENTRIES])c=h[h.length+G.PREV_VALUE];else{const t=y.binarySearch(h,s,G.ENTRIES);c=h[t+G.PREV_VALUE];const e=h[t],r=this.getCurvePercent(t/G.ENTRIES-1,1-(s-e)/(h[t+G.PREV_TIME]-e));c+=(h[t+G.VALUE]-c)*r}a==r.bq.setup?l.spacing=l.data.spacing+(c-l.data.spacing)*i:l.spacing+=(c-l.spacing)*i}}const q=class extends _{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*q.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,r){t*=q.ENTRIES,this.frames[t]=e,this.frames[t+q.ROTATE]=s,this.frames[t+q.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-q.ENTRIES])c=h[h.length+q.PREV_ROTATE],u=h[h.length+q.PREV_TRANSLATE];else{const t=y.binarySearch(h,s,q.ENTRIES);c=h[t+q.PREV_ROTATE],u=h[t+q.PREV_TRANSLATE];const e=h[t],r=this.getCurvePercent(t/q.ENTRIES-1,1-(s-e)/(h[t+q.PREV_TIME]-e));c+=(h[t+q.ROTATE]-c)*r,u+=(h[t+q.TRANSLATE]-u)*r}a==r.bq.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=q;W.ENTRIES=3,W.PREV_TIME=-3,W.PREV_ROTATE=-2,W.PREV_TRANSLATE=-1,W.ROTATE=1,W.TRANSLATE=2;const H=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new K(this),this.propertyIDs=new r.JS,this.animationsChanged=!1,this.trackEntryPool=new r.Kg((()=>new z)),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.bq.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.bq.add)for(let s=0;s1&&(i=1),s!=r.bq.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+H.SETUP)}setAttachment(t,e,s,r){e.setAttachment(null==s?null:t.getAttachment(e.data.index,s)),r&&(e.attachmentState=this.unkeyedState+H.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.M8.signum(e)!=r.M8.signum(m)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*r.M8.signum(t)),n=s),p=m+t-t%360,n!=s&&(p+=360*r.M8.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,H.emptyAnimation,!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e,s){s<=0&&(s-=e);const r=this.addAnimationWith(t,H.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]=H.HOLD_MIX,a[r]=s;continue t}break}i[r]=H.HOLD_FIRST}else i[r]=H.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){H.deprecatedWarning1||(H.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){H.deprecatedWarning2||(H.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 H.deprecatedWarning3||(H.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let j=H;j.emptyAnimation=new y("",[],0),j.SUBSEQUENT=0,j.FIRST=1,j.HOLD_SUBSEQUENT=2,j.HOLD_FIRST=3,j.HOLD_MIX=4,j.SETUP=1,j.CURRENT=2,j.deprecatedWarning1=!1,j.deprecatedWarning2=!1,j.deprecatedWarning3=!1;const $=class{constructor(){this.mixBlend=r.bq.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 $.deprecatedWarning1||($.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){$.deprecatedWarning1||($.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return $.deprecatedWarning2||($.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){$.deprecatedWarning2||($.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=$;z.deprecatedWarning1=!1,z.deprecatedWarning2=!1;const Q=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(Z.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Z.interrupt),this.objects.push(t)}end(t){this.objects.push(Z.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Z.dispose),this.objects.push(t)}complete(t){this.objects.push(Z.complete),this.objects.push(t)}event(t,e){this.objects.push(Z.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))(Z||{});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(6043);class nt{constructor(t,e,s){if(this.matrix=new rt.y3,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.Xd.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(null==h){const h=this.skeleton,d=s+90+o;return l.a=r.M8.cosDeg(s+a)*n*c,l.c=r.M8.cosDeg(d)*i*c,l.b=r.M8.sinDeg(s+a)*n*u,l.d=r.M8.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.Qe.Normal:{const t=s+90+o,e=r.M8.cosDeg(s+a)*n,h=r.M8.cosDeg(t)*i,c=r.M8.sinDeg(s+a)*n,u=r.M8.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.Qe.OnlyTranslation:{const t=s+90+o;l.a=r.M8.cosDeg(s+a)*n,l.c=r.M8.cosDeg(t)*i,l.b=r.M8.sinDeg(s+a)*n,l.d=r.M8.sinDeg(t)*i;break}case r.Qe.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.M8.radDeg):(d=0,p=0,e=90-Math.atan2(m,f)*r.M8.radDeg);const h=s+a-e,c=s+o-e+90,u=r.M8.cosDeg(h)*n,g=r.M8.cosDeg(c)*i,x=r.M8.sinDeg(h)*n,y=r.M8.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.Qe.NoScale:case r.Qe.NoScaleOrReflection:{const t=r.M8.cosDeg(s),e=r.M8.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.Qe.NoScale&&d*m-f*p<0!=(r.Xd.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,E=Math.sin(y)*x,_=r.M8.cosDeg(a)*n,w=r.M8.cosDeg(90+o)*i,v=r.M8.sinDeg(a)*n,T=r.M8.sinDeg(90+o)*i;l.a=h*_+b*v,l.c=h*w+b*T,l.b=g*_+E*v,l.d=g*w+E*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.M8.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*r.M8.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.M8.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.M8.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.M8.radDeg,this.arotation=Math.atan2(f,u)*r.M8.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*r.M8.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.M8.sinDeg(t),s=r.M8.cosDeg(t),n=this.matrix;return Math.atan2(n.a*e-n.b*s,n.d*s-n.c*e)*r.M8.radDeg}localToWorldRotation(t){const e=r.M8.sinDeg(t),s=r.M8.cosDeg(t),n=this.matrix;return Math.atan2(s*n.b+e*n.d,s*n.a+e*n.c)*r.M8.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,n=e.c,i=e.b,a=e.d,o=r.M8.cosDeg(t),h=r.M8.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.Qe.Normal,this.skinRequired=!1,this.color=new r.Il,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.Qe.NoScale:case r.Qe.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 E=0,_=0,w=0,v=m.a,T=m.c,A=m.b,S=m.d;const M=Math.abs(u-f)<=1e-4;M?(E=e.ay,_=v*b+T*E+m.tx,w=A*b+S*E+m.ty):(E=0,_=v*b+m.tx,w=A*b+m.ty);const I=t.parent.matrix;v=I.a,T=I.c,A=I.b,S=I.d;const R=1/(v*S-T*A);let C=_-I.tx,P=w-I.ty;const k=(C*S-P*T)*R-l,D=(P*v-C*A)*R-c,F=Math.sqrt(k*k+D*D);let N,B,O=e.data.length*p;if(F<1e-4)return this.apply1(t,s,n,!1,a,!1,h),void e.updateWorldTransformWith(b,E,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);C=s-I.tx,P=n-I.ty;let L=(C*S-P*T)*R-l,V=(P*v-C*A)*R-c,X=L*L+V*V;if(0!=o){o*=u*(p+1)/2;const t=Math.sqrt(X),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,V-=s*V,X=L*L+V*V}}t:if(M){O*=u;let t=(X-F*F-O*O)/(2*F*O);t<-1?t=-1:t>1&&(t=1,a&&(d*=(Math.sqrt(X)/(F+O)-1)*h+1)),B=Math.acos(t)*i,v=F+O*t,T=O*Math.sin(B),N=Math.atan2(V*v-L*T,L*v+V*T)}else{v=u*O,T=f*O;const t=v*v,e=T*T,s=Math.atan2(V,L);A=e*F*F+t*X-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)),X<=(l+m)/2?(N=s-Math.atan2(c*i,h),B=o*i):(N=s-Math.atan2(g*i,p),B=d*i)}const U=Math.atan2(E,b)*y;let Y=t.arotation;N=(N-U)*r.M8.radDeg+g-Y,N>180?N-=360:N<-180&&(N+=360),t.updateWorldTransformWith(l,c,Y+N*h,d,t.ascaleY,0,0),Y=e.arotation,B=((B+U)*r.M8.radDeg-e.ashearX)*y+x-Y,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(b,E,Y+B*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.YK.Tangent,u=h==r.YK.ChainScale,d=this.bones.length,f=l?d:d+1,p=this.bones,m=r.cQ.setArraySize(this.spaces,f);let g=null;const x=this.spacing;if(u||o){u&&(g=r.cQ.setArraySize(this.lengths,d));for(let t=0,e=f-1;t0?r.M8.degRad:-r.M8.degRad}for(let t=0,i=3;tr.M8.PI?u-=r.M8.PI2:u<-r.M8.PI&&(u+=r.M8.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.cQ.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.cQ.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.cQ.setArraySize(this.world,d),t.computeWorldVertices(a,2,d,c,0,2));const m=r.cQ.setArraySize(this.curves,f);let g=0,x=c[0],y=c[1],b=0,E=0,_=0,w=0,v=0,T=0,A=0,S=0,M=0,I=0,R=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],E=c[t+3],_=c[t+4],w=c[t+5],v=c[t+6],T=c[t+7],A=.03*(x-2*b+_),S=.03*(y-2*E+w),M=.006*(3*(b-_)-x+v),I=.006*(3*(E-w)-y+T),R=2*A+M,C=2*S+I,P=.3*(b-x)+A+.16666667*M,k=.3*(E-y)+S+.16666667*I,F=Math.sqrt(P*P+k*k),D[0]=F,t=1;t<8;t++)P+=R,k+=C,R+=M,C+=I,F+=Math.sqrt(P*P+k*k),D[t]=F;P+=R,k+=C,F+=Math.sqrt(P*P+k*k),D[8]=F,P+=R+M,k+=C+I,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,E=y*t,_=e*g+r*b+i*E+o*f,w=s*g+n*b+a*E+h*f;l[c]=_,l[c+1]=w,u&&(l[c+2]=Math.atan2(w-(s*m+n*x*2+a*d),_-(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.FM,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.M8.degRad:-r.M8.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let a=0,u=p.length;ar.M8.PI?a-=r.M8.PI2:a<-r.M8.PI&&(a+=r.M8.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.M8.PI?i-=r.M8.PI2:i<-r.M8.PI&&(i+=r.M8.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.M8.degRad:-r.M8.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let a=0,u=p.length;ar.M8.PI?a-=r.M8.PI2:a<-r.M8.PI&&(a+=r.M8.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.M8.PI?t-=r.M8.PI2:t<-r.M8.PI&&(t+=r.M8.PI2);const e=g.c,s=g.d;t=Math.atan2(s,e)+(t-r.M8.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.cQ.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 Et 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 _t{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 B(l),i=s.slots.length;for(let s=0;s=0;t--)o[t]=-1;const h=r.cQ.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 N(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 N(t.events.length);let n=0;for(let i=0;i{"use strict";s.d(e,{de:()=>d,Q2:()=>m,gN:()=>M,cU:()=>I});var r=s(6043);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.xE){const t=e;s.forEach((e=>{t.baseTexture!==r.xE.EMPTY.baseTexture&&r.VL.addToCache(t.baseTexture,e),r.xE.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.P6.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.P6.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.P6.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.Rw.handleByList(r.nw.LoadParser,d.loader.parsers).handleByList(r.nw.ResolveParser,d.resolver.parsers).handleByList(r.nw.CacheParser,d.cache.parsers).handleByList(r.nw.DetectionParser,d.detections);const f={loader:r.nw.LoadParser,resolver:r.nw.ResolveParser,cache:r.nw.CacheParser,detection:r.nw.DetectionParser};r.Rw.handle(r.nw.Asset,(t=>{const e=t.ref;Object.entries(f).filter((([t])=>!!e[t])).forEach((([t,s])=>r.Rw.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.Rw.remove(e[t])))}));const p={extension:r.nw.CacheParser,test:t=>Array.isArray(t)&&t.every((t=>t instanceof r.xE)),getCacheableAssets:(t,e)=>{const s={};return t.forEach((t=>{e.forEach(((e,r)=>{s[t+(0===r?"":r+1)]=e}))})),s}};r.Rw.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.nw.LoadParser,priority:m.Low},test:t=>r.P6.path.extname(t).includes(".json"),async load(t){const e=await r.Xd.ADAPTER.fetch(t);return await e.json()}};r.Rw.add(g);const x={extension:{type:r.nw.LoadParser,priority:m.Low},test:t=>r.P6.path.extname(t).includes(".txt"),async load(t){const e=await r.Xd.ADAPTER.fetch(t);return await e.text()}};r.Rw.add(x);const y=["normal","bold","100","200","300","400","500","600","700","800","900"],b=["woff","woff2","ttf","otf"],E={extension:{type:r.nw.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.Xd.ADAPTER.getFontFaceSet();if(s){const n=[],i=e.data?.family??function(t){const e=r.P6.path.extname(t);return r.P6.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.Xd.ADAPTER.getFontFaceSet().delete(t)))}};r.Rw.add(E);let _,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===_&&(_=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<_&&(A||(A=URL.createObjectURL(new Blob([T],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(A),t.addEventListener("message",(t=>{this.complete(t.data),this.returnWorker(t.target),this.next()}))),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise(((s,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 M(t,e){const s=t.split("?")[0],n=r.P6.path.extname(s).toLowerCase();return Array.isArray(e)?e.includes(n.toLowerCase()):n.toLowerCase()===e}function I(t,e,s){const n=new r.xE(t);return n.baseTexture.on("dispose",(()=>{delete e.promiseCache[s]})),n}const R=[".jpg",".png",".jpeg",".avif",".webp"],C={extension:{type:r.nw.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.VL(n,{resolution:r.P6.getResolutionOfUrl(t),...e.data});return i.resource.src=t,I(i,s,t)},unload(t){t.destroy(!0)}};r.Rw.add(C),r.nw.LoadParser,m.High;const P={extension:r.nw.ResolveParser,test:C.test,parse:t=>({resolution:parseFloat(r.Xd.RETINA_PREFIX.exec(t)?.[1]??"1"),format:t.split(".").pop(),src:t})};r.Rw.add(P);const k={extension:{type:r.nw.DetectionParser,priority:1},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await r.Xd.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.Rw.add(k);const D={extension:{type:r.nw.DetectionParser,priority:0},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await r.Xd.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.Rw.add(D);const F=["png","jpg","jpeg"],N={extension:{type:r.nw.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...F],remove:async t=>t.filter((t=>!F.includes(t)))};r.Rw.add(N)},6043:(t,e,s)=>{"use strict";s.d(e,{iw:()=>m,T$:()=>a,VL:()=>ge,a$:()=>br,JZ:()=>vr,Ie:()=>Er,lW:()=>Le,qm:()=>fe,yl:()=>g,Cd:()=>K,ZX:()=>H,lg:()=>o,Pj:()=>Z,nw:()=>U,I2:()=>h,wn:()=>Ms,wG:()=>Ge,A7:()=>b,KI:()=>p,y3:()=>st,bO:()=>Ze,AB:()=>et,_b:()=>q,E9:()=>$,mg:()=>J,$r:()=>Ts,ud:()=>We,jl:()=>W,Ae:()=>Q,TI:()=>Fe,c9:()=>tt,aH:()=>d,HS:()=>j,pX:()=>ve,ex:()=>As,ZM:()=>Ss,vK:()=>c,xE:()=>De,UX:()=>Rs,vB:()=>gt,wx:()=>dt,uF:()=>pt,oo:()=>je,Rv:()=>_r,Nt:()=>f,e6:()=>pr,Y9:()=>gr,kP:()=>mr,Rw:()=>G,Xd:()=>X,P6:()=>r});var r={};s.r(r),s.d(r,{BaseTextureCache:()=>te,CanvasRenderTarget:()=>re,DATA_URI:()=>ie,EventEmitter:()=>yt,ProgramCache:()=>Zt,TextureCache:()=>Jt,clearTextureCache:()=>se,correctBlendMode:()=>Nt,createIndicesForQuads:()=>Vt,decomposeDataUri:()=>ae,deprecation:()=>Kt,destroyTextureCache:()=>ee,determineCrossOrigin:()=>he,earcut:()=>bt,getBufferType:()=>Xt,getResolutionOfUrl:()=>le,hex2rgb:()=>Ct,hex2string:()=>Pt,interleaveTypedArrays:()=>Yt,isMobile:()=>V,isPow2:()=>qt,isWebGLSupported:()=>It,log2:()=>Wt,nextPow2:()=>Gt,path:()=>Tt,premultiplyBlendMode:()=>Ft,premultiplyRgba:()=>Bt,premultiplyTint:()=>Ot,premultiplyTintToRgba:()=>Lt,removeItems:()=>Ht,rgb2hex:()=>Dt,sayHello:()=>St,sign:()=>jt,skipHello:()=>At,string2hex:()=>kt,trimCanvas:()=>ne,uid:()=>zt,url:()=>_t});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||{}),E=(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))(_||{});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,M=/\bAndroid(?:.+)Mobile\b/i,I=/Android/i,R=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,C=/Silk/i,P=/Windows Phone/i,k=/\bWindows(?:.+)ARM\b/i,D=/BlackBerry/i,F=/BB10/i,N=/Opera Mini/i,B=/\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 V=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(R),tablet:!n(R)&&n(C),device:n(R)||n(C)},android:{phone:!n(P)&&n(R)||!n(P)&&n(M),tablet:!n(P)&&!n(R)&&!n(M)&&(n(C)||n(I)),device:!n(P)&&(n(R)||n(C)||n(M)||n(I))||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(N),firefox:n(O),chrome:n(B),device:n(D)||n(F)||n(N)||n(O)||n(B)},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),X={ADAPTER:w,MIPMAP_TEXTURES:p.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:E.NONE,SPRITE_MAX_TEXTURES:function(t){let e=!0;if(V.tablet||V.phone){if(V.apple.device){const t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);t&&parseInt(t[1],10)<11&&(e=!1)}if(V.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:V.apple.device?y.HIGH:y.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!V.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};X.PREFER_ENV=n.WEBGL2,X.STRICT_TEXTURE_CACHE=!1;var U=(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))(U||{});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},G={_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)}))}},q=2*Math.PI,W=180/Math.PI,H=Math.PI/180;var j=(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))(j||{});class ${constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new $(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 z=[new $,new $,new $,new $];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=j.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=z[0].set(t.left,t.top),o=z[1].set(t.left,t.bottom),h=z[2].set(t.right,t.top),l=z[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,E=x*r+y*n,_=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 K{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=j.CIRC}clone(){return new K(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 Z{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=j.ELIP}clone(){return new Z(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=j.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 $;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 $;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(q-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}}),X.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/X.TARGET_FPMS,this.elapsedMS=1/X.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=U.Application,G.add(xt);var yt=s(6729),bt=s(9187),Et=s(8575);const _t={parse:Et.Qc,format:Et.WU,resolve:Et.DB};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??X.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 Mt;function It(){return void 0===Mt&&(Mt=function(){const t={stencil:!0,failIfMajorPerformanceCaveat:X.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!X.ADAPTER.getWebGLRenderingContext())return!1;const e=X.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}}()),Mt}X.RETINA_PREFIX=/@([0-9\.]+)x/,X.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Rt={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=Rt[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 Nt(t,e){return Ft[e?1:0][t]}function Bt(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 Vt(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 qt(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 Ht(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||X.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((o||0)*this.resolution)/this.resolution,this._mipmap=r??X.MIPMAP_TEXTURES,this.anisotropicLevel=n??X.ANISOTROPIC_LEVEL,this._wrapMode=u||X.WRAP_MODE,this._scaleMode=i??X.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=zt(),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=qt(this.realWidth)&&qt(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=X.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}_${zt()}`}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(X.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_${zt()}`,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 X.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??X.ADAPTER.createCanvas(0,0),Se._EMPTY}}ce.push(Se,_e,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,Ee,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:X.SCALE_MODE,resolution:le(e)},r)),{resource:i}=n;i instanceof _e&&(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=X.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 Re(t))}}class Ne{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=E.NONE){const r=new Re(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Fe(r)}getOptimalTexture(t,e,s=1,r=E.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=Gt(t)))<<16|65535&(e=Gt(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||E.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=E.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||E.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=ze[0],r=ze[1],n=ze[2],i=ze[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)}}}Ke.extension={type:U.RendererSystem,name:"filter"},G.add(Ke);class Ze{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 Ze(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:U.RendererSystem,name:"context"},G.add(es);class ss{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=E.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 Ie(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;X.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=E.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)"},Es=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function _s(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=Zt[r];return n||(Zt[r]=n=new Ts(t,e,s)),n}}class As{constructor(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof je?e:new je(e):new je({}),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 Ms extends As{constructor(t,e,s){super(Ts.from(t||Ms.defaultVertexSrc,e||Ms.defaultFragmentSrc),s),this.padding=0,this.resolution=X.FILTER_RESOLUTION,this.multisample=X.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 Is=new st;class Rs{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(0!=(1&s),0!=(2&s),0!=(4&s),0!=(8&s))}destroy(){this.renderer=null}}Ps.extension={type:U.RendererSystem,name:"mask"},G.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=[],Ns=class extends ks{constructor(t){super(t),this.glConst=X.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(Ns.isMatrixRotated(e.worldTransform))return!1;if(Ns.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){Ns.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 Bs=Ns;Bs.extension={type:U.RendererSystem,name:"scissor"},G.add(Bs);class Os extends ks{constructor(t){super(t),this.glConst=X.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(0!=(1&n),0!=(2&n),0!=(4&n),0!=(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(0!=(1&r),0!=(2&r),0!=(4&r),0!=(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:U.RendererSystem,name:"stencil"},G.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:U.RendererSystem,name:"projection"},G.add(Ls);const Vs=new Q,Xs=new Q;class Us{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||(Vs.width=t.frame.width,Vs.height=t.frame.height,e=Vs),s||(Xs.x=t.frame.x,Xs.y=t.frame.y,Xs.width=e.width,Xs.height=e.height,s=Xs),i=n.framebuffer):(a=r.resolution,e||(Vs.width=r._view.screen.width,Vs.height=r._view.screen.height,e=Vs),s||((s=Vs).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)}Us.extension={type:U.RendererSystem,name:"renderTexture"},G.add(Us);const Gs={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 "},qs={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 Hs(t,e,s){const r=t.createShader(e);return t.shaderSource(r,s),t.compileShader(r),r}function js(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,Ks=0;const Zs={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=Ks++}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||(Zs.textureCount=0,Zs.uboCount=0,this.syncUniformGroup(t.uniformGroup,Zs)),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(qs[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=Gs[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=Hs(t,t.VERTEX_SHADER,e.vertexSrc),r=Hs(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)||zs(t,s),t.getShaderParameter(r,t.COMPILE_STATUS)||zs(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:U.RendererSystem,name:"textureGC"},G.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&&Ht(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:U.RendererSystem,name:"texture"},G.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:[U.RendererSystem,U.CanvasRendererSystem],name:"textureGenerator"},G.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:[U.RendererSystem,U.CanvasRendererSystem],name:"background"},G.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||X.ADAPTER.createCanvas(),this.resolution=t.resolution||X.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:[U.RendererSystem,U.CanvasRendererSystem],name:"_view"},G.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:[U.RendererSystem,U.CanvasRendererSystem],name:"_plugin"},G.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:[U.RendererSystem,U.CanvasRendererSystem],name:"startup"},G.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=E.HIGH?this.multisample=E.HIGH:e>=E.MEDIUM?this.multisample=E.MEDIUM:e>=E.LOW?this.multisample=E.LOW:this.multisample=E.NONE}destroy(){}}Ir.extension={type:U.RendererSystem,name:"_multisample"},G.add(Ir);class Rr{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}}Rr.extension={type:U.RendererSystem,name:"objectRenderer"},G.add(Rr)},8820:(t,e,s)=>{"use strict";s.d(e,{YZ:()=>n,W2:()=>h,s$:()=>i});var r=s(6043);r.Xd.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.Ae.EMPTY:((t=t||new r.Ae(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.P6.EventEmitter{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new r.wx,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.P6.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,{TC:()=>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(6043);class o{constructor(){this.color=16777215,this.alpha=1,this.texture=a.xE.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.xE.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-R*N,S-C*N,A-P*N,S-k*N,g,!1)+4:y+=2,g.push(A-P*B,S-k*B),g.push(A+P*N,S+k*N));continue}const u=(-R+v)*(-C+S)-(-R+A)*(-C+T),d=(-P+M)*(-k+S)-(-P+A)*(-k+I),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)*N,F=S+(m-S)*N,O=A-(f-A)*B,L=S-(m-S)*B,V=c?N:B;x<=Math.min(e*e+s*s,n*n+i*i)+V*V*_?l.join===r.BEVEL||x/_>w?(c?(g.push(b,F),g.push(A+R*B,S+C*B),g.push(b,F),g.push(A+P*B,S+k*B)):(g.push(A-R*N,S-C*N),g.push(O,L),g.push(A-P*N,S-k*N),g.push(O,L)),y+=2):l.join===r.ROUND?c?(g.push(b,F),g.push(A+R*B,S+C*B),y+=p(A,S,A+R*B,S+C*B,A+P*B,S+k*B,g,!0)+4,g.push(b,F),g.push(A+P*B,S+k*B)):(g.push(A-R*N,S-C*N),g.push(O,L),y+=p(A,S,A-R*N,S-C*N,A-P*N,S-k*N,g,!1)+4,g.push(A-P*N,S-k*N),g.push(O,L)):(g.push(b,F),g.push(O,L)):(g.push(A-R*N,S-C*N),g.push(A+R*B,S+C*B),l.join===r.ROUND?y+=c?p(A,S,A+R*B,S+C*B,A+P*B,S+k*B,g,!0)+2:p(A,S,A-R*N,S-C*N,A-P*N,S-k*N,g,!1)+2:l.join===r.MITER&&x/_<=w&&(c?(g.push(O,L),g.push(O,L)):(g.push(b,F),g.push(b,F)),y+=2),g.push(A-P*N,S-k*N),g.push(A+P*B,S+k*B),y+=2)}v=o[2*(x-2)],T=o[2*(x-2)+1],A=o[2*(x-1)],S=o[2*(x-1)+1],R=-(T-S),C=v-A,D=Math.sqrt(R*R+C*C),R/=D,C/=D,R*=E,C*=E,g.push(A-R*N,S-C*N),g.push(A+R*B,S+C*B),d||(l.cap===n.ROUND?y+=p(A-R*(N-B)*.5,S-C*(N-B)*.5,A-R*N,S-C*N,A+R*B,S+C*B,g,!1)+2:l.cap===n.SQUARE&&(y+=f(A,S,R,C,N,B,!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._b)),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=e;for(let _=1;_<=10;++_)l=_/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=E-g,b=m,E=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.HS.POLY]:l,[a.HS.CIRC]:c,[a.HS.ELIP]:c,[a.HS.RECT]:u,[a.HS.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(8820);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.E9,S=class extends a.JZ{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.YZ,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=_.pop(),r||(r=new a.a$,r.texArray=new a.Ie),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.Nt.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.VL._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.P6.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.mg,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new a.mg,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._b:i&&r<=n&&(r+=a._b),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.Ae(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new a.c9(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new a.Cd(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new a.Pj(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.mg(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.HS.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,{AL:()=>i});var r=s(5117),n=s(6043);class i extends r.Kj{constructor(t=n.xE.EMPTY,e,s,i,a){const o=new r.xc(e,s,i);o.getBuffer("aVertexPosition").static=!1,super(o,new r.rY(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)}}},5117:(t,e,s)=>{"use strict";s.d(e,{Kj:()=>l,xc:()=>u,rY:()=>c});var r=s(6043),n=s(8820);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.E9,o=new r.mg,h=class extends n.W2{constructor(t,e,s,n=r.lg.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||r.ZM.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.Xd.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.lg.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.P6.premultiplyTintToRgba(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class u extends r.wG{constructor(t,e,s){super();const n=new r.lW(t),i=new r.lW(e,!0),a=new r.lW(s,!0,!0);this.addAttribute("aVertexPosition",n,2,!1,r.vK.FLOAT).addAttribute("aTextureCoord",i,2,!1,r.vK.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}},2274:(t,e,s)=>{"use strict";s.d(e,{j:()=>o});var r=s(6043),n=s(8820);const i=new r.E9,a=new Uint16Array([0,1,2,0,2,3]);class o extends n.W2{constructor(t){super(),this._anchor=new r.AB(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.T$.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||r.xE.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.Xd.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=r.P6.sign(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=r.P6.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.Xd.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.xE.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}},339:(t,e,s)=>{"use strict";s.d(e,{PY:()=>zs});var r={};s.r(r),s.d(r,{Animation:()=>M,AnimationState:()=>st,AnimationStateAdapter2:()=>ht,AnimationStateData:()=>ct,AtlasAttachmentLoader:()=>ut,Attachment:()=>f,AttachmentTimeline:()=>U,Bone:()=>dt,BoneData:()=>ft,BoundingBoxAttachment:()=>g,ClippingAttachment:()=>x,ColorTimeline:()=>L,CurveTimeline:()=>C,DeformTimeline:()=>G,DrawOrderTimeline:()=>W,Event:()=>pt,EventData:()=>mt,EventQueue:()=>at,EventTimeline:()=>q,EventType:()=>ot,IkConstraint:()=>gt,IkConstraintData:()=>xt,IkConstraintTimeline:()=>j,JitterEffect:()=>T,MeshAttachment:()=>y,PathAttachment:()=>b,PathConstraint:()=>_t,PathConstraintData:()=>yt,PathConstraintMixTimeline:()=>tt,PathConstraintPositionTimeline:()=>K,PathConstraintSpacingTimeline:()=>Z,PointAttachment:()=>E,RegionAttachment:()=>v,RotateTimeline:()=>k,ScaleTimeline:()=>N,ShearTimeline:()=>B,Skeleton:()=>Tt,SkeletonBounds:()=>At,SkeletonData:()=>St,SkeletonJson:()=>Ct,Skin:()=>Rt,Slot:()=>_,SlotData:()=>Mt,SpacingMode:()=>bt,Spine:()=>kt,SwirlEffect:()=>S,TimelineType:()=>I,TrackEntry:()=>nt,TransformConstraint:()=>wt,TransformConstraintData:()=>It,TransformConstraintTimeline:()=>z,TranslateTimeline:()=>F,TwoColorTimeline:()=>X,VertexAttachment:()=>m});var n={};s.r(n),s.d(n,{AlphaTimeline:()=>ce,Animation:()=>jt,AnimationState:()=>Me,AnimationStateAdapter:()=>ke,AnimationStateData:()=>Xe,AtlasAttachmentLoader:()=>Ue,Attachment:()=>Dt,AttachmentTimeline:()=>fe,Bone:()=>Ye,BoneData:()=>Ge,BoundingBoxAttachment:()=>Bt,ClippingAttachment:()=>Ot,ConstraintData:()=>qe,CurveTimeline:()=>zt,CurveTimeline1:()=>Qt,CurveTimeline2:()=>Kt,DeformTimeline:()=>pe,DrawOrderTimeline:()=>ye,Event:()=>We,EventData:()=>He,EventQueue:()=>Ce,EventTimeline:()=>ge,EventType:()=>Pe,IkConstraint:()=>je,IkConstraintData:()=>$e,IkConstraintTimeline:()=>be,MeshAttachment:()=>Lt,PathAttachment:()=>Vt,PathConstraint:()=>Ze,PathConstraintData:()=>ze,PathConstraintMixTimeline:()=>ve,PathConstraintPositionTimeline:()=>_e,PathConstraintSpacingTimeline:()=>we,PointAttachment:()=>Xt,RGB2Timeline:()=>de,RGBA2Timeline:()=>ue,RGBATimeline:()=>he,RGBTimeline:()=>le,RegionAttachment:()=>Yt,RotateTimeline:()=>Zt,ScaleTimeline:()=>se,ScaleXTimeline:()=>re,ScaleYTimeline:()=>ne,Sequence:()=>qt,SequenceMode:()=>Wt,SequenceModeValues:()=>Ht,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:()=>qs,Timeline:()=>$t,TrackEntry:()=>Re,TransformConstraint:()=>ts,TransformConstraintData:()=>is,TransformConstraintTimeline:()=>Ee,TranslateTimeline:()=>Jt,TranslateXTimeline:()=>te,TranslateYTimeline:()=>ee,VertexAttachment:()=>Nt});var i=s(8766),a=s(311),o=s(6043);const h={extension:o.nw.Asset,loader:{extension:{type:o.nw.LoadParser,priority:a.Q2.Normal},test:t=>(0,a.gN)(t,".atlas"),async load(t){const e=await o.Xd.ADAPTER.fetch(t);return await e.text()},testParse(t,e){const s=(0,a.gN)(e.src,".atlas"),r="string"==typeof t;return Promise.resolve(s&&r)},async parse(t,e,s){const r=e.data;let n=o.P6.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.Yi(t,((t,s)=>{const r=e[t]||e.default;r&&r.baseTexture?s(r.baseTexture):s(r)}),d)}else u=new i.Yi(t,l(s,n,r.imageMetadata),d);return await c},unload(t){t.dispose()}}},l=(t,e,s)=>async(r,n)=>{const i=o.P6.path.normalize([...e.split(o.P6.path.sep),r].join(o.P6.path.sep));n((await t.load({src:i,data:s})).baseTexture)};function c(t){return t.hasOwnProperty("bones")}o.Rw.add(h);class u{constructor(){}installLoader(){const t=this,e={extension:o.nw.Asset,loader:{extension:{type:o.nw.LoadParser,priority:a.Q2.Normal},test:t=>(0,a.gN)(t,".skel"),async load(t){const e=await o.Xd.ADAPTER.fetch(t);return await e.arrayBuffer()},testParse(t,e){const s=(0,a.gN)(e.src,".json")&&c(t),r=(0,a.gN)(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.P6.path.extname(s.src).toLowerCase(),h=o.P6.path.basename(s.src,n);let u=o.P6.path.dirname(s.src);u&&u.lastIndexOf("/")!==u.length-1&&(u+="/");let d=null,f=e;(0,a.gN)(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.Yi(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.Rw.add(e),e}}var d=s(2873);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 I=(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))(I||{});const R=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=i.cQ.newFloatArray((t-1)*R.BEZIER_SIZE)}getFrameCount(){return this.curves.length/R.BEZIER_SIZE+1}setLinear(t){this.curves[t*R.BEZIER_SIZE]=R.LINEAR}setStepped(t){this.curves[t*R.BEZIER_SIZE]=R.STEPPED}getCurveType(t){const e=t*R.BEZIER_SIZE;if(e==this.curves.length)return R.LINEAR;const s=this.curves[e];return s==R.LINEAR?R.LINEAR:s==R.STEPPED?R.STEPPED:R.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*R.BEZIER_SIZE;const p=this.curves;p[f++]=R.BEZIER;let m=u,g=d;for(let t=f+R.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=R;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.cQ.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.bq.setup:l.rotation=l.data.rotation+t*n;break;case i.bq.first:case i.bq.replace:t+=l.data.rotation-l.rotation,t-=360*(16384-(16384.499999999996-t/360|0));case i.bq.add:l.rotation+=t*n}return}const c=M.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.bq.setup:l.rotation=l.data.rotation+(p-360*(16384-(16384.499999999996-p/360|0)))*n;break;case i.bq.first:case i.bq.replace:p+=l.data.rotation-l.rotation;case i.bq.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.cQ.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=M.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.bq.setup:l.x=l.data.x+c*n,l.y=l.data.y+u*n;break;case i.bq.first:case i.bq.replace:l.x+=(l.data.x+c-l.x)*n,l.y+=(l.data.y+u-l.y)*n;break;case i.bq.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 N 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-N.ENTRIES])c=h[h.length+N.PREV_X]*l.data.scaleX,u=h[h.length+N.PREV_Y]*l.data.scaleY;else{const t=M.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=(c+(h[t+N.X]-c)*r)*l.data.scaleX,u=(u+(h[t+N.Y]-u)*r)*l.data.scaleY}if(1==n)a==i.bq.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.bq.setup:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(c)*i.M8.signum(t)-t)*n,l.scaleY=e+(Math.abs(u)*i.M8.signum(e)-e)*n;break;case i.bq.first:case i.bq.replace:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(c)*i.M8.signum(t)-t)*n,l.scaleY=e+(Math.abs(u)*i.M8.signum(e)-e)*n;break;case i.bq.add:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(c)*i.M8.signum(t)-l.data.scaleX)*n,l.scaleY=e+(Math.abs(u)*i.M8.signum(e)-l.data.scaleY)*n}else switch(a){case i.bq.setup:t=Math.abs(l.data.scaleX)*i.M8.signum(c),e=Math.abs(l.data.scaleY)*i.M8.signum(u),l.scaleX=t+(c-t)*n,l.scaleY=e+(u-e)*n;break;case i.bq.first:case i.bq.replace:t=Math.abs(l.scaleX)*i.M8.signum(c),e=Math.abs(l.scaleY)*i.M8.signum(u),l.scaleX=t+(c-t)*n,l.scaleY=e+(u-e)*n;break;case i.bq.add:t=i.M8.signum(c),e=i.M8.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 B 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-B.ENTRIES])c=h[h.length+B.PREV_X],u=h[h.length+B.PREV_Y];else{const t=M.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+=(h[t+B.X]-c)*r,u+=(h[t+B.Y]-u)*r}switch(a){case i.bq.setup:l.shearX=l.data.shearX+c*n,l.shearY=l.data.shearY+u*n;break;case i.bq.first:case i.bq.replace:l.shearX+=(l.data.shearX+c-l.shearX)*n,l.shearY+=(l.data.shearY+u-l.shearY)*n;break;case i.bq.add:l.shearX+=c*n,l.shearY+=u*n}}}const O=class extends C{constructor(t){super(t),this.frames=i.cQ.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=M.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.bq.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 V=class extends C{constructor(t){super(t),this.frames=i.cQ.newFloatArray(t*V.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,r,n,i,a,o,h){t*=V.ENTRIES,this.frames[t]=e,this.frames[t+V.R]=s,this.frames[t+V.G]=r,this.frames[t+V.B]=n,this.frames[t+V.A]=i,this.frames[t+V.R2]=a,this.frames[t+V.G2]=o,this.frames[t+V.B2]=h}apply(t,e,s,r,n,a,o){const h=t.slots[this.slotIndex],l=this.frames;if(s=l[l.length-V.ENTRIES]){const t=l.length;c=l[t+V.PREV_R],u=l[t+V.PREV_G],d=l[t+V.PREV_B],f=l[t+V.PREV_A],p=l[t+V.PREV_R2],m=l[t+V.PREV_G2],g=l[t+V.PREV_B2]}else{const t=M.binarySearch(l,s,V.ENTRIES);c=l[t+V.PREV_R],u=l[t+V.PREV_G],d=l[t+V.PREV_B],f=l[t+V.PREV_A],p=l[t+V.PREV_R2],m=l[t+V.PREV_G2],g=l[t+V.PREV_B2];const e=l[t],r=this.getCurvePercent(t/V.ENTRIES-1,1-(s-e)/(l[t+V.PREV_TIME]-e));c+=(l[t+V.R]-c)*r,u+=(l[t+V.G]-u)*r,d+=(l[t+V.B]-d)*r,f+=(l[t+V.A]-f)*r,p+=(l[t+V.R2]-p)*r,m+=(l[t+V.G2]-m)*r,g+=(l[t+V.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.bq.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 X=V;X.ENTRIES=8,X.PREV_TIME=-8,X.PREV_R=-7,X.PREV_G=-6,X.PREV_B=-5,X.PREV_A=-4,X.PREV_R2=-3,X.PREV_G2=-2,X.PREV_B2=-1,X.R=1,X.G=2,X.B=3,X.A=4,X.R2=5,X.G2=6,X.B2=7;class U{constructor(t){this.frames=i.cQ.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.bq.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:M.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 G extends C{constructor(t){super(t),this.frames=i.cQ.newFloatArray(t),this.frameVertices=new Array(t),null==Y&&(Y=i.cQ.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.bq.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.bq.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.cQ.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.bq.setup)return void i.cQ.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);const c=this.frames;if(s=c[c.length-1]?c.length-1:M.binarySearch(c,s)-1;const d=this.drawOrders[u];if(null==d)i.cQ.arrayCopy(l,0,h,0,l.length);else for(let t=0,e=d.length;t=h[h.length-H.ENTRIES])return void(a==i.bq.setup?(l.mix=l.data.mix+(h[h.length+H.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+H.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+H.PREV_COMPRESS],l.stretch=0!=h[h.length+H.PREV_STRETCH])):(l.mix+=(h[h.length+H.PREV_MIX]-l.mix)*n,o==i.mJ.mixIn&&(l.bendDirection=h[h.length+H.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+H.PREV_COMPRESS],l.stretch=0!=h[h.length+H.PREV_STRETCH])));const c=M.binarySearch(h,s,H.ENTRIES),u=h[c+H.PREV_MIX],d=h[c],f=this.getCurvePercent(c/H.ENTRIES-1,1-(s-d)/(h[c+H.PREV_TIME]-d));a==i.bq.setup?(l.mix=l.data.mix+(u+(h[c+H.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+H.PREV_BEND_DIRECTION],l.compress=0!=h[c+H.PREV_COMPRESS],l.stretch=0!=h[c+H.PREV_STRETCH])):(l.mix+=(u+(h[c+H.MIX]-u)*f-l.mix)*n,o==i.mJ.mixIn&&(l.bendDirection=h[c+H.PREV_BEND_DIRECTION],l.compress=0!=h[c+H.PREV_COMPRESS],l.stretch=0!=h[c+H.PREV_STRETCH]))}};let j=H;j.ENTRIES=5,j.PREV_TIME=-5,j.PREV_MIX=-4,j.PREV_BEND_DIRECTION=-3,j.PREV_COMPRESS=-2,j.PREV_STRETCH=-1,j.MIX=1,j.BEND_DIRECTION=2,j.COMPRESS=3,j.STRETCH=4;const $=class extends C{constructor(t){super(t),this.frames=i.cQ.newFloatArray(t*$.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,i){t*=$.ENTRIES,this.frames[t]=e,this.frames[t+$.ROTATE]=s,this.frames[t+$.TRANSLATE]=r,this.frames[t+$.SCALE]=n,this.frames[t+$.SHEAR]=i}apply(t,e,s,r,n,a,o){const h=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(s=h[h.length-$.ENTRIES]){const t=h.length;c=h[t+$.PREV_ROTATE],u=h[t+$.PREV_TRANSLATE],d=h[t+$.PREV_SCALE],f=h[t+$.PREV_SHEAR]}else{const t=M.binarySearch(h,s,$.ENTRIES);c=h[t+$.PREV_ROTATE],u=h[t+$.PREV_TRANSLATE],d=h[t+$.PREV_SCALE],f=h[t+$.PREV_SHEAR];const e=h[t],r=this.getCurvePercent(t/$.ENTRIES-1,1-(s-e)/(h[t+$.PREV_TIME]-e));c+=(h[t+$.ROTATE]-c)*r,u+=(h[t+$.TRANSLATE]-u)*r,d+=(h[t+$.SCALE]-d)*r,f+=(h[t+$.SHEAR]-f)*r}if(a==i.bq.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=$;z.ENTRIES=5,z.PREV_TIME=-5,z.PREV_ROTATE=-4,z.PREV_TRANSLATE=-3,z.PREV_SCALE=-2,z.PREV_SHEAR=-1,z.ROTATE=1,z.TRANSLATE=2,z.SCALE=3,z.SHEAR=4;const Q=class extends C{constructor(t){super(t),this.frames=i.cQ.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=M.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.bq.setup?l.position=l.data.position+(c-l.data.position)*n:l.position+=(c-l.position)*n}};let K=Q;K.ENTRIES=2,K.PREV_TIME=-2,K.PREV_VALUE=-1,K.VALUE=1;class Z extends K{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-Z.ENTRIES])c=h[h.length+Z.PREV_VALUE];else{const t=M.binarySearch(h,s,Z.ENTRIES);c=h[t+Z.PREV_VALUE];const e=h[t],r=this.getCurvePercent(t/Z.ENTRIES-1,1-(s-e)/(h[t+Z.PREV_TIME]-e));c+=(h[t+Z.VALUE]-c)*r}a==i.bq.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.cQ.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=M.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.bq.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.JS,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new i.Kg((()=>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.bq.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.bq.add)for(let s=0;s1&&(n=1),s!=i.bq.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=M.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.M8.signum(e)!=i.M8.signum(m)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*i.M8.signum(t)),r=s),p=m+t-t%360,r!=s&&(p+=360*i.M8.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 M("",[],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.bq.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(e)}newClippingAttachment(t,e){return new x(e)}}class dt{constructor(t,e,s){if(this.matrix=new o.y3,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.Xd.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(null==h){const h=this.skeleton,d=s+90+o;return l.a=i.M8.cosDeg(s+a)*r*c,l.c=i.M8.cosDeg(d)*n*c,l.b=i.M8.sinDeg(s+a)*r*u,l.d=i.M8.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.Qe.Normal:{const t=s+90+o,e=i.M8.cosDeg(s+a)*r,h=i.M8.cosDeg(t)*n,c=i.M8.sinDeg(s+a)*r,u=i.M8.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.Qe.OnlyTranslation:{const t=s+90+o;l.a=i.M8.cosDeg(s+a)*r,l.c=i.M8.cosDeg(t)*n,l.b=i.M8.sinDeg(s+a)*r,l.d=i.M8.sinDeg(t)*n;break}case i.Qe.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.M8.radDeg):(d=0,p=0,e=90-Math.atan2(m,f)*i.M8.radDeg);const h=s+a-e,c=s+o-e+90,u=i.M8.cosDeg(h)*r,g=i.M8.cosDeg(c)*n,x=i.M8.sinDeg(h)*r,y=i.M8.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.Qe.NoScale:case i.Qe.NoScaleOrReflection:{const t=i.M8.cosDeg(s),e=i.M8.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.Qe.NoScale&&d*m-f*p<0!=(i.Xd.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,E=Math.sin(y)*x,_=i.M8.cosDeg(a)*r,w=i.M8.cosDeg(90+o)*n,v=i.M8.sinDeg(a)*r,T=i.M8.sinDeg(90+o)*n;l.a=h*_+b*v,l.c=h*w+b*T,l.b=g*_+E*v,l.d=g*w+E*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.M8.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*i.M8.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.M8.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.M8.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.M8.radDeg,this.arotation=Math.atan2(f,u)*i.M8.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*i.M8.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.M8.sinDeg(t),s=i.M8.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*i.M8.radDeg}localToWorldRotation(t){const e=i.M8.sinDeg(t),s=i.M8.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*i.M8.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,o=i.M8.cosDeg(t),h=i.M8.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.Qe.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,E=0,_=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,E=w*y+v*b+p.tx,_=T*y+A*b+p.ty):(b=0,E=w*y+p.tx,_=T*y+p.ty);const M=t.parent.matrix;w=M.a,v=M.c,T=M.b,A=M.d;const I=1/(w*A-v*T);let R=s-M.tx,C=r-M.ty;const P=(R*A-C*v)*I-h,k=(C*w-R*T)*I-l,D=P*P+k*k;R=E-M.tx,C=_-M.ty;const F=(R*A-C*v)*I-h,N=(C*w-R*T)*I-l,B=Math.sqrt(F*F+N*N);let O=e.data.length*f,L=0,V=0;t:if(S){O*=c;let t=(D-B*B-O*O)/(2*B*O);t<-1?t=-1:t>1&&(t=1,a&&B+O>1e-4&&(u*=(Math.sqrt(D)/(B+O)-1)*o+1)),V=Math.acos(t)*n,w=B+O*t,v=O*Math.sin(V),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*B*B+t*D-t*e;const r=-2*e*B,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),R=w*Math.cos(T)+B,C=v*Math.sin(T),A=R*R+C*C,Am&&(f=T,m=A,p=R,g=C)),D<=(l+m)/2?(L=s-Math.atan2(u*n,h),V=o*n):(L=s-Math.atan2(g*n,p),V=f*n)}const X=Math.atan2(b,y)*x;let U=t.arotation;L=(L-X)*i.M8.radDeg+m-U,L>180?L-=360:L<-180&&(L+=360),t.updateWorldTransformWith(h,l,U+L*o,u,t.ascaleY,0,0),U=e.arotation,V=((V+X)*i.M8.radDeg-e.ashearX)*x+g-U,V>180?V-=360:V<-180&&(V+=360),e.updateWorldTransformWith(y,b,U+V*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 Et=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.YK.Tangent,c=h==i.YK.ChainScale,u=this.bones.length,d=l?u:u+1,f=this.bones,p=i.cQ.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(c||o){c&&(m=i.cQ.setArraySize(this.lengths,u));for(let t=0,e=d-1;t0?i.M8.degRad:-i.M8.degRad}for(let t=0,n=3;ti.M8.PI?u-=i.M8.PI2:u<-i.M8.PI&&(u+=i.M8.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.cQ.setArraySize(this.positions,3*e+2);let c=null;const u=t.closed;let d=t.worldVerticesLength,f=d/6,p=Et.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!=Et.AFTER&&(p=Et.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.cQ.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.cQ.setArraySize(this.world,d),t.computeWorldVertices(a,2,d,c,0,2));const m=i.cQ.setArraySize(this.curves,f);let g=0,x=c[0],y=c[1],b=0,E=0,_=0,w=0,v=0,T=0,A=0,S=0,M=0,I=0,R=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],E=c[t+3],_=c[t+4],w=c[t+5],v=c[t+6],T=c[t+7],A=.03*(x-2*b+_),S=.03*(y-2*E+w),M=.006*(3*(b-_)-x+v),I=.006*(3*(E-w)-y+T),R=2*A+M,C=2*S+I,P=.3*(b-x)+A+.16666667*M,k=.3*(E-y)+S+.16666667*I,F=Math.sqrt(P*P+k*k),D[0]=F,t=1;t<8;t++)P+=R,k+=C,R+=M,C+=I,F+=Math.sqrt(P*P+k*k),D[t]=F;P+=R,k+=C,F+=Math.sqrt(P*P+k*k),D[8]=F,P+=R+M,k+=C+I,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,E=y*t,_=e*g+r*b+i*E+o*f,w=s*g+n*b+a*E+h*f;l[c]=_,l[c+1]=w,u&&(l[c+2]=Math.atan2(w-(s*m+n*x*2+a*d),_-(e*m+r*x*2+i*d)))}getOrder(){return this.data.order}};let _t=Et;_t.NONE=-1,_t.BEFORE=-2,_t.AFTER=-3,_t.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.FM,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.M8.degRad:-i.M8.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let a=0,u=p.length;ai.M8.PI?a-=i.M8.PI2:a<-i.M8.PI&&(a+=i.M8.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.M8.PI?n-=i.M8.PI2:n<-i.M8.PI&&(n+=i.M8.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.M8.degRad:-i.M8.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let a=0,u=p.length;ai.M8.PI?a-=i.M8.PI2:a<-i.M8.PI&&(a+=i.M8.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.M8.PI?t-=i.M8.PI2:t<-i.M8.PI&&(t+=i.M8.PI2);const e=g.c,s=g.d;t=Math.atan2(s,e)+(t-i.M8.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 It{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 Rt{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 q(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 Gt._nextID++}};let qt=Gt;qt._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 Ht=[0,1,2,3,4,5,6];class jt{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new i.PA,!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 zt extends $t{constructor(t,e,s){super(t,s),this.curves=i.cQ.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.cQ.newFloatArray(e);i.cQ.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,E=.3*(a-n)+p+.16666667*g,_=r+b,w=n+E;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 zt{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 Kt extends zt{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 Zt 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.bq.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(E){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,E-2),f=this.getBezierValue(s,b,2,E+18-2),p=this.getBezierValue(s,b,3,E+36-2),m=this.getBezierValue(s,b,4,E+54-2),g=this.getBezierValue(s,b,5,E+72-2),x=this.getBezierValue(s,b,6,E+90-2),y=this.getBezierValue(s,b,7,E+108-2)}if(1==n)c.set(d,f,p,m),u.r=g,u.g=x,u.b=y;else{if(a==i.bq.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 zt{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 Nt)||l.timelineAttachment!=this.attachment)return;const c=h.deform;0==c.length&&(a=i.bq.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.bq.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 $t{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.bq.setup&&i.cQ.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.bq.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 $t{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 Nt&&l.timelineAttachment==c))return;const u=this.frames;if(s>4;const x=this.attachment.sequence.regions.length,y=Ht[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.PA,this.animationsChanged=!1,this.trackEntryPool=new i.Kg((()=>new Re)),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.bq.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.bq.add)for(let e=0;e1&&(n=1),s!=i.bq.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.M8.signum(e)!=i.M8.signum(f)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*i.M8.signum(t)),r=s),d=f+t-t%360,r!=s&&(d+=360*i.M8.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]=Be}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 Me=Se;Me._emptyAnimation=new jt("",[],0),Me.deprecatedWarning1=!1,Me.deprecatedWarning2=!1,Me.deprecatedWarning3=!1;const Ie=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.bq.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,Ne=2,Be=3,Oe=4,Le=1,Ve=2;class Xe{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 Ue{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.M8.radDeg):(d=0,p=0,e=90-Math.atan2(m,f)*i.M8.radDeg);const h=s+a-e,g=s+o-e+90,x=i.M8.cosDeg(h)*r,y=i.M8.cosDeg(g)*n,b=i.M8.sinDeg(h)*r,E=i.M8.sinDeg(g)*n;l.a=d*x-f*b,l.c=d*y-f*E,l.b=p*x+m*b,l.d=p*y+m*E;break}case i.Qe.NoScale:case i.Qe.NoScaleOrReflection:{const t=i.M8.cosDeg(s),e=i.M8.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.Qe.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,E=Math.sin(y)*x,_=i.M8.cosDeg(a)*r,w=i.M8.cosDeg(90+o)*n,v=i.M8.sinDeg(a)*r,T=i.M8.sinDeg(90+o)*n;l.a=h*_+b*v,l.c=h*w+b*T,l.b=g*_+E*v,l.d=g*w+E*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.M8.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*i.M8.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.M8.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.M8.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.M8.radDeg,this.arotation=Math.atan2(f,u)*i.M8.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*i.M8.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.M8.sinDeg(t),s=i.M8.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*i.M8.radDeg}localToWorldRotation(t){t-=this.rotation-this.shearX;const e=i.M8.sinDeg(t),s=i.M8.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*i.M8.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,o=i.M8.cosDeg(t),h=i.M8.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 Ge{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.Qe.Normal,this.skinRequired=!1,this.color=new i.Il,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 qe{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 He{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class je{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.Qe.NoScale:case i.Qe.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,E=0;d<0?(d=-d,y=180,E=-1):(y=0,E=1),f<0&&(f=-f,E=-E),g<0?(g=-g,b=180):b=0;const _=e.ax;let w=0,v=0,T=0,A=x.a,S=x.c,M=x.b,I=x.d;const R=Math.abs(d-f)<=1e-4;!R||a?(w=0,v=A*_+x.tx,T=M*_+x.ty):(w=e.ay,v=A*_+S*w+x.tx,T=M*_+I*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,M=C.b,I=C.d;const P=1/(A*I-S*M);let k=v-C.tx,D=T-C.ty;const F=(k*I-D*S)*P-c,N=(D*A-k*M)*P-u,B=Math.sqrt(F*F+N*N);let O,L,V=e.data.length*g;if(B<1e-4)return this.apply1(t,s,r,!1,a,!1,l),void e.updateWorldTransformWith(_,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);k=s-C.tx,D=r-C.ty;let X=(k*I-D*S)*P-c,U=(D*A-k*M)*P-u,Y=X*X+U*U;if(0!=h){h*=d*(g+1)*.5;const t=Math.sqrt(Y),e=t-B-V*d+h;if(e>0){let s=Math.min(1,e/(2*h))-1;s=(e-h*(1-s*s))/t,X-=s*X,U-=s*U,Y=X*X+U*U}}t:if(R){V*=d;let t=(Y-B*B-V*V)/(2*B*V);t<-1?(t=-1,L=Math.PI*n):t>1?(t=1,L=0,a&&(A=(Math.sqrt(Y)/(B+V)-1)*l+1,p*=A,o&&(m*=A))):L=Math.acos(t)*n,A=B+V*t,S=V*Math.sin(L),O=Math.atan2(U*A-X*S,X*A+U*S)}else{A=d*V,S=f*V;const t=A*A,e=S*S,s=Math.atan2(U,X);M=e*B*B+t*Y-t*e;const r=-2*e*B,a=e-t;if(I=r*r-4*a*M,I>=0){let t=Math.sqrt(I);r<0&&(t=-t),t=.5*-(r+t);const e=t/a,i=M/t,o=Math.abs(e)=-1&&M<=1&&(M=Math.acos(M),k=A*Math.cos(M)+B,D=S*Math.sin(M),I=k*k+D*D,Im&&(u=M,m=I,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 G=Math.atan2(w,_)*E;let q=t.arotation;O=(O-G)*i.M8.radDeg+y-q,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(c,u,q+O*l,p,m,0,0),q=e.arotation,L=((L+G)*i.M8.radDeg-e.ashearX)*E+b-q,L>180?L-=360:L<-180&&(L+=360),e.updateWorldTransformWith(_,w,q+L*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class $e extends qe{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 ze extends qe{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=i.T.Fixed,this.spacingMode=Qe.Fixed,this.rotateMode=i.YK.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 Ke=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.M8.degRad:-i.M8.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)*e,g+=(t*(b*s+f*o)-_)*e}else d+=x;d>i.M8.PI?d-=i.M8.PI2:d<-i.M8.PI&&(d+=i.M8.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.cQ.setArraySize(this.positions,3*e+2);let h=this.world;const l=t.closed;let c=t.worldVerticesLength,u=c/6,d=Ke.NONE;if(!t.constantSpeed){const f=t.lengths;u-=l?1:2;const p=f[u];let m;switch(this.data.positionMode==i.T.Percent&&(n*=p),this.data.spacingMode){case Qe.Percent:m=p;break;case Qe.Proportional:m=p/e;break;default:m=1}h=i.cQ.setArraySize(this.world,8);for(let i=0,g=0,x=0;ip){d!=Ke.AFTER&&(d=Ke.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.cQ.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.cQ.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,h,0,2));const f=i.cQ.setArraySize(this.curves,u);let p,m=0,g=h[0],x=h[1],y=0,b=0,E=0,_=0,w=0,v=0,T=0,A=0,S=0,M=0,I=0,R=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],E=h[t+4],_=h[t+5],w=h[t+6],v=h[t+7],T=.03*(g-2*y+E),A=.03*(x-2*b+_),S=.006*(3*(y-E)-g+w),M=.006*(3*(b-_)-x+v),I=2*T+S,R=2*A+M,C=.3*(y-g)+T+.16666667*S,P=.3*(b-x)+A+.16666667*M,D=Math.sqrt(C*C+P*P),k[0]=D,t=1;t<8;t++)C+=I,P+=R,I+=S,R+=M,D+=Math.sqrt(C*C+P*P),k[t]=D;C+=I,P+=R,D+=Math.sqrt(C*C+P*P),k[8]=D,C+=I+S,P+=R+M,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,E=y*t,_=e*g+r*b+i*E+o*f,w=s*g+n*b+a*E+h*f;l[c]=_,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*m+r*x*2+i*d)))}};let Ze=Ke;Ze.NONE=-1,Ze.BEFORE=-2,Ze.AFTER=-3,Ze.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.Il,this.darkColor=t.darkColor?new i.Il:null,this.setToSetupPose(),this.blendMode=this.data.blendMode}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof Nt&&this.attachment instanceof Nt&&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.FM,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.M8.degRad:-i.M8.degRad,m=this.data.offsetRotation*p,g=this.data.offsetShearY*p,x=this.bones;for(let l=0,p=x.length;li.M8.PI?a-=i.M8.PI2:a<-i.M8.PI&&(a+=i.M8.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.M8.PI?r-=i.M8.PI2:r<-i.M8.PI&&(r+=i.M8.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.M8.degRad:-i.M8.degRad,m=this.data.offsetRotation*p,g=this.data.offsetShearY*p,x=this.bones;for(let l=0,p=x.length;li.M8.PI?a-=i.M8.PI2:a<-i.M8.PI&&(a+=i.M8.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.M8.PI?t-=i.M8.PI2:t<-i.M8.PI&&(t+=i.M8.PI2);const e=y.c,s=y.d;t=Math.atan2(s,e)+(t-i.M8.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 qe{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.cQ.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,Gs(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 Hs(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 js{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=Hs(r);if(n===Ws.VER38&&(s=new d.SkeletonBinary(new d.AtlasAttachmentLoader(t))),r=this.readVersionNewFormat(e),n=Hs(r),n!==Ws.VER40&&n!==Ws.VER41||(s=new hs(new Ue(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.YT(t);let s;try{e.readString(),s=e.readString()}catch(t){s=""}return s||""}readVersionNewFormat(t){const e=new i.YT(t);let s;e.readInt32(),e.readInt32();try{s=e.readString()}catch(t){s=""}return s||""}}class $s{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=Hs(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 Ue(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 zs extends i.Ww{createSkeleton(t){const e=Hs(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 js}createJsonParser(){return new $s}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}).installLoader()},7200:(t,e,s)=>{"use strict";s.d(e,{KgH:()=>At,deM:()=>v.de,W20:()=>a.W2,TCu:()=>W.TC,jyi:()=>i.j,xvT:()=>at,oO3:()=>Mt,e6u:()=>r.e6});var r=s(6043);r.wn,["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join("\n"),r.wn,r.wn;class n extends r.wn{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.Y9,"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.wn,r.wn,r.wn;var i=s(2274),a=s(8820);const o=new r.y3;a.s$.prototype._cacheAsBitmap=!1,a.s$.prototype._cacheData=null,a.s$.prototype._cacheAsBitmapResolution=null,a.s$.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.s$.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.s$.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.s$.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.Xd.RESOLUTION);const n=t.renderTexture.current,a=t.renderTexture.sourceFrame.clone(),h=t.renderTexture.destinationFrame.clone(),l=t.projection.transform,c=r.TI.create({width:s.width,height:s.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:this.cacheAsBitmapMultisample??t.multisample}),u=`cacheAsBitmap_${r.P6.uid()}`;this._cacheData.textureCacheId=u,r.VL.addToCache(c.baseTexture,u),r.xE.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.j(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.s$.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.s$.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.Xd.RESOLUTION);const h=r.TI.create({width:e.width,height:e.height}),l=`cacheAsBitmap_${r.P6.uid()}`;this._cacheData.textureCacheId=l,r.VL.addToCache(h.baseTexture,l),r.xE.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.j(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.s$.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},a.s$.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},a.s$.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,r.VL.removeFromCache(this._cacheData.textureCacheId),r.xE.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},a.s$.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},a.s$.prototype.name=null,a.W2.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.nw.RendererPlugin,r.nw.CanvasRendererPlugin]},r.Rw.add(b);const E=class{constructor(t){this.stage=new a.W2,t=Object.assign({forceCanvas:!1},t),this.renderer=(0,r.e6)(t),E._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=E._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;_._plugins=[],r.Rw.handleByList(r.nw.Application,_._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.nw.Application,r.Rw.add(w);var v=s(311),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.qm{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.Rv(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.Rv(s),this.loaded=!0,this.onBlobLoaded(s),this.update(),this}}class M 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=M._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||M._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 I,R;function C(){R={s3tc:I.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:I.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:I.getExtension("WEBGL_compressed_texture_etc"),etc1:I.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:I.getExtension("WEBGL_compressed_texture_pvrtc")||I.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:I.getExtension("WEBGL_compressed_texture_atc"),astc:I.getExtension("WEBGL_compressed_texture_astc")}}const P={extension:{type:r.nw.DetectionParser,priority:2},test:async()=>{const t=r.Xd.ADAPTER.createCanvas().getContext("webgl");return!!t&&(I=t,!0)},add:async t=>{R||C();const e=[];for(const t in R)R[t]&&e.push(t);return[...e,...t]},remove:async t=>(R||C(),t.filter((t=>!(t in R))))};r.Rw.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],N={[r.vK.UNSIGNED_BYTE]:1,[r.vK.UNSIGNED_SHORT]:2,[r.vK.INT]:4,[r.vK.UNSIGNED_INT]:4,[r.vK.FLOAT]:4,[r.vK.HALF_FLOAT]:8},B={[r.I2.RGBA]:4,[r.I2.RGB]:3,[r.I2.RG]:2,[r.I2.RED]:1,[r.I2.LUMINANCE]:1,[r.I2.LUMINANCE_ALPHA]:2,[r.I2.ALPHA]:1},O={[r.vK.UNSIGNED_SHORT_4_4_4_4]:2,[r.vK.UNSIGNED_SHORT_5_5_5_1]:2,[r.vK.UNSIGNED_SHORT_5_6_5]:2};function L(t){switch(t){case r.I2.RGBA:return r.I2.RGBA_INTEGER;case r.I2.RGB:return r.I2.RGB_INTEGER;case r.I2.RG:return r.I2.RG_INTEGER;case r.I2.RED:return r.I2.RED_INTEGER;default:return t}}const V={extension:{type:r.nw.LoadParser,priority:v.Q2.High},test:t=>(0,v.gN)(t,".dds"),async load(t,e,s){const n=await r.Xd.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 M(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 M(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.VL(n,{mipmap:r.KI.OFF,alphaMode:r.iw.NO_PREMULTIPLIED_ALPHA,resolution:r.P6.getResolutionOfUrl(t),...e.data});return(0,v.cU)(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.Rw.add(V);const X={extension:{type:r.nw.LoadParser,priority:v.Q2.High},test:t=>(0,v.gN)(t,".ktx"),async load(t,e,s){const n=await r.Xd.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:I,levelBuffer:new Uint8Array(e,r,w)},r+=w}R+=s+4,R=R%4!=0?R+4-R%4:R,v=v>>1||1,T=T>>1||1,S=v+4-1&-4,I=T+4-1&-4,w=S*I*b}return 0!==a?{uncompressed:y.map((t=>{let e=t[0].levelBuffer,s=!1;return a===r.vK.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):a===r.vK.UNSIGNED_INT?(s=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):a===r.vK.INT&&(s=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new r.qm(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:a,format:s?L(o):o}})),kvData:_}:{compressed:y.map((t=>new M(null,{format:h,width:l,height:c,levels:p,levelBuffers:t}))),kvData:_}}(0,i),l=a??o,c={mipmap:r.KI.OFF,alphaMode:r.iw.NO_PREMULTIPLIED_ALPHA,resolution:r.P6.getResolutionOfUrl(t),...e.data},u=l.map((e=>{l===o&&Object.assign(c,{type:e.type,format:e.format});const n=new r.VL(e,c);return n.ktxKeyValueData=h,(0,v.cU)(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.Rw.add(X);const U={extension:r.nw.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.Xd.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e.find((e=>t.endsWith(e))),src:t}}return{resolution:parseFloat(r.Xd.RETINA_PREFIX.exec(t)?.[1]??"1"),format:t.split(".").pop(),src:t}}};r.Rw.add(U);const Y=new r.Ae,G=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.TI?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.P6.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(G.arrayPostDivide(u,f.data),c.context.putImageData(f,0,0),a){const t=new r.P6.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.TI?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),G.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.P6.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.P6.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.P6.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}}$.extension={name:"particle",type:r.nw.RendererPlugin},r.Rw.add($),r.Xd.UPLOADS_PER_FRAME=4;var z=(t=>(t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",t))(z||{});const Q={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:z.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},K=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];class Z{constructor(t){this.styleID=0,this.reset(),et(this,t,t)}clone(){const t={};return et(t,this,Q),new Z(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)||K.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.P6.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.vB.system.addOnce(this.tick,this,r.uF.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.vB.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.VL&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function xt(t,e){if(!(e instanceof W.TC))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<=Et.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}_processFrames(t){let e=t;const s=Et.BATCH_SIZE;for(;e-t{this._batchIndex*Et.BATCH_SIZE{n[t]=e})),Object.keys(e.textures).forEach((t=>{n[t]=e.textures[t]})),!s){const s=r.P6.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.nw.Asset,cache:{test:t=>t instanceof _t,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.Xd.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{extension:{type:r.nw.LoadParser,priority:v.Q2.Normal},testParse:async(t,e)=>r.P6.path.extname(e.src).includes(".json")&&!!t.frames,async parse(t,e,s){let n=r.P6.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 _t(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.Rw.add(Tt);class At extends i.j{constructor(t,e=!0){super(t[0]instanceof r.xE?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.vB.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(r.vB.shared.add(this.update,this,r.uF.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.vB.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(r.vB.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const St=new r.E9;class Mt extends i.j{constructor(t,e=100,s=100){super(t),this.tileTransform=new r.wx,this._width=e,this._height=s,this.uvMatrix=this.texture.uvMatrix||new r.UX(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.Ae),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.ex.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.ex.from(It,"#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.Nt.CLAMP:h.wrapMode===r.Nt.CLAMP&&(h.wrapMode=r.Nt.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,x=t._height;Rt.set(c.a*p/g,c.b*p/x,c.c*m/g,c.d*m/x,c.tx/g,c.ty/x),Rt.invert(),d?Rt.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=Rt.toArray(!0),f.uniforms.uColor=r.P6.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.P6.correctBlendMode(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Ct.extension={name:"tilingSprite",type:r.nw.RendererPlugin},r.Rw.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 Nt=[kt,Dt,Ft];function Bt(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}Bt(p,m,s,x,y,a,u);const T=Lt(s.text);f.char.push({id:T,page:_.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.Xd.ROUND_PIXELS,this.dirty=!0,this._resolution=r.Xd.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const t=Xt.available[this._fontName],e=this.fontSize,s=e/t.size,n=new r.E9,i=[],a=[],o=[],h=Ot(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),l=this._maxWidth*t.size/e,c="none"===t.distanceFieldType?Ut: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.P6.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 E=h[h.length-1];"\r"!==E&&"\n"!==E&&(/(?:\s)/.test(E)&&(d=g),a.push(d),f=Math.max(f,d),o.push(-1));const _=[];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]),_.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.T$.NORMAL_NPM);const a=new H.Kj(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.xE(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*H.Kj.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.xE.EMPTY}));for(const t in e)e[t].destroy(),delete e[t];this._font=null,this._textureCache=null,super.destroy(t)}};qt.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const Wt=[".xml",".fnt"],Ht={extension:{type:r.nw.LoadParser,priority:v.Q2.Normal},test:t=>Wt.includes(r.P6.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 Xt.install(n,l,!0)},load:async(t,e)=>(await r.Xd.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};r.Rw.add(Ht)}}]);