/*! For license information please see 400.03bc4b65077c28d1dc09.js.LICENSE.txt */ (self.webpackChunkcrasher=self.webpackChunkcrasher||[]).push([[400],{1924:(t,e,r)=>{"use strict";var i=r(210),s=r(5559),n=s(i("String.prototype.indexOf"));t.exports=function(t,e){var r=i(t,!!e);return"function"==typeof r&&n(t,".prototype.")>-1?s(r):r}},5559:(t,e,r)=>{"use strict";var i=r(8612),s=r(210),n=r(7771),o=s("%TypeError%"),a=s("%Function.prototype.apply%"),h=s("%Function.prototype.call%"),l=s("%Reflect.apply%",!0)||i.call(h,a),u=s("%Object.defineProperty%",!0),c=s("%Math.max%");if(u)try{u({},"a",{value:1})}catch(t){u=null}t.exports=function(t){if("function"!=typeof t)throw new o("a function is required");var e=l(i,h,arguments);return n(e,1+c(0,t.length-(arguments.length-1)),!0)};var d=function(){return l(i,a,arguments)};u?u(t.exports,"apply",{value:d}):t.exports.apply=d},2296:(t,e,r)=>{"use strict";var i=r(1044)(),s=r(210),n=i&&s("%Object.defineProperty%",!0);if(n)try{n({},"a",{value:1})}catch(t){n=!1}var o=s("%SyntaxError%"),a=s("%TypeError%"),h=r(7296);t.exports=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new a("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new a("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new a("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new a("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new a("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new a("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],c=!!h&&h(t,e);if(n)n(t,e,{configurable:null===l&&c?c.configurable:!l,enumerable:null===i&&c?c.enumerable:!i,value:r,writable:null===s&&c?c.writable:!s});else{if(!u&&(i||s||l))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}}},9187:t=>{"use strict";function e(t,e,i){i=i||2;var n,o,a,h,c,d,f,m=e&&e.length,g=m?e[0]*i:t.length,_=r(t,0,g,i,!0),y=[];if(!_||_.next===_.prev)return y;if(m&&(_=function(t,e,i,s){var n,o,a,h=[];for(n=0,o=e.length;n80*i){n=a=t[0],o=h=t[1];for(var x=i;xa&&(a=c),d>h&&(h=d);f=0!==(f=Math.max(a-n,h-o))?32767/f:0}return s(_,y,i,n,o,f,0),y}function r(t,e,r,i,s){var n,o;if(s===S(t,e,r,i)>0)for(n=e;n=e;n-=i)o=T(n,t[n],t[n+1],o);return o&&_(o,o.next)&&(A(o),o=o.next),o}function i(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!_(i,i.next)&&0!==g(i.prev,i,i.next))i=i.next;else{if(A(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function s(t,e,r,l,u,c,p){if(t){!p&&c&&function(t,e,r,i){var s=t;do{0===s.z&&(s.z=d(s.x,s.y,e,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,r,i,s,n,o,a,h,l=1;do{for(r=t,t=null,n=null,o=0;r;){for(o++,i=r,a=0,e=0;e0||h>0&&i;)0!==a&&(0===h||!i||r.z<=i.z)?(s=r,r=r.nextZ,a--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=i}n.nextZ=null,l*=2}while(o>1)}(s)}(t,l,u,c);for(var f,m,g=t;t.prev!==t.next;)if(f=t.prev,m=t.next,c?o(t,l,u,c):n(t))e.push(f.i/r|0),e.push(t.i/r|0),e.push(m.i/r|0),A(t),t=m.next,g=m.next;else if((t=m)===g){p?1===p?s(t=a(i(t),e,r),e,r,l,u,c,2):2===p&&h(t,e,r,l,u,c):s(i(t),e,r,l,u,c,1);break}}}function n(t){var e=t.prev,r=t,i=t.next;if(g(e,r,i)>=0)return!1;for(var s=e.x,n=r.x,o=i.x,a=e.y,h=r.y,l=i.y,u=sn?s>o?s:o:n>o?n:o,p=a>h?a>l?a:l:h>l?h:l,m=i.next;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=c&&m.y<=p&&f(s,a,n,h,o,l,m.x,m.y)&&g(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function o(t,e,r,i){var s=t.prev,n=t,o=t.next;if(g(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,u=s.y,c=n.y,p=o.y,m=ah?a>l?a:l:h>l?h:l,x=u>c?u>p?u:p:c>p?c:p,v=d(m,_,e,r,i),b=d(y,x,e,r,i),E=t.prevZ,T=t.nextZ;E&&E.z>=v&&T&&T.z<=b;){if(E.x>=m&&E.x<=y&&E.y>=_&&E.y<=x&&E!==s&&E!==o&&f(a,u,h,c,l,p,E.x,E.y)&&g(E.prev,E,E.next)>=0)return!1;if(E=E.prevZ,T.x>=m&&T.x<=y&&T.y>=_&&T.y<=x&&T!==s&&T!==o&&f(a,u,h,c,l,p,T.x,T.y)&&g(T.prev,T,T.next)>=0)return!1;T=T.nextZ}for(;E&&E.z>=v;){if(E.x>=m&&E.x<=y&&E.y>=_&&E.y<=x&&E!==s&&E!==o&&f(a,u,h,c,l,p,E.x,E.y)&&g(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;T&&T.z<=b;){if(T.x>=m&&T.x<=y&&T.y>=_&&T.y<=x&&T!==s&&T!==o&&f(a,u,h,c,l,p,T.x,T.y)&&g(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function a(t,e,r){var s=t;do{var n=s.prev,o=s.next.next;!_(n,o)&&y(n,s,s.next,o)&&b(n,o)&&b(o,n)&&(e.push(n.i/r|0),e.push(s.i/r|0),e.push(o.i/r|0),A(s),A(s.next),s=t=o),s=s.next}while(s!==t);return i(s)}function h(t,e,r,n,o,a){var h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&m(h,l)){var u=E(h,l);return h=i(h,h.next),u=i(u,u.next),s(h,e,r,n,o,a,0),void s(u,e,r,n,o,a,0)}l=l.next}h=h.next}while(h!==t)}function l(t,e){return t.x-e.x}function u(t,e){var r=function(t,e){var r,i=e,s=t.x,n=t.y,o=-1/0;do{if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){var a=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=s&&a>o&&(o=a,r=i.x=i.x&&i.x>=u&&s!==i.x&&f(nr.x||i.x===r.x&&c(r,i)))&&(r=i,p=h)),i=i.next}while(i!==l);return r}(t,e);if(!r)return e;var s=E(r,t);return i(s,s.next),i(r,r.next)}function c(t,e){return g(t.prev,t,e.prev)<0&&g(e.next,t,t.next)<0}function d(t,e,r,i,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p(t){var e=t,r=t;do{(e.x=(t-o)*(n-a)&&(t-o)*(i-a)>=(r-o)*(e-a)&&(r-o)*(n-a)>=(s-o)*(i-a)}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&y(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(b(t,e)&&b(e,t)&&function(t,e){var r=t,i=!1,s=(t.x+e.x)/2,n=(t.y+e.y)/2;do{r.y>n!=r.next.y>n&&r.next.y!==r.y&&s<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(g(t.prev,t,e.prev)||g(t,e.prev,e))||_(t,e)&&g(t.prev,t,t.next)>0&&g(e.prev,e,e.next)>0)}function g(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function _(t,e){return t.x===e.x&&t.y===e.y}function y(t,e,r,i){var s=v(g(t,e,r)),n=v(g(t,e,i)),o=v(g(r,i,t)),a=v(g(r,i,e));return s!==n&&o!==a||!(0!==s||!x(t,r,e))||!(0!==n||!x(t,i,e))||!(0!==o||!x(r,t,i))||!(0!==a||!x(r,e,i))}function x(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function v(t){return t>0?1:t<0?-1:0}function b(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 E(t,e){var r=new w(t.i,t.x,t.y),i=new w(e.i,e.x,e.y),s=t.next,n=e.prev;return t.next=e,e.prev=t,r.next=s,s.prev=r,i.next=r,r.prev=i,n.next=i,i.prev=n,i}function T(t,e,r,i){var s=new w(t,e,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function A(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 w(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function S(t,e,r,i){for(var s=0,n=e,o=r-i;n0&&(i+=t[s-1].length,r.holes.push(i))}return r}},6729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,r="~";function i(){}function s(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function n(t,e,i,n,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new s(i,n||t,o),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,i,s=[];if(0===this._eventsCount)return s;for(i in t=this._events)e.call(t,i)&&s.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,n=i.length,o=new Array(n);s{"use strict";var e=Object.prototype.toString,r=Math.max,i=function(t,e){for(var r=[],i=0;i{"use strict";var i=r(7648);t.exports=Function.prototype.bind||i},210:(t,e,r)=>{"use strict";var i,s=SyntaxError,n=Function,o=TypeError,a=function(t){try{return n('"use strict"; return ('+t+").constructor;")()}catch(t){}},h=Object.getOwnPropertyDescriptor;if(h)try{h({},"")}catch(t){h=null}var l=function(){throw new o},u=h?function(){try{return l}catch(t){try{return h(arguments,"callee").get}catch(t){return l}}}():l,c=r(1405)(),d=r(8185)(),p=Object.getPrototypeOf||(d?function(t){return t.__proto__}:null),f={},m="undefined"!=typeof Uint8Array&&p?p(Uint8Array):i,g={"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":c&&p?p([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":n,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":c&&p?p(p([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&c&&p?p((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&c&&p?p((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":c&&p?p(""[Symbol.iterator]()):i,"%Symbol%":c?Symbol:i,"%SyntaxError%":s,"%ThrowTypeError%":u,"%TypedArray%":m,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet};if(p)try{null.error}catch(t){var _=p(p(t));g["%Error.prototype%"]=_}var y=function t(e){var r;if("%AsyncFunction%"===e)r=a("async function () {}");else if("%GeneratorFunction%"===e)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=a("async function* () {}");else if("%AsyncGenerator%"===e){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===e){var s=t("%AsyncGenerator%");s&&p&&(r=p(s.prototype))}return g[e]=r,r},x={"%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"]},v=r(8612),b=r(8824),E=v.call(Function.call,Array.prototype.concat),T=v.call(Function.apply,Array.prototype.splice),A=v.call(Function.call,String.prototype.replace),w=v.call(Function.call,String.prototype.slice),S=v.call(Function.call,RegExp.prototype.exec),R=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,I=/\\(\\)?/g,C=function(t,e){var r,i=t;if(b(x,i)&&(i="%"+(r=x[i])[0]+"%"),b(g,i)){var n=g[i];if(n===f&&(n=y(i)),void 0===n&&!e)throw new o("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new s("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');if(null===S(/^%?[^%]*%?$/,t))throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=w(t,0,1),r=w(t,-1);if("%"===e&&"%"!==r)throw new s("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new s("invalid intrinsic syntax, expected opening `%`");var i=[];return A(t,R,(function(t,e,r,s){i[i.length]=r?A(s,I,"$1"):e||t})),i}(t),i=r.length>0?r[0]:"",n=C("%"+i+"%",e),a=n.name,l=n.value,u=!1,c=n.alias;c&&(i=c[0],T(r,E([0,1],c)));for(var d=1,p=!0;d=r.length){var y=h(l,f);l=(p=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:l[f]}else p=b(l,f),l=l[f];p&&!u&&(g[a]=l)}}return l}},7296:(t,e,r)=>{"use strict";var i=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(t){i=null}t.exports=i},1044:(t,e,r)=>{"use strict";var i=r(210)("%Object.defineProperty%",!0),s=function(){if(i)try{return i({},"a",{value:1}),!0}catch(t){return!1}return!1};s.hasArrayLengthDefineBug=function(){if(!s())return null;try{return 1!==i([],"length",{value:1}).length}catch(t){return!0}},t.exports=s},8185:t=>{"use strict";var e={foo:{}},r=Object;t.exports=function(){return{__proto__:e}.foo===e.foo&&!({__proto__:null}instanceof r)}},1405:(t,e,r)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,s=r(5419);t.exports=function(){return"function"==typeof i&&"function"==typeof Symbol&&"symbol"==typeof i("foo")&&"symbol"==typeof Symbol("bar")&&s()}},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"),r=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(r))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 i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var s=Object.getOwnPropertyDescriptor(t,e);if(42!==s.value||!0!==s.enumerable)return!1}return!0}},8824:(t,e,r)=>{"use strict";var i=Function.prototype.call,s=Object.prototype.hasOwnProperty,n=r(8612);t.exports=n.call(i,s)},631:(t,e,r)=>{var i="function"==typeof Map&&Map.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,n=i&&s&&"function"==typeof s.get?s.get:null,o=i&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,h=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=a&&h&&"function"==typeof h.get?h.get:null,u=a&&Set.prototype.forEach,c="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,_=String.prototype.match,y=String.prototype.slice,x=String.prototype.replace,v=String.prototype.toUpperCase,b=String.prototype.toLowerCase,E=RegExp.prototype.test,T=Array.prototype.concat,A=Array.prototype.join,w=Array.prototype.slice,S=Math.floor,R="function"==typeof BigInt?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,P="function"==typeof Symbol&&"object"==typeof Symbol.iterator,M="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,D=Object.prototype.propertyIsEnumerable,B=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function O(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||E.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var i=t<0?-S(-t):S(t);if(i!==t){var s=String(i),n=y.call(e,s.length+1);return x.call(s,r,"$&_")+"."+x.call(x.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return x.call(e,r,"$&_")}var N=r(4654),F=N.custom,L=X(F)?F:null;function U(t,e,r){var i="double"===(r.quoteStyle||e)?'"':"'";return i+t+i}function k(t){return x.call(String(t),/"/g,""")}function G(t){return!("[object Array]"!==z(t)||M&&"object"==typeof t&&M in t)}function H(t){return!("[object RegExp]"!==z(t)||M&&"object"==typeof t&&M in t)}function X(t){if(P)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!C)return!1;try{return C.call(t),!0}catch(t){}return!1}t.exports=function t(e,i,s,a){var h=i||{};if(W(h,"quoteStyle")&&"single"!==h.quoteStyle&&"double"!==h.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(h,"maxStringLength")&&("number"==typeof h.maxStringLength?h.maxStringLength<0&&h.maxStringLength!==1/0:null!==h.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var m=!W(h,"customInspect")||h.customInspect;if("boolean"!=typeof m&&"symbol"!==m)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(h,"indent")&&null!==h.indent&&"\t"!==h.indent&&!(parseInt(h.indent,10)===h.indent&&h.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(h,"numericSeparator")&&"boolean"!=typeof h.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var v=h.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return Y(e,h);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var E=String(e);return v?O(e,E):E}if("bigint"==typeof e){var S=String(e)+"n";return v?O(e,S):S}var I=void 0===h.depth?5:h.depth;if(void 0===s&&(s=0),s>=I&&I>0&&"object"==typeof e)return G(e)?"[Array]":"[Object]";var F,j=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=A.call(Array(t.indent+1)," ")}return{base:r,prev:A.call(Array(e+1),r)}}(h,s);if(void 0===a)a=[];else if(V(a,e)>=0)return"[Circular]";function $(e,r,i){if(r&&(a=w.call(a)).push(r),i){var n={depth:h.depth};return W(h,"quoteStyle")&&(n.quoteStyle=h.quoteStyle),t(e,n,s+1,a)}return t(e,h,s+1,a)}if("function"==typeof e&&!H(e)){var tt=function(t){if(t.name)return t.name;var e=_.call(g.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(e),et=J(e,$);return"[Function"+(tt?": "+tt:" (anonymous)")+"]"+(et.length>0?" { "+A.call(et,", ")+" }":"")}if(X(e)){var rt=P?x.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(e);return"object"!=typeof e||P?rt:q(rt)}if((F=e)&&"object"==typeof F&&("undefined"!=typeof HTMLElement&&F instanceof HTMLElement||"string"==typeof F.nodeName&&"function"==typeof F.getAttribute)){for(var it="<"+b.call(String(e.nodeName)),st=e.attributes||[],nt=0;nt"}if(G(e)){if(0===e.length)return"[]";var ot=J(e,$);return j&&!function(t){for(var e=0;e=0)return!1;return!0}(ot)?"["+Q(ot,j)+"]":"[ "+A.call(ot,", ")+" ]"}if(function(t){return!("[object Error]"!==z(t)||M&&"object"==typeof t&&M in t)}(e)){var at=J(e,$);return"cause"in Error.prototype||!("cause"in e)||D.call(e,"cause")?0===at.length?"["+String(e)+"]":"{ ["+String(e)+"] "+A.call(at,", ")+" }":"{ ["+String(e)+"] "+A.call(T.call("[cause]: "+$(e.cause),at),", ")+" }"}if("object"==typeof e&&m){if(L&&"function"==typeof e[L]&&N)return N(e,{depth:I-s});if("symbol"!==m&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!n||!t||"object"!=typeof t)return!1;try{n.call(t);try{l.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var ht=[];return o&&o.call(e,(function(t,r){ht.push($(r,e,!0)+" => "+$(t,e))})),Z("Map",n.call(e),ht,j)}if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t);try{n.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var lt=[];return u&&u.call(e,(function(t){lt.push($(t,e))})),Z("Set",l.call(e),lt,j)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t,c);try{d.call(t,d)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return K("WeakMap");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{d.call(t,d);try{c.call(t,c)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return K("WeakSet");if(function(t){if(!p||!t||"object"!=typeof t)return!1;try{return p.call(t),!0}catch(t){}return!1}(e))return K("WeakRef");if(function(t){return!("[object Number]"!==z(t)||M&&"object"==typeof t&&M in t)}(e))return q($(Number(e)));if(function(t){if(!t||"object"!=typeof t||!R)return!1;try{return R.call(t),!0}catch(t){}return!1}(e))return q($(R.call(e)));if(function(t){return!("[object Boolean]"!==z(t)||M&&"object"==typeof t&&M in t)}(e))return q(f.call(e));if(function(t){return!("[object String]"!==z(t)||M&&"object"==typeof t&&M in t)}(e))return q($(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if(e===r.g)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==z(t)||M&&"object"==typeof t&&M in t)}(e)&&!H(e)){var ut=J(e,$),ct=B?B(e)===Object.prototype:e instanceof Object||e.constructor===Object,dt=e instanceof Object?"":"null prototype",pt=!ct&&M&&Object(e)===e&&M in e?y.call(z(e),8,-1):dt?"Object":"",ft=(ct||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(pt||dt?"["+A.call(T.call([],pt||[],dt||[]),": ")+"] ":"");return 0===ut.length?ft+"{}":j?ft+"{"+Q(ut,j)+"}":ft+"{ "+A.call(ut,", ")+" }"}return String(e)};var j=Object.prototype.hasOwnProperty||function(t){return t in this};function W(t,e){return j.call(t,e)}function z(t){return m.call(t)}function V(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return Y(y.call(t,0,e.maxStringLength),e)+i}return U(x.call(x.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$),"single",e)}function $(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+v.call(e.toString(16))}function q(t){return"Object("+t+")"}function K(t){return t+" { ? }"}function Z(t,e,r,i){return t+" ("+e+") {"+(i?Q(r,i):A.call(r,", "))+"}"}function Q(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+A.call(t,","+r)+"\n"+e.prev}function J(t,e){var r=G(t),i=[];if(r){i.length=t.length;for(var s=0;s{"use strict";var i=r(210),s=r(2296),n=r(1044)(),o=r(7296),a=i("%TypeError%"),h=i("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new a("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||h(e)!==e)throw new a("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,l=!0;if("length"in t&&o){var u=o(t,"length");u&&!u.configurable&&(i=!1),u&&!u.writable&&(l=!1)}return(i||l||!r)&&(n?s(t,"length",e,!0,!0):s(t,"length",e)),t}},7478:(t,e,r)=>{"use strict";var i=r(210),s=r(1924),n=r(631),o=i("%TypeError%"),a=i("%WeakMap%",!0),h=i("%Map%",!0),l=s("WeakMap.prototype.get",!0),u=s("WeakMap.prototype.set",!0),c=s("WeakMap.prototype.has",!0),d=s("Map.prototype.get",!0),p=s("Map.prototype.set",!0),f=s("Map.prototype.has",!0),m=function(t,e){for(var r,i=t;null!==(r=i.next);i=r)if(r.key===e)return i.next=r.next,r.next=t.next,t.next=r,r};t.exports=function(){var t,e,r,i={assert:function(t){if(!i.has(t))throw new o("Side channel does not contain "+n(t))},get:function(i){if(a&&i&&("object"==typeof i||"function"==typeof i)){if(t)return l(t,i)}else if(h){if(e)return d(e,i)}else if(r)return function(t,e){var r=m(t,e);return r&&r.value}(r,i)},has:function(i){if(a&&i&&("object"==typeof i||"function"==typeof i)){if(t)return c(t,i)}else if(h){if(e)return f(e,i)}else if(r)return function(t,e){return!!m(t,e)}(r,i);return!1},set:function(i,s){a&&i&&("object"==typeof i||"function"==typeof i)?(t||(t=new a),u(t,i,s)):h?(e||(e=new h),p(e,i,s)):(r||(r={key:{},next:null}),function(t,e,r){var i=m(t,e);i?i.value=r:t.next={key:e,next:t.next,value:r}}(r,i,s))}};return i}},2511:function(t,e,r){var i;t=r.nmd(t),function(s){e&&e.nodeType,t&&t.nodeType;var n="object"==typeof r.g&&r.g;n.global!==n&&n.window!==n&&n.self;var o,a=2147483647,h=36,l=26,u=38,c=700,d=/^xn--/,p=/[^\x20-\x7E]/,f=/[\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,_=Math.floor,y=String.fromCharCode;function x(t){throw new RangeError(m[t])}function v(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function b(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+v((t=t.replace(f,".")).split("."),e).join(".")}function E(t){for(var e,r,i=[],s=0,n=t.length;s=55296&&e<=56319&&s65535&&(e+=y((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+y(t)})).join("")}function A(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,r){var i=0;for(t=r?_(t/c):t>>1,t+=_(t/e);t>g*l>>1;i+=h)t=_(t/g);return _(i+(g+1)*t/(t+u))}function S(t){var e,r,i,s,n,o,u,c,d,p,f,m=[],g=t.length,y=0,v=128,b=72;for((r=t.lastIndexOf("-"))<0&&(r=0),i=0;i=128&&x("not-basic"),m.push(t.charCodeAt(i));for(s=r>0?r+1:0;s=g&&x("invalid-input"),((c=(f=t.charCodeAt(s++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:h)>=h||c>_((a-y)/o))&&x("overflow"),y+=c*o,!(c<(d=u<=b?1:u>=b+l?l:u-b));u+=h)o>_(a/(p=h-d))&&x("overflow"),o*=p;b=w(y-n,e=m.length+1,0==n),_(y/e)>a-v&&x("overflow"),v+=_(y/e),y%=e,m.splice(y++,0,v)}return T(m)}function R(t){var e,r,i,s,n,o,u,c,d,p,f,m,g,v,b,T=[];for(m=(t=E(t)).length,e=128,r=0,n=72,o=0;o=e&&f_((a-r)/(g=i+1))&&x("overflow"),r+=(u-e)*g,e=u,o=0;oa&&x("overflow"),f==e){for(c=r,d=h;!(c<(p=d<=n?1:d>=n+l?l:d-n));d+=h)b=c-p,v=h-p,T.push(y(A(p+b%v,0))),c=_(b/v);T.push(y(A(c,0))),n=w(r,g,i==s),r=0,++i}++r,++e}return T.join("")}o={version:"1.4.1",ucs2:{decode:E,encode:T},decode:S,encode:R,toASCII:function(t){return b(t,(function(t){return p.test(t)?"xn--"+R(t):t}))},toUnicode:function(t){return b(t,(function(t){return d.test(t)?S(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return o}.call(e,r,e,t))||(t.exports=i)}()},9532:t=>{"use strict";var e=String.prototype.replace,r=/%20/g,i="RFC3986";t.exports={default:i,formatters:{RFC1738:function(t){return e.call(t,r,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:i}},5984:(t,e,r)=>{"use strict";var i=r(4730),s=r(7325),n=r(9532);t.exports={formats:n,parse:s,stringify:i}},7325:(t,e,r)=>{"use strict";var i=r(9368),s=Object.prototype.hasOwnProperty,n=Array.isArray,o={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:i.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=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,r,i){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(n),l=a?n.slice(0,a.index):n,u=[];if(l){if(!r.plainObjects&&s.call(Object.prototype,l)&&!r.allowPrototypes)return;u.push(l)}for(var c=0;r.depth>0&&null!==(a=o.exec(n))&&c=0;--n){var o,a=t[n];if("[]"===a&&r.parseArrays)o=[].concat(s);else{o=r.plainObjects?Object.create(null):{};var l="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,u=parseInt(l,10);r.parseArrays||""!==l?!isNaN(u)&&a!==l&&String(u)===l&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(o=[])[u]=s:"__proto__"!==l&&(o[l]=s):o={0:s}}s=o}return s}(u,e,r,i)}};t.exports=function(t,e){var r=function(t){if(!t)return o;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?o.charset:t.charset;return{allowDots:void 0===t.allowDots?o.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:o.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:o.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:o.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:o.comma,decoder:"function"==typeof t.decoder?t.decoder:o.decoder,delimiter:"string"==typeof t.delimiter||i.isRegExp(t.delimiter)?t.delimiter:o.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:o.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:o.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:o.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:o.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var u="string"==typeof t?function(t,e){var r,l={__proto__:null},u=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,c=e.parameterLimit===1/0?void 0:e.parameterLimit,d=u.split(e.delimiter,c),p=-1,f=e.charset;if(e.charsetSentinel)for(r=0;r-1&&(g=n(g)?[g]:g),s.call(l,m)?l[m]=i.combine(l[m],g):l[m]=g}return l}(t,r):t,c=r.plainObjects?Object.create(null):{},d=Object.keys(u),p=0;p{"use strict";var i=r(7478),s=r(9368),n=r(9532),o=Object.prototype.hasOwnProperty,a={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,u=function(t,e){l.apply(t,h(e)?e:[e])},c=Date.prototype.toISOString,d=n.default,p={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:s.encode,encodeValuesOnly:!1,format:d,formatter:n.formatters[d],indices:!1,serializeDate:function(t){return c.call(t)},skipNulls:!1,strictNullHandling:!1},f={},m=function t(e,r,n,o,a,l,c,d,m,g,_,y,x,v,b,E){for(var T,A=e,w=E,S=0,R=!1;void 0!==(w=w.get(f))&&!R;){var I=w.get(e);if(S+=1,void 0!==I){if(I===S)throw new RangeError("Cyclic object value");R=!0}void 0===w.get(f)&&(S=0)}if("function"==typeof d?A=d(r,A):A instanceof Date?A=_(A):"comma"===n&&h(A)&&(A=s.maybeMap(A,(function(t){return t instanceof Date?_(t):t}))),null===A){if(a)return c&&!v?c(r,p.encoder,b,"key",y):r;A=""}if("string"==typeof(T=A)||"number"==typeof T||"boolean"==typeof T||"symbol"==typeof T||"bigint"==typeof T||s.isBuffer(A))return c?[x(v?r:c(r,p.encoder,b,"key",y))+"="+x(c(A,p.encoder,b,"value",y))]:[x(r)+"="+x(String(A))];var C,P=[];if(void 0===A)return P;if("comma"===n&&h(A))v&&c&&(A=s.maybeMap(A,c)),C=[{value:A.length>0?A.join(",")||null:void 0}];else if(h(d))C=d;else{var M=Object.keys(A);C=m?M.sort(m):M}for(var D=o&&h(A)&&1===A.length?r+"[]":r,B=0;B0?b+v:""}},9368:(t,e,r)=>{"use strict";var i=r(9532),s=Object.prototype.hasOwnProperty,n=Array.isArray,o=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),a=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},i=0;i1;){var e=t.pop(),r=e.obj[e.prop];if(n(r)){for(var i=[],s=0;s=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||n===i.RFC1738&&(40===u||41===u)?h+=a.charAt(l):u<128?h+=o[u]:u<2048?h+=o[192|u>>6]+o[128|63&u]:u<55296||u>=57344?h+=o[224|u>>12]+o[128|u>>6&63]+o[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&a.charCodeAt(l)),h+=o[240|u>>18]+o[128|u>>12&63]+o[128|u>>6&63]+o[128|63&u])}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(n(t)){for(var r=[],i=0;i{"use strict";var i=r(2511);function s(){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 n=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(h),u=["%","/","?",";","#"].concat(l),c=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={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},_=r(5984);function y(t,e,r){if(t&&"object"==typeof t&&t instanceof s)return t;var i=new s;return i.parse(t,e,r),i}s.prototype.parse=function(t,e,r){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),o=-1!==s&&s127?D+="x":D+=M[B];if(!D.match(d)){var N=C.slice(0,S),F=C.slice(S+1),L=M.match(p);L&&(N.push(L[1]),F.unshift(L[2])),F.length&&(y="/"+F.join(".")+y),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=i.toASCII(this.hostname));var U=this.port?":"+this.port:"",k=this.hostname||"";this.host=k+U,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!f[b])for(S=0,P=l.length;S0)&&r.host.split("@"))&&(r.auth=I.shift(),r.hostname=I.shift(),r.host=r.hostname)),r.search=t.search,r.query=t.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],w=(r.host||t.host||E.length>1)&&("."===A||".."===A)||""===A,S=0,R=E.length;R>=0;R--)"."===(A=E[R])?E.splice(R,1):".."===A?(E.splice(R,1),S++):S&&(E.splice(R,1),S--);if(!v&&!b)for(;S--;S)E.unshift("..");!v||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),w&&"/"!==E.join("/").substr(-1)&&E.push("");var I,C=""===E[0]||E[0]&&"/"===E[0].charAt(0);return T&&(r.hostname=C?"":E.length?E.shift():"",r.host=r.hostname,(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.hostname=I.shift(),r.host=r.hostname)),(v=v||r.host&&E.length)&&!C&&E.unshift(""),E.length>0?r.pathname=E.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var t=this.host,e=o.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 s?t.format():s.prototype.format.call(t)}},3400:(t,e,r)=>{"use strict";r.r(e),r.d(e,{ALPHA_MODES:()=>g,AbstractMultiResource:()=>xe,AccessibilityManager:()=>fs,AnimatedSprite:()=>da,Application:()=>gs,ArrayResource:()=>ve,Assets:()=>Rs,AssetsClass:()=>Ss,Attribute:()=>Ge,BLEND_MODES:()=>a,BUFFER_BITS:()=>o,BUFFER_TYPE:()=>T,BackgroundSystem:()=>yi,BaseImageResource:()=>be,BasePrepare:()=>ea,BaseRenderTexture:()=>Be,BaseTexture:()=>ye,BatchDrawCall:()=>Pi,BatchGeometry:()=>Oi,BatchRenderer:()=>Fi,BatchShaderGenerator:()=>Bi,BatchSystem:()=>ir,BatchTextureArray:()=>Mi,BitmapFont:()=>Ia,BitmapFontData:()=>ya,BitmapText:()=>Ba,BlobResource:()=>rn,Bounds:()=>Yi,BrowserAdapter:()=>A,Buffer:()=>Xe,BufferResource:()=>me,BufferSystem:()=>ki,CLEAR_MODES:()=>_,COLOR_MASK_BITS:()=>b,Cache:()=>vs,CanvasResource:()=>Ee,Circle:()=>J,CompressedTextureResource:()=>sn,Container:()=>Zi,ContextSystem:()=>nr,CountLimiter:()=>Yo,CubeResource:()=>Ae,DEG_TO_RAD:()=>$,DRAW_MODES:()=>h,DisplayObject:()=>$i,ENV:()=>s,Ellipse:()=>tt,EventBoundary:()=>us,EventSystem:()=>ds,ExtensionType:()=>j,Extract:()=>Xn,FORMATS:()=>l,FORMATS_TO_COMPONENTS:()=>Bn,FederatedDisplayObject:()=>ps,FederatedEvent:()=>ss,FederatedMouseEvent:()=>ns,FederatedPointerEvent:()=>os,FederatedWheelEvent:()=>as,FillStyle:()=>Vn,Filter:()=>Br,FilterState:()=>Qe,FilterSystem:()=>er,Framebuffer:()=>De,FramebufferSystem:()=>hr,GC_MODES:()=>y,GLFramebuffer:()=>or,GLProgram:()=>ei,GLTexture:()=>fi,GRAPHICS_CURVES:()=>zn,GenerateTextureSystem:()=>_i,Geometry:()=>Ye,GeometrySystem:()=>ur,Graphics:()=>_o,GraphicsData:()=>ao,GraphicsGeometry:()=>co,IGLUniformData:()=>ti,INSTALLED:()=>de,INTERNAL_FORMATS:()=>tn,INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:()=>en,ImageBitmapResource:()=>Pe,ImageResource:()=>we,LINE_CAP:()=>Wn,LINE_JOIN:()=>jn,LineStyle:()=>po,LoaderParserPriority:()=>Ps,MASK_TYPES:()=>v,MIPMAP_MODES:()=>m,MSAA_QUALITY:()=>E,MaskData:()=>cr,MaskSystem:()=>Lr,Matrix:()=>st,Mesh:()=>To,MeshBatchUvs:()=>xo,MeshGeometry:()=>wo,MeshMaterial:()=>Ao,MultisampleSystem:()=>Gi,NineSlicePlane:()=>Mo,ObjectRenderer:()=>rr,ObjectRendererSystem:()=>Hi,ObservablePoint:()=>it,PI_2:()=>V,PRECISION:()=>x,ParticleContainer:()=>Do,ParticleRenderer:()=>Oo,PlaneGeometry:()=>So,PluginSystem:()=>vi,Point:()=>K,Polygon:()=>et,Prepare:()=>na,Program:()=>Pr,ProjectionSystem:()=>Wr,Quad:()=>$e,QuadUv:()=>qe,RAD_TO_DEG:()=>Y,RENDERER_TYPE:()=>n,Rectangle:()=>Q,RenderTexture:()=>Ue,RenderTexturePool:()=>ke,RenderTextureSystem:()=>Yr,Renderer:()=>Ci,ResizePlugin:()=>_s,Resource:()=>fe,RopeGeometry:()=>Ro,RoundedRectangle:()=>rt,Runner:()=>mt,SAMPLER_TYPES:()=>d,SCALE_MODES:()=>p,SHAPES:()=>q,SVGResource:()=>Re,ScissorSystem:()=>Xr,Shader:()=>Mr,ShaderSystem:()=>ui,SimpleMesh:()=>Po,SimplePlane:()=>Co,SimpleRope:()=>Io,Sprite:()=>ts,SpriteMaskFilter:()=>Fr,Spritesheet:()=>ha,StartupSystem:()=>Ei,State:()=>Dr,StateSystem:()=>di,StencilSystem:()=>jr,SystemManager:()=>bi,TARGETS:()=>u,TEXT_GRADIENT:()=>No,TYPES:()=>c,TYPES_TO_BYTES_PER_COMPONENT:()=>Dn,TYPES_TO_BYTES_PER_PIXEL:()=>On,TemporaryDisplayObject:()=>qi,Text:()=>Vo,TextFormat:()=>xa,TextMetrics:()=>jo,TextStyle:()=>Uo,Texture:()=>Le,TextureGCSystem:()=>pi,TextureMatrix:()=>Nr,TextureSystem:()=>mi,TextureUvs:()=>Oe,Ticker:()=>yt,TickerPlugin:()=>xt,TilingSprite:()=>fa,TilingSpriteRenderer:()=>_a,TimeLimiter:()=>oa,Transform:()=>ft,TransformFeedback:()=>Li,TransformFeedbackSystem:()=>Ti,UPDATE_PRIORITY:()=>gt,UniformGroup:()=>Ze,VERSION:()=>Xi,VideoResource:()=>Ce,ViewSystem:()=>xi,ViewableBuffer:()=>Di,WRAP_MODES:()=>f,XMLFormat:()=>va,XMLStringFormat:()=>ba,accessibleTarget:()=>is,autoDetectFormat:()=>Ta,autoDetectRenderer:()=>wi,autoDetectResource:()=>pe,cacheTextureArray:()=>Cs,checkExtension:()=>js,checkMaxIfStatementsInShader:()=>Rr,convertToList:()=>xs,createStringVariations:()=>As,createTexture:()=>Ws,createUBOElements:()=>Zr,defaultFilterVertex:()=>Ri,defaultVertex:()=>Si,detectAvif:()=>Ks,detectCompressedTextures:()=>hn,detectDefaults:()=>Js,detectWebp:()=>Zs,extensions:()=>z,filters:()=>Fa,generateProgram:()=>oi,generateUniformBufferSync:()=>Jr,getFontFamilyName:()=>Ns,getTestContext:()=>mr,getUBOData:()=>Qr,graphicsUtils:()=>yo,groupD8:()=>dt,isMobile:()=>H,isSingleItem:()=>bs,loadBitmapFont:()=>Na,loadDDS:()=>Ln,loadImageBitmap:()=>Vs,loadJson:()=>Ms,loadKTX:()=>Un,loadSVG:()=>$s,loadTextures:()=>Ys,loadTxt:()=>Ds,loadWebFont:()=>Fs,parseDDS:()=>Rn,parseKTX:()=>Nn,resolveCompressedTextureUrl:()=>kn,resolveTextureUrl:()=>qs,settings:()=>X,spritesheetAsset:()=>ca,uniformParsers:()=>Er,utils:()=>i});var i={};r.r(i),r.d(i,{BaseTextureCache:()=>re,CanvasRenderTarget:()=>ne,DATA_URI:()=>ae,EventEmitter:()=>vt,ProgramCache:()=>te,TextureCache:()=>ee,clearTextureCache:()=>se,correctBlendMode:()=>Lt,createIndicesForQuads:()=>Ht,decomposeDataUri:()=>he,deprecation:()=>Jt,destroyTextureCache:()=>ie,determineCrossOrigin:()=>ue,earcut:()=>bt,getBufferType:()=>Xt,getResolutionOfUrl:()=>ce,hex2rgb:()=>Dt,hex2string:()=>Bt,interleaveTypedArrays:()=>Wt,isMobile:()=>H,isPow2:()=>Vt,isWebGLSupported:()=>Pt,log2:()=>Yt,nextPow2:()=>zt,path:()=>St,premultiplyBlendMode:()=>Ft,premultiplyRgba:()=>Ut,premultiplyTint:()=>kt,premultiplyTintToRgba:()=>Gt,removeItems:()=>$t,rgb2hex:()=>Nt,sayHello:()=>It,sign:()=>qt,skipHello:()=>Rt,string2hex:()=>Ot,trimCanvas:()=>oe,uid:()=>Zt,url:()=>Tt});var s=(t=>(t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2",t))(s||{}),n=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS",t))(n||{}),o=(t=>(t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL",t))(o||{}),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||{}),h=(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))(h||{}),l=(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))(l||{}),u=(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))(u||{}),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||{}),d=(t=>(t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t))(d||{}),p=(t=>(t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t))(p||{}),f=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(f||{}),m=(t=>(t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL",t))(m||{}),g=(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))(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))(_||{}),y=(t=>(t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL",t))(y||{}),x=(t=>(t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp",t))(x||{}),v=(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))(v||{}),b=(t=>(t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA",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[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(T||{});const A={createCanvas:(t,e)=>{const r=document.createElement("canvas");return r.width=t,r.height=e,r},getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e)};var w=/iPhone/i,S=/iPod/i,R=/iPad/i,I=/\biOS-universal(?:.+)Mac\b/i,C=/\bAndroid(?:.+)Mobile\b/i,P=/Android/i,M=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,D=/Silk/i,B=/Windows Phone/i,O=/\bWindows(?:.+)ARM\b/i,N=/BlackBerry/i,F=/BB10/i,L=/Opera Mini/i,U=/\b(CriOS|Chrome)(?:.+)Mobile/i,k=/Mobile(?:.+)Firefox\b/i,G=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};const H=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 r=e.userAgent,i=r.split("[FBAN");void 0!==i[1]&&(r=i[0]),void 0!==(i=r.split("Twitter"))[1]&&(r=i[0]);var s=function(t){return function(e){return e.test(t)}}(r),n={apple:{phone:s(w)&&!s(B),ipod:s(S),tablet:!s(w)&&(s(R)||G(e))&&!s(B),universal:s(I),device:(s(w)||s(S)||s(R)||s(I)||G(e))&&!s(B)},amazon:{phone:s(M),tablet:!s(M)&&s(D),device:s(M)||s(D)},android:{phone:!s(B)&&s(M)||!s(B)&&s(C),tablet:!s(B)&&!s(M)&&!s(C)&&(s(D)||s(P)),device:!s(B)&&(s(M)||s(D)||s(C)||s(P))||s(/\bokhttp\b/i)},windows:{phone:s(B),tablet:s(O),device:s(B)||s(O)},other:{blackberry:s(N),blackberry10:s(F),opera:s(L),firefox:s(k),chrome:s(U),device:s(N)||s(F)||s(L)||s(k)||s(U)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}(globalThis.navigator),X={ADAPTER:A,MIPMAP_TEXTURES:m.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:E.NONE,SPRITE_MAX_TEXTURES:function(t){let e=!0;if(H.tablet||H.phone){if(H.apple.device){const t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);t&&parseInt(t[1],10)<11&&(e=!1)}if(H.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:y.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:f.CLAMP,SCALE_MODE:p.LINEAR,PRECISION_VERTEX:x.HIGH,PRECISION_FRAGMENT:H.apple.device?x.HIGH:x.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!H.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};X.PREFER_ENV=s.WEBGL2,X.STRICT_TEXTURE_CACHE=!1;var j=(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))(j||{});const W=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},z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(W).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(W).forEach((t=>{t.type.forEach((e=>{const r=this._addHandlers,i=this._queue;r[e]?r[e](t):(i[e]=i[e]||[],i[e].push(t))}))})),this},handle(t,e,r){const i=this._addHandlers,s=this._removeHandlers;i[t]=e,s[t]=r;const n=this._queue;return n[t]&&(n[t].forEach((t=>e(t))),delete n[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 r=e.indexOf(t.ref);-1!==r&&e.splice(r,1)}))}},V=2*Math.PI,Y=180/Math.PI,$=Math.PI/180;var q=(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))(q||{});class K{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new K(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 K,new K,new K,new K];class Q{constructor(t=0,e=0,r=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(i),this.type=q.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 r=this.yt.bottom?t.bottom:this.bottom)>r}const r=this.left,i=this.right,s=this.top,n=this.bottom;if(i<=r||n<=s)return!1;const o=Z[0].set(t.left,t.top),a=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<=o.x||a.y<=o.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u)return!1;if(e.apply(o,o),e.apply(a,a),e.apply(h,h),e.apply(l,l),Math.max(o.x,a.x,h.x,l.x)<=r||Math.min(o.x,a.x,h.x,l.x)>=i||Math.max(o.y,a.y,h.y,l.y)<=s||Math.min(o.y,a.y,h.y,l.y)>=n)return!1;const c=u*(a.y-o.y),d=u*(o.x-a.x),p=c*r+d*s,f=c*i+d*s,m=c*r+d*n,g=c*i+d*n;if(Math.max(p,f,m,g)<=c*o.x+d*o.y||Math.min(p,f,m,g)>=c*l.x+d*l.y)return!1;const _=u*(o.y-h.y),y=u*(h.x-o.x),x=_*r+y*s,v=_*i+y*s,b=_*r+y*n,E=_*i+y*n;return!(Math.max(x,v,b,E)<=_*o.x+y*o.y||Math.min(x,v,b,E)>=_*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),r=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=i,this.height=Math.max(s-i,0),this}ceil(t=1,e=.001){const r=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=i,this.height=s-i,this}}class J{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=q.CIRC}clone(){return new J(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const r=this.radius*this.radius;let i=this.x-t,s=this.y-e;return i*=i,s*=s,i+s<=r}getBounds(){return new Q(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}}class tt{constructor(t=0,e=0,r=0,i=0){this.x=t,this.y=e,this.width=r,this.height=i,this.type=q.ELIP}clone(){return new tt(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,i=(e-this.y)/this.height;return r*=r,i*=i,r+i<=1}getBounds(){return new Q(this.x-this.width,this.y-this.height,this.width,this.height)}}class et{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let r=0,i=e.length;re!=h>e&&t<(e-o)/(h-o)*(a-i)+i&&(r=!r)}return r}}class rt{constructor(t=0,e=0,r=0,i=0,s=20){this.x=t,this.y=e,this.width=r,this.height=i,this.radius=s,this.type=q.RREC}clone(){return new rt(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let i=t-(this.x+r),s=e-(this.y+r);const n=r*r;if(i*i+s*s<=n)return!0;if(i=t-(this.x+this.width-r),i*i+s*s<=n)return!0;if(s=e-(this.y+this.height-r),i*i+s*s<=n)return!0;if(i=t-(this.x+r),i*i+s*s<=n)return!0}return!1}}class it{constructor(t,e,r=0,i=0){this._x=r,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new it(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,r=0,i=1,s=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=i,this.tx=s,this.ty=n}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,r,i,s,n){return this.a=t,this.b=e,this.c=r,this.d=i,this.tx=s,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new K;const r=t.x,i=t.y;return e.x=this.a*r+this.c*i+this.tx,e.y=this.b*r+this.d*i+this.ty,e}applyInverse(t,e){e=e||new K;const r=1/(this.a*this.d+this.c*-this.b),i=t.x,s=t.y;return e.x=this.d*r*i+-this.c*r*s+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*s+-this.b*r*i+(-this.ty*this.a+this.tx*this.b)*r,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),r=Math.sin(t),i=this.a,s=this.c,n=this.tx;return this.a=i*e-this.b*r,this.b=i*r+this.b*e,this.c=s*e-this.d*r,this.d=s*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){const e=this.a,r=this.b,i=this.c,s=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*r+t.b*s,this.c=t.c*e+t.d*i,this.d=t.c*r+t.d*s,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*r+t.ty*s+this.ty,this}setTransform(t,e,r,i,s,n,o,a,h){return this.a=Math.cos(o+h)*s,this.b=Math.sin(o+h)*s,this.c=-Math.sin(o-a)*n,this.d=Math.cos(o-a)*n,this.tx=t-(r*this.a+i*this.c),this.ty=e-(r*this.b+i*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,r=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,r=this.b,i=this.c,s=this.d,n=t.pivot,o=-Math.atan2(-i,s),a=Math.atan2(r,e),h=Math.abs(o+a);return h<1e-5||Math.abs(V-h)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=a),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(i*i+s*s),t.position.x=this.tx+(n.x*e+n.y*i),t.position.y=this.ty+(n.x*r+n.y*s),t}invert(){const t=this.a,e=this.b,r=this.c,i=this.d,s=this.tx,n=t*i-e*r;return this.a=i/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-i*s)/n,this.ty=-(t*this.ty-e*s)/n,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 nt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ot=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],at=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ht=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],lt=[],ut=[],ct=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];lt.push(e);for(let r=0;r<16;r++){const i=ct(nt[t]*nt[r]+at[t]*ot[r]),s=ct(ot[t]*nt[r]+ht[t]*ot[r]),n=ct(nt[t]*at[r]+at[t]*ht[r]),o=ct(ot[t]*at[r]+ht[t]*ht[r]);for(let t=0;t<16;t++)if(nt[t]===i&&ot[t]===s&&at[t]===n&&ht[t]===o){e.push(t);break}}}for(let t=0;t<16;t++){const e=new st;e.set(nt[t],ot[t],at[t],ht[t],0,0),ut.push(e)}}();const dt={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=>nt[t],uY:t=>ot[t],vX:t=>at[t],vY:t=>ht[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>lt[t][e],sub:(t,e)=>lt[t][dt.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?dt.S:dt.N:2*Math.abs(e)<=Math.abs(t)?t>0?dt.E:dt.W:e>0?t>0?dt.SE:dt.SW:t>0?dt.NE:dt.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{const s=ut[dt.inv(e)];s.tx=r,s.ty=i,t.append(s)}},pt=class{constructor(){this.worldTransform=new st,this.localTransform=new st,this.position=new it(this.onChange,this,0,0),this.scale=new it(this.onChange,this,1,1),this.pivot=new it(this.onChange,this,0,0),this.skew=new it(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 r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.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 ft=pt;ft.IDENTITY=new pt;class mt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,i,s,n,o,a){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:l}=this;this._aliasCount++;for(let u=0,c=l.length;u0&&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(mt.prototype,{dispatch:{value:mt.prototype.emit},run:{value:mt.prototype.emit}}),X.TARGET_FPMS=.06;var gt=(t=>(t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(gt||{});class _t{constructor(t,e=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=i}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}class yt{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 _t(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,r=gt.NORMAL){return this._addListener(new _t(t,e,r))}addOnce(t,e,r=gt.NORMAL){return this._addListener(new _t(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r=r.match(t,e)?r.destroy():r.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?yt.shared:new yt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}xt.extension=j.Application,z.add(xt);var vt=r(6729),bt=r(9187),Et=r(8575);const Tt={parse:Et.Qc,format:Et.WU,resolve:Et.DB};function At(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function wt(t){return t.split("?")[0].split("#")[0]}const St={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){At(t),t=this.toPosix(t);let e="";const r=/^file:\/\/\//.exec(t),i=/^[^/:]+:\/\//.exec(t),s=/^[^/:]+:\//.exec(t);if(r||i||s){const n=r?.[0]||i?.[0]||s?.[0];e=n,t=t.slice(n.length)}return e},toAbsolute(t,e,r){if(this.isDataUrl(t))return t;const i=wt(this.toPosix(e??X.ADAPTER.getBaseUrl())),s=wt(this.toPosix(r??this.rootname(i)));return At(t),(t=this.toPosix(t)).startsWith("/")?St.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(At(t=this.toPosix(t)),0===t.length)return".";let e="";const r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const i=t.endsWith("/");return(t=function(t,e){let r,i="",s=0,n=-1,o=0;for(let e=0;e<=t.length;++e){if(e2){const t=i.lastIndexOf("/");if(t!==i.length-1){-1===t?(i="",s=0):(i=i.slice(0,t),s=i.length-1-i.lastIndexOf("/")),n=e,o=0;continue}}else if(2===i.length||1===i.length){i="",s=0,n=e,o=0;continue}}else i.length>0?i+=`/${t.slice(n+1,e)}`:i=t.slice(n+1,e),s=e-n-1;n=e,o=0}else 46===r&&-1!==o?++o:o=-1}return i}(t)).length>0&&i&&(t+="/"),r?`/${t}`:e+t},isAbsolute(t){return At(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let r=0;r0)if(void 0===e)e=i;else{const s=t[r-1]??"";this.extname(s)?e+=`/../${i}`:e+=`/${i}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(At(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const r=47===e;let i=-1,s=!0;const n=this.getProtocol(t),o=t;for(let r=(t=t.slice(n.length)).length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!s){i=r;break}}else s=!1;return-1===i?r?"/":this.isUrl(o)?n+t:n:r&&1===i?"//":n+t.slice(0,i)},rootname(t){At(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const r=t.indexOf("/",e.length);e=-1!==r?t.slice(0,r):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){At(t),e&&At(e),t=this.toPosix(t);let r,i=0,s=-1,n=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(r=t.length-1;r>=0;--r){const h=t.charCodeAt(r);if(47===h){if(!n){i=r+1;break}}else-1===a&&(n=!1,a=r+1),o>=0&&(h===e.charCodeAt(o)?-1==--o&&(s=r):(o=-1,s=a))}return i===s?s=a:-1===s&&(s=t.length),t.slice(i,s)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!n){i=r+1;break}}else-1===s&&(n=!1,s=r+1);return-1===s?"":t.slice(i,s)},extname(t){At(t);let e=-1,r=0,i=-1,s=!0,n=0;for(let o=(t=this.toPosix(t)).length-1;o>=0;--o){const a=t.charCodeAt(o);if(47!==a)-1===i&&(s=!1,i=o+1),46===a?-1===e?e=o:1!==n&&(n=1):-1!==e&&(n=-1);else if(!s){r=o+1;break}}return-1===e||-1===i||0===n||1===n&&e===i-1&&e===r+1?"":t.slice(e,i)},parse(t){At(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let r=(t=this.toPosix(t)).charCodeAt(0);const i=this.isAbsolute(t);let s;e.root=this.rootname(t),s=i||this.hasProtocol(t)?1:0;let n=-1,o=0,a=-1,h=!0,l=t.length-1,u=0;for(;l>=s;--l)if(r=t.charCodeAt(l),47!==r)-1===a&&(h=!1,a=l+1),46===r?-1===n?n=l:1!==u&&(u=1):-1!==n&&(u=-1);else if(!h){o=l+1;break}return-1===n||-1===a||0===u||1===u&&n===a-1&&n===o+1?-1!==a&&(e.base=e.name=0===o&&i?t.slice(1,a):t.slice(o,a)):(0===o&&i?(e.name=t.slice(1,n),e.base=t.slice(1,a)):(e.name=t.slice(o,n),e.base=t.slice(o,a)),e.ext=t.slice(n,a)),e.dir=this.dirname(t),e},sep:"/",delimiter:":"};function Rt(){}function It(){}let Ct;function Pt(){return void 0===Ct&&(Ct=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 r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const i=!(!r||!r.getContextAttributes().stencil);if(r){const t=r.getExtension("WEBGL_lose_context");t&&t.loseContext()}return r=null,i}catch(t){return!1}}()),Ct}X.RETINA_PREFIX=/@([0-9\.]+)x/,X.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Mt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Dt(t,e=[]){return e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function Bt(t){let e=t.toString(16);return e="000000".substring(0,6-e.length)+e,`#${e}`}function Ot(t){if("string"==typeof t&&("#"===(t=Mt[t.toLowerCase()]||t)[0]&&(t=t.slice(1)),3===t.length)){const[e,r,i]=t;t=e+e+r+r+i+i}return parseInt(t,16)}function Nt(t){return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)}const Ft=function(){const t=[],e=[];for(let r=0;r<32;r++)t[r]=r,e[r]=r;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 r=[];return r.push(e),r.push(t),r}();function Lt(t,e){return Ft[e?1:0][t]}function Ut(t,e,r,i){return r=r||new Float32Array(4),i||void 0===i?(r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e):(r[0]=t[0],r[1]=t[1],r[2]=t[2]),r[3]=e,r}function kt(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;let r=t>>16&255,i=t>>8&255,s=255&t;return r=r*e+.5|0,i=i*e+.5|0,s=s*e+.5|0,(255*e<<24)+(r<<16)+(i<<8)+s}function Gt(t,e,r,i){return(r=r||new Float32Array(4))[0]=(t>>16&255)/255,r[1]=(t>>8&255)/255,r[2]=(255&t)/255,(i||void 0===i)&&(r[0]*=e,r[1]*=e,r[2]*=e),r[3]=e,r}function Ht(t,e=null){const r=6*t;if((e=e||new Uint16Array(r)).length!==r)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let t=0,i=0;t>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}function Vt(t){return!(t&t-1||!t)}function Yt(t){let e=(t>65535?1:0)<<4,r=((t>>>=e)>255?1:0)<<3;return e|=r,r=((t>>>=r)>15?1:0)<<2,e|=r,r=((t>>>=r)>3?1:0)<<1,e|=r,e|(t>>>=r)>>1}function $t(t,e,r){const i=t.length;let s;if(e>=i||0===r)return;const n=i-(r=e+r>i?i-e:r);for(s=e;s=0;--i){const s=de[i];if(s.test&&s.test(t,r))return new s(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class fe{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new mt("setRealSize"),this.onUpdate=new mt("update"),this.onError=new mt("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,r){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 me extends fe{constructor(t,e){const{width:r,height:i}=e||{};if(!r||!i)throw new Error("BufferResource width or height invalid");super(r,i),this.data=t}upload(t,e,r){const i=t.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===g.UNPACK);const s=e.realWidth,n=e.realHeight;return r.width===s&&r.height===n?i.texSubImage2D(e.target,0,0,0,s,n,e.format,r.type,this.data):(r.width=s,r.height=n,i.texImage2D(e.target,0,r.internalFormat,s,n,0,e.format,r.type,this.data)),!0}dispose(){this.data=null}static test(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array}}const ge={scaleMode:p.NEAREST,format:l.RGBA,alphaMode:g.NPM},_e=class extends vt{constructor(t=null,e=null){super(),e=e||{};const{alphaMode:r,mipmap:i,anisotropicLevel:s,scaleMode:n,width:o,height:a,wrapMode:h,format:d,type:p,target:f,resolution:m,resourceOptions:_}=e;!t||t instanceof fe||((t=pe(t,_)).internal=!0),this.resolution=m||X.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((a||0)*this.resolution)/this.resolution,this._mipmap=i??X.MIPMAP_TEXTURES,this.anisotropicLevel=s??X.ANISOTROPIC_LEVEL,this._wrapMode=h||X.WRAP_MODE,this._scaleMode=n??X.SCALE_MODE,this.format=d||l.RGBA,this.type=p||c.UNSIGNED_BYTE,this.target=f||u.TEXTURE_2D,this.alphaMode=r??g.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=o>0&&a>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 r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Vt(this.realWidth)&&Vt(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 re[this.cacheId],delete ee[this.cacheId],this.cacheId=null),this.dispose(),_e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,r=X.STRICT_TEXTURE_CACHE){const i="string"==typeof t;let s=null;if(i)s=t;else{if(!t._pixiId){const r=e?.pixiIdPrefix||"pixiid";t._pixiId=`${r}_${Zt()}`}s=t._pixiId}let n=re[s];if(i&&r&&!n)throw new Error(`The cacheId "${s}" does not exist in BaseTextureCache.`);return n||(n=new _e(t,e),n.cacheId=s,_e.addToCache(n,s)),n}static fromBuffer(t,e,r,i){t=t||new Float32Array(e*r*4);const s=new me(t,{width:e,height:r}),n=t instanceof Float32Array?c.FLOAT:c.UNSIGNED_BYTE;return new _e(s,Object.assign({},ge,i||{width:e,height:r,type:n}))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),re[e]&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),re[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=re[t];if(e){const r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete re[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 ve extends xe{constructor(t,e){const{width:r,height:i}=e||{};let s,n;Array.isArray(t)?(s=t,n=t.length):n=t,super(n,{width:r,height:i}),s&&this.initFromArray(s,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=u.TEXTURE_2D_ARRAY}upload(t,e,r){const{length:i,itemDirtyIds:s,items:n}=this,{gl:o}=t;r.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,i,0,e.format,r.type,null);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=u.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,r){const i=this.itemDirtyIds;for(let s=0;s{const r=this.source;this.url=r.src;const i=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.resize(r.width,r.height),this._load=null,this.createBitmap?t(this.process()):t(this))};r.complete&&r.src?i():(r.onload=i,r.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,r=!t.crossOrigin||"anonymous"===t.crossOrigin;return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then((t=>t.blob())).then((r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===g.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,r){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let t=!0;const i=e._glTextures;for(const s in i){const n=i[s];if(n!==r&&n.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 Se=class extends be{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)},Se.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;be.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,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=e*this.scale,s=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/r*e,s=this._overrideHeight||this._overrideWidth/e*r),i=Math.round(i),s=Math.round(s);const n=this.source;n.width=i,n.height=s,n._pixiId=`canvas_${Zt()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,i,s),this._resolve(),this._resolve=null}}static getSize(t){const e=Se.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}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&&Se.SVG_XML.test(t)}};let Re=Se;Re.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;const Ie=class extends be{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const r=document.createElement("video");r.setAttribute("preload","auto"),r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline",""),"string"==typeof t&&(t=[t]);const i=t[0].src||t[0];be.crossOrigin(r,i,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&&(yt.shared.add(this.update,this),this._isConnectedToTicker=!0)}_onPlayStop(){this._isConnectedToTicker&&(yt.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&&(yt.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?(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(yt.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||Ie.TYPES.includes(e)}};let Ce=Ie;Ce.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ce.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};class Pe extends be{constructor(t,e){var r=(...t)=>{super(...t)};e=e||{},"string"==typeof t?(r(Pe.EMPTY),this.url=t):(r(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 r=await e.blob();if(this.destroyed)return;const i=await createImageBitmap(r,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===g.UNPACK?"premultiply":"none"});if(this.destroyed)return;this.source=i,this.update(),t(this)}catch(t){if(this.destroyed)return;e(t),this.onError.emit(t)}else t(this)}))),this._load}upload(t,e,r){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(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 Pe._EMPTY=Pe._EMPTY??X.ADAPTER.createCanvas(0,0),Pe._EMPTY}}de.push(Pe,we,Ee,Ce,Re,me,Ae,ve);class Me extends me{upload(t,e,r){const i=t.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===g.UNPACK);const s=e.realWidth,n=e.realHeight;return r.width===s&&r.height===n?i.texSubImage2D(e.target,0,0,0,s,n,e.format,r.type,this.data):(r.width=s,r.height=n,i.texImage2D(e.target,0,r.internalFormat,s,n,0,e.format,r.type,this.data)),!0}}class De{constructor(t,e){this.width=Math.round(t||100),this.height=Math.round(e||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new mt("disposeFramebuffer"),this.multisample=E.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ye(null,{scaleMode:p.NEAREST,resolution:1,mipmap:m.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ye(new Me(null,{width:this.width,height:this.height}),{scaleMode:p.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:m.OFF,format:l.DEPTH_COMPONENT,type:c.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let r=0;rPromise.resolve(i)))}static fromBuffer(t,e,r,i){return new Le(ye.fromBuffer(t,e,r,i))}static fromLoader(t,e,r,i){const s=new ye(t,Object.assign({scaleMode:X.SCALE_MODE,resolution:ce(e)},i)),{resource:n}=s;n instanceof we&&(n.url=e);const o=new Le(s);return r||(r=e),ye.addToCache(o.baseTexture,r),Le.addToCache(o,r),r!==e&&(ye.addToCache(o.baseTexture,e),Le.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise((t=>{o.baseTexture.once("loaded",(()=>t(o)))}))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),ee[e]&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),ee[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=ee[t];if(e){const r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete ee[t],e}}else if(t?.textureCacheIds){for(let e=0;ethis.baseTexture.width,o=r+s>this.baseTexture.height;if(n||o){const t=n&&o?"and":"or",a=`X: ${e} + ${i} = ${e+i} > ${this.baseTexture.width}`,h=`Y: ${r} + ${s} = ${r+s} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${a} ${t} ${h}`)}this.valid=i&&s&&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 Le._EMPTY||(Le._EMPTY=new Le(new ye),Fe(Le._EMPTY),Fe(Le._EMPTY.baseTexture)),Le._EMPTY}static get WHITE(){if(!Le._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),Le._WHITE=new Le(ye.from(t)),Fe(Le._WHITE),Fe(Le._WHITE.baseTexture)}return Le._WHITE}}class Ue extends Le{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,r=!0){const i=this.baseTexture.resolution,s=Math.round(t*i)/i,n=Math.round(e*i)/i;this.valid=s>0&&n>0,this._frame.width=this.orig.width=s,this._frame.height=this.orig.height=n,r&&this.baseTexture.resize(s,n),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 Ue(new Be(t))}}class ke{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=E.NONE){const i=new Be(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new Ue(i)}getOptimalTexture(t,e,r=1,i=E.NONE){let s;t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?s=i>1?-i:-1:(s=((65535&(t=zt(t)))<<16|65535&(e=zt(e)))>>>0,i>1&&(s+=4294967296*i)),this.texturePool[s]||(this.texturePool[s]=[]);let n=this.texturePool[s].pop();return n||(n=this.createTexture(t,e,i)),n.filterPoolKey=s,n.setResolution(r),n}getFilterTexture(t,e,r){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||E.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=!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&&(i=this.getOptimalFilterTexture(t.width,t.height,e.resolution),i.filterFrame=t.filterFrame),r[s].apply(this,t,i,_.CLEAR,e);const n=t;t=i,i=n}r[s].apply(this,t,a.renderTexture,_.BLEND,e),s>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(t),this.returnFilterTexture(i)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=_.CLEAR){const{renderTexture:r,state:i}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){const e=this.tempRect;e.x=0,e.y=0,e.width=t.filterFrame.width,e.height=t.filterFrame.height,r.bind(t,t.filterFrame,e)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const s=1&i.stateId||this.forceClear;(e===_.CLEAR||e===_.BLIT&&s)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,i){const s=this.renderer;s.state.set(t.state),this.bindAndClear(r,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(h.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(h.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:r,destinationFrame:i}=this.activeState,{orig:s}=e._texture,n=t.set(i.width,0,0,i.height,r.x,r.y),o=e.worldTransform.copyTo(st.TEMP_MATRIX);return o.invert(),n.prepend(o),n.scale(1/s.width,1/s.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,i=E.NONE){return this.texturePool.getOptimalTexture(t,e,r,i)}getFilterTexture(t,e,r){if("number"==typeof t){const r=t;t=e,e=r}t=t||this.activeState.renderTexture;const i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||E.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const r=Je[0],i=Je[1],s=Je[2],n=Je[3];r.set(e.left,e.top),i.set(e.left,e.bottom),s.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(r,r),t.apply(i,i),t.apply(s,s),t.apply(n,n);const o=Math.min(r.x,i.x,s.x,n.x),a=Math.min(r.y,i.y,s.y,n.y),h=Math.max(r.x,i.x,s.x,n.x),l=Math.max(r.y,i.y,s.y,n.y);e.x=o,e.y=a,e.width=h-o,e.height=l-a}roundFrame(t,e,r,i,s){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(s){const{a:t,b:e,c:r,d:i}=s;if((Math.abs(e)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(i)>1e-4))return}(s=s?tr.copyFrom(s):tr.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}}}er.extension={type:j.RendererSystem,name:"filter"},z.add(er);class rr{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}class ir{constructor(t){this.renderer=t,this.emptyRenderer=new rr(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:r}=this.renderer.texture;for(let i=e-1;i>=0;--i)t[i]=r[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,r,i){const{elements:s,ids:n,count:o}=t;let a=0;for(let t=0;t=0&&h=s.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,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(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const i=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}nr.extension={type:j.RendererSystem,name:"context"},z.add(nr);class or{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 ar=new Q;class hr{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new De(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,r=this.renderer.context.extensions.depthTexture;X.PREFER_ENV===s.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=t=>e.drawBuffersWEBGL(t):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){const{gl:i}=this;if(t){const s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=r),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):s.dirtySize!==t.dirtySize&&(s.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let e=0;e>r,i=e.height>>r,s=t/e.width;this.setViewport(e.x*s,e.y*s,t,i)}else{const e=t.width>>r,i=t.height>>r;this.setViewport(0,0,e,i)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,r,i){const s=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),i=Math.round(i),s.width===r&&s.height===i&&s.x===t&&s.y===e||(s.x=t,s.y=e,s.width=r,s.height=i,this.gl.viewport(t,e,r,i))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,r,i,s=o.COLOR|o.DEPTH){const{gl:n}=this;n.clearColor(t,e,r,i),n.clear(s)}initFramebuffer(t){const{gl:e}=this,r=new or(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){const{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];r.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));const i=t.colorTextures;let s=i.length;e.drawBuffers||(s=Math.min(s,1));for(let n=0;n1&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||r.createRenderbuffer():i.msaaBuffer&&(r.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const o=[];for(let a=0;a1&&r.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const i=t.depthTexture;this.renderer.texture.bind(i,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,i._glTextures[this.CONTEXT_UID].texture,e)}!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture?i.stencil&&(r.deleteRenderbuffer(i.stencil),i.stencil=null):(i.stencil=i.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.stencil),i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.DEPTH24_STENCIL8,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,i.stencil))}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let r=E.NONE;if(t<=1||null===e)return r;for(let i=0;i=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&i.deleteRenderbuffer(r.msaaBuffer),r.stencil&&i.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&r.blitFramebuffer.dispose()}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;re.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,r)=>e.vertexAttribDivisorANGLE(t,r),t.drawElementsInstanced=(t,r,i,s,n)=>e.drawElementsInstancedANGLE(t,r,i,s,n),t.drawArraysInstanced=(t,r,i,s)=>e.drawArraysInstancedANGLE(t,r,i,s)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:r}=this;let i=t.glVertexArrayObjects[this.CONTEXT_UID],s=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},s=!0);const n=i[e.program.id]||this.initGeometryVao(t,e,s);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r=s.WEBGL2&&(e=t.getContext("webgl2",{})),e||(e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),fr=e}return fr}function gr(t,e,r){if("precision"!==t.substring(0,9)){let i=e;return e===x.HIGH&&r!==x.HIGH&&(i=x.MEDIUM),`precision ${i} float;\n${t}`}return r!==x.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}const _r={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function yr(t){return _r[t]}let xr=null;const vr={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function br(t,e){if(!xr){const e=Object.keys(vr);xr={};for(let r=0;r"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 }`}],Tr={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 }"},Ar={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)"},wr=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Sr(t){let e="";for(let r=0;r0&&(e+="\nelse "),r0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))}destroy(){this.renderer=null}}Lr.extension={type:j.RendererSystem,name:"mask"},z.add(Lr);class Ur{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;const i=this.getStackLength();i!==r&&(0===i?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const kr=new st,Gr=[],Hr=class extends Ur{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:r}=t,{renderer:i}=this,s=i.renderTexture,n=r.getBounds(!0,Gr.pop()??new Q);this.roundFrameToPixels(n,s.current?s.current.resolution:i.resolution,s.sourceFrame,s.destinationFrame,i.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:r,c:i,d:s}=t;return(Math.abs(r)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(s)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect())return!1;if(Hr.isMatrixRotated(e.worldTransform))return!1;if(Hr.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,e,r,i,s){Hr.isMatrixRotated(s)||((s=s?kr.copyFrom(s):kr.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.renderer.filter.transformAABB(s,t),t.fit(i),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&Gr.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 Xr=Hr;Xr.extension={type:j.RendererSystem,name:"scissor"},z.add(Xr);class jr extends Ur{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:r}=this.renderer,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;const s=t._colorMask;0!==s&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,i,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==s&&(t._colorMask=s,r.colorMask(0!=(1&s),0!=(2&s),0!=(4&s),0!=(8&s))),this._useCurrent()}pop(t){const e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{const r=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=r?r._colorMask:15;0!==i&&(r._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!==i&&(r._colorMask=i,e.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}jr.extension={type:j.RendererSystem,name:"stencil"},z.add(jr);class Wr{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new st,this.transform=null}update(t,e,r,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,i),this.transform&&this.projectionMatrix.append(this.transform);const s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)}calculateProjection(t,e,r,i){const s=this.projectionMatrix,n=i?-1:1;s.identity(),s.a=1/e.width*2,s.d=n*(1/e.height*2),s.tx=-1-e.x*s.a,s.ty=-n-e.y*s.d}setTransform(t){}destroy(){this.renderer=null}}Wr.extension={type:j.RendererSystem,name:"projection"},z.add(Wr);const zr=new Q,Vr=new Q;class Yr{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,r){const i=this.renderer;let s,n,o;this.current=t,t?(s=t.baseTexture,o=s.resolution,e||(zr.width=t.frame.width,zr.height=t.frame.height,e=zr),r||(Vr.x=t.frame.x,Vr.y=t.frame.y,Vr.width=e.width,Vr.height=e.height,r=Vr),n=s.framebuffer):(o=i.resolution,e||(zr.width=i._view.screen.width,zr.height=i._view.screen.height,e=zr),r||((r=zr).width=e.width,r.height=e.height));const a=this.viewportFrame;a.x=r.x*o,a.y=r.y*o,a.width=r.width*o,a.height=r.height*o,t||(a.y=i.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(r,e,o,!n),t?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){t=this.current?t||this.current.baseTexture.clearColor:t||this.renderer.background.colorRgba;const r=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer._view.screen,s=r.width!==i.width||r.height!==i.height;if(s){let{x:t,y:e,width:r,height:i}=this.viewportFrame;t=Math.round(t),e=Math.round(e),r=Math.round(r),i=Math.round(i),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(t,e,r,i)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),s&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}function $r(t,e,r,i,s){r.buffer.update(s)}Yr.extension={type:j.RendererSystem,name:"renderTexture"},z.add(Yr);const qr={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 "},Kr={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};function Zr(t){const e=t.map((t=>({data:t,offset:0,dataLen:0,dirty:0})));let r=0,i=0,s=0;for(let t=0;t1&&(r=Math.max(r,16)*n.data.size),n.dataLen=r,i%r!=0&&i<16){const t=i%r%16;i+=t,s+=t}i+r>16?(s=16*Math.ceil(s/16),n.offset=s,s+=r,i=r):(n.offset=s,i+=r,s+=r)}return s=16*Math.ceil(s/16),{uboElements:e,size:s}}function Qr(t,e){const r=[];for(const i in t)e[i]&&r.push(e[i]);return r.sort(((t,e)=>t.index-e.index)),r}function Jr(t,e){if(!t.autoManage)return{size:0,syncFunc:$r};const r=Qr(t.uniforms,e),{uboElements:i,size:s}=Zr(r),n=["\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=yr(r.data.type),e=Math.max(Kr[r.data.type]/16,1),i=t/e,s=(4-i%4)%4;n.push(`\n cv = ud.${o}.value;\n v = uv.${o};\n offset = ${r.offset/4};\n\n t = 0;\n\n for(var i=0; i < ${r.data.size*e}; i++)\n {\n for(var j = 0; j < ${i}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${s};\n }\n\n `)}else{const t=qr[r.data.type];n.push(`\n cv = ud.${o}.value;\n v = uv.${o};\n offset = ${r.offset/4};\n ${t};\n `)}}return n.push("\n renderer.buffer.update(buffer);\n "),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join("\n"))}}class ti{}class ei{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 ri(t,e,r){const i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),i}function ii(t){const e=new Array(t);for(let t=0;t`${e}: ${t}`)),i=t.getShaderInfoLog(e),s=i.split("\n"),n={},o=s.map((t=>parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1")))).filter((t=>!(!t||n[t]||(n[t]=!0,0)))),a=[""];o.forEach((t=>{r[t-1]=`%c${r[t-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));const h=r.join("\n");a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function oi(t,e){const r=ri(t,t.VERTEX_SHADER,e.vertexSrc),i=ri(t,t.FRAGMENT_SHADER,e.fragmentSrc),s=t.createProgram();t.attachShader(s,r),t.attachShader(s,i);const n=e.extra?.transformFeedbackVaryings;if(n&&("function"!=typeof t.transformFeedbackVaryings||t.transformFeedbackVaryings(s,n.names,"separate"===n.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||function(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||ni(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||ni(t,i),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,s,r,i),e.attributeData=function(t,e){const r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;st>e?1:-1));for(let i=0;i>=1,r++;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 r=!1;for(let i=0;ithis.maxIdle&&(t.destroyTexture(s,!0),e[i]=null,r=!0)}if(r){let t=0;for(let r=0;r=0;e--)this.unload(t.children[e])}destroy(){this.renderer=null}}pi.extension={type:j.RendererSystem,name:"textureGC"},z.add(pi);class fi{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=l.RGBA,this.samplerType=0}}class mi{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ye,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]:{[l.RGBA]:t.RGBA8,[l.RGB]:t.RGB8,[l.RG]:t.RG8,[l.RED]:t.R8,[l.RGBA_INTEGER]:t.RGBA8UI,[l.RGB_INTEGER]:t.RGB8UI,[l.RG_INTEGER]:t.RG8UI,[l.RED_INTEGER]:t.R8UI,[l.ALPHA]:t.ALPHA,[l.LUMINANCE]:t.LUMINANCE,[l.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[c.BYTE]:{[l.RGBA]:t.RGBA8_SNORM,[l.RGB]:t.RGB8_SNORM,[l.RG]:t.RG8_SNORM,[l.RED]:t.R8_SNORM,[l.RGBA_INTEGER]:t.RGBA8I,[l.RGB_INTEGER]:t.RGB8I,[l.RG_INTEGER]:t.RG8I,[l.RED_INTEGER]:t.R8I},[c.UNSIGNED_SHORT]:{[l.RGBA_INTEGER]:t.RGBA16UI,[l.RGB_INTEGER]:t.RGB16UI,[l.RG_INTEGER]:t.RG16UI,[l.RED_INTEGER]:t.R16UI,[l.DEPTH_COMPONENT]:t.DEPTH_COMPONENT16},[c.SHORT]:{[l.RGBA_INTEGER]:t.RGBA16I,[l.RGB_INTEGER]:t.RGB16I,[l.RG_INTEGER]:t.RG16I,[l.RED_INTEGER]:t.R16I},[c.UNSIGNED_INT]:{[l.RGBA_INTEGER]:t.RGBA32UI,[l.RGB_INTEGER]:t.RGB32UI,[l.RG_INTEGER]:t.RG32UI,[l.RED_INTEGER]:t.R32UI,[l.DEPTH_COMPONENT]:t.DEPTH_COMPONENT24},[c.INT]:{[l.RGBA_INTEGER]:t.RGBA32I,[l.RGB_INTEGER]:t.RGB32I,[l.RG_INTEGER]:t.RG32I,[l.RED_INTEGER]:t.R32I},[c.FLOAT]:{[l.RGBA]:t.RGBA32F,[l.RGB]:t.RGB32F,[l.RG]:t.RG32F,[l.RED]:t.R32F,[l.DEPTH_COMPONENT]:t.DEPTH_COMPONENT32F},[c.HALF_FLOAT]:{[l.RGBA]:t.RGBA16F,[l.RGB]:t.RGB16F,[l.RG]:t.RG16F,[l.RED]:t.R16F},[c.UNSIGNED_SHORT_5_6_5]:{[l.RGB]:t.RGB565},[c.UNSIGNED_SHORT_4_4_4_4]:{[l.RGBA]:t.RGBA4},[c.UNSIGNED_SHORT_5_5_5_1]:{[l.RGBA]:t.RGB5_A1},[c.UNSIGNED_INT_2_10_10_10_REV]:{[l.RGBA]:t.RGB10_A2,[l.RGBA_INTEGER]:t.RGB10_A2UI},[c.UNSIGNED_INT_10F_11F_11F_REV]:{[l.RGB]:t.R11F_G11F_B10F},[c.UNSIGNED_INT_5_9_9_9_REV]:{[l.RGB]:t.RGB9_E5},[c.UNSIGNED_INT_24_8]:{[l.DEPTH_STENCIL]:t.DEPTH24_STENCIL8},[c.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[l.DEPTH_STENCIL]:t.DEPTH32F_STENCIL8}}:{[c.UNSIGNED_BYTE]:{[l.RGBA]:t.RGBA,[l.RGB]:t.RGB,[l.ALPHA]:t.ALPHA,[l.LUMINANCE]:t.LUMINANCE,[l.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[c.UNSIGNED_SHORT_5_6_5]:{[l.RGB]:t.RGB},[c.UNSIGNED_SHORT_4_4_4_4]:{[l.RGBA]:t.RGBA},[c.UNSIGNED_SHORT_5_5_5_1]:{[l.RGBA]:t.RGBA}},e}(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let t=0;t=0;--r){const t=e[r];t&&t._glTextures[i].samplerType!==d.FLOAT&&this.renderer.texture.unbind(t)}}initTexture(t){const e=new fi(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 r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==d.FLOAT&&(this.hasIntegerTextures=!0);else{const i=t.realWidth,s=t.realHeight,n=r.gl;(e.width!==i||e.height!==s||e.dirtyId<0)&&(e.width=i,e.height=s,n.texImage2D(t.target,0,e.internalFormat,i,s,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:r}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.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&&$t(this.managedTextures,e,1)}}updateTextureStyle(t){const e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==m.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 r=this.gl;if(e.mipmap&&t.mipmap!==m.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===p.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);const e=this.renderer.context.extensions.anisotropicFiltering;if(e&&t.anisotropicLevel>0&&t.scaleMode===p.LINEAR){const i=Math.min(t.anisotropicLevel,r.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY_EXT,i)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===p.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===p.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}}mi.extension={type:j.RendererSystem,name:"texture"},z.add(mi);const gi=new ft;class _i{constructor(t){this.renderer=t,this._tempMatrix=new st}generateTexture(t,e){const{region:r,...i}=e||{},s=r||t.getLocalBounds(null,!0);0===s.width&&(s.width=1),0===s.height&&(s.height=1);const n=Ue.create({width:s.width,height:s.height,...i});this._tempMatrix.tx=-s.x,this._tempMatrix.ty=-s.y;const o=t.transform;return t.transform=gi,this.renderer.render(t,{renderTexture:n,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,n}destroy(){}}_i.extension={type:[j.RendererSystem,j.CanvasRendererSystem],name:"textureGenerator"},z.add(_i);class yi{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?Ot(t.color):t.color),this.alpha=t.alpha}get color(){return this._backgroundColor}set color(t){this._backgroundColor=t,this._backgroundColorString=Bt(t),Dt(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(){}}yi.extension={type:[j.RendererSystem,j.CanvasRendererSystem],name:"background"},z.add(yi);class xi{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 r=this.element.width/this.resolution,i=this.element.height/this.resolution;this.screen.width=r,this.screen.height=i,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${i}px`),this.renderer.emit("resize",r,i),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}}xi.extension={type:[j.RendererSystem,j.CanvasRendererSystem],name:"_view"},z.add(xi);class vi{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}}vi.extension={type:[j.RendererSystem,j.CanvasRendererSystem],name:"_plugin"},z.add(vi);class bi extends vt{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter((e=>t.systems[e])),r=[...e,...Object.keys(t.systems).filter((t=>!e.includes(t)))];for(const e of r)this.addSystem(t.systems[e],e)}addRunners(...t){t.forEach((t=>{this.runners[t]=new mt(t)}))}addSystem(t,e){const r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(const t in this.runners)this.runners[t].add(r);return this}emitWithCustomOptions(t,e){const r=Object.keys(this._systemsHash);t.items.forEach((i=>{const s=r.find((t=>this._systemsHash[t]===i));i[t.name](e[s])}))}destroy(){Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash={}}}class Ei{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(){}}Ei.extension={type:[j.RendererSystem,j.CanvasRendererSystem],name:"startup"},z.add(Ei);class Ti{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:r}=this,i=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:r,renderer:i}=this;e&&i.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:r,CONTEXT_UID:i}=this,s=e.createTransformFeedback();t._glTransformFeedbacks[i]=s,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s);for(let s=0;s0&&(e+="\nelse "),rthis.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,r=Ni._textureArrayPool,i=this.renderer.batch,s=this._tempBoundTextures,n=this.renderer.textureGC.count;let o=++ye._globalBatch,a=0,h=r[0],l=0;i.copyBoundTextures(s,e);for(let u=0;u=e&&(i.boundArray(h,s,o,e),this.buildDrawCalls(h,l,u),l=u,h=r[++a],++o),c._batchEnabled=o,c.touched=n,h.elements[h.count++]=c)}h.count>0&&(i.boundArray(h,s,o,e),this.buildDrawCalls(h,l,this._bufferSize),++a,++o);for(let t=0;t=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const r=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,r)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const r=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),r&&(e||i.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let r=0;r=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(){}}Gi.extension={type:j.RendererSystem,name:"_multisample"},z.add(Gi);class Hi{constructor(t){this.renderer=t}render(t,e){const r=this.renderer;let i,s,n,o;if(e&&(i=e.renderTexture,s=e.clear,n=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!i,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(i||(this.lastObjectRendered=t),!o){const e=t.enableTempParent();t.updateTransform(),t.disableTempParent(e)}r.renderTexture.bind(i),r.batch.currentRenderer.start(),(s??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),i&&(e.blit&&r.framebuffer.blit(),i.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Hi.extension={type:j.RendererSystem,name:"objectRenderer"},z.add(Hi);const Xi="7.0.4",ji={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Wi=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join("\n");class zi extends Br{constructor(t,e=8,r=4,i=X.FILTER_RESOLUTION,s=5){const n=function(t,e){const r=Math.ceil(t/2);let i,s="\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 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\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }",n="";i=e?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let e=0;e=r&&(i=t-s-1),o=o.replace("%value%",e[i].toString()),n+=o,n+="\n"}return s=s.replace("%blur%",n),s=s.replace("%size%",t.toString()),s}(s);super(n,o),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=r,this.blur=e}apply(t,e,r,i){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{const s=t.getFilterTexture(),n=t.renderer;let o=e,a=s;this.state.blend=!1,t.applyFilter(this,o,a,_.CLEAR);for(let e=1;e 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 r=t;e&&(this._multiply(r,this.uniforms.m,t),r=this._colorMatrix(r)),this.uniforms.m=r}_multiply(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[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 r=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}tint(t,e){const r=[(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(r,e)}greyscale(t,e){const r=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(r,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 r=Math.cos(t),i=Math.sin(t),s=1/3,n=(0,Math.sqrt)(s),o=[r+(1-r)*s,s*(1-r)-n*i,s*(1-r)+n*i,0,0,s*(1-r)+n*i,r+s*(1-r),s*(1-r)-n*i,0,0,s*(1-r)-n*i,s*(1-r)+n*i,r+s*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,e)}contrast(t,e){const r=(t||0)+1,i=-.5*(r-1),s=[r,0,0,0,i,0,r,0,0,i,0,0,r,0,i,0,0,0,1,0];this._loadMatrix(s,e)}saturate(t=0,e){const r=2*t/3+1,i=-.5*(r-1),s=[r,i,i,0,0,i,r,i,0,0,i,i,r,0,0,0,0,0,1,0];this._loadMatrix(s,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,r,i,s){const n=((r=r||16770432)>>16&255)/255,o=(r>>8&255)/255,a=(255&r)/255,h=((i=i||3375104)>>16&255)/255,l=(i>>8&255)/255,u=(255&i)/255,c=[.3,.59,.11,0,0,n,o,a,t=t||.2,0,h,l,u,e=e||.15,0,n-h,o-l,a-u,0,0];this._loadMatrix(c,s)}night(t,e){const r=[-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(r,e)}predator(t,e){const r=[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(r,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}}Vi.prototype.grayscale=Vi.prototype.greyscale,X.SORTABLE_CHILDREN=!1;class Yi{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?Q.EMPTY:((t=t||new Q(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:r,b:i,c:s,d:n,tx:o,ty:a}=t,h=r*e.x+s*e.y+o,l=i*e.x+n*e.y+a;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,r=this.minY,i=this.maxX,s=this.maxY,n=t[0],o=t[1];e=ni?n:i,s=o>s?o:s,n=t[2],o=t[3],e=ni?n:i,s=o>s?o:s,n=t[4],o=t[5],e=ni?n:i,s=o>s?o:s,n=t[6],o=t[7],e=ni?n:i,s=o>s?o:s,this.minX=e,this.minY=r,this.maxX=i,this.maxY=s}addFrame(t,e,r,i,s){this.addFrameMatrix(t.worldTransform,e,r,i,s)}addFrameMatrix(t,e,r,i,s){const n=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,u=t.ty;let c=this.minX,d=this.minY,p=this.maxX,f=this.maxY,m=n*e+a*r+l,g=o*e+h*r+u;c=mp?m:p,f=g>f?g:f,m=n*i+a*r+l,g=o*i+h*r+u,c=mp?m:p,f=g>f?g:f,m=n*e+a*s+l,g=o*e+h*s+u,c=mp?m:p,f=g>f?g:f,m=n*i+a*s+l,g=o*i+h*s+u,c=mp?m:p,f=g>f?g:f,this.minX=c,this.minY=d,this.maxX=p,this.maxY=f}addVertexData(t,e,r){let i=this.minX,s=this.minY,n=this.maxX,o=this.maxY;for(let a=e;an?e:n,o=r>o?r:o}this.minX=i,this.minY=s,this.maxX=n,this.maxY=o}addVertices(t,e,r,i){this.addVerticesMatrix(t.worldTransform,e,r,i)}addVerticesMatrix(t,e,r,i,s=0,n=s){const o=t.a,a=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,p=this.minY,f=this.maxX,m=this.maxY;for(let t=r;ti?t.maxX:i,this.maxY=t.maxY>s?t.maxY:s}addBoundsMask(t,e){const r=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,s=t.maxXo?s:o,this.maxY=n>a?n:a}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const r=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,s=t.maxXo?s:o,this.maxY=n>a?n:a}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,r,i,s,n){t-=s,e-=n,r+=s,i+=n,this.minX=this.minXr?this.maxX:r,this.minY=this.minYi?this.maxY:i}}class $i extends vt{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ft,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 Yi,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 r=0;r1)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 r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t,this.onChildrenChange(r=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const r=this.getChildIndex(t);$t(this.children,r,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&&i<=e){s=this.children.splice(r,i);for(let t=0;t1&&this.children.sort(Ki),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 r,i;if(this.cullArea?(r=this.cullArea,i=this.worldTransform):this._render!==Zi.prototype._render&&(r=this.getBounds(!0)),r&&e.intersects(r,i))this._render(t);else if(this.cullArea)return;for(let e=0,r=this.children.length;e=i&&Qi.x=s&&Qi.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||Le.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const es=new st;$i.prototype._cacheAsBitmap=!1,$i.prototype._cacheData=null,$i.prototype._cacheAsBitmapResolution=null,$i.prototype._cacheAsBitmapMultisample=null;class rs{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($i.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 rs),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)}}}),$i.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))},$i.prototype._initCachedDisplayObject=function(t){if(this._cacheData?.sprite)return;const e=this.alpha;this.alpha=1,t.batch.flush();const r=this.getLocalBounds(null,!0).clone();if(this.filters?.length){const t=this.filters[0].padding;r.pad(t)}r.ceil(X.RESOLUTION);const i=t.renderTexture.current,s=t.renderTexture.sourceFrame.clone(),n=t.renderTexture.destinationFrame.clone(),o=t.projection.transform,a=Ue.create({width:r.width,height:r.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:this.cacheAsBitmapMultisample??t.multisample}),h=`cacheAsBitmap_${Zt()}`;this._cacheData.textureCacheId=h,ye.addToCache(a.baseTexture,h),Le.addToCache(a,h);const l=this.transform.localTransform.copyTo(es).invert().translate(-r.x,-r.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:a,clear:!0,transform:l,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=o,t.renderTexture.bind(i,s,n),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 u=new ts(a);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-r.x/r.width,u.anchor.y=-r.y/r.height,u.alpha=e,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)},$i.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))},$i.prototype._initCachedDisplayObjectCanvas=function(t){if(this._cacheData?.sprite)return;const e=this.getLocalBounds(null,!0),r=this.alpha;this.alpha=1;const i=t.canvasContext.activeContext,s=t._projTransform;e.ceil(X.RESOLUTION);const n=Ue.create({width:e.width,height:e.height}),o=`cacheAsBitmap_${Zt()}`;this._cacheData.textureCacheId=o,ye.addToCache(n.baseTexture,o),Le.addToCache(n,o);const a=es;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=e.x,a.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:n,clear:!0,transform:a,skipUpdateTransform:!1}),t.canvasContext.activeContext=i,t._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;const h=new ts(n);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-e.x/e.width,h.anchor.y=-e.y/e.height,h.alpha=r,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)},$i.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},$i.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},$i.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,ye.removeFromCache(this._cacheData.textureCacheId),Le.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},$i.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},$i.prototype.name=null,Zi.prototype.getChildByName=function(t,e){for(let e=0,r=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 r=0,i=e.length;r=0;i--)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this.rootTarget){t.eventPhase=t.BUBBLING_PHASE;const i=r.children;if(i)for(let r=0;r=0;o--){const a=n[o],h=this.hitTestRecursive(a,e||a.interactive,r,i,s);if(h){if(h.length>0&&!h[h.length-1].parent)continue;return(h.length>0||t.interactive)&&h.push(t),h}}}return e&&i(t,r)?t.interactive?[t]:[]:null}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,ls),!t.hitArea.contains(ls.x,ls.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!r.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 r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof os))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 os))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.createPointerEvent(t),r="mouse"===e.pointerType||"pen"===e.pointerType,i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.overTargets);if(i.overTargets&&s!==e.target){const i="mousemove"===t.type?"mouseout":"pointerout",n=this.createPointerEvent(t,i,s);if(this.dispatchEvent(n,"pointerout"),r&&this.dispatchEvent(n,"mouseout"),!e.composedPath().includes(s)){const i=this.createPointerEvent(t,"pointerleave",s);for(i.eventPhase=i.AT_TARGET;i.target&&!e.composedPath().includes(i.target);)i.currentTarget=i.target,this.notifyTarget(i),r&&this.notifyTarget(i,"mouseleave"),i.target=i.target.parent;this.freeEvent(i)}this.freeEvent(n)}if(s!==e.target){const i="mousemove"===t.type?"mouseover":"pointerover",n=this.clonePointerEvent(e,i);this.dispatchEvent(n,"pointerover"),r&&this.dispatchEvent(n,"mouseover");let o=s?.parent;for(;o&&o!==this.rootTarget.parent&&o!==e.target;)o=o.parent;if(!o||o===this.rootTarget.parent){const t=this.clonePointerEvent(e,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==s&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(n)}const n=this.moveOnAll?"all":"dispatchEvent";this[n](e,"pointermove"),"touch"===e.pointerType&&this[n](e,"touchmove"),r&&(this[n](e,"mousemove"),this.cursor=e.target?.cursor),i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof os))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),i="mouse"===r.pointerType||"pen"===r.pointerType;this.dispatchEvent(r,"pointerover"),i&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=r.target?.cursor);const s=this.clonePointerEvent(r,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),i&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(s)}mapPointerOut(t){if(!(t instanceof os))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 r="mouse"===t.pointerType||"pen"===t.pointerType,i=this.findMountedTarget(e.overTargets),s=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(s),r&&this.dispatchEvent(s,"mouseout");const n=this.createPointerEvent(t,"pointerleave",i);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(s),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof os))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),"touch"===r.pointerType)this.dispatchEvent(r,"touchend");else if("mouse"===r.pointerType||"pen"===r.pointerType){const t=2===r.button;this.dispatchEvent(r,t?"rightup":"mouseup")}const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]);let n=s;if(s&&!r.composedPath().includes(s)){let e=s;for(;e&&!r.composedPath().includes(e);){if(r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType)this.notifyTarget(r,"touchendoutside");else if("mouse"===r.pointerType||"pen"===r.pointerType){const t=2===r.button;this.notifyTarget(r,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete i.pressTargetsByButton[t.button],n=e}if(n){const s=this.clonePointerEvent(r,"click");s.target=n,s.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:s.target,timeStamp:e});const o=i.clicksByButton[t.button];o.target===s.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=s.target,o.timeStamp=e,s.detail=o.clickCount,"mouse"===s.pointerType?this.dispatchEvent(s,"click"):"touch"===s.pointerType&&this.dispatchEvent(s,"tap"),this.dispatchEvent(s,"pointertap"),this.freeEvent(s)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof os))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(r){let s=r;for(;s;)i.currentTarget=s,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType?this.notifyTarget(i,"touchendoutside"):"mouse"!==i.pointerType&&"pen"!==i.pointerType||this.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),s=s.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof as))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 r=1;r0&&(e=t.composedPath()[0]);const r=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,e=i.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:r}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-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:r}=t.target,i=this.renderer.events.rootBoundary,s=Object.assign(new ss(i),{target:r});i.rootTarget=this.renderer.lastObjectRendered,e.forEach((t=>i.dispatchEvent(s,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}}fs.extension={name:"accessibility",type:[j.RendererPlugin,j.CanvasRendererPlugin]},z.add(fs);const ms=class{constructor(t){this.stage=new Zi,t=Object.assign({forceCanvas:!1},t),this.renderer=wi(t),ms._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 r=ms._plugins.slice(0);r.reverse(),r.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};let gs=ms;gs._plugins=[],z.handleByList(j.Application,gs._plugins);class _s{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:r,clientHeight:i}=this._resizeTo;t=r,e=i}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}}_s.extension=j.Application,z.add(_s);class ys{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 r=0;r(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t?e(t):t)):t),vs=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 r=xs(t);let i;for(let t=0;t{i[t]=e})));const s=Object.keys(i),n={cacheKeys:s,keys:r};if(r.forEach((t=>{this._cacheMap.set(t,n)})),s.forEach((t=>{this._cache.has(t)&&this._cache.get(t),this._cache.set(t,i[t])})),e instanceof Le){const t=e;r.forEach((e=>{t.baseTexture!==Le.EMPTY.baseTexture&&ye.addToCache(t.baseTexture,e),Le.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}},bs=t=>!Array.isArray(t);class Es{constructor(){this._parsers=[],this.promiseCache={}}reset(){this.promiseCache={}}_getLoadPromiseAndParser(t,e){const r={promise:null,parser:null};return r.promise=(async()=>{let i=null;for(let s=0;s({src:t}))),o=n.length,a=n.map((async t=>{const s=St.toAbsolute(t.src);if(!i[t.src])try{this.promiseCache[s]||(this.promiseCache[s]=this._getLoadPromiseAndParser(s,t)),i[t.src]=await this.promiseCache[s].promise,e&&e(++r/o)}catch(e){throw delete this.promiseCache[s],delete i[t.src],new Error(`[Loader.load] Failed to load ${s}.\n${e}`)}}));return await Promise.all(a),s?i[n[0].src]:i}async unload(t){const e=xs(t,(t=>({src:t}))).map((async t=>{const e=St.toAbsolute(t.src),r=this.promiseCache[e];if(r){const i=await r.promise;r.parser?.unload?.(i,t,this),delete this.promiseCache[e]}}));await Promise.all(e)}get parsers(){return this._parsers}}function Ts(t,e,r,i,s){const n=e[r];for(let o=0;o{const e=t.substring(1,t.length-1).split(",");i.push(e)})),Ts(t,i,0,e,r)}else r.push(t);return r}class ws{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 r=[];Array.isArray(e)?e.forEach((t=>{"string"==typeof t.name?r.push(t.name):r.push(...t.name),this.add(t.name,t.srcs)})):Object.keys(e).forEach((t=>{r.push(t),this.add(t,e[t])})),this._bundles[t]=r}add(t,e,r){const i=xs(t);i.forEach((t=>{this._assetMap[t]})),Array.isArray(e)||(e="string"==typeof e?As(e):[e]);const s=e.map((t=>{let e=t;if("string"==typeof t){let r=!1;for(let i=0;i{this._assetMap[t]=s}))}resolveBundle(t){const e=bs(t);t=xs(t);const r={};return t.forEach((t=>{const e=this._bundles[t];e&&(r[t]=this.resolve(e))})),e?r[t[0]]:r}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const r in e)t[r]=e[r].src;return t}return e.src}resolve(t){const e=bs(t);t=xs(t);const r={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const r=this._getPreferredOrder(e),i=e[0];r?.priority.forEach((t=>{r.params[t].forEach((r=>{const i=e.filter((e=>!!e[t]&&e[t]===r));i.length&&(e=i)}))})),this._resolverHash[t]=e[0]??i}else{let e=t;(this._basePath||this._rootPath)&&(e=St.toAbsolute(e,this._basePath,this._rootPath)),this._resolverHash[t]={src:e}}r[t]=this._resolverHash[t]})),e?r[t[0]]:r}_getPreferredOrder(t){for(let e=0;et.params.format.includes(e.format)));if(r)return r}return this._preferredOrder[0]}}class Ss{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ws,this.loader=new Es,this.cache=vs,this._backgroundLoader=new ys(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,r="number"==typeof e?[e]:e;let i=[];if(t.texturePreference?.format){const e=t.texturePreference?.format;i="string"==typeof e?[e]:e;for(const t of this._detections)await t.test()||(i=await t.remove(i))}else for(const t of this._detections)await t.test()&&(i=await t.add(i));this.resolver.prefer({params:{format:i,resolution:r}})}add(t,e,r){this.resolver.add(t,e,r)}async load(t,e){this._initialized||await this.init();const r=bs(t),i=xs(t).map((t=>"string"!=typeof t?(this.resolver.add(t.src,t),t.src):t)),s=this.resolver.resolve(i),n=await this._mapLoadToResolve(s,e);return r?n[i[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;"string"==typeof t&&(r=!0,t=[t]);const i=this.resolver.resolveBundle(t),s={},n=Object.keys(i);let o=0,a=0;const h=()=>{e?.(++o/a)},l=n.map((t=>{const e=i[t];return a+=Object.keys(e).length,this._mapLoadToResolve(e,h).then((e=>{s[t]=e}))}));return await Promise.all(l),r?s[t[0]]:s}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 vs.get(t);const e={};for(let r=0;r{const r=s[t.src],o=[t.src];t.alias&&o.push(...t.alias),n[i[e]]=r,vs.set(o,r)})),n}async unload(t){this._initialized||await this.init();const e=xs(t).map((t=>"string"!=typeof t?t.src:t)),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=xs(t);const e=this.resolver.resolveBundle(t),r=Object.keys(e).map((t=>this._unloadFromResolved(e[t])));await Promise.all(r)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach((t=>{vs.remove(t.src)})),await this.loader.unload(e)}get detections(){return this._detections}}const Rs=new Ss;z.handleByList(j.LoadParser,Rs.loader.parsers).handleByList(j.ResolveParser,Rs.resolver.parsers).handleByList(j.CacheParser,Rs.cache.parsers).handleByList(j.DetectionParser,Rs.detections);const Is={loader:j.LoadParser,resolver:j.ResolveParser,cache:j.CacheParser,detection:j.DetectionParser};z.handle(j.Asset,(t=>{const e=t.ref;Object.entries(Is).filter((([t])=>!!e[t])).forEach((([t,r])=>z.add(Object.assign(e[t],{extension:e[t].extension??r}))))}),(t=>{const e=t.ref;Object.keys(Is).filter((t=>!!e[t])).forEach((t=>z.remove(e[t])))}));const Cs={extension:j.CacheParser,test:t=>Array.isArray(t)&&t.every((t=>t instanceof Le)),getCacheableAssets:(t,e)=>{const r={};return t.forEach((t=>{e.forEach(((e,i)=>{r[t+(0===i?"":i+1)]=e}))})),r}};z.add(Cs);var Ps=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Ps||{});const Ms={extension:{type:j.LoadParser,priority:Ps.Low},test:t=>St.extname(t).includes(".json"),async load(t){const e=await X.ADAPTER.fetch(t);return await e.json()}};z.add(Ms);const Ds={extension:{type:j.LoadParser,priority:Ps.Low},test:t=>St.extname(t).includes(".txt"),async load(t){const e=await X.ADAPTER.fetch(t);return await e.text()}};z.add(Ds);const Bs=["normal","bold","100","200","300","400","500","600","700","800","900"],Os=["woff","woff2","ttf","otf"];function Ns(t){const e=St.extname(t);return St.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join(" ")}const Fs={extension:{type:j.LoadParser,priority:Ps.Low},test(t){const e=t.split("?")[0].split(".").pop();return Os.includes(e)},async load(t,e){if(!globalThis.navigator.onLine)throw new Error("[loadWebFont] Cannot load font - navigator is offline");const r=X.ADAPTER.getFontFaceSet();if(r){const i=[],s=e.data?.family??Ns(t),n=e.data?.weights?.filter((t=>Bs.includes(t)))??["normal"],o=e.data??{};for(let e=0;eX.ADAPTER.getFontFaceSet().delete(t)))}};z.add(Fs);let Ls,Us=0;const ks="\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 ",Gs="\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 Hs;const Xs=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([ks],{type:"application/javascript"})),r=new Worker(e);r.addEventListener("message",(i=>{r.terminate(),URL.revokeObjectURL(e),t(i.data)}))}))),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===Ls&&(Ls=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers{this.complete(t.data),this.returnWorker(t.target),this.next()}))),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const r=new Promise(((r,i)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:i})}));return this.next(),r}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),r=e.id;this.resolveHash[Us]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Us++,id:r})}};function js(t,e){const r=t.split("?")[0],i=St.extname(r).toLowerCase();return Array.isArray(e)?e.includes(i.toLowerCase()):i.toLowerCase()===e}function Ws(t,e,r){const i=new Le(t);return i.baseTexture.on("dispose",(()=>{delete e.promiseCache[r]})),i}const zs=[".jpg",".png",".jpeg",".avif",".webp"];async function Vs(t){const e=await X.ADAPTER.fetch(t);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${t}: ${e.status} ${e.statusText}`);const r=await e.blob();return await createImageBitmap(r)}const Ys={extension:{type:j.LoadParser,priority:Ps.High},config:{preferWorkers:!0},test(t){let e=!1;for(let r=0;r{i=new Image,i.crossOrigin="anonymous",i.src=t,i.complete?e(i):i.onload=()=>{e(i)}}));const s=new ye(i,{resolution:ce(t),...e.data});return s.resource.src=t,Ws(s,r,t)},unload(t){t.destroy(!0)}};z.add(Ys);const $s={extension:{type:j.LoadParser,priority:Ps.High},test:t=>St.extname(t).includes(".svg"),testParse:async t=>Re.test(t),async parse(t,e,r){const i=new Re(t,e?.data?.resourceOptions),s=new ye(i,{resolution:ce(t),...e?.data});s.resource.src=t;const n=Ws(s,r,t);return e?.data?.resourceOptions?.autoLoad||await i.load(),n},load:async(t,e)=>(await X.ADAPTER.fetch(t)).text(),unload:Ys.unload},qs={extension:j.ResolveParser,test:Ys.test,parse:t=>({resolution:parseFloat(X.RETINA_PREFIX.exec(t)?.[1]??"1"),format:t.split(".").pop(),src:t})};z.add(qs);const Ks={extension:{type:j.DetectionParser,priority:1},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await X.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))};z.add(Ks);const Zs={extension:{type:j.DetectionParser,priority:0},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await X.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))};z.add(Zs);const Qs=["png","jpg","jpeg"],Js={extension:{type:j.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...Qs],remove:async t=>t.filter((t=>!Qs.includes(t)))};z.add(Js);var tn=(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))(tn||{});const en={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 rn extends me{constructor(t,e={width:1,height:1,autoLoad:!0}){let r,i;"string"==typeof t?(r=t,i=new Uint8Array):(r=null,i=t),super(i,e),this.origin=r,this.buffer=i?new Di(i):null,this.origin&&!1!==e.autoLoad&&this.load(),i?.length&&(this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}async load(){const t=await fetch(this.origin),e=await t.blob(),r=await e.arrayBuffer();return this.data=new Uint32Array(r),this.buffer=new Di(r),this.loaded=!0,this.onBlobLoaded(r),this.update(),this}}class sn extends rn{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=sn._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||sn._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,r){const i=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;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,r,i,s,n,o){const a=new Array(r);let h=t.byteOffset,l=n,u=o,c=l+i-1&~(i-1),d=u+s-1&~(s-1),p=c*d*en[e];for(let n=0;n1?l:c,levelHeight:r>1?u:d,levelBuffer:new Uint8Array(t.buffer,h,p)},h+=p,l=l>>1||1,u=u>>1||1,c=l+i-1&~(i-1),d=u+s-1&~(s-1),p=c*d*en[e];return a}}let nn,on;function an(){on={s3tc:nn.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:nn.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:nn.getExtension("WEBGL_compressed_texture_etc"),etc1:nn.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:nn.getExtension("WEBGL_compressed_texture_pvrtc")||nn.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:nn.getExtension("WEBGL_compressed_texture_atc"),astc:nn.getExtension("WEBGL_compressed_texture_astc")}}const hn={extension:{type:j.DetectionParser,priority:2},test:async()=>{const t=X.ADAPTER.createCanvas().getContext("webgl");return!!t&&(nn=t,!0)},add:async t=>{on||an();const e=[];for(const t in on)on[t]&&e.push(t);return[...e,...t]},remove:async t=>(on||an(),t.filter((t=>!(t in on))))};z.add(hn);const ln=4,un=124,cn=32,dn=20,pn=542327876,fn={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},mn={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},gn={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},_n=1,yn=2,xn=4,vn=64,bn=512,En=131072,Tn=808540228,An=4,wn={827611204:tn.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:tn.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:tn.COMPRESSED_RGBA_S3TC_DXT5_EXT},Sn={70:tn.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:tn.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:tn.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:tn.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:tn.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:tn.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:tn.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:tn.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:tn.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Rn(t){const e=new Uint32Array(t);if(e[0]!==pn)throw new Error("Invalid DDS file magic word");const r=new Uint32Array(t,0,un/Uint32Array.BYTES_PER_ELEMENT),i=r[fn.HEIGHT],s=r[fn.WIDTH],n=r[fn.MIPMAP_COUNT],o=new Uint32Array(t,fn.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,cn/Uint32Array.BYTES_PER_ELEMENT),a=o[_n];if(a&xn){const r=o[mn.FOURCC];if(r!==Tn){const e=wn[r],o=new Uint8Array(t,ln+un);return[new sn(o,{format:e,width:s,height:i,levels:n})]}const a=ln+un,h=new Uint32Array(e.buffer,a,dn/Uint32Array.BYTES_PER_ELEMENT),l=h[gn.DXGI_FORMAT],u=h[gn.RESOURCE_DIMENSION],c=h[gn.MISC_FLAG],d=h[gn.ARRAY_SIZE],p=Sn[l];if(void 0===p)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(c===An)throw new Error("DDSParser does not support cubemap textures");if(6===u)throw new Error("DDSParser does not supported 3D texture data");const f=new Array,m=ln+un+dn;if(1===d)f.push(new Uint8Array(t,m));else{const e=en[p];let r=0,o=s,a=i;for(let t=0;t>>=1,a>>>=1;let h=m;for(let e=0;enew sn(t,{format:p,width:s,height:i,levels:n})))}if(a&vn)throw new Error("DDSParser does not support uncompressed texture data.");if(a&bn)throw new Error("DDSParser does not supported YUV uncompressed texture data.");if(a&En)throw new Error("DDSParser does not support single-channel (lumninance) texture data!");if(a&yn)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!")}const In=[171,75,84,88,32,49,49,187,13,10,26,10],Cn=67305985,Pn={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},Mn=64,Dn={[c.UNSIGNED_BYTE]:1,[c.UNSIGNED_SHORT]:2,[c.INT]:4,[c.UNSIGNED_INT]:4,[c.FLOAT]:4,[c.HALF_FLOAT]:8},Bn={[l.RGBA]:4,[l.RGB]:3,[l.RG]:2,[l.RED]:1,[l.LUMINANCE]:1,[l.LUMINANCE_ALPHA]:2,[l.ALPHA]:1},On={[c.UNSIGNED_SHORT_4_4_4_4]:2,[c.UNSIGNED_SHORT_5_5_5_1]:2,[c.UNSIGNED_SHORT_5_6_5]:2};function Nn(t,e,r=!1){const i=new DataView(e);if(!function(t,e){for(let t=0;te-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h1||0!==n?T:w,levelHeight:f>1||0!==n?A:S,levelBuffer:new Uint8Array(e,o,E)},o+=E}R+=r+4,R=R%4!=0?R+4-R%4:R,T=T>>1||1,A=A>>1||1,w=T+4-1&-4,S=A+4-1&-4,E=w*S*x}return 0!==n?{uncompressed:y.map((t=>{let e=t[0].levelBuffer,r=!1;return n===c.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):n===c.UNSIGNED_INT?(r=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):n===c.INT&&(r=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new me(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:n,format:r?Fn(o):o}})),kvData:b}:{compressed:y.map((t=>new sn(null,{format:a,width:h,height:l,levels:f,levelBuffers:t}))),kvData:b}}function Fn(t){switch(t){case l.RGBA:return l.RGBA_INTEGER;case l.RGB:return l.RGB_INTEGER;case l.RG:return l.RG_INTEGER;case l.RED:return l.RED_INTEGER;default:return t}}const Ln={extension:{type:j.LoadParser,priority:Ps.High},test:t=>js(t,".dds"),async load(t,e,r){const i=await X.ADAPTER.fetch(t),s=Rn(await i.arrayBuffer()).map((i=>Ws(new ye(i,{mipmap:m.OFF,alphaMode:g.NO_PREMULTIPLIED_ALPHA,resolution:ce(t),...e.data}),r,t)));return 1===s.length?s[0]:s},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};z.add(Ln);const Un={extension:{type:j.LoadParser,priority:Ps.High},test:t=>js(t,".ktx"),async load(t,e,r){const i=await X.ADAPTER.fetch(t),s=await i.arrayBuffer(),{compressed:n,uncompressed:o,kvData:a}=Nn(0,s),h=n??o,l={mipmap:m.OFF,alphaMode:g.NO_PREMULTIPLIED_ALPHA,resolution:ce(t),...e.data},u=h.map((e=>{h===o&&Object.assign(l,{type:e.type,format:e.format});const i=new ye(e,l);return i.ktxKeyValueData=a,Ws(i,r,t)}));return 1===u.length?u[0]:u},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};z.add(Un);const kn={extension:j.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(X.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e.find((e=>t.endsWith(e))),src:t}}return{resolution:parseFloat(X.RETINA_PREFIX.exec(t)?.[1]??"1"),format:t.split(".").pop(),src:t}}};z.add(kn);const Gn=new Q,Hn=class{constructor(t){this.renderer=t}async image(t,e,r){const i=new Image;return i.src=await this.base64(t,e,r),i}async base64(t,e,r){const i=this.canvas(t);if(void 0!==i.toDataURL)return i.toDataURL(e,r);if(void 0!==i.convertToBlob){const t=await i.convertToBlob({type:e,quality:r});return await new Promise((e=>{const r=new FileReader;r.onload=()=>e(r.result),r.readAsDataURL(t)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL or ICanvas.convertToBlob to be implemented")}canvas(t,e){const r=this.renderer;let i,s,n=!1,o=!1;t&&(t instanceof Ue?s=t:(s=this.renderer.generateTexture(t),o=!0)),s?(i=s.baseTexture.resolution,e=e??s.frame,n=!1,r.renderTexture.bind(s)):(i=r.resolution,e||((e=Gn).width=r.width,e.height=r.height),n=!0,r.renderTexture.bind(null));const a=Math.round(e.width*i),h=Math.round(e.height*i);let l=new ne(a,h,1);const u=new Uint8Array(4*a*h),c=r.gl;c.readPixels(Math.round(e.x*i),Math.round(e.y*i),a,h,c.RGBA,c.UNSIGNED_BYTE,u);const d=l.context.getImageData(0,0,a,h);if(Hn.arrayPostDivide(u,d.data),l.context.putImageData(d,0,0),n){const t=new ne(l.width,l.height,1);t.context.scale(1,-1),t.context.drawImage(l.canvas,0,-h),l.destroy(),l=t}return o&&s.destroy(!0),l.canvas}pixels(t,e){const r=this.renderer;let i,s,n=!1;t&&(t instanceof Ue?s=t:(s=this.renderer.generateTexture(t),n=!0)),s?(i=s.baseTexture.resolution,e=e??s.frame,r.renderTexture.bind(s)):(i=r.resolution,e||((e=Gn).width=r.width,e.height=r.height),r.renderTexture.bind(null));const o=Math.round(e.width*i),a=Math.round(e.height*i),h=new Uint8Array(4*o*a),l=r.gl;return l.readPixels(Math.round(e.x*i),Math.round(e.y*i),o,a,l.RGBA,l.UNSIGNED_BYTE,h),n&&s.destroy(!0),Hn.arrayPostDivide(h,h),h}destroy(){this.renderer=null}static arrayPostDivide(t,e){for(let r=0;r(t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t))(jn||{}),Wn=(t=>(t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t))(Wn||{});const zn={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let r=Math.ceil(t/this.maxLength);return rthis.maxSegments&&(r=this.maxSegments),r}};class Vn{constructor(){this.color=16777215,this.alpha=1,this.texture=Le.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Vn;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=Le.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}function Yn(t,e=!1){const r=t.length;if(r<6)return;let i=0;for(let e=0,s=t[r-2],n=t[r-1];e0||e&&i<=0){const e=r/2;for(let i=e+e%2;i=6){Yn(r,!1);const t=[];for(let e=0;e=0&&a>=0&&s>=0&&n>=0))return void(e.length=0);const h=Math.ceil(2.3*Math.sqrt(o+a)),l=8*h+(s?4:0)+(n?4:0);if(e.length=l,0===l)return;if(0===h)return e.length=8,e[0]=e[6]=r+s,e[1]=e[3]=i+n,e[2]=e[4]=r-s,void(e[5]=e[7]=i-n);let u=0,c=4*h+(s?2:0)+2,d=c,p=l;{const t=s+o,a=n,h=r+t,l=r-t,f=i+a;if(e[u++]=h,e[u++]=f,e[--c]=f,e[--c]=l,n){const t=i-a;e[d++]=l,e[d++]=t,e[--p]=t,e[--p]=h}}for(let t=1;t=0&&n>=0&&o.push(r,i,r+s,i,r+s,i+n,r,i+n)},triangulate(t,e){const r=t.points,i=e.points;if(0===r.length)return;const s=i.length/2;i.push(r[0],r[1],r[2],r[3],r[6],r[7],r[4],r[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},Zn={build(t){qn.build(t)},triangulate(t,e){qn.triangulate(t,e)}};function Qn(t,e,r,i,s,n,o,a){let h,l;o?(h=i,l=-r):(h=-i,l=r);const u=t-r*s+h,c=e-i*s+l,d=t+r*n+h,p=e+i*n+l;return a.push(u,c),a.push(d,p),2}function Jn(t,e,r,i,s,n,o,a){const h=r-t,l=i-e;let u=Math.atan2(h,l),c=Math.atan2(s-t,n-e);a&&uc&&(c+=2*Math.PI);let d=u;const p=c-u,f=Math.abs(p),m=Math.sqrt(h*h+l*l),g=1+(15*f*Math.sqrt(m)/Math.PI>>0),_=p/g;if(d+=_,a){o.push(t,e),o.push(r,i);for(let r=1,i=d;r=0&&(n.join===jn.ROUND?d+=Jn(x,v,x-T*C,v-A*C,x-w*C,v-S*C,u,!1)+4:d+=2,u.push(x-w*P,v-S*P),u.push(x+w*C,v+S*C));continue}const c=(-T+_)*(-A+v)-(-T+x)*(-A+y),p=(-w+b)*(-S+v)-(-w+x)*(-S+E),I=(e*p-s*c)/h,M=(o*c-r*p)/h,D=(I-x)*(I-x)+(M-v)*(M-v),B=x+(I-x)*C,O=v+(M-v)*C,N=x-(I-x)*P,F=v-(M-v)*P,L=l?C:P;D<=Math.min(e*e+r*r,s*s+o*o)+L*L*m?n.join===jn.BEVEL||D/m>g?(l?(u.push(B,O),u.push(x+T*P,v+A*P),u.push(B,O),u.push(x+w*P,v+S*P)):(u.push(x-T*C,v-A*C),u.push(N,F),u.push(x-w*C,v-S*C),u.push(N,F)),d+=2):n.join===jn.ROUND?l?(u.push(B,O),u.push(x+T*P,v+A*P),d+=Jn(x,v,x+T*P,v+A*P,x+w*P,v+S*P,u,!0)+4,u.push(B,O),u.push(x+w*P,v+S*P)):(u.push(x-T*C,v-A*C),u.push(N,F),d+=Jn(x,v,x-T*C,v-A*C,x-w*C,v-S*C,u,!1)+4,u.push(x-w*C,v-S*C),u.push(N,F)):(u.push(B,O),u.push(N,F)):(u.push(x-T*C,v-A*C),u.push(x+T*P,v+A*P),n.join===jn.ROUND?d+=l?Jn(x,v,x+T*P,v+A*P,x+w*P,v+S*P,u,!0)+2:Jn(x,v,x-T*C,v-A*C,x-w*C,v-S*C,u,!1)+2:n.join===jn.MITER&&D/m<=g&&(l?(u.push(N,F),u.push(N,F)):(u.push(B,O),u.push(B,O)),d+=2),u.push(x-w*C,v-S*C),u.push(x+w*P,v+S*P),d+=2)}_=i[2*(c-2)],y=i[2*(c-2)+1],x=i[2*(c-1)],v=i[2*(c-1)+1],T=-(y-v),A=_-x,R=Math.sqrt(T*T+A*A),T/=R,A/=R,T*=f,A*=f,u.push(x-T*C,v-A*C),u.push(x+T*P,v+A*P),h||(n.cap===Wn.ROUND?d+=Jn(x-T*(C-P)*.5,v-A*(C-P)*.5,x-T*C,v-A*C,x+T*P,v+A*P,u,!1)+2:n.cap===Wn.SQUARE&&(d+=Qn(x,v,T,A,C,P,!1,u)));const M=e.indices,D=zn.epsilon*zn.epsilon;for(let t=p;tu*a}}static arc(t,e,r,i,s,n,o,a,h){const l=o-n,u=zn._segmentsCount(Math.abs(l)*s,40*Math.ceil(Math.abs(l)/V)),c=l/(2*u),d=2*c,p=Math.cos(c),f=Math.sin(c),m=u-1,g=m%1/m;for(let t=0;t<=m;++t){const e=c+n+d*(t+g*t),o=Math.cos(e),a=-Math.sin(e);h.push((p*o+f*a)*s+r,(p*-a+f*o)*s+i)}}}class ro{static curveLength(t,e,r,i,s,n,o,a){let h=0,l=0,u=0,c=0,d=0,p=0,f=0,m=0,g=0,_=0,y=0,x=t,v=e;for(let b=1;b<=10;++b)l=b/10,u=l*l,c=u*l,d=1-l,p=d*d,f=p*d,m=f*t+3*p*l*r+3*d*u*s+c*o,g=f*e+3*p*l*i+3*d*u*n+c*a,_=x-m,y=v-g,x=m,v=g,h+=Math.sqrt(_*_+y*y);return h}static curveTo(t,e,r,i,s,n,o){const a=o[o.length-2],h=o[o.length-1];o.length-=2;const l=zn._segmentsCount(ro.curveLength(a,h,t,e,r,i,s,n));let u=0,c=0,d=0,p=0,f=0;o.push(a,h);for(let m=1,g=0;m<=l;++m)g=m/l,u=1-g,c=u*u,d=c*u,p=g*g,f=p*g,o.push(d*a+3*c*g*t+3*u*p*r+f*s,d*h+3*c*g*e+3*u*p*i+f*n)}}class io{static curveLength(t,e,r,i,s,n){const o=t-2*r+s,a=e-2*i+n,h=2*r-2*t,l=2*i-2*e,u=4*(o*o+a*a),c=4*(o*h+a*l),d=h*h+l*l,p=2*Math.sqrt(u+c+d),f=Math.sqrt(u),m=2*u*f,g=2*Math.sqrt(d),_=c/f;return(m*p+f*c*(p-g)+(4*d*u-c*c)*Math.log((2*f+_+p)/(_+g)))/(4*m)}static curveTo(t,e,r,i,s){const n=s[s.length-2],o=s[s.length-1],a=zn._segmentsCount(io.curveLength(n,o,t,e,r,i));let h=0,l=0;for(let u=1;u<=a;++u){const c=u/a;h=n+(t-n)*c,l=o+(e-o)*c,s.push(h+(t+(r-t)*c-h)*c,l+(e+(i-e)*c-l)*c)}}}const so={[q.POLY]:$n,[q.CIRC]:qn,[q.ELIP]:qn,[q.RECT]:Kn,[q.RREC]:Zn},no=[],oo=[];class ao{constructor(t,e=null,r=null,i=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=i,this.type=t.type}clone(){return new ao(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}}class ho{constructor(){this.reset()}begin(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r}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 lo=new K,uo=class extends Oi{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 Yi,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,r=null,i=null){const s=new ao(t,e,r,i);return this.graphicsData.push(s),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const r=new ao(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=i.lineStyle,i.holes.push(r),this.dirty++,this}destroy(){super.destroy();for(let t=0;t0&&(r=this.batches[this.batches.length-1],i=r.style);for(let s=this.shapeIndex;s65535;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&&(i=oo.pop(),i||(i=new Pi,i.texArray=new Mi),this.drawCalls.push(i)),i.start=u,i.size=0,i.texArray.count=0,i.type=l),g.touched=1,g._batchEnabled=t,g._batchLocation=s,g.wrapMode=f.REPEAT,i.texArray.elements[i.texArray.count++]=g,s++)),i.size+=d.size,u+=d.size,o=g._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(r,o,d.attribSize,d.attribStart)}ye._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,r=this.colors,i=this.textureIds,s=new ArrayBuffer(3*t.length*4),n=new Float32Array(s),o=new Uint32Array(s);let a=0;for(let s=0;s>16)+(65280&e)+((255&e)<<16),r);t.length=Math.max(t.length,s+i);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 et,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new et,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 r=this.currentPath.points,i=r[r.length-2],s=r[r.length-1];return i===t&&s===e||r.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,r,i){this._initCurve();const s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),io.curveTo(t,e,r,i,s),this}bezierCurveTo(t,e,r,i,s,n){return this._initCurve(),ro.curveTo(t,e,r,i,s,n,this.currentPath.points),this}arcTo(t,e,r,i,s){this._initCurve(t,e);const n=this.currentPath.points,o=eo.curveTo(t,e,r,i,s,n);if(o){const{cx:t,cy:e,radius:r,startAngle:i,endAngle:s,anticlockwise:n}=o;this.arc(t,e,r,i,s,n)}return this}arc(t,e,r,i,s,n=!1){if(i===s)return this;if(!n&&s<=i?s+=V:n&&i<=s&&(i+=V),0==s-i)return this;const o=t+Math.cos(i)*r,a=e+Math.sin(i)*r,h=this._geometry.closePointEps;let l=this.currentPath?this.currentPath.points:null;if(l){const t=Math.abs(l[l.length-2]-o),e=Math.abs(l[l.length-1]-a);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,r,i){return this.drawShape(new Q(t,e,r,i))}drawRoundedRect(t,e,r,i,s){return this.drawShape(new rt(t,e,r,i,s))}drawCircle(t,e,r){return this.drawShape(new J(t,e,r))}drawEllipse(t,e,r,i){return this.drawShape(new tt(t,e,r,i))}drawPolygon(...t){let e,r=!0;const i=t[0];i.points?(r=i.closeStroke,e=i.points):e=Array.isArray(t[0])?t[0]:t;const s=new et(e);return s.closeStroke=r,this.drawShape(s),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!==q.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,r=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=r,this.vertexData=new Float32Array(t.points);for(let i=0;i>16&255)/255*s,n.tint[1]=(i>>8&255)/255*s,n.tint[2]=(255&i)/255*s,n.tint[3]=s,t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(let e=0,i=o.length;e>16)+(65280&s)+((255&s)<<16)}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,r=e.a,i=e.b,s=e.c,n=e.d,o=e.tx,a=e.ty,h=this._geometry.points,l=this.vertexData;let u=0;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;Gt(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class wo extends Ye{constructor(t,e,r){super();const i=new Xe(t),s=new Xe(e,!0),n=new Xe(r,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,c.FLOAT).addAttribute("aTextureCoord",s,2,!1,c.FLOAT).addIndex(n),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}class So extends wo{constructor(t=100,e=100,r=10,i=10){super(),this.segWidth=r,this.segHeight=i,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],r=[],i=[],s=this.segWidth-1,n=this.segHeight-1,o=this.width/s,a=this.height/n;for(let i=0;i0){const r=a.x-t[e].x,i=a.y-t[e].y,s=Math.sqrt(r*r+i*i);a=t[e],o+=s/h}else o=e/(l-1);s[r]=o,s[r+1]=0,s[r+2]=o,s[r+3]=1}let u=0;for(let t=0;t1&&(u=1);const c=Math.sqrt(i*i+s*s),d=this.textureScale>0?this.textureScale*this._width/2:this._width/2;i/=c,s/=c,i*=d,s*=d,n[l]=h.x+i,n[l+1]=h.y+s,n[l+2]=h.x-i,n[l+3]=h.y-s,r=h}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class Io extends To{constructor(t,e,r=0){const i=new Ro(t.height,e,r),s=new Ao(t);r>0&&(t.baseTexture.wrapMode=f.REPEAT),super(i,s),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class Co extends To{constructor(t,e,r){super(new So(t.width,t.height,e,r),new Ao(Le.WHITE)),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:r}=this.shader.texture;!this.autoResize||t.width===e&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}class Po extends To{constructor(t=Le.EMPTY,e,r,i,s){const n=new wo(e,r,i);n.getBuffer("aVertexPosition").static=!1,super(n,new Ao(t),null,s),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class Mo extends Co{constructor(t,e=10,r=10,i=10,s=10){super(Le.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=e,this._rightWidth=i,this._topHeight=r,this._bottomHeight=s,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,r=this._topHeight+this._bottomHeight,i=this._height>r?1:this._height/r;return Math.min(e,i)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const r=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class Do extends Zi{constructor(t=1500,e,r=16384,i=!1){super(),r>16384&&(r=16384),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=r,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=a.NORMAL,this.autoResize=i,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tint=0,this.tintRgb=new Float32Array(4),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tint}set tint(t){this._tint=t,Dt(t,this.tintRgb)}render(t){this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(()=>this.onChildrenChange(0)))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.lengthr&&!t.autoResize&&(n=r);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const a=e[0]._texture.baseTexture,h=a.alphaMode>0;this.state.blendMode=Lt(t.blendMode,h),s.state.set(this.state);const l=s.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(s.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=Ut(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,h),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);let c=!1;for(let r=0,a=0;ri&&(h=i),a>=o.length&&o.push(this._generateOneMoreBuffer(t));const u=o[a];u.uploadDynamic(e,r,h);const d=t._bufferUpdateIDs[a]||0;c=c||u._updateID0,h=r.alpha,l=h<1&&a?kt(r._tintRGB,h):r._tintRGB+(255*h<<24);i[n]=l,i[n+s]=l,i[n+2*s]=l,i[n+3*s]=l,n+=4*s}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Oo.extension={name:"particle",type:j.RendererPlugin},z.add(Oo),X.UPLOADS_PER_FRAME=4;var No=(t=>(t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",t))(No||{});const Fo={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:No.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},Lo=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];class Uo{constructor(t){this.styleID=0,this.reset(),Ho(this,t,t)}clone(){const t={};return Ho(t,this,Fo),new Uo(t)}reset(){Ho(this,Fo,Fo)}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=Go(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=Go(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 r=0;r=0;t--){let r=e[t].trim();/([\"\'])[^\'\"]+\1/.test(r)||Lo.includes(r)||(r=`"${r}"`),e[t]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}}function ko(t){return"number"==typeof t?Bt(t):("string"==typeof t&&t.startsWith("0x")&&(t=t.replace("0x","#")),t)}function Go(t){if(Array.isArray(t)){for(let e=0;ep)if(""!==n&&(o+=jo.addLine(n),n="",s=0),jo.canBreakWords(r,e.breakWords)){const t=jo.wordWrapSplit(r);for(let l=0;lp&&(o+=jo.addLine(n),d=!1,n="",s=0),n+=u,s+=f}}else{n.length>0&&(o+=jo.addLine(n),n="",s=0);const e=t===f.length-1;o+=jo.addLine(r,!e),d=!1,n="",s=0}else l+s>p&&(d=!1,o+=jo.addLine(n),n="",s=0),(n.length>0||!jo.isBreakingSpace(r)||d)&&(n+=r,s+=l)}return o+=jo.addLine(n,!1),o}static addLine(t,e=!0){return t=jo.trimRight(t),e?`${t}\n`:t}static getFromCache(t,e,r,i){let s=r[t];if("number"!=typeof s){const n=t.length*e;s=i.measureText(t).width+n,r[t]=s}return s}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 r=t[e];if(!jo.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static isNewline(t){return"string"==typeof t&&jo._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return"string"==typeof t&&jo._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let r="";if("string"!=typeof t)return e;for(let i=0;io;--c){for(let t=0;t0&&n>o&&(a=(o+n)/2);const c=o+i,d=r.lineHeight*(t+1);let p=c;t+10}}function $o(t,e){let r=!1;if(t?._textures?.length)for(let i=0;i{this.queue&&this.prepareItems()},this.registerFindHook(Jo),this.registerFindHook(ta),this.registerFindHook($o),this.registerFindHook(qo),this.registerFindHook(Ko),this.registerUploadHook(Zo),this.registerUploadHook(Qo)}upload(t){return new Promise((e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,yt.system.addOnce(this.tick,this,gt.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 r=0,i=this.uploadHooks.length;r=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&yt.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 ra(t,e){return e instanceof ye&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function ia(t,e){if(!(e instanceof _o))return!1;const{geometry:r}=e;e.finishPoly(),r.updateBatches();const{batches:i}=r;for(let e=0;e{this._callback=t,this._batchIndex=0,this._frameKeys.length<=aa.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}_processFrames(t){let e=t;const r=aa.BATCH_SIZE;for(;e-t{this._batchIndex*aa.BATCH_SIZE{i[t]=e})),Object.keys(e.textures).forEach((t=>{i[t]=e.textures[t]})),!r){const r=St.dirname(t[0]);e.linkedSheets.forEach(((t,s)=>{const n=ua([`${r}/${e.data.meta.related_multi_packs[s]}`],t,!0);Object.assign(i,n)}))}return i}const ca={extension:j.Asset,cache:{test:t=>t instanceof ha,getCacheableAssets:(t,e)=>ua(t,e,!1)},resolver:{test:t=>{const e=t.split("?")[0].split("."),r=e.pop(),i=e.pop();return"json"===r&&la.includes(i)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(X.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{extension:{type:j.LoadParser,priority:Ps.Normal},testParse:async(t,e)=>St.extname(e.src).includes(".json")&&!!t.frames,async parse(t,e,r){let i=St.dirname(e.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const s=i+t.meta.image,n=(await r.load([s]))[s],o=new ha(n.baseTexture,t,e.src);await o.parse();const a=t?.meta?.related_multi_packs;if(Array.isArray(a)){const t=[];for(const s of a){if("string"!=typeof s)continue;const n=i+s;e.data?.ignoreMultiPack||t.push(r.load({src:n,data:{ignoreMultiPack:!0}}))}const s=await Promise.all(t);o.linkedSheets=s,s.forEach((t=>{t.linkedSheets=[o].concat(o.linkedSheets.filter((e=>e!==t)))}))}return o},unload(t){t.destroy(!0)}}};z.add(ca);class da extends ts{constructor(t,e=!0){super(t[0]instanceof Le?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&&(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(yt.shared.add(this.update,this,gt.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,r=this.currentFrame;if(null!==this._durations){let r=this._currentTime%1*this._durations[this.currentFrame];for(r+=e/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];const i=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFramer)&&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 r=0;rthis.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?(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(yt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const pa=new K;class fa extends ts{constructor(t,e=100,r=100){super(t),this.tileTransform=new ft,this._width=e,this._height=r,this.uvMatrix=this.texture.uvMatrix||new Nr(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,r=this._width*(1-this._anchor._x),i=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,r,i)}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 Q),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,pa);const e=this._width,r=this._height,i=-e*this.anchor._x;if(pa.x>=i&&pa.x=t&&pa.y1?Mr.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):Mr.from(ma,"#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,r=this.quad;let i=r.vertices;i[0]=i[6]=t._width*-t.anchor.x,i[1]=i[3]=t._height*-t.anchor.y,i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);const s=t.uvRespectAnchor?t.anchor.x:0,n=t.uvRespectAnchor?t.anchor.y:0;i=r.uvs,i[0]=i[6]=-s,i[1]=i[3]=-n,i[2]=i[4]=1-s,i[5]=i[7]=1-n,r.invalidate();const o=t._texture,a=o.baseTexture,h=a.alphaMode>0,l=t.tileTransform.localTransform,u=t.uvMatrix;let c=a.isPowerOfTwo&&o.frame.width===a.width&&o.frame.height===a.height;c&&(a._glTextures[e.CONTEXT_UID]?c=a.wrapMode!==f.CLAMP:a.wrapMode===f.CLAMP&&(a.wrapMode=f.REPEAT));const d=c?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,_=t._height;ga.set(l.a*p/g,l.b*p/_,l.c*m/g,l.d*m/_,l.tx/g,l.ty/_),ga.invert(),c?ga.prepend(u.mapCoord):(d.uniforms.uMapCoord=u.mapCoord.toArray(!0),d.uniforms.uClampFrame=u.uClampFrame,d.uniforms.uClampOffset=u.uClampOffset),d.uniforms.uTransform=ga.toArray(!0),d.uniforms.uColor=Gt(t.tint,t.worldAlpha,d.uniforms.uColor,h),d.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),d.uniforms.uSampler=o,e.shader.bind(d),e.geometry.bind(r),this.state.blendMode=Lt(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}_a.extension={name:"tilingSprite",type:j.RendererPlugin},z.add(_a);class ya{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class xa{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const t in e){const i=e[t].match(/^[a-z]+/gm)[0],s=e[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),n={};for(const t in s){const e=s[t].split("="),r=e[0],i=e[1].replace(/"/gm,""),o=parseFloat(i),a=isNaN(o)?i:o;n[r]=a}r[i].push(n)}const i=new ya;return r.info.forEach((t=>i.info.push({face:t.face,size:parseInt(t.size,10)}))),r.common.forEach((t=>i.common.push({lineHeight:parseInt(t.lineHeight,10)}))),r.page.forEach((t=>i.page.push({id:parseInt(t.id,10),file:t.file}))),r.char.forEach((t=>i.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)}))),r.kerning.forEach((t=>i.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)}))),r.distanceField.forEach((t=>i.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType}))),i}}class va{static test(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){const e=new ya,r=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),s=t.getElementsByTagName("page"),n=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),a=t.getElementsByTagName("distanceField");for(let t=0;t")){const e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return va.test(e)}return!1}static parse(t){const e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return va.parse(e)}}const Ea=[xa,va,ba];function Ta(t){for(let e=0;e=a-b*n){if(0===_)throw new Error(`[BitmapFont] textureHeight ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${e}')`);--t,p=null,f=null,m=null,_=0,g=0,y=0;continue}if(y=Math.max(b+r.fontProperties.descent,y),E*n+g>=c){if(0===g)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${e}')`);--t,_+=y*n,_=Math.ceil(_),g=0,y=0;continue}Aa(p,f,r,g,_,n,u);const T=Sa(r.text);d.char.push({id:T,page:v.length-1,x:g/n,y:_/n,width:E,height:b,xoffset:0,yoffset:0,xadvance:Math.ceil(i-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0))}),g+=(E+2*s)*n,g=Math.ceil(g)}for(let t=0,e=l.length;t{this.dirty=!0}),this,0,0),this._roundPixels=X.ROUND_PIXELS,this.dirty=!0,this._resolution=X.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const t=Ia.available[this._fontName],e=this.fontSize,r=e/t.size,i=new K,s=[],n=[],o=[],h=wa(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),l=this._maxWidth*t.size/e,u="none"===t.distanceFieldType?Ca:Pa;let c=null,d=0,p=0,f=0,m=-1,g=0,_=0,y=0,x=0;for(let e=0;e0&&i.x>l&&(++_,$t(s,1+m-_,1+e-m),e=m,m=-1,n.push(g),o.push(s.length>0?s[s.length-1].prevSpaces:0),p=Math.max(p,g),f++,i.x=0,i.y+=t.lineHeight,c=null,x=0)}const v=h[h.length-1];"\r"!==v&&"\n"!==v&&(/(?:\s)/.test(v)&&(d=g),n.push(d),p=Math.max(p,d),o.push(-1));const b=[];for(let t=0;t<=f;t++){let e=0;"right"===this._align?e=p-n[t]:"center"===this._align?e=(p-n[t])/2:"justify"===this._align&&(e=o[t]<0?0:(p-n[t])/o[t]),b.push(e)}const E=s.length,T={},A=[],w=this._activePagesMeshData;u.push(...w);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}}),s=a.NORMAL_NPM);const n=new To(r,i);n.blendMode=s,e={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:n,vertices:null,uvs:null,indices:null}}e.index=0,e.indexCount=0,e.vertexCount=0,e.uvsCount=0,e.total=0;const{_textureCache:s}=this;s[i]=s[i]||new Le(r.baseTexture),e.mesh.texture=s[i],e.mesh.tint=this._tint,A.push(e),T[i]=e}T[i].total++}for(let t=0;t6*r)||e.vertices.length<2*To.BATCHABLE_SIZE)e.vertices=new Float32Array(8*r),e.uvs=new Float32Array(8*r),e.indices=new Uint16Array(6*r);else{const t=e.total,r=e.vertices;for(let e=4*t*2;ee[t.mesh.texture.baseTexture.uid])).forEach((t=>{t.mesh.texture=Le.EMPTY}));for(const t in e)e[t].destroy(),delete e[t];this._font=null,this._textureCache=null,super.destroy(t)}};let Ba=Da;Ba.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const Oa=[".xml",".fnt"],Na={extension:{type:j.LoadParser,priority:Ps.Normal},test:t=>Oa.includes(St.extname(t)),testParse:async t=>xa.test(t)||ba.test(t),async parse(t,e,r){const i=xa.test(t)?xa.parse(t):ba.parse(t),{src:s}=e,{page:n}=i,o=[];for(let t=0;ta[t]));return Ia.install(i,h,!0)},load:async(t,e)=>(await X.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};z.add(Na);const Fa={AlphaFilter:class extends Br{constructor(t=1){super(Si,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}},BlurFilter:class extends Br{constructor(t=8,e=4,r=X.FILTER_RESOLUTION,i=5){super(),this.blurXFilter=new zi(!0,t,e,r,i),this.blurYFilter=new zi(!1,t,e,r,i),this.resolution=r,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,r,i){const s=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(s&&n){const s=t.getFilterTexture();this.blurXFilter.apply(t,e,s,_.CLEAR),this.blurYFilter.apply(t,s,r,i),t.returnFilterTexture(s)}else n?this.blurYFilter.apply(t,e,r,i):this.blurXFilter.apply(t,e,r,i)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}},BlurFilterPass:zi,ColorMatrixFilter:Vi,DisplacementFilter:class extends Br{constructor(t,e){const r=new st;t.renderable=!1,super("attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\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\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:t._texture,filterMatrix:r,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=r,null==e&&(e=20),this.scale=new K(e,e)}apply(t,e,r,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const s=this.maskSprite.worldTransform,n=Math.sqrt(s.a*s.a+s.b*s.b),o=Math.sqrt(s.c*s.c+s.d*s.d);0!==n&&0!==o&&(this.uniforms.rotation[0]=s.a/n,this.uniforms.rotation[1]=s.b/n,this.uniforms.rotation[2]=s.c/o,this.uniforms.rotation[3]=s.d/o),t.applyFilter(this,e,r,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}},FXAAFilter:class extends Br{constructor(){super("\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\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\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')}},NoiseFilter:class extends Br{constructor(t=.5,e=Math.random()){super(Ri,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}}}}]);