@prefecthq/graphs 2.1.8 → 2.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- (function(oe,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("vue"),require("@prefecthq/vue-compositions"),require("@prefecthq/prefect-design")):typeof define=="function"&&define.amd?define(["exports","vue","@prefecthq/vue-compositions","@prefecthq/prefect-design"],j):(oe=typeof globalThis<"u"?globalThis:oe||self,j(oe["prefect-graphs"]={},oe.Vue,oe.vueCompositions,oe.prefectDesign))})(this,function(oe,j,pr,Zi){"use strict";var vM=Object.defineProperty;var TM=(oe,j,pr)=>j in oe?vM(oe,j,{enumerable:!0,configurable:!0,writable:!0,value:pr}):oe[j]=pr;var dp=(oe,j,pr)=>(TM(oe,typeof j!="symbol"?j+"":j,pr),pr);const _p="nodes-container",Ab="node-container",Rb="edge-container";function cl(r){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(r)}function vp(r){if(r===null||r===!0||r===!1)return NaN;var t=Number(r);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Gn(r,t){if(t.length<r)throw new TypeError(r+" argument"+(r>1?"s":"")+" required, but only "+t.length+" present")}function dl(r){Gn(1,arguments);var t=Object.prototype.toString.call(r);return r instanceof Date||cl(r)==="object"&&t==="[object Date]"?new Date(r.getTime()):typeof r=="number"||t==="[object Number]"?new Date(r):((typeof r=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Mb(r,t){Gn(2,arguments);var e=dl(r).getTime(),i=vp(t);return new Date(e+i)}function Pb(r,t){Gn(2,arguments);var e=vp(t);return Mb(r,e*1e3)}var zo=1e3;function Tp(r,t){return Gn(2,arguments),dl(r).getTime()-dl(t).getTime()}var wp={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},Lb="trunc";function Gb(r){return r?wp[r]:wp[Lb]}function Nb(r,t,e){Gn(2,arguments);var i=Tp(r,t)/1e3;return Gb(e==null?void 0:e.roundingMethod)(i)}var Ur=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ur||{}),Sp=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Sp||{}),pl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(pl||{}),ct=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(ct||{}),bi=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(bi||{}),H=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(H||{}),Ms=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Ms||{}),at=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(at||{}),Q=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(Q||{}),Vi=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Vi||{}),Ki=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Ki||{}),xi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(xi||{}),xe=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(xe||{}),_i=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(_i||{}),fl=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(fl||{}),Oe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Oe||{}),jt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(jt||{}),Yt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Yt||{}),vi=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(vi||{});const q={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var ml=/iPhone/i,Ep=/iPod/i,Cp=/iPad/i,Ip=/\biOS-universal(?:.+)Mac\b/i,gl=/\bAndroid(?:.+)Mobile\b/i,Ap=/Android/i,Ps=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,jo=/Silk/i,Hi=/Windows Phone/i,Rp=/\bWindows(?:.+)ARM\b/i,Mp=/BlackBerry/i,Pp=/BB10/i,Lp=/Opera Mini/i,Gp=/\b(CriOS|Chrome)(?:.+)Mobile/i,Np=/Mobile(?:.+)Firefox\b/i,Fp=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Fb(r){return function(t){return t.test(r)}}function Dp(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=Fb(e),n={apple:{phone:s(ml)&&!s(Hi),ipod:s(Ep),tablet:!s(ml)&&(s(Cp)||Fp(t))&&!s(Hi),universal:s(Ip),device:(s(ml)||s(Ep)||s(Cp)||s(Ip)||Fp(t))&&!s(Hi)},amazon:{phone:s(Ps),tablet:!s(Ps)&&s(jo),device:s(Ps)||s(jo)},android:{phone:!s(Hi)&&s(Ps)||!s(Hi)&&s(gl),tablet:!s(Hi)&&!s(Ps)&&!s(gl)&&(s(jo)||s(Ap)),device:!s(Hi)&&(s(Ps)||s(jo)||s(gl)||s(Ap))||s(/\bokhttp\b/i)},windows:{phone:s(Hi),tablet:s(Rp),device:s(Hi)||s(Rp)},other:{blackberry:s(Mp),blackberry10:s(Pp),opera:s(Lp),firefox:s(Np),chrome:s(Gp),device:s(Mp)||s(Pp)||s(Lp)||s(Np)||s(Gp)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const Db=Dp.default??Dp,Yi=Db(globalThis.navigator);q.RETINA_PREFIX=/@([0-9\.]+)x/,q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ti=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function kb(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var kp={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var p=new s(u,c||h,d),m=e?e+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],p]:h._events[m].push(p):(h._events[m]=p,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},a.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,p=c.length,m=new Array(p);d<p;d++)m[d]=c[d].fn;return m},a.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},a.prototype.emit=function(l,u,c,d,p,m){var f=e?e+l:l;if(!this._events[f])return!1;var g=this._events[f],y=arguments.length,_,b;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,d),!0;case 5:return g.fn.call(g.context,u,c,d,p),!0;case 6:return g.fn.call(g.context,u,c,d,p,m),!0}for(b=1,_=new Array(y-1);b<y;b++)_[b-1]=arguments[b];g.fn.apply(g.context,_)}else{var v=g.length,S;for(b=0;b<v;b++)switch(g[b].once&&this.removeListener(l,g[b].fn,void 0,!0),y){case 1:g[b].fn.call(g[b].context);break;case 2:g[b].fn.call(g[b].context,u);break;case 3:g[b].fn.call(g[b].context,u,c);break;case 4:g[b].fn.call(g[b].context,u,c,d);break;default:if(!_)for(S=1,_=new Array(y-1);S<y;S++)_[S-1]=arguments[S];g[b].fn.apply(g[b].context,_)}}return!0},a.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},a.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},a.prototype.removeListener=function(l,u,c,d){var p=e?e+l:l;if(!this._events[p])return this;if(!u)return o(this,p),this;var m=this._events[p];if(m.fn)m.fn===u&&(!d||m.once)&&(!c||m.context===c)&&o(this,p);else{for(var f=0,g=[],y=m.length;f<y;f++)(m[f].fn!==u||d&&!m[f].once||c&&m[f].context!==c)&&g.push(m[f]);g.length?this._events[p]=g.length===1?g[0]:g:o(this,p)}return this},a.prototype.removeAllListeners=function(l){var u;return l?(u=e?e+l:l,this._events[u]&&o(this,u)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(kp);var Ob=kp.exports;const Fn=Nn(Ob);var yl={exports:{}};yl.exports=Jo,yl.exports.default=Jo;function Jo(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Op(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,u,c,d,p;if(i&&(n=Zb(r,t,n,e)),r.length>80*e){a=l=r[0],h=u=r[1];for(var m=e;m<s;m+=e)c=r[m],d=r[m+1],c<a&&(a=c),d<h&&(h=d),c>l&&(l=c),d>u&&(u=d);p=Math.max(l-a,u-h),p=p!==0?32767/p:0}return Dn(n,o,e,a,h,p,0),o}function Op(r,t,e,i,s){var n,o;if(s===_l(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Up(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Up(n,r[n],r[n+1],o);return o&&$o(o,o.next)&&(On(o),o=o.next),o}function Xr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&($o(e,e.next)||Dt(e.prev,e,e.next)===0)){if(On(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Dn(r,t,e,i,s,n,o){if(r){!o&&n&&zb(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?Bb(r,i,s,n):Wb(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),On(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=Ub(Xr(r),t,e),Dn(r,t,e,i,s,n,2)):o===2&&Xb(r,t,e,i,s,n):Dn(Xr(r),t,e,i,s,n,1);break}}}}function Wb(r){var t=r.prev,e=r,i=r.next;if(Dt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,u=s<n?s<o?s:o:n<o?n:o,c=a<h?a<l?a:l:h<l?h:l,d=s>n?s>o?s:o:n>o?n:o,p=a>h?a>l?a:l:h>l?h:l,m=i.next;m!==t;){if(m.x>=u&&m.x<=d&&m.y>=c&&m.y<=p&&Ls(s,a,n,h,o,l,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Bb(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Dt(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,u=s.y,c=n.y,d=o.y,p=a<h?a<l?a:l:h<l?h:l,m=u<c?u<d?u:d:c<d?c:d,f=a>h?a>l?a:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,y=bl(p,m,t,e,i),_=bl(f,g,t,e,i),b=r.prevZ,v=r.nextZ;b&&b.z>=y&&v&&v.z<=_;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&Ls(a,u,h,c,l,d,b.x,b.y)&&Dt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Ls(a,u,h,c,l,d,v.x,v.y)&&Dt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&Ls(a,u,h,c,l,d,b.x,b.y)&&Dt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=_;){if(v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Ls(a,u,h,c,l,d,v.x,v.y)&&Dt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ub(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!$o(s,n)&&Wp(s,i,i.next,n)&&kn(s,n)&&kn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),On(i),On(i.next),i=r=n),i=i.next}while(i!==r);return Xr(i)}function Xb(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&$b(o,a)){var h=Bp(o,a);o=Xr(o,o.next),h=Xr(h,h.next),Dn(o,t,e,i,s,n,0),Dn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function Zb(r,t,e,i){var s=[],n,o,a,h,l;for(n=0,o=t.length;n<o;n++)a=t[n]*i,h=n<o-1?t[n+1]*i:r.length,l=Op(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(Jb(l));for(s.sort(Vb),n=0;n<s.length;n++)e=Kb(s[n],e);return e}function Vb(r,t){return r.x-t.x}function Kb(r,t){var e=Hb(r,t);if(!e)return t;var i=Bp(e,r);return Xr(i,i.next),Xr(e,e.next)}function Hb(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var h=o,l=o.x,u=o.y,c=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&Ls(s<u?i:n,s,l,u,s<u?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),kn(e,r)&&(d<c||d===c&&(e.x>o.x||e.x===o.x&&Yb(o,e)))&&(o=e,c=d)),e=e.next;while(e!==h);return o}function Yb(r,t){return Dt(r.prev,r,t.prev)<0&&Dt(t.next,r,r.next)<0}function zb(r,t,e,i){var s=r;do s.z===0&&(s.z=bl(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,jb(s)}function jb(r){var t,e,i,s,n,o,a,h,l=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,l*=2}while(o>1);return r}function bl(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Jb(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Ls(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function $b(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Qb(r,t)&&(kn(r,t)&&kn(t,r)&&qb(r,t)&&(Dt(r.prev,r,t.prev)||Dt(r,t.prev,t))||$o(r,t)&&Dt(r.prev,r,r.next)>0&&Dt(t.prev,t,t.next)>0)}function Dt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function $o(r,t){return r.x===t.x&&r.y===t.y}function Wp(r,t,e,i){var s=qo(Dt(r,t,e)),n=qo(Dt(r,t,i)),o=qo(Dt(e,i,r)),a=qo(Dt(e,i,t));return!!(s!==n&&o!==a||s===0&&Qo(r,e,t)||n===0&&Qo(r,i,t)||o===0&&Qo(e,r,i)||a===0&&Qo(e,t,i))}function Qo(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function qo(r){return r>0?1:r<0?-1:0}function Qb(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Wp(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function kn(r,t){return Dt(r.prev,r,r.next)<0?Dt(r,t,r.next)>=0&&Dt(r,r.prev,t)>=0:Dt(r,t,r.prev)<0||Dt(r,r.next,t)<0}function qb(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function Bp(r,t){var e=new xl(r.i,r.x,r.y),i=new xl(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Up(r,t,e,i){var s=new xl(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function On(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function xl(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Jo.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(_l(r,0,n,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,u=a<h-1?t[a+1]*e:r.length;o-=Math.abs(_l(r,l,u,e))}var c=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,p=i[a+1]*e,m=i[a+2]*e;c+=Math.abs((r[d]-r[m])*(r[p+1]-r[d+1])-(r[d]-r[p])*(r[m+1]-r[d+1]))}return o===0&&c===0?0:Math.abs((c-o)/o)};function _l(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}Jo.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var tx=yl.exports;const ex=Nn(tx);var ta={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */ta.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof ti=="object"&&ti;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,u=26,c=38,d=700,p=72,m=128,f="-",g=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=h-l,S=Math.floor,E=String.fromCharCode,A;function I(F){throw new RangeError(b[F])}function P(F,G){for(var V=F.length,$=[];V--;)$[V]=G(F[V]);return $}function W(F,G){var V=F.split("@"),$="";V.length>1&&($=V[0]+"@",F=V[1]),F=F.replace(_,".");var ut=F.split("."),nt=P(ut,G).join(".");return $+nt}function D(F){for(var G=[],V=0,$=F.length,ut,nt;V<$;)ut=F.charCodeAt(V++),ut>=55296&&ut<=56319&&V<$?(nt=F.charCodeAt(V++),(nt&64512)==56320?G.push(((ut&1023)<<10)+(nt&1023)+65536):(G.push(ut),V--)):G.push(ut);return G}function L(F){return P(F,function(G){var V="";return G>65535&&(G-=65536,V+=E(G>>>10&1023|55296),G=56320|G&1023),V+=E(G),V}).join("")}function C(F){return F-48<10?F-22:F-65<26?F-65:F-97<26?F-97:h}function N(F,G){return F+22+75*(F<26)-((G!=0)<<5)}function U(F,G,V){var $=0;for(F=V?S(F/d):F>>1,F+=S(F/G);F>v*u>>1;$+=h)F=S(F/v);return S($+(v+1)*F/(F+c))}function K(F){var G=[],V=F.length,$,ut=0,nt=m,Ct=p,Rt,_t,Y,tt,et,O,xt,gt,Mt;for(Rt=F.lastIndexOf(f),Rt<0&&(Rt=0),_t=0;_t<Rt;++_t)F.charCodeAt(_t)>=128&&I("not-basic"),G.push(F.charCodeAt(_t));for(Y=Rt>0?Rt+1:0;Y<V;){for(tt=ut,et=1,O=h;Y>=V&&I("invalid-input"),xt=C(F.charCodeAt(Y++)),(xt>=h||xt>S((a-ut)/et))&&I("overflow"),ut+=xt*et,gt=O<=Ct?l:O>=Ct+u?u:O-Ct,!(xt<gt);O+=h)Mt=h-gt,et>S(a/Mt)&&I("overflow"),et*=Mt;$=G.length+1,Ct=U(ut-tt,$,tt==0),S(ut/$)>a-nt&&I("overflow"),nt+=S(ut/$),ut%=$,G.splice(ut++,0,nt)}return L(G)}function Z(F){var G,V,$,ut,nt,Ct,Rt,_t,Y,tt,et,O=[],xt,gt,Mt,Ut;for(F=D(F),xt=F.length,G=m,V=0,nt=p,Ct=0;Ct<xt;++Ct)et=F[Ct],et<128&&O.push(E(et));for($=ut=O.length,ut&&O.push(f);$<xt;){for(Rt=a,Ct=0;Ct<xt;++Ct)et=F[Ct],et>=G&&et<Rt&&(Rt=et);for(gt=$+1,Rt-G>S((a-V)/gt)&&I("overflow"),V+=(Rt-G)*gt,G=Rt,Ct=0;Ct<xt;++Ct)if(et=F[Ct],et<G&&++V>a&&I("overflow"),et==G){for(_t=V,Y=h;tt=Y<=nt?l:Y>=nt+u?u:Y-nt,!(_t<tt);Y+=h)Ut=_t-tt,Mt=h-tt,O.push(E(N(tt+Ut%Mt,0))),_t=S(Ut/Mt);O.push(E(N(_t,0))),nt=U(V,gt,$==ut),V=0,++$}++V,++G}return O.join("")}function z(F){return W(F,function(G){return g.test(G)?K(G.slice(4).toLowerCase()):G})}function k(F){return W(F,function(G){return y.test(G)?"xn--"+Z(G):G})}if(o={version:"1.4.1",ucs2:{decode:D,encode:L},decode:K,encode:Z,toASCII:k,toUnicode:z},i&&s)if(r.exports==i)s.exports=o;else for(A in o)o.hasOwnProperty(A)&&(i[A]=o[A]);else e.punycode=o})(ti)}(ta,ta.exports);var ix=ta.exports,rx=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==s||o.enumerable!==!0)return!1}return!0},Xp=typeof Symbol<"u"&&Symbol,sx=rx,nx=function(){return typeof Xp!="function"||typeof Symbol!="function"||typeof Xp("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:sx()},Zp={foo:{}},ox=Object,ax=function(){return{__proto__:Zp}.foo===Zp.foo&&!({__proto__:null}instanceof ox)},hx="Function.prototype.bind called on incompatible ",vl=Array.prototype.slice,lx=Object.prototype.toString,ux="[object Function]",cx=function(t){var e=this;if(typeof e!="function"||lx.call(e)!==ux)throw new TypeError(hx+e);for(var i=vl.call(arguments,1),s,n=function(){if(this instanceof s){var u=e.apply(this,i.concat(vl.call(arguments)));return Object(u)===u?u:this}else return e.apply(t,i.concat(vl.call(arguments)))},o=Math.max(0,e.length-i.length),a=[],h=0;h<o;h++)a.push("$"+h);if(s=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s},dx=cx,Tl=Function.prototype.bind||dx,px=Tl,fx=px.call(Function.call,Object.prototype.hasOwnProperty),wt,Gs=SyntaxError,Vp=Function,Ns=TypeError,wl=function(r){try{return Vp('"use strict"; return ('+r+").constructor;")()}catch{}},Zr=Object.getOwnPropertyDescriptor;if(Zr)try{Zr({},"")}catch{Zr=null}var Sl=function(){throw new Ns},mx=Zr?function(){try{return arguments.callee,Sl}catch{try{return Zr(arguments,"callee").get}catch{return Sl}}}():Sl,Fs=nx(),gx=ax(),qt=Object.getPrototypeOf||(gx?function(r){return r.__proto__}:null),Ds={},yx=typeof Uint8Array>"u"||!qt?wt:qt(Uint8Array),Vr={"%AggregateError%":typeof AggregateError>"u"?wt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?wt:ArrayBuffer,"%ArrayIteratorPrototype%":Fs&&qt?qt([][Symbol.iterator]()):wt,"%AsyncFromSyncIteratorPrototype%":wt,"%AsyncFunction%":Ds,"%AsyncGenerator%":Ds,"%AsyncGeneratorFunction%":Ds,"%AsyncIteratorPrototype%":Ds,"%Atomics%":typeof Atomics>"u"?wt:Atomics,"%BigInt%":typeof BigInt>"u"?wt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?wt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?wt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?wt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?wt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?wt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?wt:FinalizationRegistry,"%Function%":Vp,"%GeneratorFunction%":Ds,"%Int8Array%":typeof Int8Array>"u"?wt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?wt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?wt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Fs&&qt?qt(qt([][Symbol.iterator]())):wt,"%JSON%":typeof JSON=="object"?JSON:wt,"%Map%":typeof Map>"u"?wt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Fs||!qt?wt:qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?wt:Promise,"%Proxy%":typeof Proxy>"u"?wt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?wt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?wt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Fs||!qt?wt:qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?wt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Fs&&qt?qt(""[Symbol.iterator]()):wt,"%Symbol%":Fs?Symbol:wt,"%SyntaxError%":Gs,"%ThrowTypeError%":mx,"%TypedArray%":yx,"%TypeError%":Ns,"%Uint8Array%":typeof Uint8Array>"u"?wt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?wt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?wt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?wt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?wt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?wt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?wt:WeakSet};if(qt)try{null.error}catch(r){var bx=qt(qt(r));Vr["%Error.prototype%"]=bx}var xx=function r(t){var e;if(t==="%AsyncFunction%")e=wl("async function () {}");else if(t==="%GeneratorFunction%")e=wl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=wl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&qt&&(e=qt(s.prototype))}return Vr[t]=e,e},Kp={"%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"]},Wn=Tl,ea=fx,_x=Wn.call(Function.call,Array.prototype.concat),vx=Wn.call(Function.apply,Array.prototype.splice),Hp=Wn.call(Function.call,String.prototype.replace),ia=Wn.call(Function.call,String.prototype.slice),Tx=Wn.call(Function.call,RegExp.prototype.exec),wx=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Sx=/\\(\\)?/g,Ex=function(t){var e=ia(t,0,1),i=ia(t,-1);if(e==="%"&&i!=="%")throw new Gs("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Gs("invalid intrinsic syntax, expected opening `%`");var s=[];return Hp(t,wx,function(n,o,a,h){s[s.length]=a?Hp(h,Sx,"$1"):o||n}),s},Cx=function(t,e){var i=t,s;if(ea(Kp,i)&&(s=Kp[i],i="%"+s[0]+"%"),ea(Vr,i)){var n=Vr[i];if(n===Ds&&(n=xx(i)),typeof n>"u"&&!e)throw new Ns("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Gs("intrinsic "+t+" does not exist!")},El=function(t,e){if(typeof t!="string"||t.length===0)throw new Ns("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Ns('"allowMissing" argument must be a boolean');if(Tx(/^%?[^%]*%?$/,t)===null)throw new Gs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Ex(t),s=i.length>0?i[0]:"",n=Cx("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],vx(i,_x([0,1],l)));for(var u=1,c=!0;u<i.length;u+=1){var d=i[u],p=ia(d,0,1),m=ia(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Gs("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(h=!0),s+="."+d,o="%"+s+"%",ea(Vr,o))a=Vr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Ns("base intrinsic for "+t+" exists, but the property is not available.");return}if(Zr&&u+1>=i.length){var f=Zr(a,d);c=!!f,c&&"get"in f&&!("originalValue"in f.get)?a=f.get:a=a[d]}else c=ea(a,d),a=a[d];c&&!h&&(Vr[o]=a)}}return a},Yp={exports:{}};(function(r){var t=Tl,e=El,i=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),n=e("%Reflect.apply%",!0)||t.call(s,i),o=e("%Object.getOwnPropertyDescriptor%",!0),a=e("%Object.defineProperty%",!0),h=e("%Math.max%");if(a)try{a({},"a",{value:1})}catch{a=null}r.exports=function(c){var d=n(t,s,arguments);if(o&&a){var p=o(d,"length");p.configurable&&a(d,"length",{value:1+h(0,c.length-(arguments.length-1))})}return d};var l=function(){return n(t,i,arguments)};a?a(r.exports,"apply",{value:l}):r.exports.apply=l})(Yp);var Ix=Yp.exports,zp=El,jp=Ix,Ax=jp(zp("String.prototype.indexOf")),Rx=function(t,e){var i=zp(t,!!e);return typeof i=="function"&&Ax(t,".prototype.")>-1?jp(i):i};const Mx=kb(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Cl=typeof Map=="function"&&Map.prototype,Il=Object.getOwnPropertyDescriptor&&Cl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ra=Cl&&Il&&typeof Il.get=="function"?Il.get:null,Jp=Cl&&Map.prototype.forEach,Al=typeof Set=="function"&&Set.prototype,Rl=Object.getOwnPropertyDescriptor&&Al?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,sa=Al&&Rl&&typeof Rl.get=="function"?Rl.get:null,$p=Al&&Set.prototype.forEach,Px=typeof WeakMap=="function"&&WeakMap.prototype,Bn=Px?WeakMap.prototype.has:null,Lx=typeof WeakSet=="function"&&WeakSet.prototype,Un=Lx?WeakSet.prototype.has:null,Gx=typeof WeakRef=="function"&&WeakRef.prototype,Qp=Gx?WeakRef.prototype.deref:null,Nx=Boolean.prototype.valueOf,Fx=Object.prototype.toString,Dx=Function.prototype.toString,kx=String.prototype.match,Ml=String.prototype.slice,fr=String.prototype.replace,Ox=String.prototype.toUpperCase,qp=String.prototype.toLowerCase,tf=RegExp.prototype.test,ef=Array.prototype.concat,Ti=Array.prototype.join,Wx=Array.prototype.slice,rf=Math.floor,Pl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ll=Object.getOwnPropertySymbols,Gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ks=typeof Symbol=="function"&&typeof Symbol.iterator=="object",le=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ks||!0)?Symbol.toStringTag:null,sf=Object.prototype.propertyIsEnumerable,nf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function of(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||tf.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-rf(-r):rf(r);if(i!==r){var s=String(i),n=Ml.call(t,s.length+1);return fr.call(s,e,"$&_")+"."+fr.call(fr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return fr.call(t,e,"$&_")}var Nl=Mx,af=Nl.custom,hf=cf(af)?af:null,Bx=function r(t,e,i,s){var n=e||{};if(mr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(mr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=mr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(mr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(mr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return pf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?of(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?of(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof t=="object")return Fl(t)?"[Array]":"[Object]";var c=s_(n,i);if(typeof s>"u")s=[];else if(df(s,t)>=0)return"[Circular]";function d(C,N,U){if(N&&(s=Wx.call(s),s.push(N)),U){var K={depth:n.depth};return mr(n,"quoteStyle")&&(K.quoteStyle=n.quoteStyle),r(C,K,i+1,s)}return r(C,n,i+1,s)}if(typeof t=="function"&&!uf(t)){var p=jx(t),m=na(t,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+Ti.call(m,", ")+" }":"")}if(cf(t)){var f=ks?fr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Gl.call(t);return typeof t=="object"&&!ks?Xn(f):f}if(e_(t)){for(var g="<"+qp.call(String(t.nodeName)),y=t.attributes||[],_=0;_<y.length;_++)g+=" "+y[_].name+"="+lf(Ux(y[_].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+qp.call(String(t.nodeName))+">",g}if(Fl(t)){if(t.length===0)return"[]";var b=na(t,d);return c&&!r_(b)?"["+kl(b,c)+"]":"[ "+Ti.call(b,", ")+" ]"}if(Zx(t)){var v=na(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!sf.call(t,"cause")?"{ ["+String(t)+"] "+Ti.call(ef.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ti.call(v,", ")+" }"}if(typeof t=="object"&&o){if(hf&&typeof t[hf]=="function"&&Nl)return Nl(t,{depth:u-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Jx(t)){var S=[];return Jp&&Jp.call(t,function(C,N){S.push(d(N,t,!0)+" => "+d(C,t))}),ff("Map",ra.call(t),S,c)}if(qx(t)){var E=[];return $p&&$p.call(t,function(C){E.push(d(C,t))}),ff("Set",sa.call(t),E,c)}if($x(t))return Dl("WeakMap");if(t_(t))return Dl("WeakSet");if(Qx(t))return Dl("WeakRef");if(Kx(t))return Xn(d(Number(t)));if(Yx(t))return Xn(d(Pl.call(t)));if(Hx(t))return Xn(Nx.call(t));if(Vx(t))return Xn(d(String(t)));if(!Xx(t)&&!uf(t)){var A=na(t,d),I=nf?nf(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",W=!I&&le&&Object(t)===t&&le in t?Ml.call(gr(t),8,-1):P?"Object":"",D=I||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",L=D+(W||P?"["+Ti.call(ef.call([],W||[],P||[]),": ")+"] ":"");return A.length===0?L+"{}":c?L+"{"+kl(A,c)+"}":L+"{ "+Ti.call(A,", ")+" }"}return String(t)};function lf(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function Ux(r){return fr.call(String(r),/"/g,"&quot;")}function Fl(r){return gr(r)==="[object Array]"&&(!le||!(typeof r=="object"&&le in r))}function Xx(r){return gr(r)==="[object Date]"&&(!le||!(typeof r=="object"&&le in r))}function uf(r){return gr(r)==="[object RegExp]"&&(!le||!(typeof r=="object"&&le in r))}function Zx(r){return gr(r)==="[object Error]"&&(!le||!(typeof r=="object"&&le in r))}function Vx(r){return gr(r)==="[object String]"&&(!le||!(typeof r=="object"&&le in r))}function Kx(r){return gr(r)==="[object Number]"&&(!le||!(typeof r=="object"&&le in r))}function Hx(r){return gr(r)==="[object Boolean]"&&(!le||!(typeof r=="object"&&le in r))}function cf(r){if(ks)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Gl)return!1;try{return Gl.call(r),!0}catch{}return!1}function Yx(r){if(!r||typeof r!="object"||!Pl)return!1;try{return Pl.call(r),!0}catch{}return!1}var zx=Object.prototype.hasOwnProperty||function(r){return r in this};function mr(r,t){return zx.call(r,t)}function gr(r){return Fx.call(r)}function jx(r){if(r.name)return r.name;var t=kx.call(Dx.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function df(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function Jx(r){if(!ra||!r||typeof r!="object")return!1;try{ra.call(r);try{sa.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function $x(r){if(!Bn||!r||typeof r!="object")return!1;try{Bn.call(r,Bn);try{Un.call(r,Un)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function Qx(r){if(!Qp||!r||typeof r!="object")return!1;try{return Qp.call(r),!0}catch{}return!1}function qx(r){if(!sa||!r||typeof r!="object")return!1;try{sa.call(r);try{ra.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function t_(r){if(!Un||!r||typeof r!="object")return!1;try{Un.call(r,Un);try{Bn.call(r,Bn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function e_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function pf(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return pf(Ml.call(r,0,t.maxStringLength),t)+i}var s=fr.call(fr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,i_);return lf(s,"single",t)}function i_(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Ox.call(t.toString(16))}function Xn(r){return"Object("+r+")"}function Dl(r){return r+" { ? }"}function ff(r,t,e,i){var s=i?kl(e,i):Ti.call(e,", ");return r+" ("+t+") {"+s+"}"}function r_(r){for(var t=0;t<r.length;t++)if(df(r[t],`
1
+ (function(ae,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("vue"),require("@prefecthq/vue-compositions"),require("@prefecthq/prefect-design")):typeof define=="function"&&define.amd?define(["exports","vue","@prefecthq/vue-compositions","@prefecthq/prefect-design"],j):(ae=typeof globalThis<"u"?globalThis:ae||self,j(ae["prefect-graphs"]={},ae.Vue,ae.vueCompositions,ae.prefectDesign))})(this,function(ae,j,pr,Zi){"use strict";var vM=Object.defineProperty;var TM=(ae,j,pr)=>j in ae?vM(ae,j,{enumerable:!0,configurable:!0,writable:!0,value:pr}):ae[j]=pr;var dp=(ae,j,pr)=>(TM(ae,typeof j!="symbol"?j+"":j,pr),pr);const _p="nodes-container",Ab="node-container",Rb="edge-container";function cl(r){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(r)}function vp(r){if(r===null||r===!0||r===!1)return NaN;var t=Number(r);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Nn(r,t){if(t.length<r)throw new TypeError(r+" argument"+(r>1?"s":"")+" required, but only "+t.length+" present")}function dl(r){Nn(1,arguments);var t=Object.prototype.toString.call(r);return r instanceof Date||cl(r)==="object"&&t==="[object Date]"?new Date(r.getTime()):typeof r=="number"||t==="[object Number]"?new Date(r):((typeof r=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Mb(r,t){Nn(2,arguments);var e=dl(r).getTime(),i=vp(t);return new Date(e+i)}function Pb(r,t){Nn(2,arguments);var e=vp(t);return Mb(r,e*1e3)}var jo=1e3;function Tp(r,t){return Nn(2,arguments),dl(r).getTime()-dl(t).getTime()}var wp={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},Lb="trunc";function Gb(r){return r?wp[r]:wp[Lb]}function Nb(r,t,e){Nn(2,arguments);var i=Tp(r,t)/1e3;return Gb(e==null?void 0:e.roundingMethod)(i)}var Ur=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ur||{}),Sp=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Sp||{}),pl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(pl||{}),ct=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(ct||{}),bi=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(bi||{}),H=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(H||{}),Ps=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Ps||{}),at=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(at||{}),Q=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(Q||{}),Vi=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Vi||{}),Ki=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Ki||{}),xi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(xi||{}),_e=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(_e||{}),_i=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(_i||{}),fl=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(fl||{}),Be=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Be||{}),jt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(jt||{}),Yt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Yt||{}),vi=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(vi||{});const q={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var ml=/iPhone/i,Ep=/iPod/i,Cp=/iPad/i,Ip=/\biOS-universal(?:.+)Mac\b/i,gl=/\bAndroid(?:.+)Mobile\b/i,Ap=/Android/i,Ls=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Jo=/Silk/i,Hi=/Windows Phone/i,Rp=/\bWindows(?:.+)ARM\b/i,Mp=/BlackBerry/i,Pp=/BB10/i,Lp=/Opera Mini/i,Gp=/\b(CriOS|Chrome)(?:.+)Mobile/i,Np=/Mobile(?:.+)Firefox\b/i,Fp=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Fb(r){return function(t){return t.test(r)}}function Dp(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=Fb(e),n={apple:{phone:s(ml)&&!s(Hi),ipod:s(Ep),tablet:!s(ml)&&(s(Cp)||Fp(t))&&!s(Hi),universal:s(Ip),device:(s(ml)||s(Ep)||s(Cp)||s(Ip)||Fp(t))&&!s(Hi)},amazon:{phone:s(Ls),tablet:!s(Ls)&&s(Jo),device:s(Ls)||s(Jo)},android:{phone:!s(Hi)&&s(Ls)||!s(Hi)&&s(gl),tablet:!s(Hi)&&!s(Ls)&&!s(gl)&&(s(Jo)||s(Ap)),device:!s(Hi)&&(s(Ls)||s(Jo)||s(gl)||s(Ap))||s(/\bokhttp\b/i)},windows:{phone:s(Hi),tablet:s(Rp),device:s(Hi)||s(Rp)},other:{blackberry:s(Mp),blackberry10:s(Pp),opera:s(Lp),firefox:s(Np),chrome:s(Gp),device:s(Mp)||s(Pp)||s(Lp)||s(Np)||s(Gp)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const Db=Dp.default??Dp,Yi=Db(globalThis.navigator);q.RETINA_PREFIX=/@([0-9\.]+)x/,q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ei=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function kb(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var kp={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var p=new s(u,c||h,d),m=e?e+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],p]:h._events[m].push(p):(h._events[m]=p,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},a.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,p=c.length,m=new Array(p);d<p;d++)m[d]=c[d].fn;return m},a.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},a.prototype.emit=function(l,u,c,d,p,m){var f=e?e+l:l;if(!this._events[f])return!1;var g=this._events[f],y=arguments.length,_,b;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,d),!0;case 5:return g.fn.call(g.context,u,c,d,p),!0;case 6:return g.fn.call(g.context,u,c,d,p,m),!0}for(b=1,_=new Array(y-1);b<y;b++)_[b-1]=arguments[b];g.fn.apply(g.context,_)}else{var v=g.length,S;for(b=0;b<v;b++)switch(g[b].once&&this.removeListener(l,g[b].fn,void 0,!0),y){case 1:g[b].fn.call(g[b].context);break;case 2:g[b].fn.call(g[b].context,u);break;case 3:g[b].fn.call(g[b].context,u,c);break;case 4:g[b].fn.call(g[b].context,u,c,d);break;default:if(!_)for(S=1,_=new Array(y-1);S<y;S++)_[S-1]=arguments[S];g[b].fn.apply(g[b].context,_)}}return!0},a.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},a.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},a.prototype.removeListener=function(l,u,c,d){var p=e?e+l:l;if(!this._events[p])return this;if(!u)return o(this,p),this;var m=this._events[p];if(m.fn)m.fn===u&&(!d||m.once)&&(!c||m.context===c)&&o(this,p);else{for(var f=0,g=[],y=m.length;f<y;f++)(m[f].fn!==u||d&&!m[f].once||c&&m[f].context!==c)&&g.push(m[f]);g.length?this._events[p]=g.length===1?g[0]:g:o(this,p)}return this},a.prototype.removeAllListeners=function(l){var u;return l?(u=e?e+l:l,this._events[u]&&o(this,u)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(kp);var Ob=kp.exports;const Dn=Fn(Ob);var yl={exports:{}};yl.exports=$o,yl.exports.default=$o;function $o(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Op(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,u,c,d,p;if(i&&(n=Zb(r,t,n,e)),r.length>80*e){a=l=r[0],h=u=r[1];for(var m=e;m<s;m+=e)c=r[m],d=r[m+1],c<a&&(a=c),d<h&&(h=d),c>l&&(l=c),d>u&&(u=d);p=Math.max(l-a,u-h),p=p!==0?32767/p:0}return kn(n,o,e,a,h,p,0),o}function Op(r,t,e,i,s){var n,o;if(s===_l(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Up(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Up(n,r[n],r[n+1],o);return o&&Qo(o,o.next)&&(Wn(o),o=o.next),o}function Xr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Qo(e,e.next)||Dt(e.prev,e,e.next)===0)){if(Wn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function kn(r,t,e,i,s,n,o){if(r){!o&&n&&zb(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?Bb(r,i,s,n):Wb(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Wn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=Ub(Xr(r),t,e),kn(r,t,e,i,s,n,2)):o===2&&Xb(r,t,e,i,s,n):kn(Xr(r),t,e,i,s,n,1);break}}}}function Wb(r){var t=r.prev,e=r,i=r.next;if(Dt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,u=s<n?s<o?s:o:n<o?n:o,c=a<h?a<l?a:l:h<l?h:l,d=s>n?s>o?s:o:n>o?n:o,p=a>h?a>l?a:l:h>l?h:l,m=i.next;m!==t;){if(m.x>=u&&m.x<=d&&m.y>=c&&m.y<=p&&Gs(s,a,n,h,o,l,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Bb(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Dt(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,u=s.y,c=n.y,d=o.y,p=a<h?a<l?a:l:h<l?h:l,m=u<c?u<d?u:d:c<d?c:d,f=a>h?a>l?a:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,y=bl(p,m,t,e,i),_=bl(f,g,t,e,i),b=r.prevZ,v=r.nextZ;b&&b.z>=y&&v&&v.z<=_;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&Gs(a,u,h,c,l,d,b.x,b.y)&&Dt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Gs(a,u,h,c,l,d,v.x,v.y)&&Dt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&Gs(a,u,h,c,l,d,b.x,b.y)&&Dt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=_;){if(v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Gs(a,u,h,c,l,d,v.x,v.y)&&Dt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ub(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Qo(s,n)&&Wp(s,i,i.next,n)&&On(s,n)&&On(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Wn(i),Wn(i.next),i=r=n),i=i.next}while(i!==r);return Xr(i)}function Xb(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&$b(o,a)){var h=Bp(o,a);o=Xr(o,o.next),h=Xr(h,h.next),kn(o,t,e,i,s,n,0),kn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function Zb(r,t,e,i){var s=[],n,o,a,h,l;for(n=0,o=t.length;n<o;n++)a=t[n]*i,h=n<o-1?t[n+1]*i:r.length,l=Op(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(Jb(l));for(s.sort(Vb),n=0;n<s.length;n++)e=Kb(s[n],e);return e}function Vb(r,t){return r.x-t.x}function Kb(r,t){var e=Hb(r,t);if(!e)return t;var i=Bp(e,r);return Xr(i,i.next),Xr(e,e.next)}function Hb(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var h=o,l=o.x,u=o.y,c=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&Gs(s<u?i:n,s,l,u,s<u?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),On(e,r)&&(d<c||d===c&&(e.x>o.x||e.x===o.x&&Yb(o,e)))&&(o=e,c=d)),e=e.next;while(e!==h);return o}function Yb(r,t){return Dt(r.prev,r,t.prev)<0&&Dt(t.next,r,r.next)<0}function zb(r,t,e,i){var s=r;do s.z===0&&(s.z=bl(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,jb(s)}function jb(r){var t,e,i,s,n,o,a,h,l=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,l*=2}while(o>1);return r}function bl(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Jb(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Gs(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function $b(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Qb(r,t)&&(On(r,t)&&On(t,r)&&qb(r,t)&&(Dt(r.prev,r,t.prev)||Dt(r,t.prev,t))||Qo(r,t)&&Dt(r.prev,r,r.next)>0&&Dt(t.prev,t,t.next)>0)}function Dt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Qo(r,t){return r.x===t.x&&r.y===t.y}function Wp(r,t,e,i){var s=ta(Dt(r,t,e)),n=ta(Dt(r,t,i)),o=ta(Dt(e,i,r)),a=ta(Dt(e,i,t));return!!(s!==n&&o!==a||s===0&&qo(r,e,t)||n===0&&qo(r,i,t)||o===0&&qo(e,r,i)||a===0&&qo(e,t,i))}function qo(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function ta(r){return r>0?1:r<0?-1:0}function Qb(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Wp(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function On(r,t){return Dt(r.prev,r,r.next)<0?Dt(r,t,r.next)>=0&&Dt(r,r.prev,t)>=0:Dt(r,t,r.prev)<0||Dt(r,r.next,t)<0}function qb(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function Bp(r,t){var e=new xl(r.i,r.x,r.y),i=new xl(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Up(r,t,e,i){var s=new xl(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Wn(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function xl(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}$o.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(_l(r,0,n,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,u=a<h-1?t[a+1]*e:r.length;o-=Math.abs(_l(r,l,u,e))}var c=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,p=i[a+1]*e,m=i[a+2]*e;c+=Math.abs((r[d]-r[m])*(r[p+1]-r[d+1])-(r[d]-r[p])*(r[m+1]-r[d+1]))}return o===0&&c===0?0:Math.abs((c-o)/o)};function _l(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}$o.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var tx=yl.exports;const ex=Fn(tx);var ea={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */ea.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof ei=="object"&&ei;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,u=26,c=38,d=700,p=72,m=128,f="-",g=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=h-l,S=Math.floor,E=String.fromCharCode,I;function A(F){throw new RangeError(b[F])}function P(F,G){for(var V=F.length,$=[];V--;)$[V]=G(F[V]);return $}function O(F,G){var V=F.split("@"),$="";V.length>1&&($=V[0]+"@",F=V[1]),F=F.replace(_,".");var ut=F.split("."),nt=P(ut,G).join(".");return $+nt}function W(F){for(var G=[],V=0,$=F.length,ut,nt;V<$;)ut=F.charCodeAt(V++),ut>=55296&&ut<=56319&&V<$?(nt=F.charCodeAt(V++),(nt&64512)==56320?G.push(((ut&1023)<<10)+(nt&1023)+65536):(G.push(ut),V--)):G.push(ut);return G}function L(F){return P(F,function(G){var V="";return G>65535&&(G-=65536,V+=E(G>>>10&1023|55296),G=56320|G&1023),V+=E(G),V}).join("")}function C(F){return F-48<10?F-22:F-65<26?F-65:F-97<26?F-97:h}function N(F,G){return F+22+75*(F<26)-((G!=0)<<5)}function X(F,G,V){var $=0;for(F=V?S(F/d):F>>1,F+=S(F/G);F>v*u>>1;$+=h)F=S(F/v);return S($+(v+1)*F/(F+c))}function K(F){var G=[],V=F.length,$,ut=0,nt=m,Ct=p,Rt,_t,Y,tt,et,k,xt,gt,Mt;for(Rt=F.lastIndexOf(f),Rt<0&&(Rt=0),_t=0;_t<Rt;++_t)F.charCodeAt(_t)>=128&&A("not-basic"),G.push(F.charCodeAt(_t));for(Y=Rt>0?Rt+1:0;Y<V;){for(tt=ut,et=1,k=h;Y>=V&&A("invalid-input"),xt=C(F.charCodeAt(Y++)),(xt>=h||xt>S((a-ut)/et))&&A("overflow"),ut+=xt*et,gt=k<=Ct?l:k>=Ct+u?u:k-Ct,!(xt<gt);k+=h)Mt=h-gt,et>S(a/Mt)&&A("overflow"),et*=Mt;$=G.length+1,Ct=X(ut-tt,$,tt==0),S(ut/$)>a-nt&&A("overflow"),nt+=S(ut/$),ut%=$,G.splice(ut++,0,nt)}return L(G)}function Z(F){var G,V,$,ut,nt,Ct,Rt,_t,Y,tt,et,k=[],xt,gt,Mt,Ut;for(F=W(F),xt=F.length,G=m,V=0,nt=p,Ct=0;Ct<xt;++Ct)et=F[Ct],et<128&&k.push(E(et));for($=ut=k.length,ut&&k.push(f);$<xt;){for(Rt=a,Ct=0;Ct<xt;++Ct)et=F[Ct],et>=G&&et<Rt&&(Rt=et);for(gt=$+1,Rt-G>S((a-V)/gt)&&A("overflow"),V+=(Rt-G)*gt,G=Rt,Ct=0;Ct<xt;++Ct)if(et=F[Ct],et<G&&++V>a&&A("overflow"),et==G){for(_t=V,Y=h;tt=Y<=nt?l:Y>=nt+u?u:Y-nt,!(_t<tt);Y+=h)Ut=_t-tt,Mt=h-tt,k.push(E(N(tt+Ut%Mt,0))),_t=S(Ut/Mt);k.push(E(N(_t,0))),nt=X(V,gt,$==ut),V=0,++$}++V,++G}return k.join("")}function z(F){return O(F,function(G){return g.test(G)?K(G.slice(4).toLowerCase()):G})}function D(F){return O(F,function(G){return y.test(G)?"xn--"+Z(G):G})}if(o={version:"1.4.1",ucs2:{decode:W,encode:L},decode:K,encode:Z,toASCII:D,toUnicode:z},i&&s)if(r.exports==i)s.exports=o;else for(I in o)o.hasOwnProperty(I)&&(i[I]=o[I]);else e.punycode=o})(ei)}(ea,ea.exports);var ix=ea.exports,rx=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==s||o.enumerable!==!0)return!1}return!0},Xp=typeof Symbol<"u"&&Symbol,sx=rx,nx=function(){return typeof Xp!="function"||typeof Symbol!="function"||typeof Xp("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:sx()},Zp={foo:{}},ox=Object,ax=function(){return{__proto__:Zp}.foo===Zp.foo&&!({__proto__:null}instanceof ox)},hx="Function.prototype.bind called on incompatible ",vl=Array.prototype.slice,lx=Object.prototype.toString,ux="[object Function]",cx=function(t){var e=this;if(typeof e!="function"||lx.call(e)!==ux)throw new TypeError(hx+e);for(var i=vl.call(arguments,1),s,n=function(){if(this instanceof s){var u=e.apply(this,i.concat(vl.call(arguments)));return Object(u)===u?u:this}else return e.apply(t,i.concat(vl.call(arguments)))},o=Math.max(0,e.length-i.length),a=[],h=0;h<o;h++)a.push("$"+h);if(s=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s},dx=cx,Tl=Function.prototype.bind||dx,px=Tl,fx=px.call(Function.call,Object.prototype.hasOwnProperty),wt,Ns=SyntaxError,Vp=Function,Fs=TypeError,wl=function(r){try{return Vp('"use strict"; return ('+r+").constructor;")()}catch{}},Zr=Object.getOwnPropertyDescriptor;if(Zr)try{Zr({},"")}catch{Zr=null}var Sl=function(){throw new Fs},mx=Zr?function(){try{return arguments.callee,Sl}catch{try{return Zr(arguments,"callee").get}catch{return Sl}}}():Sl,Ds=nx(),gx=ax(),qt=Object.getPrototypeOf||(gx?function(r){return r.__proto__}:null),ks={},yx=typeof Uint8Array>"u"||!qt?wt:qt(Uint8Array),Vr={"%AggregateError%":typeof AggregateError>"u"?wt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?wt:ArrayBuffer,"%ArrayIteratorPrototype%":Ds&&qt?qt([][Symbol.iterator]()):wt,"%AsyncFromSyncIteratorPrototype%":wt,"%AsyncFunction%":ks,"%AsyncGenerator%":ks,"%AsyncGeneratorFunction%":ks,"%AsyncIteratorPrototype%":ks,"%Atomics%":typeof Atomics>"u"?wt:Atomics,"%BigInt%":typeof BigInt>"u"?wt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?wt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?wt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?wt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?wt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?wt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?wt:FinalizationRegistry,"%Function%":Vp,"%GeneratorFunction%":ks,"%Int8Array%":typeof Int8Array>"u"?wt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?wt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?wt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ds&&qt?qt(qt([][Symbol.iterator]())):wt,"%JSON%":typeof JSON=="object"?JSON:wt,"%Map%":typeof Map>"u"?wt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ds||!qt?wt:qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?wt:Promise,"%Proxy%":typeof Proxy>"u"?wt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?wt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?wt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ds||!qt?wt:qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?wt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ds&&qt?qt(""[Symbol.iterator]()):wt,"%Symbol%":Ds?Symbol:wt,"%SyntaxError%":Ns,"%ThrowTypeError%":mx,"%TypedArray%":yx,"%TypeError%":Fs,"%Uint8Array%":typeof Uint8Array>"u"?wt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?wt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?wt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?wt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?wt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?wt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?wt:WeakSet};if(qt)try{null.error}catch(r){var bx=qt(qt(r));Vr["%Error.prototype%"]=bx}var xx=function r(t){var e;if(t==="%AsyncFunction%")e=wl("async function () {}");else if(t==="%GeneratorFunction%")e=wl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=wl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&qt&&(e=qt(s.prototype))}return Vr[t]=e,e},Kp={"%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"]},Bn=Tl,ia=fx,_x=Bn.call(Function.call,Array.prototype.concat),vx=Bn.call(Function.apply,Array.prototype.splice),Hp=Bn.call(Function.call,String.prototype.replace),ra=Bn.call(Function.call,String.prototype.slice),Tx=Bn.call(Function.call,RegExp.prototype.exec),wx=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Sx=/\\(\\)?/g,Ex=function(t){var e=ra(t,0,1),i=ra(t,-1);if(e==="%"&&i!=="%")throw new Ns("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ns("invalid intrinsic syntax, expected opening `%`");var s=[];return Hp(t,wx,function(n,o,a,h){s[s.length]=a?Hp(h,Sx,"$1"):o||n}),s},Cx=function(t,e){var i=t,s;if(ia(Kp,i)&&(s=Kp[i],i="%"+s[0]+"%"),ia(Vr,i)){var n=Vr[i];if(n===ks&&(n=xx(i)),typeof n>"u"&&!e)throw new Fs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Ns("intrinsic "+t+" does not exist!")},El=function(t,e){if(typeof t!="string"||t.length===0)throw new Fs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Fs('"allowMissing" argument must be a boolean');if(Tx(/^%?[^%]*%?$/,t)===null)throw new Ns("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Ex(t),s=i.length>0?i[0]:"",n=Cx("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],vx(i,_x([0,1],l)));for(var u=1,c=!0;u<i.length;u+=1){var d=i[u],p=ra(d,0,1),m=ra(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Ns("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(h=!0),s+="."+d,o="%"+s+"%",ia(Vr,o))a=Vr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Fs("base intrinsic for "+t+" exists, but the property is not available.");return}if(Zr&&u+1>=i.length){var f=Zr(a,d);c=!!f,c&&"get"in f&&!("originalValue"in f.get)?a=f.get:a=a[d]}else c=ia(a,d),a=a[d];c&&!h&&(Vr[o]=a)}}return a},Yp={exports:{}};(function(r){var t=Tl,e=El,i=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),n=e("%Reflect.apply%",!0)||t.call(s,i),o=e("%Object.getOwnPropertyDescriptor%",!0),a=e("%Object.defineProperty%",!0),h=e("%Math.max%");if(a)try{a({},"a",{value:1})}catch{a=null}r.exports=function(c){var d=n(t,s,arguments);if(o&&a){var p=o(d,"length");p.configurable&&a(d,"length",{value:1+h(0,c.length-(arguments.length-1))})}return d};var l=function(){return n(t,i,arguments)};a?a(r.exports,"apply",{value:l}):r.exports.apply=l})(Yp);var Ix=Yp.exports,zp=El,jp=Ix,Ax=jp(zp("String.prototype.indexOf")),Rx=function(t,e){var i=zp(t,!!e);return typeof i=="function"&&Ax(t,".prototype.")>-1?jp(i):i};const Mx=kb(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Cl=typeof Map=="function"&&Map.prototype,Il=Object.getOwnPropertyDescriptor&&Cl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,sa=Cl&&Il&&typeof Il.get=="function"?Il.get:null,Jp=Cl&&Map.prototype.forEach,Al=typeof Set=="function"&&Set.prototype,Rl=Object.getOwnPropertyDescriptor&&Al?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,na=Al&&Rl&&typeof Rl.get=="function"?Rl.get:null,$p=Al&&Set.prototype.forEach,Px=typeof WeakMap=="function"&&WeakMap.prototype,Un=Px?WeakMap.prototype.has:null,Lx=typeof WeakSet=="function"&&WeakSet.prototype,Xn=Lx?WeakSet.prototype.has:null,Gx=typeof WeakRef=="function"&&WeakRef.prototype,Qp=Gx?WeakRef.prototype.deref:null,Nx=Boolean.prototype.valueOf,Fx=Object.prototype.toString,Dx=Function.prototype.toString,kx=String.prototype.match,Ml=String.prototype.slice,fr=String.prototype.replace,Ox=String.prototype.toUpperCase,qp=String.prototype.toLowerCase,tf=RegExp.prototype.test,ef=Array.prototype.concat,Ti=Array.prototype.join,Wx=Array.prototype.slice,rf=Math.floor,Pl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ll=Object.getOwnPropertySymbols,Gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Os=typeof Symbol=="function"&&typeof Symbol.iterator=="object",le=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Os||!0)?Symbol.toStringTag:null,sf=Object.prototype.propertyIsEnumerable,nf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function of(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||tf.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-rf(-r):rf(r);if(i!==r){var s=String(i),n=Ml.call(t,s.length+1);return fr.call(s,e,"$&_")+"."+fr.call(fr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return fr.call(t,e,"$&_")}var Nl=Mx,af=Nl.custom,hf=cf(af)?af:null,Bx=function r(t,e,i,s){var n=e||{};if(mr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(mr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=mr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(mr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(mr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return pf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?of(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?of(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof t=="object")return Fl(t)?"[Array]":"[Object]";var c=s_(n,i);if(typeof s>"u")s=[];else if(df(s,t)>=0)return"[Circular]";function d(C,N,X){if(N&&(s=Wx.call(s),s.push(N)),X){var K={depth:n.depth};return mr(n,"quoteStyle")&&(K.quoteStyle=n.quoteStyle),r(C,K,i+1,s)}return r(C,n,i+1,s)}if(typeof t=="function"&&!uf(t)){var p=jx(t),m=oa(t,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+Ti.call(m,", ")+" }":"")}if(cf(t)){var f=Os?fr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Gl.call(t);return typeof t=="object"&&!Os?Zn(f):f}if(e_(t)){for(var g="<"+qp.call(String(t.nodeName)),y=t.attributes||[],_=0;_<y.length;_++)g+=" "+y[_].name+"="+lf(Ux(y[_].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+qp.call(String(t.nodeName))+">",g}if(Fl(t)){if(t.length===0)return"[]";var b=oa(t,d);return c&&!r_(b)?"["+kl(b,c)+"]":"[ "+Ti.call(b,", ")+" ]"}if(Zx(t)){var v=oa(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!sf.call(t,"cause")?"{ ["+String(t)+"] "+Ti.call(ef.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ti.call(v,", ")+" }"}if(typeof t=="object"&&o){if(hf&&typeof t[hf]=="function"&&Nl)return Nl(t,{depth:u-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Jx(t)){var S=[];return Jp&&Jp.call(t,function(C,N){S.push(d(N,t,!0)+" => "+d(C,t))}),ff("Map",sa.call(t),S,c)}if(qx(t)){var E=[];return $p&&$p.call(t,function(C){E.push(d(C,t))}),ff("Set",na.call(t),E,c)}if($x(t))return Dl("WeakMap");if(t_(t))return Dl("WeakSet");if(Qx(t))return Dl("WeakRef");if(Kx(t))return Zn(d(Number(t)));if(Yx(t))return Zn(d(Pl.call(t)));if(Hx(t))return Zn(Nx.call(t));if(Vx(t))return Zn(d(String(t)));if(!Xx(t)&&!uf(t)){var I=oa(t,d),A=nf?nf(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",O=!A&&le&&Object(t)===t&&le in t?Ml.call(gr(t),8,-1):P?"Object":"",W=A||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",L=W+(O||P?"["+Ti.call(ef.call([],O||[],P||[]),": ")+"] ":"");return I.length===0?L+"{}":c?L+"{"+kl(I,c)+"}":L+"{ "+Ti.call(I,", ")+" }"}return String(t)};function lf(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function Ux(r){return fr.call(String(r),/"/g,"&quot;")}function Fl(r){return gr(r)==="[object Array]"&&(!le||!(typeof r=="object"&&le in r))}function Xx(r){return gr(r)==="[object Date]"&&(!le||!(typeof r=="object"&&le in r))}function uf(r){return gr(r)==="[object RegExp]"&&(!le||!(typeof r=="object"&&le in r))}function Zx(r){return gr(r)==="[object Error]"&&(!le||!(typeof r=="object"&&le in r))}function Vx(r){return gr(r)==="[object String]"&&(!le||!(typeof r=="object"&&le in r))}function Kx(r){return gr(r)==="[object Number]"&&(!le||!(typeof r=="object"&&le in r))}function Hx(r){return gr(r)==="[object Boolean]"&&(!le||!(typeof r=="object"&&le in r))}function cf(r){if(Os)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Gl)return!1;try{return Gl.call(r),!0}catch{}return!1}function Yx(r){if(!r||typeof r!="object"||!Pl)return!1;try{return Pl.call(r),!0}catch{}return!1}var zx=Object.prototype.hasOwnProperty||function(r){return r in this};function mr(r,t){return zx.call(r,t)}function gr(r){return Fx.call(r)}function jx(r){if(r.name)return r.name;var t=kx.call(Dx.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function df(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function Jx(r){if(!sa||!r||typeof r!="object")return!1;try{sa.call(r);try{na.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function $x(r){if(!Un||!r||typeof r!="object")return!1;try{Un.call(r,Un);try{Xn.call(r,Xn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function Qx(r){if(!Qp||!r||typeof r!="object")return!1;try{return Qp.call(r),!0}catch{}return!1}function qx(r){if(!na||!r||typeof r!="object")return!1;try{na.call(r);try{sa.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function t_(r){if(!Xn||!r||typeof r!="object")return!1;try{Xn.call(r,Xn);try{Un.call(r,Un)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function e_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function pf(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return pf(Ml.call(r,0,t.maxStringLength),t)+i}var s=fr.call(fr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,i_);return lf(s,"single",t)}function i_(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Ox.call(t.toString(16))}function Zn(r){return"Object("+r+")"}function Dl(r){return r+" { ? }"}function ff(r,t,e,i){var s=i?kl(e,i):Ti.call(e,", ");return r+" ("+t+") {"+s+"}"}function r_(r){for(var t=0;t<r.length;t++)if(df(r[t],`
2
2
  `)>=0)return!1;return!0}function s_(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Ti.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Ti.call(Array(t+1),e)}}function kl(r,t){if(r.length===0)return"";var e=`
3
3
  `+t.prev+t.base;return e+Ti.call(r,","+e)+`
4
- `+t.prev}function na(r,t){var e=Fl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=mr(r,s)?t(r[s],r):""}var n=typeof Ll=="function"?Ll(r):[],o;if(ks){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)mr(r,h)&&(e&&String(Number(h))===h&&h<r.length||ks&&o["$"+h]instanceof Symbol||(tf.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Ll=="function")for(var l=0;l<n.length;l++)sf.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Ol=El,Os=Rx,n_=Bx,o_=Ol("%TypeError%"),oa=Ol("%WeakMap%",!0),aa=Ol("%Map%",!0),a_=Os("WeakMap.prototype.get",!0),h_=Os("WeakMap.prototype.set",!0),l_=Os("WeakMap.prototype.has",!0),u_=Os("Map.prototype.get",!0),c_=Os("Map.prototype.set",!0),d_=Os("Map.prototype.has",!0),Wl=function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},p_=function(r,t){var e=Wl(r,t);return e&&e.value},f_=function(r,t,e){var i=Wl(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},m_=function(r,t){return!!Wl(r,t)},g_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new o_("Side channel does not contain "+n_(n))},get:function(n){if(oa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return a_(t,n)}else if(aa){if(e)return u_(e,n)}else if(i)return p_(i,n)},has:function(n){if(oa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return l_(t,n)}else if(aa){if(e)return d_(e,n)}else if(i)return m_(i,n);return!1},set:function(n,o){oa&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new oa),h_(t,n,o)):aa?(e||(e=new aa),c_(e,n,o)):(i||(i={key:{},next:null}),f_(i,n,o))}};return s},y_=String.prototype.replace,b_=/%20/g,Bl={RFC1738:"RFC1738",RFC3986:"RFC3986"},Ul={default:Bl.RFC3986,formatters:{RFC1738:function(r){return y_.call(r,b_,"+")},RFC3986:function(r){return String(r)}},RFC1738:Bl.RFC1738,RFC3986:Bl.RFC3986},x_=Ul,Xl=Object.prototype.hasOwnProperty,Kr=Array.isArray,wi=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),__=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Kr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},mf=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},v_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Kr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Xl.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Kr(t)&&!Kr(e)&&(s=mf(t,i)),Kr(t)&&Kr(e)?(e.forEach(function(n,o){if(Xl.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return Xl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},T_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},w_=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},S_=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(u){return"%26%23"+parseInt(u.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var l=o.charCodeAt(h);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||n===x_.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+wi[l];continue}if(l<2048){a=a+(wi[192|l>>6]+wi[128|l&63]);continue}if(l<55296||l>=57344){a=a+(wi[224|l>>12]+wi[128|l>>6&63]+wi[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=wi[240|l>>18]+wi[128|l>>12&63]+wi[128|l>>6&63]+wi[128|l&63]}return a},E_=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var l=a[h],u=o[l];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(e.push({obj:o,prop:l}),i.push(u))}return __(e),t},C_=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},I_=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},A_=function(t,e){return[].concat(t,e)},R_=function(t,e){if(Kr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},gf={arrayToObject:mf,assign:T_,combine:A_,compact:E_,decode:w_,encode:S_,isBuffer:I_,isRegExp:C_,maybeMap:R_,merge:v_},yf=g_,ha=gf,Zn=Ul,M_=Object.prototype.hasOwnProperty,bf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},zi=Array.isArray,P_=Array.prototype.push,xf=function(r,t){P_.apply(r,zi(t)?t:[t])},L_=Date.prototype.toISOString,_f=Zn.default,ue={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:ha.encode,encodeValuesOnly:!1,format:_f,formatter:Zn.formatters[_f],indices:!1,serializeDate:function(t){return L_.call(t)},skipNulls:!1,strictNullHandling:!1},G_=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Zl={},N_=function r(t,e,i,s,n,o,a,h,l,u,c,d,p,m,f,g){for(var y=t,_=g,b=0,v=!1;(_=_.get(Zl))!==void 0&&!v;){var S=_.get(t);if(b+=1,typeof S<"u"){if(S===b)throw new RangeError("Cyclic object value");v=!0}typeof _.get(Zl)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=c(y):i==="comma"&&zi(y)&&(y=ha.maybeMap(y,function(K){return K instanceof Date?c(K):K})),y===null){if(n)return a&&!m?a(e,ue.encoder,f,"key",d):e;y=""}if(G_(y)||ha.isBuffer(y)){if(a){var E=m?e:a(e,ue.encoder,f,"key",d);return[p(E)+"="+p(a(y,ue.encoder,f,"value",d))]}return[p(e)+"="+p(String(y))]}var A=[];if(typeof y>"u")return A;var I;if(i==="comma"&&zi(y))m&&a&&(y=ha.maybeMap(y,a)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(zi(h))I=h;else{var P=Object.keys(y);I=l?P.sort(l):P}for(var W=s&&zi(y)&&y.length===1?e+"[]":e,D=0;D<I.length;++D){var L=I[D],C=typeof L=="object"&&typeof L.value<"u"?L.value:y[L];if(!(o&&C===null)){var N=zi(y)?typeof i=="function"?i(W,L):W:W+(u?"."+L:"["+L+"]");g.set(t,b);var U=yf();U.set(Zl,g),xf(A,r(C,N,i,s,n,o,i==="comma"&&m&&zi(y)?null:a,h,l,u,c,d,p,m,f,U))}}return A},F_=function(t){if(!t)return ue;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Zn.default;if(typeof t.format<"u"){if(!M_.call(Zn.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Zn.formatters[i],n=ue.filter;return(typeof t.filter=="function"||zi(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:typeof t.allowDots>"u"?ue.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},D_=function(r,t){var e=r,i=F_(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):zi(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in bf?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=bf[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=h==="comma"&&t&&t.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var u=yf(),c=0;c<s.length;++c){var d=s[c];i.skipNulls&&e[d]===null||xf(o,N_(e[d],d,h,l,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,u))}var p=o.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),p.length>0?m+p:""},Ws=gf,Vl=Object.prototype.hasOwnProperty,k_=Array.isArray,te={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ws.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},O_=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},vf=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},W_="utf8=%26%2310003%3B",B_="utf8=%E2%9C%93",U_=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,n),a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===B_?l="utf-8":o[h]===W_&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var u=o[h],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,p,m;d===-1?(p=e.decoder(u,te.decoder,l,"key"),m=e.strictNullHandling?null:""):(p=e.decoder(u.slice(0,d),te.decoder,l,"key"),m=Ws.maybeMap(vf(u.slice(d+1),e),function(f){return e.decoder(f,te.decoder,l,"value")})),m&&e.interpretNumericEntities&&l==="iso-8859-1"&&(m=O_(m)),u.indexOf("[]=")>-1&&(m=k_(m)?[m]:m),Vl.call(i,p)?i[p]=Ws.combine(i[p],m):i[p]=m}return i},X_=function(r,t,e,i){for(var s=i?t:vf(t,e),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&e.parseArrays)o=[].concat(s);else{o=e.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(h,10);!e.parseArrays&&h===""?o={0:s}:!isNaN(l)&&a!==h&&String(l)===h&&l>=0&&e.parseArrays&&l<=e.arrayLimit?(o=[],o[l]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},Z_=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),l=h?n.slice(0,h.index):n,u=[];if(l){if(!i.plainObjects&&Vl.call(Object.prototype,l)&&!i.allowPrototypes)return;u.push(l)}for(var c=0;i.depth>0&&(h=a.exec(n))!==null&&c<i.depth;){if(c+=1,!i.plainObjects&&Vl.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(h[1])}return h&&u.push("["+n.slice(h.index)+"]"),X_(u,e,i,s)}},V_=function(t){if(!t)return te;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=typeof t.charset>"u"?te.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?te.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:te.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:te.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:te.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:te.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:te.comma,decoder:typeof t.decoder=="function"?t.decoder:te.decoder,delimiter:typeof t.delimiter=="string"||Ws.isRegExp(t.delimiter)?t.delimiter:te.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:te.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:te.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:te.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:te.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:te.strictNullHandling}},K_=function(r,t){var e=V_(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?U_(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=Z_(a,i[a],e,typeof r=="string");s=Ws.merge(s,h,e)}return e.allowSparse===!0?s:Ws.compact(s)},H_=D_,Y_=K_,z_=Ul,j_={formats:z_,parse:Y_,stringify:H_},J_=ix;function ji(){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 $_=/^([a-z0-9.+-]+:)/i,Q_=/:[0-9]*$/,q_=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,t1=["<",">",'"',"`"," ","\r",`
5
- `," "],e1=["{","}","|","\\","^","`"].concat(t1),Kl=["'"].concat(e1),Tf=["%","/","?",";","#"].concat(Kl),wf=["/","?","#"],i1=255,Sf=/^[+a-z0-9A-Z_-]{0,63}$/,r1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,s1={javascript:!0,"javascript:":!0},Hl={javascript:!0,"javascript:":!0},Bs={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Yl=j_;function n1(r,t,e){if(r&&typeof r=="object"&&r instanceof ji)return r;var i=new ji;return i.parse(r,t,e),i}ji.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var h=q_.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Yl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=$_.exec(a);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var c=a.substr(0,2)==="//";c&&!(l&&Hl[l])&&(a=a.substr(2),this.slashes=!0)}if(!Hl[l]&&(c||l&&!Bs[l])){for(var d=-1,p=0;p<wf.length;p++){var m=a.indexOf(wf[p]);m!==-1&&(d===-1||m<d)&&(d=m)}var f,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(f=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(f)),d=-1;for(var p=0;p<Tf.length;p++){var m=a.indexOf(Tf[p]);m!==-1&&(d===-1||m<d)&&(d=m)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var _=this.hostname.split(/\./),p=0,b=_.length;p<b;p++){var v=_[p];if(v&&!v.match(Sf)){for(var S="",E=0,A=v.length;E<A;E++)v.charCodeAt(E)>127?S+="x":S+=v[E];if(!S.match(Sf)){var I=_.slice(0,p),P=_.slice(p+1),W=v.match(r1);W&&(I.push(W[1]),P.unshift(W[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>i1?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=J_.toASCII(this.hostname));var D=this.port?":"+this.port:"",L=this.hostname||"";this.host=L+D,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!s1[u])for(var p=0,b=Kl.length;p<b;p++){var C=Kl[p];if(a.indexOf(C)!==-1){var N=encodeURIComponent(C);N===C&&(N=escape(C)),a=a.split(C).join(N)}}var U=a.indexOf("#");U!==-1&&(this.hash=a.substr(U),a=a.slice(0,U));var K=a.indexOf("?");if(K!==-1?(this.search=a.substr(K),this.query=a.substr(K+1),t&&(this.query=Yl.parse(this.query)),a=a.slice(0,K)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Bs[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var D=this.pathname||"",Z=this.search||"";this.path=D+Z}return this.href=this.format(),this},ji.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=Yl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Bs[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+s+e+o+i},ji.prototype.resolve=function(r){return this.resolveObject(n1(r,!1,!0)).format()},ji.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new ji;t.parse(r,!1,!0),r=t}for(var e=new ji,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(e[h]=r[h])}return Bs[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Bs[r.protocol]){for(var l=Object.keys(r),u=0;u<l.length;u++){var c=l[u];e[c]=r[c]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Hl[r.protocol]){for(var b=(r.pathname||"").split("/");b.length&&!(r.host=b.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),e.pathname=b.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",p=e.search||"";e.path=d+p}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var m=e.pathname&&e.pathname.charAt(0)==="/",f=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=f||m||e.host&&r.pathname,y=g,_=e.pathname&&e.pathname.split("/")||[],b=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!Bs[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(b[0]===""?b[0]=r.host:b.unshift(r.host)),r.host=null),g=g&&(b[0]===""||_[0]==="")),f)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,_=b;else if(b.length)_||(_=[]),_.pop(),_=_.concat(b),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=_.shift(),e.hostname=e.host;var S=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;S&&(e.auth=S.shift(),e.hostname=S.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var E=_.slice(-1)[0],A=(e.host||r.host||_.length>1)&&(E==="."||E==="..")||E==="",I=0,P=_.length;P>=0;P--)E=_[P],E==="."?_.splice(P,1):E===".."?(_.splice(P,1),I++):I&&(_.splice(P,1),I--);if(!g&&!y)for(;I--;I)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),A&&_.join("/").substr(-1)!=="/"&&_.push("");var W=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(v){e.hostname=W?"":_.length?_.shift():"",e.host=e.hostname;var S=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;S&&(e.auth=S.shift(),e.hostname=S.shift(),e.host=e.hostname)}return g=g||e.host&&_.length,g&&!W&&_.unshift(""),_.length>0?e.pathname=_.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},ji.prototype.parseHost=function(){var r=this.host,t=Q_.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Ef={};function Tt(r,t,e=3){if(Ef[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
4
+ `+t.prev}function oa(r,t){var e=Fl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=mr(r,s)?t(r[s],r):""}var n=typeof Ll=="function"?Ll(r):[],o;if(Os){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)mr(r,h)&&(e&&String(Number(h))===h&&h<r.length||Os&&o["$"+h]instanceof Symbol||(tf.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Ll=="function")for(var l=0;l<n.length;l++)sf.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Ol=El,Ws=Rx,n_=Bx,o_=Ol("%TypeError%"),aa=Ol("%WeakMap%",!0),ha=Ol("%Map%",!0),a_=Ws("WeakMap.prototype.get",!0),h_=Ws("WeakMap.prototype.set",!0),l_=Ws("WeakMap.prototype.has",!0),u_=Ws("Map.prototype.get",!0),c_=Ws("Map.prototype.set",!0),d_=Ws("Map.prototype.has",!0),Wl=function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},p_=function(r,t){var e=Wl(r,t);return e&&e.value},f_=function(r,t,e){var i=Wl(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},m_=function(r,t){return!!Wl(r,t)},g_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new o_("Side channel does not contain "+n_(n))},get:function(n){if(aa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return a_(t,n)}else if(ha){if(e)return u_(e,n)}else if(i)return p_(i,n)},has:function(n){if(aa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return l_(t,n)}else if(ha){if(e)return d_(e,n)}else if(i)return m_(i,n);return!1},set:function(n,o){aa&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new aa),h_(t,n,o)):ha?(e||(e=new ha),c_(e,n,o)):(i||(i={key:{},next:null}),f_(i,n,o))}};return s},y_=String.prototype.replace,b_=/%20/g,Bl={RFC1738:"RFC1738",RFC3986:"RFC3986"},Ul={default:Bl.RFC3986,formatters:{RFC1738:function(r){return y_.call(r,b_,"+")},RFC3986:function(r){return String(r)}},RFC1738:Bl.RFC1738,RFC3986:Bl.RFC3986},x_=Ul,Xl=Object.prototype.hasOwnProperty,Kr=Array.isArray,wi=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),__=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Kr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},mf=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},v_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Kr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Xl.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Kr(t)&&!Kr(e)&&(s=mf(t,i)),Kr(t)&&Kr(e)?(e.forEach(function(n,o){if(Xl.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return Xl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},T_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},w_=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},S_=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(u){return"%26%23"+parseInt(u.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var l=o.charCodeAt(h);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||n===x_.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+wi[l];continue}if(l<2048){a=a+(wi[192|l>>6]+wi[128|l&63]);continue}if(l<55296||l>=57344){a=a+(wi[224|l>>12]+wi[128|l>>6&63]+wi[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=wi[240|l>>18]+wi[128|l>>12&63]+wi[128|l>>6&63]+wi[128|l&63]}return a},E_=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var l=a[h],u=o[l];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(e.push({obj:o,prop:l}),i.push(u))}return __(e),t},C_=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},I_=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},A_=function(t,e){return[].concat(t,e)},R_=function(t,e){if(Kr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},gf={arrayToObject:mf,assign:T_,combine:A_,compact:E_,decode:w_,encode:S_,isBuffer:I_,isRegExp:C_,maybeMap:R_,merge:v_},yf=g_,la=gf,Vn=Ul,M_=Object.prototype.hasOwnProperty,bf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},zi=Array.isArray,P_=Array.prototype.push,xf=function(r,t){P_.apply(r,zi(t)?t:[t])},L_=Date.prototype.toISOString,_f=Vn.default,ue={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:la.encode,encodeValuesOnly:!1,format:_f,formatter:Vn.formatters[_f],indices:!1,serializeDate:function(t){return L_.call(t)},skipNulls:!1,strictNullHandling:!1},G_=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Zl={},N_=function r(t,e,i,s,n,o,a,h,l,u,c,d,p,m,f,g){for(var y=t,_=g,b=0,v=!1;(_=_.get(Zl))!==void 0&&!v;){var S=_.get(t);if(b+=1,typeof S<"u"){if(S===b)throw new RangeError("Cyclic object value");v=!0}typeof _.get(Zl)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=c(y):i==="comma"&&zi(y)&&(y=la.maybeMap(y,function(K){return K instanceof Date?c(K):K})),y===null){if(n)return a&&!m?a(e,ue.encoder,f,"key",d):e;y=""}if(G_(y)||la.isBuffer(y)){if(a){var E=m?e:a(e,ue.encoder,f,"key",d);return[p(E)+"="+p(a(y,ue.encoder,f,"value",d))]}return[p(e)+"="+p(String(y))]}var I=[];if(typeof y>"u")return I;var A;if(i==="comma"&&zi(y))m&&a&&(y=la.maybeMap(y,a)),A=[{value:y.length>0?y.join(",")||null:void 0}];else if(zi(h))A=h;else{var P=Object.keys(y);A=l?P.sort(l):P}for(var O=s&&zi(y)&&y.length===1?e+"[]":e,W=0;W<A.length;++W){var L=A[W],C=typeof L=="object"&&typeof L.value<"u"?L.value:y[L];if(!(o&&C===null)){var N=zi(y)?typeof i=="function"?i(O,L):O:O+(u?"."+L:"["+L+"]");g.set(t,b);var X=yf();X.set(Zl,g),xf(I,r(C,N,i,s,n,o,i==="comma"&&m&&zi(y)?null:a,h,l,u,c,d,p,m,f,X))}}return I},F_=function(t){if(!t)return ue;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Vn.default;if(typeof t.format<"u"){if(!M_.call(Vn.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Vn.formatters[i],n=ue.filter;return(typeof t.filter=="function"||zi(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:typeof t.allowDots>"u"?ue.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},D_=function(r,t){var e=r,i=F_(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):zi(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in bf?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=bf[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=h==="comma"&&t&&t.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var u=yf(),c=0;c<s.length;++c){var d=s[c];i.skipNulls&&e[d]===null||xf(o,N_(e[d],d,h,l,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,u))}var p=o.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),p.length>0?m+p:""},Bs=gf,Vl=Object.prototype.hasOwnProperty,k_=Array.isArray,te={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Bs.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},O_=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},vf=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},W_="utf8=%26%2310003%3B",B_="utf8=%E2%9C%93",U_=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,n),a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===B_?l="utf-8":o[h]===W_&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var u=o[h],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,p,m;d===-1?(p=e.decoder(u,te.decoder,l,"key"),m=e.strictNullHandling?null:""):(p=e.decoder(u.slice(0,d),te.decoder,l,"key"),m=Bs.maybeMap(vf(u.slice(d+1),e),function(f){return e.decoder(f,te.decoder,l,"value")})),m&&e.interpretNumericEntities&&l==="iso-8859-1"&&(m=O_(m)),u.indexOf("[]=")>-1&&(m=k_(m)?[m]:m),Vl.call(i,p)?i[p]=Bs.combine(i[p],m):i[p]=m}return i},X_=function(r,t,e,i){for(var s=i?t:vf(t,e),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&e.parseArrays)o=[].concat(s);else{o=e.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(h,10);!e.parseArrays&&h===""?o={0:s}:!isNaN(l)&&a!==h&&String(l)===h&&l>=0&&e.parseArrays&&l<=e.arrayLimit?(o=[],o[l]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},Z_=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),l=h?n.slice(0,h.index):n,u=[];if(l){if(!i.plainObjects&&Vl.call(Object.prototype,l)&&!i.allowPrototypes)return;u.push(l)}for(var c=0;i.depth>0&&(h=a.exec(n))!==null&&c<i.depth;){if(c+=1,!i.plainObjects&&Vl.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(h[1])}return h&&u.push("["+n.slice(h.index)+"]"),X_(u,e,i,s)}},V_=function(t){if(!t)return te;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=typeof t.charset>"u"?te.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?te.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:te.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:te.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:te.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:te.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:te.comma,decoder:typeof t.decoder=="function"?t.decoder:te.decoder,delimiter:typeof t.delimiter=="string"||Bs.isRegExp(t.delimiter)?t.delimiter:te.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:te.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:te.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:te.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:te.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:te.strictNullHandling}},K_=function(r,t){var e=V_(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?U_(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=Z_(a,i[a],e,typeof r=="string");s=Bs.merge(s,h,e)}return e.allowSparse===!0?s:Bs.compact(s)},H_=D_,Y_=K_,z_=Ul,j_={formats:z_,parse:Y_,stringify:H_},J_=ix;function ji(){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 $_=/^([a-z0-9.+-]+:)/i,Q_=/:[0-9]*$/,q_=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,t1=["<",">",'"',"`"," ","\r",`
5
+ `," "],e1=["{","}","|","\\","^","`"].concat(t1),Kl=["'"].concat(e1),Tf=["%","/","?",";","#"].concat(Kl),wf=["/","?","#"],i1=255,Sf=/^[+a-z0-9A-Z_-]{0,63}$/,r1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,s1={javascript:!0,"javascript:":!0},Hl={javascript:!0,"javascript:":!0},Us={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Yl=j_;function n1(r,t,e){if(r&&typeof r=="object"&&r instanceof ji)return r;var i=new ji;return i.parse(r,t,e),i}ji.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var h=q_.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Yl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=$_.exec(a);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var c=a.substr(0,2)==="//";c&&!(l&&Hl[l])&&(a=a.substr(2),this.slashes=!0)}if(!Hl[l]&&(c||l&&!Us[l])){for(var d=-1,p=0;p<wf.length;p++){var m=a.indexOf(wf[p]);m!==-1&&(d===-1||m<d)&&(d=m)}var f,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(f=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(f)),d=-1;for(var p=0;p<Tf.length;p++){var m=a.indexOf(Tf[p]);m!==-1&&(d===-1||m<d)&&(d=m)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var _=this.hostname.split(/\./),p=0,b=_.length;p<b;p++){var v=_[p];if(v&&!v.match(Sf)){for(var S="",E=0,I=v.length;E<I;E++)v.charCodeAt(E)>127?S+="x":S+=v[E];if(!S.match(Sf)){var A=_.slice(0,p),P=_.slice(p+1),O=v.match(r1);O&&(A.push(O[1]),P.unshift(O[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=A.join(".");break}}}this.hostname.length>i1?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=J_.toASCII(this.hostname));var W=this.port?":"+this.port:"",L=this.hostname||"";this.host=L+W,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!s1[u])for(var p=0,b=Kl.length;p<b;p++){var C=Kl[p];if(a.indexOf(C)!==-1){var N=encodeURIComponent(C);N===C&&(N=escape(C)),a=a.split(C).join(N)}}var X=a.indexOf("#");X!==-1&&(this.hash=a.substr(X),a=a.slice(0,X));var K=a.indexOf("?");if(K!==-1?(this.search=a.substr(K),this.query=a.substr(K+1),t&&(this.query=Yl.parse(this.query)),a=a.slice(0,K)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Us[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var W=this.pathname||"",Z=this.search||"";this.path=W+Z}return this.href=this.format(),this},ji.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=Yl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Us[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+s+e+o+i},ji.prototype.resolve=function(r){return this.resolveObject(n1(r,!1,!0)).format()},ji.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new ji;t.parse(r,!1,!0),r=t}for(var e=new ji,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(e[h]=r[h])}return Us[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Us[r.protocol]){for(var l=Object.keys(r),u=0;u<l.length;u++){var c=l[u];e[c]=r[c]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Hl[r.protocol]){for(var b=(r.pathname||"").split("/");b.length&&!(r.host=b.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),e.pathname=b.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",p=e.search||"";e.path=d+p}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var m=e.pathname&&e.pathname.charAt(0)==="/",f=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=f||m||e.host&&r.pathname,y=g,_=e.pathname&&e.pathname.split("/")||[],b=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!Us[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(b[0]===""?b[0]=r.host:b.unshift(r.host)),r.host=null),g=g&&(b[0]===""||_[0]==="")),f)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,_=b;else if(b.length)_||(_=[]),_.pop(),_=_.concat(b),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=_.shift(),e.hostname=e.host;var S=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;S&&(e.auth=S.shift(),e.hostname=S.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var E=_.slice(-1)[0],I=(e.host||r.host||_.length>1)&&(E==="."||E==="..")||E==="",A=0,P=_.length;P>=0;P--)E=_[P],E==="."?_.splice(P,1):E===".."?(_.splice(P,1),A++):A&&(_.splice(P,1),A--);if(!g&&!y)for(;A--;A)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),I&&_.join("/").substr(-1)!=="/"&&_.push("");var O=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(v){e.hostname=O?"":_.length?_.shift():"",e.host=e.hostname;var S=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;S&&(e.auth=S.shift(),e.hostname=S.shift(),e.host=e.hostname)}return g=g||e.host&&_.length,g&&!O&&_.unshift(""),_.length>0?e.pathname=_.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},ji.prototype.parseHost=function(){var r=this.host,t=Q_.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Ef={};function Tt(r,t,e=3){if(Ef[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
6
6
  Deprecated since v${r}`):(i=i.split(`
7
7
  `).splice(e).join(`
8
8
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
9
9
  Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
10
- Deprecated since v${r}`),console.warn(i))),Ef[t]=!0}function ei(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Vn(r){return r.split("?")[0].split("#")[0]}function o1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a1(r,t,e){return r.replace(new RegExp(o1(t),"g"),e)}function h1(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const Jt={toPosix(r){return a1(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){ei(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(ei(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=Vn(this.toPosix(t??q.ADAPTER.getBaseUrl())),s=Vn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Jt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(ei(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=h1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return ei(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const i=r[e];if(ei(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.extname(s)?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(ei(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){ei(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){ei(r),t&&ei(t),r=Vn(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){ei(r),r=Vn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){ei(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Vn(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,h=!0,l=r.length-1,u=0;for(;l>=s;--l){if(e=r.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||a===-1||u===0||u===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":"};let zl;async function l1(){return zl??(zl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return xe.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return xe.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?xe.PMA:xe.UNPACK})()),zl}let jl;function u1(){return typeof jl>"u"&&(jl=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!q.ADAPTER.getWebGLRenderingContext())return!1;const e=q.ADAPTER.createCanvas();let i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),jl}var c1={grad:.9,turn:360,rad:360/(2*Math.PI)},Ji=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ee=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},We=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Cf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},If=function(r){return{r:We(r.r,0,255),g:We(r.g,0,255),b:We(r.b,0,255),a:We(r.a)}},Jl=function(r){return{r:ee(r.r),g:ee(r.g),b:ee(r.b),a:ee(r.a,3)}},d1=/^#([0-9a-f]{3,8})$/i,la=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Af=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Rf=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:s}},Mf=function(r){return{h:Cf(r.h),s:We(r.s,0,100),l:We(r.l,0,100),a:We(r.a)}},Pf=function(r){return{h:ee(r.h),s:ee(r.s),l:ee(r.l),a:ee(r.a,3)}},Lf=function(r){return Rf((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Kn=function(r){return{h:(t=Af(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},p1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,f1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,g1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$l={string:[[function(r){var t=d1.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ee(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ee(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=m1.exec(r)||g1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:If({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=p1.exec(r)||f1.exec(r);if(!t)return null;var e,i,s=Mf({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(c1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Lf(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Ji(t)&&Ji(e)&&Ji(i)?If({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Ji(t)||!Ji(e)||!Ji(i))return null;var o=Mf({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Lf(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Ji(t)||!Ji(e)||!Ji(i))return null;var o=function(a){return{h:Cf(a.h),s:We(a.s,0,100),v:We(a.v,0,100),a:We(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Rf(o)},"hsv"]]},Gf=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},y1=function(r){return typeof r=="string"?Gf(r.trim(),$l.string):typeof r=="object"&&r!==null?Gf(r,$l.object):[null,void 0]},Ql=function(r,t){var e=Kn(r);return{h:e.h,s:We(e.s+100*t,0,100),l:e.l,a:e.a}},ql=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Nf=function(r,t){var e=Kn(r);return{h:e.h,s:e.s,l:We(e.l+100*t,0,100),a:e.a}},tu=function(){function r(t){this.parsed=y1(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ee(ql(this.rgba),2)},r.prototype.isDark=function(){return ql(this.rgba)<.5},r.prototype.isLight=function(){return ql(this.rgba)>=.5},r.prototype.toHex=function(){return t=Jl(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?la(ee(255*n)):"","#"+la(e)+la(i)+la(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return Jl(this.rgba)},r.prototype.toRgbString=function(){return t=Jl(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return Pf(Kn(this.rgba))},r.prototype.toHslString=function(){return t=Pf(Kn(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=Af(this.rgba),{h:ee(t.h),s:ee(t.s),v:ee(t.v),a:ee(t.a,3)};var t},r.prototype.invert=function(){return Si({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Si(Ql(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Si(Ql(this.rgba,-t))},r.prototype.grayscale=function(){return Si(Ql(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Si(Nf(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Si(Nf(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Si({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ee(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Kn(this.rgba);return typeof t=="number"?Si({h:t,s:e.s,l:e.l,a:e.a}):ee(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Si(t).toHex()},r}(),Si=function(r){return r instanceof tu?r:new tu(r)},Ff=[],b1=function(r){r.forEach(function(t){Ff.indexOf(t)<0&&(t(tu,$l),Ff.push(t))})};function x1(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var p in e)n[p]=new r(e[p]).toRgb();for(var m in e){var f=(a=u,h=n[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));f<c&&(c=f,d=m)}return d}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new r(h).toRgb():null},"name"])}b1([x1]);const Us=class ol{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof ol)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=ol.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=ol.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Si(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};Us.shared=new Us,Us.temp=new Us,Us.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Gt=Us;function _1(r){return Tt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Gt.shared.setValue(r).toHex()}function v1(r){return Tt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Gt.shared.setValue(r).toNumber()}function T1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[ct.NORMAL_NPM]=ct.NORMAL,r[ct.ADD_NPM]=ct.ADD,r[ct.SCREEN_NPM]=ct.SCREEN,t[ct.NORMAL]=ct.NORMAL_NPM,t[ct.ADD]=ct.ADD_NPM,t[ct.SCREEN]=ct.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Df=T1();function kf(r,t){return Df[t?1:0][r]}function w1(r,t=null){const e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function Of(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function ua(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Wf(r){return!(r&r-1)&&!!r}function Bf(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Xs(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}function yr(r){return r===0?0:r<0?-1:1}let S1=0;function Hr(){return++S1}const eu=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};eu.EMPTY=new eu(0,0,0,0);let Uf=eu;const Xf={},Ei=Object.create(null),br=Object.create(null);class E1{constructor(t,e,i){this._canvas=q.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||q.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function Zf(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function Vf(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function C1(r){const{width:t,height:e}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,t,e).data;let n=0,o=0,a=t-1,h=e-1;for(;o<e&&Zf(s,t,o);)++o;if(o===e)return Uf.EMPTY;for(;Zf(s,t,h);)--h;for(;Vf(s,t,n,o,h);)++n;for(;Vf(s,t,a,o,h);)--a;return++a,++h,new Uf(n,o,a,h)}function I1(r){const t=C1(r),{width:e,height:i}=t;let s=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:s}}function A1(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function $i(r,t=1){var i;const e=(i=q.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var J=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(J||{});const iu=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Kf=(r,t)=>iu(r).priority??t,it={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(iu).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(iu).forEach(t=>{t.type.forEach(e=>{const i=this._addHandlers,s=this._queue;i[e]?i[e](t):(s[e]=s[e]||[],s[e].push(t))})}),this},handle(r,t,e){const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;const n=this._queue;return n[r]&&(n[r].forEach(o=>t(o)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{t[e.name]=e.ref},e=>{delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>Kf(n,e)-Kf(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class ru{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const R1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
10
+ Deprecated since v${r}`),console.warn(i))),Ef[t]=!0}function ii(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Kn(r){return r.split("?")[0].split("#")[0]}function o1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a1(r,t,e){return r.replace(new RegExp(o1(t),"g"),e)}function h1(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const Jt={toPosix(r){return a1(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){ii(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(ii(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=Kn(this.toPosix(t??q.ADAPTER.getBaseUrl())),s=Kn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Jt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(ii(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=h1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return ii(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const i=r[e];if(ii(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.extname(s)?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(ii(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){ii(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){ii(r),t&&ii(t),r=Kn(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){ii(r),r=Kn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){ii(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Kn(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,h=!0,l=r.length-1,u=0;for(;l>=s;--l){if(e=r.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||a===-1||u===0||u===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":"};let zl;async function l1(){return zl??(zl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return _e.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return _e.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?_e.PMA:_e.UNPACK})()),zl}let jl;function u1(){return typeof jl>"u"&&(jl=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!q.ADAPTER.getWebGLRenderingContext())return!1;const e=q.ADAPTER.createCanvas();let i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),jl}var c1={grad:.9,turn:360,rad:360/(2*Math.PI)},Ji=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ee=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ue=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Cf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},If=function(r){return{r:Ue(r.r,0,255),g:Ue(r.g,0,255),b:Ue(r.b,0,255),a:Ue(r.a)}},Jl=function(r){return{r:ee(r.r),g:ee(r.g),b:ee(r.b),a:ee(r.a,3)}},d1=/^#([0-9a-f]{3,8})$/i,ua=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Af=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Rf=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:s}},Mf=function(r){return{h:Cf(r.h),s:Ue(r.s,0,100),l:Ue(r.l,0,100),a:Ue(r.a)}},Pf=function(r){return{h:ee(r.h),s:ee(r.s),l:ee(r.l),a:ee(r.a,3)}},Lf=function(r){return Rf((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Hn=function(r){return{h:(t=Af(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},p1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,f1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,g1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$l={string:[[function(r){var t=d1.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ee(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ee(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=m1.exec(r)||g1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:If({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=p1.exec(r)||f1.exec(r);if(!t)return null;var e,i,s=Mf({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(c1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Lf(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Ji(t)&&Ji(e)&&Ji(i)?If({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Ji(t)||!Ji(e)||!Ji(i))return null;var o=Mf({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Lf(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Ji(t)||!Ji(e)||!Ji(i))return null;var o=function(a){return{h:Cf(a.h),s:Ue(a.s,0,100),v:Ue(a.v,0,100),a:Ue(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Rf(o)},"hsv"]]},Gf=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},y1=function(r){return typeof r=="string"?Gf(r.trim(),$l.string):typeof r=="object"&&r!==null?Gf(r,$l.object):[null,void 0]},Ql=function(r,t){var e=Hn(r);return{h:e.h,s:Ue(e.s+100*t,0,100),l:e.l,a:e.a}},ql=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Nf=function(r,t){var e=Hn(r);return{h:e.h,s:e.s,l:Ue(e.l+100*t,0,100),a:e.a}},tu=function(){function r(t){this.parsed=y1(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ee(ql(this.rgba),2)},r.prototype.isDark=function(){return ql(this.rgba)<.5},r.prototype.isLight=function(){return ql(this.rgba)>=.5},r.prototype.toHex=function(){return t=Jl(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?ua(ee(255*n)):"","#"+ua(e)+ua(i)+ua(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return Jl(this.rgba)},r.prototype.toRgbString=function(){return t=Jl(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return Pf(Hn(this.rgba))},r.prototype.toHslString=function(){return t=Pf(Hn(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=Af(this.rgba),{h:ee(t.h),s:ee(t.s),v:ee(t.v),a:ee(t.a,3)};var t},r.prototype.invert=function(){return Si({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Si(Ql(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Si(Ql(this.rgba,-t))},r.prototype.grayscale=function(){return Si(Ql(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Si(Nf(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Si(Nf(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Si({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ee(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Hn(this.rgba);return typeof t=="number"?Si({h:t,s:e.s,l:e.l,a:e.a}):ee(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Si(t).toHex()},r}(),Si=function(r){return r instanceof tu?r:new tu(r)},Ff=[],b1=function(r){r.forEach(function(t){Ff.indexOf(t)<0&&(t(tu,$l),Ff.push(t))})};function x1(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var p in e)n[p]=new r(e[p]).toRgb();for(var m in e){var f=(a=u,h=n[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));f<c&&(c=f,d=m)}return d}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new r(h).toRgb():null},"name"])}b1([x1]);const Xs=class ol{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof ol)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=ol.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=ol.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Si(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};Xs.shared=new Xs,Xs.temp=new Xs,Xs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Gt=Xs;function _1(r){return Tt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Gt.shared.setValue(r).toHex()}function v1(r){return Tt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Gt.shared.setValue(r).toNumber()}function T1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[ct.NORMAL_NPM]=ct.NORMAL,r[ct.ADD_NPM]=ct.ADD,r[ct.SCREEN_NPM]=ct.SCREEN,t[ct.NORMAL]=ct.NORMAL_NPM,t[ct.ADD]=ct.ADD_NPM,t[ct.SCREEN]=ct.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Df=T1();function kf(r,t){return Df[t?1:0][r]}function w1(r,t=null){const e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function Of(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function ca(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Wf(r){return!(r&r-1)&&!!r}function Bf(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Zs(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}function yr(r){return r===0?0:r<0?-1:1}let S1=0;function Hr(){return++S1}const eu=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};eu.EMPTY=new eu(0,0,0,0);let Uf=eu;const Xf={},Ei=Object.create(null),br=Object.create(null);class E1{constructor(t,e,i){this._canvas=q.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||q.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function Zf(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function Vf(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function C1(r){const{width:t,height:e}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,t,e).data;let n=0,o=0,a=t-1,h=e-1;for(;o<e&&Zf(s,t,o);)++o;if(o===e)return Uf.EMPTY;for(;Zf(s,t,h);)--h;for(;Vf(s,t,n,o,h);)++n;for(;Vf(s,t,a,o,h);)--a;return++a,++h,new Uf(n,o,a,h)}function I1(r){const t=C1(r),{width:e,height:i}=t;let s=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:s}}function A1(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function $i(r,t=1){var i;const e=(i=q.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var J=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(J||{});const iu=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Kf=(r,t)=>iu(r).priority??t,it={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(iu).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(iu).forEach(t=>{t.type.forEach(e=>{const i=this._addHandlers,s=this._queue;i[e]?i[e](t):(s[e]=s[e]||[],s[e].push(t))})}),this},handle(r,t,e){const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;const n=this._queue;return n[r]&&(n[r].forEach(o=>t(o)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{t[e.name]=e.ref},e=>{delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>Kf(n,e)-Kf(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class ru{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const R1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
11
  `);function M1(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
12
- else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function P1(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=R1.replace(/%forloop%/gi,M1(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const su=0,nu=1,ou=2,au=3,hu=4,lu=5;class Ci{constructor(){this.data=0,this.blendMode=ct.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<su)}set blend(t){!!(this.data&1<<su)!==t&&(this.data^=1<<su)}get offsets(){return!!(this.data&1<<nu)}set offsets(t){!!(this.data&1<<nu)!==t&&(this.data^=1<<nu)}get culling(){return!!(this.data&1<<ou)}set culling(t){!!(this.data&1<<ou)!==t&&(this.data^=1<<ou)}get depthTest(){return!!(this.data&1<<au)}set depthTest(t){!!(this.data&1<<au)!==t&&(this.data^=1<<au)}get depthMask(){return!!(this.data&1<<lu)}set depthMask(t){!!(this.data&1<<lu)!==t&&(this.data^=1<<lu)}get clockwiseFrontFace(){return!!(this.data&1<<hu)}set clockwiseFrontFace(t){!!(this.data&1<<hu)!==t&&(this.data^=1<<hu)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==ct.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ci;return t.depthTest=!1,t.blend=!0,t}}Ci.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const uu=[];function Hf(r,t){if(!r)return null;let e="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=uu.length-1;i>=0;--i){const s=uu[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ii{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,i,s,n,o,a,h);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ii.prototype,{dispatch:{value:ii.prototype.emit},run:{value:ii.prototype.emit}});class Hn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ii("setRealSize"),this.onUpdate=new ii("update"),this.onError=new ii("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class ca extends Hn{constructor(t,e){const{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===xe.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const L1={scaleMode:Vi.NEAREST,alphaMode:xe.NPM},cu=class Rn extends Fn{constructor(t=null,e=null){super(),e=Object.assign({},Rn.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:u,type:c,target:d,resolution:p,resourceOptions:m}=e;t&&!(t instanceof Hn)&&(t=Hf(t,m),t.internal=!0),this.resolution=p||q.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=u,this.type=c,this.target=d,this.alphaMode=i,this.uid=Hr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Wf(this.realWidth)&&Wf(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete br[this.cacheId],delete Ei[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Rn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Hr()}`}n=t._pixiId}let o=br[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Rn(t,e),o.cacheId=n,Rn.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new ca(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=H.RGBA,a=at.FLOAT):t instanceof Int32Array?(o=H.RGBA_INTEGER,a=at.INT):t instanceof Uint32Array?(o=H.RGBA_INTEGER,a=at.UNSIGNED_INT):t instanceof Int16Array?(o=H.RGBA_INTEGER,a=at.SHORT):t instanceof Uint16Array?(o=H.RGBA_INTEGER,a=at.UNSIGNED_SHORT):t instanceof Int8Array?(o=H.RGBA,a=at.BYTE):(o=H.RGBA,a=at.UNSIGNED_BYTE),n.internal=!0,new Rn(n,Object.assign({},L1,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),br[e]&&br[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),br[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=br[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete br[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete br[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};cu.defaultOptions={mipmap:xi.POW2,anisotropicLevel:0,scaleMode:Vi.LINEAR,wrapMode:Ki.CLAMP,alphaMode:xe.UNPACK,target:Ms.TEXTURE_2D,format:H.RGBA,type:at.UNSIGNED_BYTE},cu._globalBatch=0;let mt=cu;class du{constructor(){this.texArray=null,this.blend=0,this.type=bi.TRIANGLES,this.start=0,this.size=0,this.data=null}}let G1=0;class Kt{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=G1++,this.disposeRunner=new ii("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?vi.ELEMENT_ARRAY_BUFFER:vi.ARRAY_BUFFER}get index(){return this.type===vi.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Kt(t)}}class da{constructor(t,e=0,i=!1,s=at.FLOAT,n,o,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,n){return new da(t,e,i,s,n)}}const N1={Float32Array,Uint32Array,Int32Array,Uint8Array};function F1(r,t){let e=0,i=0;const s={};for(let h=0;h<r.length;h++)i+=t[h],e+=r[h].length;const n=new ArrayBuffer(e*4);let o=null,a=0;for(let h=0;h<r.length;h++){const l=t[h],u=r[h],c=Of(u);s[c]||(s[c]=new N1[c](n)),o=s[c];for(let d=0;d<u.length;d++){const p=(d/l|0)*i+a,m=d%l;o[p+m]=u[d]}a+=l}return new Float32Array(n)}const Yf={5126:4,5123:2,5121:1};let D1=0;const k1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class xr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=D1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ii("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,o,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Kt||(e instanceof Array&&(e=new Float32Array(e)),e=new Kt(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,i,s,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new da(u,i,s,n,o,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Kt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Kt(t)),t.type=vi.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],i=new Kt;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*Yf[n.type]/4),n.buffer=0}for(i.data=F1(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new xr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Kt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new da(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=vi.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new xr,i=[],s=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)s[h]=s[h]||0,s[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new k1[Of(o.buffers[a].data)](s[a]),e.buffers[a]=new Kt(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=vi.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,u=0;for(let c=0;c<o.buffers.length;c++)if(o.buffers[c]!==o.indexBuffer){u=c;break}for(const c in o.attributes){const d=o.attributes[c];(d.buffer|0)===u&&(h+=d.size*Yf[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let p=0;p<d.length;p++)e.indexBuffer.data[p+l]+=a;a+=t[c].buffers[u].data.length/h,l+=d.length}}return e}}class zf extends xr{constructor(t=!1){super(),this._buffer=new Kt(null,t,!1),this._indexBuffer=new Kt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,at.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,at.FLOAT).addAttribute("aColor",this._buffer,4,!0,at.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,at.FLOAT).addIndex(this._indexBuffer)}}const pa=Math.PI*2,O1=180/Math.PI,W1=Math.PI/180;var ae=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(ae||{});class lt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new lt(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}}lt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const fa=[new lt,new lt,new lt,new lt];class dt{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=ae.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 dt(0,0,0,0)}clone(){return new dt(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const I=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=I)return!1;const P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=fa[0].set(t.left,t.top),h=fa[1].set(t.left,t.bottom),l=fa[2].set(t.right,t.top),u=fa[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(a.x,h.x,l.x,u.x)<=i||Math.min(a.x,h.x,l.x,u.x)>=s||Math.max(a.y,h.y,l.y,u.y)<=n||Math.min(a.y,h.y,l.y,u.y)>=o))return!1;const d=c*(h.y-a.y),p=c*(a.x-h.x),m=d*i+p*n,f=d*s+p*n,g=d*i+p*o,y=d*s+p*o;if(Math.max(m,f,g,y)<=d*a.x+p*a.y||Math.min(m,f,g,y)>=d*u.x+p*u.y)return!1;const _=c*(a.y-l.y),b=c*(l.x-a.x),v=_*i+b*n,S=_*s+b*n,E=_*i+b*o,A=_*s+b*o;return!(Math.max(v,S,E,A)<=_*a.x+b*a.y||Math.min(v,S,E,A)>=_*u.x+b*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}}dt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ma{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=ae.CIRC}clone(){return new ma(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new dt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}ma.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class ga{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=ae.ELIP}clone(){return new ga(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new dt(this.x-this.width,this.y-this.height,this.width,this.height)}}ga.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Yr{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=ae.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Yr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],u=this.points[o*2+1];h>e!=u>e&&t<(l-a)*((e-h)/(u-h))+a&&(i=!i)}return i}}Yr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class ya{constructor(t=0,e=0,i=0,s=0,n=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n,this.type=ae.RREC}clone(){return new ya(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}}ya.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Nt{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new lt;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new lt;const i=1/(this.a*this.d+this.c*-this.b),s=t.x,n=t.y;return e.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(pa-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,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 Nt;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 Nt}static get TEMP_MATRIX(){return new Nt}}Nt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const zr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],jr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Jr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],$r=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],pu=[],jf=[],ba=Math.sign;function B1(){for(let r=0;r<16;r++){const t=[];pu.push(t);for(let e=0;e<16;e++){const i=ba(zr[r]*zr[e]+Jr[r]*jr[e]),s=ba(jr[r]*zr[e]+$r[r]*jr[e]),n=ba(zr[r]*Jr[e]+Jr[r]*$r[e]),o=ba(jr[r]*Jr[e]+$r[r]*$r[e]);for(let a=0;a<16;a++)if(zr[a]===i&&jr[a]===s&&Jr[a]===n&&$r[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Nt;t.set(zr[r],jr[r],Jr[r],$r[r],0,0),jf.push(t)}}B1();const kt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>zr[r],uY:r=>jr[r],vX:r=>Jr[r],vY:r=>$r[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>pu[r][t],sub:(r,t)=>pu[r][kt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?kt.S:kt.N:Math.abs(t)*2<=Math.abs(r)?r>0?kt.E:kt.W:t>0?r>0?kt.SE:kt.SW:r>0?kt.NE:kt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=jf[kt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class Qi{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new Qi(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))}}Qi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const fu=class{constructor(){this.worldTransform=new Nt,this.localTransform=new Nt,this.position=new Qi(this.onChange,this,0,0),this.scale=new Qi(this.onChange,this,1,1),this.pivot=new Qi(this.onChange,this,0,0),this.skew=new Qi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){const e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};fu.IDENTITY=new fu;let mu=fu;mu.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var U1=`varying vec2 vTextureCoord;
12
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function P1(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=R1.replace(/%forloop%/gi,M1(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const su=0,nu=1,ou=2,au=3,hu=4,lu=5;class Ci{constructor(){this.data=0,this.blendMode=ct.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<su)}set blend(t){!!(this.data&1<<su)!==t&&(this.data^=1<<su)}get offsets(){return!!(this.data&1<<nu)}set offsets(t){!!(this.data&1<<nu)!==t&&(this.data^=1<<nu)}get culling(){return!!(this.data&1<<ou)}set culling(t){!!(this.data&1<<ou)!==t&&(this.data^=1<<ou)}get depthTest(){return!!(this.data&1<<au)}set depthTest(t){!!(this.data&1<<au)!==t&&(this.data^=1<<au)}get depthMask(){return!!(this.data&1<<lu)}set depthMask(t){!!(this.data&1<<lu)!==t&&(this.data^=1<<lu)}get clockwiseFrontFace(){return!!(this.data&1<<hu)}set clockwiseFrontFace(t){!!(this.data&1<<hu)!==t&&(this.data^=1<<hu)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==ct.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ci;return t.depthTest=!1,t.blend=!0,t}}Ci.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const uu=[];function Hf(r,t){if(!r)return null;let e="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=uu.length-1;i>=0;--i){const s=uu[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ri{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,i,s,n,o,a,h);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ri.prototype,{dispatch:{value:ri.prototype.emit},run:{value:ri.prototype.emit}});class Yn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ri("setRealSize"),this.onUpdate=new ri("update"),this.onError=new ri("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class da extends Yn{constructor(t,e){const{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===_e.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const L1={scaleMode:Vi.NEAREST,alphaMode:_e.NPM},cu=class Mn extends Dn{constructor(t=null,e=null){super(),e=Object.assign({},Mn.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:u,type:c,target:d,resolution:p,resourceOptions:m}=e;t&&!(t instanceof Yn)&&(t=Hf(t,m),t.internal=!0),this.resolution=p||q.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=u,this.type=c,this.target=d,this.alphaMode=i,this.uid=Hr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Wf(this.realWidth)&&Wf(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete br[this.cacheId],delete Ei[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Mn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Hr()}`}n=t._pixiId}let o=br[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Mn(t,e),o.cacheId=n,Mn.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new da(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=H.RGBA,a=at.FLOAT):t instanceof Int32Array?(o=H.RGBA_INTEGER,a=at.INT):t instanceof Uint32Array?(o=H.RGBA_INTEGER,a=at.UNSIGNED_INT):t instanceof Int16Array?(o=H.RGBA_INTEGER,a=at.SHORT):t instanceof Uint16Array?(o=H.RGBA_INTEGER,a=at.UNSIGNED_SHORT):t instanceof Int8Array?(o=H.RGBA,a=at.BYTE):(o=H.RGBA,a=at.UNSIGNED_BYTE),n.internal=!0,new Mn(n,Object.assign({},L1,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),br[e]&&br[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),br[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=br[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete br[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete br[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};cu.defaultOptions={mipmap:xi.POW2,anisotropicLevel:0,scaleMode:Vi.LINEAR,wrapMode:Ki.CLAMP,alphaMode:_e.UNPACK,target:Ps.TEXTURE_2D,format:H.RGBA,type:at.UNSIGNED_BYTE},cu._globalBatch=0;let mt=cu;class du{constructor(){this.texArray=null,this.blend=0,this.type=bi.TRIANGLES,this.start=0,this.size=0,this.data=null}}let G1=0;class Kt{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=G1++,this.disposeRunner=new ri("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?vi.ELEMENT_ARRAY_BUFFER:vi.ARRAY_BUFFER}get index(){return this.type===vi.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Kt(t)}}class pa{constructor(t,e=0,i=!1,s=at.FLOAT,n,o,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,n){return new pa(t,e,i,s,n)}}const N1={Float32Array,Uint32Array,Int32Array,Uint8Array};function F1(r,t){let e=0,i=0;const s={};for(let h=0;h<r.length;h++)i+=t[h],e+=r[h].length;const n=new ArrayBuffer(e*4);let o=null,a=0;for(let h=0;h<r.length;h++){const l=t[h],u=r[h],c=Of(u);s[c]||(s[c]=new N1[c](n)),o=s[c];for(let d=0;d<u.length;d++){const p=(d/l|0)*i+a,m=d%l;o[p+m]=u[d]}a+=l}return new Float32Array(n)}const Yf={5126:4,5123:2,5121:1};let D1=0;const k1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class xr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=D1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ri("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,o,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Kt||(e instanceof Array&&(e=new Float32Array(e)),e=new Kt(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,i,s,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new pa(u,i,s,n,o,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Kt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Kt(t)),t.type=vi.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],i=new Kt;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*Yf[n.type]/4),n.buffer=0}for(i.data=F1(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new xr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Kt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new pa(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=vi.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new xr,i=[],s=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)s[h]=s[h]||0,s[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new k1[Of(o.buffers[a].data)](s[a]),e.buffers[a]=new Kt(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=vi.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,u=0;for(let c=0;c<o.buffers.length;c++)if(o.buffers[c]!==o.indexBuffer){u=c;break}for(const c in o.attributes){const d=o.attributes[c];(d.buffer|0)===u&&(h+=d.size*Yf[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let p=0;p<d.length;p++)e.indexBuffer.data[p+l]+=a;a+=t[c].buffers[u].data.length/h,l+=d.length}}return e}}class zf extends xr{constructor(t=!1){super(),this._buffer=new Kt(null,t,!1),this._indexBuffer=new Kt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,at.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,at.FLOAT).addAttribute("aColor",this._buffer,4,!0,at.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,at.FLOAT).addIndex(this._indexBuffer)}}const fa=Math.PI*2,O1=180/Math.PI,W1=Math.PI/180;var he=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(he||{});class lt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new lt(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}}lt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const ma=[new lt,new lt,new lt,new lt];class dt{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=he.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 dt(0,0,0,0)}clone(){return new dt(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;const P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=ma[0].set(t.left,t.top),h=ma[1].set(t.left,t.bottom),l=ma[2].set(t.right,t.top),u=ma[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(a.x,h.x,l.x,u.x)<=i||Math.min(a.x,h.x,l.x,u.x)>=s||Math.max(a.y,h.y,l.y,u.y)<=n||Math.min(a.y,h.y,l.y,u.y)>=o))return!1;const d=c*(h.y-a.y),p=c*(a.x-h.x),m=d*i+p*n,f=d*s+p*n,g=d*i+p*o,y=d*s+p*o;if(Math.max(m,f,g,y)<=d*a.x+p*a.y||Math.min(m,f,g,y)>=d*u.x+p*u.y)return!1;const _=c*(a.y-l.y),b=c*(l.x-a.x),v=_*i+b*n,S=_*s+b*n,E=_*i+b*o,I=_*s+b*o;return!(Math.max(v,S,E,I)<=_*a.x+b*a.y||Math.min(v,S,E,I)>=_*u.x+b*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}}dt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ga{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=he.CIRC}clone(){return new ga(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new dt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}ga.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class ya{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=he.ELIP}clone(){return new ya(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new dt(this.x-this.width,this.y-this.height,this.width,this.height)}}ya.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Yr{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=he.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Yr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],u=this.points[o*2+1];h>e!=u>e&&t<(l-a)*((e-h)/(u-h))+a&&(i=!i)}return i}}Yr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class ba{constructor(t=0,e=0,i=0,s=0,n=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n,this.type=he.RREC}clone(){return new ba(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}}ba.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Nt{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new lt;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new lt;const i=1/(this.a*this.d+this.c*-this.b),s=t.x,n=t.y;return e.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(fa-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,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 Nt;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 Nt}static get TEMP_MATRIX(){return new Nt}}Nt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const zr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],jr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Jr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],$r=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],pu=[],jf=[],xa=Math.sign;function B1(){for(let r=0;r<16;r++){const t=[];pu.push(t);for(let e=0;e<16;e++){const i=xa(zr[r]*zr[e]+Jr[r]*jr[e]),s=xa(jr[r]*zr[e]+$r[r]*jr[e]),n=xa(zr[r]*Jr[e]+Jr[r]*$r[e]),o=xa(jr[r]*Jr[e]+$r[r]*$r[e]);for(let a=0;a<16;a++)if(zr[a]===i&&jr[a]===s&&Jr[a]===n&&$r[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Nt;t.set(zr[r],jr[r],Jr[r],$r[r],0,0),jf.push(t)}}B1();const kt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>zr[r],uY:r=>jr[r],vX:r=>Jr[r],vY:r=>$r[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>pu[r][t],sub:(r,t)=>pu[r][kt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?kt.S:kt.N:Math.abs(t)*2<=Math.abs(r)?r>0?kt.E:kt.W:t>0?r>0?kt.SE:kt.SW:r>0?kt.NE:kt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=jf[kt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class Qi{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new Qi(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))}}Qi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const fu=class{constructor(){this.worldTransform=new Nt,this.localTransform=new Nt,this.position=new Qi(this.onChange,this,0,0),this.scale=new Qi(this.onChange,this,1,1),this.pivot=new Qi(this.onChange,this,0,0),this.skew=new Qi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){const e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};fu.IDENTITY=new fu;let mu=fu;mu.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var U1=`varying vec2 vTextureCoord;
13
13
 
14
14
  uniform sampler2D uSampler;
15
15
 
@@ -26,7 +26,7 @@ void main(void){
26
26
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
27
27
  vTextureCoord = aTextureCoord;
28
28
  }
29
- `;function Jf(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function gu(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function $f(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return gu(2*t);case"bvec3":return gu(3*t);case"bvec4":return gu(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const Zs=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
29
+ `;function Jf(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function gu(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function $f(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return gu(2*t);case"bvec3":return gu(3*t);case"bvec4":return gu(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const Vs=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
30
30
  if(uv["${r}"] !== ud["${r}"].value)
31
31
  {
32
32
  ud["${r}"].value = uv["${r}"]
@@ -292,18 +292,18 @@ void main(void){
292
292
  renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}');
293
293
  `):e.push(`
294
294
  renderer.shader.syncUniformGroup(uv.${s}, syncData);
295
- `));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<Zs.length;h++)if(Zs[h].test(n,o)){e.push(Zs[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?Z1:V1)[n.type].replace("location",`ud["${s}"].location`);e.push(`
295
+ `));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<Vs.length;h++)if(Vs[h].test(n,o)){e.push(Vs[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?Z1:V1)[n.type].replace("location",`ud["${s}"].location`);e.push(`
296
296
  cu = ud["${s}"];
297
297
  cv = cu.value;
298
298
  v = uv["${s}"];
299
299
  ${h};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
300
- `))}const Qf={};let Vs=Qf;function H1(){if(Vs===Qf||Vs!=null&&Vs.isContextLost()){const r=q.ADAPTER.createCanvas();let t;q.PREFER_ENV>=Ur.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Vs=t}return Vs}let xa;function Y1(){if(!xa){xa=Oe.MEDIUM;const r=H1();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(xa=t.precision?Oe.HIGH:Oe.MEDIUM)}}return xa}function qf(r,t){const e=r.getShaderSource(t).split(`
300
+ `))}const Qf={};let Ks=Qf;function H1(){if(Ks===Qf||Ks!=null&&Ks.isContextLost()){const r=q.ADAPTER.createCanvas();let t;q.PREFER_ENV>=Ur.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Ks=t}return Ks}let _a;function Y1(){if(!_a){_a=Be.MEDIUM;const r=H1();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(_a=t.precision?Be.HIGH:Be.MEDIUM)}}return _a}function qf(r,t){const e=r.getShaderSource(t).split(`
301
301
  `).map((l,u)=>`${u}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(`
302
302
  `),n={},o=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),a=[""];o.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(`
303
- `);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function z1(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||qf(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||qf(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const j1={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 tm(r){return j1[r]}let _a=null;const em={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 im(r,t){if(!_a){const e=Object.keys(em);_a={};for(let i=0;i<e.length;++i){const s=e[i];_a[r[s]]=em[s]}}return _a[t]}function rm(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Oe.HIGH&&e!==Oe.HIGH&&(i=Oe.MEDIUM),`precision ${i} float;
304
- ${r}`}else if(e!==Oe.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let Yn;function J1(){if(typeof Yn=="boolean")return Yn;try{Yn=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Yn=!1}return Yn}let $1=0;const va={},yu=class Mn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=$1++,this.vertexSrc=t||Mn.defaultVertexSrc,this.fragmentSrc=e||Mn.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),va[i]?(va[i]++,i+=`-${va[i]}`):va[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
303
+ `);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function z1(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||qf(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||qf(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const j1={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 tm(r){return j1[r]}let va=null;const em={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 im(r,t){if(!va){const e=Object.keys(em);va={};for(let i=0;i<e.length;++i){const s=e[i];va[r[s]]=em[s]}}return va[t]}function rm(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Be.HIGH&&e!==Be.HIGH&&(i=Be.MEDIUM),`precision ${i} float;
304
+ ${r}`}else if(e!==Be.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let zn;function J1(){if(typeof zn=="boolean")return zn;try{zn=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{zn=!1}return zn}let $1=0;const Ta={},yu=class Pn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=$1++,this.vertexSrc=t||Pn.defaultVertexSrc,this.fragmentSrc=e||Pn.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),Ta[i]?(Ta[i]++,i+=`-${Ta[i]}`):Ta[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
305
305
  ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
306
- ${this.fragmentSrc}`,this.vertexSrc=rm(this.vertexSrc,Mn.defaultVertexPrecision,Oe.HIGH),this.fragmentSrc=rm(this.fragmentSrc,Mn.defaultFragmentPrecision,Y1())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return X1}static get defaultFragmentSrc(){return U1}static from(t,e,i){const s=t+e;let n=Xf[s];return n||(Xf[s]=n=new Mn(t,e,i)),n}};yu.defaultVertexPrecision=Oe.HIGH,yu.defaultFragmentPrecision=Yi.apple.device?Oe.HIGH:Oe.MEDIUM;let qi=yu,Q1=0;class ri{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Q1++,this.static=!!e,this.ubo=!!i,t instanceof Kt?(this.buffer=t,this.buffer.type=vi.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Kt(new Float32Array(1)),this.buffer.type=vi.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new ri(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new ri(t,e,i)}static uboFrom(t,e){return new ri(t,e??!0,!0)}}class Ii{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof ri?this.uniformGroup=e:this.uniformGroup=new ri(e):this.uniformGroup=new ri({}),this.disposeRunner=new ii("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const i in e.uniforms){const s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){const s=qi.from(t,e);return new Ii(s,i)}}class q1{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const i=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n;this.defaultGroupCache[t]=ri.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new qi(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:this.defaultGroupCache[t]};return new Ii(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
306
+ ${this.fragmentSrc}`,this.vertexSrc=rm(this.vertexSrc,Pn.defaultVertexPrecision,Be.HIGH),this.fragmentSrc=rm(this.fragmentSrc,Pn.defaultFragmentPrecision,Y1())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return X1}static get defaultFragmentSrc(){return U1}static from(t,e,i){const s=t+e;let n=Xf[s];return n||(Xf[s]=n=new Pn(t,e,i)),n}};yu.defaultVertexPrecision=Be.HIGH,yu.defaultFragmentPrecision=Yi.apple.device?Be.HIGH:Be.MEDIUM;let qi=yu,Q1=0;class si{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Q1++,this.static=!!e,this.ubo=!!i,t instanceof Kt?(this.buffer=t,this.buffer.type=vi.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Kt(new Float32Array(1)),this.buffer.type=vi.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new si(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new si(t,e,i)}static uboFrom(t,e){return new si(t,e??!0,!0)}}class Ii{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof si?this.uniformGroup=e:this.uniformGroup=new si(e):this.uniformGroup=new si({}),this.disposeRunner=new ri("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const i in e.uniforms){const s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){const s=qi.from(t,e);return new Ii(s,i)}}class q1{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const i=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n;this.defaultGroupCache[t]=si.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new qi(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:this.defaultGroupCache[t]};return new Ii(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
307
307
  `,e+=`
308
308
  `;for(let i=0;i<t;i++)i>0&&(e+=`
309
309
  else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
@@ -311,7 +311,7 @@ else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
311
311
  color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
312
312
  }`;return e+=`
313
313
  `,e+=`
314
- `,e}}class bu{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function tv(){return!Yi.apple.device}function ev(r){let t=!0;const e=q.ADAPTER.getNavigator();if(Yi.tablet||Yi.phone){if(Yi.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Yi.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class Ta{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var iv=`varying vec2 vTextureCoord;
314
+ `,e}}class bu{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function tv(){return!Yi.apple.device}function ev(r){let t=!0;const e=q.ADAPTER.getNavigator();if(Yi.tablet||Yi.phone){if(Yi.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Yi.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class wa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var iv=`varying vec2 vTextureCoord;
315
315
  varying vec4 vColor;
316
316
  varying float vTextureId;
317
317
  uniform sampler2D uSamplers[%count%];
@@ -342,7 +342,7 @@ void main(void){
342
342
  vTextureId = aTextureId;
343
343
  vColor = aColor * tint;
344
344
  }
345
- `;const zn=class yi extends Ta{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=zf,this.vertexSize=6,this.state=Ci.for2d(),this.size=yi.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??ev(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??tv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return Tt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return rv}static get defaultFragmentTemplate(){return iv}setShaderGenerator({vertex:t=yi.defaultVertexSrc,fragment:e=yi.defaultFragmentTemplate}={}){this.shaderGenerator=new q1(t,e)}contextChange(){const t=this.renderer.gl;q.PREFER_ENV===Ur.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),yi.defaultMaxTextures),this.maxTextures=P1(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=yi,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new du);for(;e.length<s;)e.push(new bu);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,i=yi._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++mt._globalBatch,h=0,l=i[0],u=0;s.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,u,c),u=c,l=i[++h],++a),d._batchEnabled=a,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++a);for(let c=0;c<n.length;c++)n[c]=null;mt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=yi._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let p=e;p<i;++p){const m=s[p],f=m._texture.baseTexture,g=Df[f.alphaMode?1:0][m.blendMode];s[p]=null,e<p&&d.blend!==g&&(d.size=c-d.start,e=p,d=h[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(m,n,o,u,c),u+=m.vertexData.length/2*a,c+=m.indices.length,d.blend=g}e<i&&(d.size=c-d.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;yi.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:i}=this.renderer,s=yi._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:h,size:l,start:u,blend:c}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=c,i.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,u*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),yi.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=ua(Math.ceil(t/8)),i=Bf(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[s];return n||(this._aBuffers[s]=n=new ru(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=ua(Math.ceil(t/12)),i=Bf(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(s)),n}packInterleavedGeometry(t,e,i,s,n){const{uint32View:o,float32View:a}=e,h=s/this.vertexSize,l=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,p=Math.min(t.worldAlpha,1),m=Gt.shared.setValue(t._tintRGB).toPremultiplied(p,t._texture.baseTexture.alphaMode>0);for(let f=0;f<c.length;f+=2)a[s++]=c[f],a[s++]=c[f+1],a[s++]=l[f],a[s++]=l[f+1],o[s++]=m,a[s++]=d;for(let f=0;f<u.length;f++)i[n++]=h+u[f]}};zn.defaultBatchSize=4096,zn.extension={name:"batch",type:J.RendererPlugin},zn._drawCallPool=[],zn._textureArrayPool=[];let Qr=zn;it.add(Qr);var sv=`varying vec2 vTextureCoord;
345
+ `;const jn=class yi extends wa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=zf,this.vertexSize=6,this.state=Ci.for2d(),this.size=yi.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??ev(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??tv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return Tt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return rv}static get defaultFragmentTemplate(){return iv}setShaderGenerator({vertex:t=yi.defaultVertexSrc,fragment:e=yi.defaultFragmentTemplate}={}){this.shaderGenerator=new q1(t,e)}contextChange(){const t=this.renderer.gl;q.PREFER_ENV===Ur.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),yi.defaultMaxTextures),this.maxTextures=P1(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=yi,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new du);for(;e.length<s;)e.push(new bu);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,i=yi._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++mt._globalBatch,h=0,l=i[0],u=0;s.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,u,c),u=c,l=i[++h],++a),d._batchEnabled=a,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++a);for(let c=0;c<n.length;c++)n[c]=null;mt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=yi._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let p=e;p<i;++p){const m=s[p],f=m._texture.baseTexture,g=Df[f.alphaMode?1:0][m.blendMode];s[p]=null,e<p&&d.blend!==g&&(d.size=c-d.start,e=p,d=h[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(m,n,o,u,c),u+=m.vertexData.length/2*a,c+=m.indices.length,d.blend=g}e<i&&(d.size=c-d.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;yi.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:i}=this.renderer,s=yi._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:h,size:l,start:u,blend:c}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=c,i.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,u*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),yi.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=ca(Math.ceil(t/8)),i=Bf(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[s];return n||(this._aBuffers[s]=n=new ru(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=ca(Math.ceil(t/12)),i=Bf(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(s)),n}packInterleavedGeometry(t,e,i,s,n){const{uint32View:o,float32View:a}=e,h=s/this.vertexSize,l=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,p=Math.min(t.worldAlpha,1),m=Gt.shared.setValue(t._tintRGB).toPremultiplied(p,t._texture.baseTexture.alphaMode>0);for(let f=0;f<c.length;f+=2)a[s++]=c[f],a[s++]=c[f+1],a[s++]=l[f],a[s++]=l[f+1],o[s++]=m,a[s++]=d;for(let f=0;f<u.length;f++)i[n++]=h+u[f]}};jn.defaultBatchSize=4096,jn.extension={name:"batch",type:J.RendererPlugin},jn._drawCallPool=[],jn._textureArrayPool=[];let Qr=jn;it.add(Qr);var sv=`varying vec2 vTextureCoord;
346
346
 
347
347
  uniform sampler2D uSampler;
348
348
 
@@ -375,7 +375,7 @@ void main(void)
375
375
  gl_Position = filterVertexPosition();
376
376
  vTextureCoord = filterTextureCoord();
377
377
  }
378
- `;const xu=class Zo extends Ii{constructor(t,e,i){const s=qi.from(t||Zo.defaultVertexSrc,e||Zo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Zo.defaultResolution,this.multisample=Zo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ci}apply(t,e,i,s,n){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return nv}static get defaultFragmentSrc(){return sv}};xu.defaultResolution=1,xu.defaultMultisample=Yt.NONE;let ge=xu;class wa{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Gt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:s}=t,n=i??e;n!==void 0&&(this.color=n),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}wa.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},wa.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"background"},it.add(wa);class sm{constructor(t){this.renderer=t,this.emptyRenderer=new Ta(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){const{elements:n,ids:o,count:a}=t;let h=0;for(let l=0;l<a;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<s&&e[c]===u){o[l]=c;continue}for(;h<s;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,u._batchLocation=h,e[h]=u;break}}}destroy(){this.renderer=null}}sm.extension={type:J.RendererSystem,name:"batch"},it.add(sm);let nm=0;class Sa{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=nm++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=nm++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(q.PREFER_ENV>=Ur.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Sa.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Sa.extension={type:J.RendererSystem,name:"context"},it.add(Sa);class _u{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new ii("disposeFramebuffer"),this.multisample=Yt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new mt(null,{scaleMode:Vi.NEAREST,resolution:1,mipmap:xi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new mt(null,{scaleMode:Vi.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:xi.OFF,format:H.DEPTH_COMPONENT,type:at.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const s=this.colorTextures[i],n=s.resolution;s.setSize(t/n,e/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class om extends mt{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],s=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:s,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Yt.NONE),super(null,t),this.mipmap=xi.OFF,this.valid=!0,this._clear=new Gt([0,0,0,0]),this.framebuffer=new _u(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class _r extends Hn{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.width,s=e.naturalHeight||e.videoHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=A1(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){const n=t.gl,o=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===xe.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=o,i.height=a,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class am extends _r{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;_r.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??q.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===xe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0;const n=e._glTextures;for(const o in n){const a=n[o];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class vu{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,h=t.x/s+o,l=t.y/n+a;i=kt.add(i,kt.NW),this.x0=h+o*kt.uX(i),this.y0=l+a*kt.uY(i),i=kt.add(i,2),this.x1=h+o*kt.uX(i),this.y1=l+a*kt.uY(i),i=kt.add(i,2),this.x2=h+o*kt.uX(i),this.y2=l+a*kt.uY(i),i=kt.add(i,2),this.x3=h+o*kt.uX(i),this.y3=l+a*kt.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}vu.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const hm=new vu;function Ea(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class rt extends Fn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new dt(0,0,1,1)),t instanceof rt&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=hm,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=o?new lt(o.x,o.y):new lt(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&Ei[e.url]&&rt.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,rt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new rt(this.baseTexture,!this.noFrame&&t,e,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===hm&&(this._uvs=new vu),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof mt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${Hr()}`,mt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Hr()}`}n=t._pixiId}let o=Ei[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof mt)?(e.resolution||(e.resolution=$i(t)),o=new rt(new mt(t,e)),o.baseTexture.cacheId=n,mt.addToCache(o.baseTexture,n),rt.addToCache(o,n)):!o&&t instanceof mt&&(o=new rt(t),rt.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=rt.from(t,Object.assign({resourceOptions:i},e),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new rt(mt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new mt(t,Object.assign({scaleMode:mt.defaultOptions.scaleMode,resolution:$i(e)},s)),{resource:o}=n;o instanceof am&&(o.url=e);const a=new rt(n);return i||(i=e),mt.addToCache(a.baseTexture,i),rt.addToCache(a,i),i!==e&&(mt.addToCache(a.baseTexture,e),rt.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Ei[e]&&Ei[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Ei[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ei[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Ei[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Ei[t.textureCacheIds[e]]===t&&delete Ei[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:i,width:s,height:n}=t,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,u=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=s&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return rt._EMPTY||(rt._EMPTY=new rt(new mt),Ea(rt._EMPTY),Ea(rt._EMPTY.baseTexture)),rt._EMPTY}static get WHITE(){if(!rt._WHITE){const t=q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),rt._WHITE=new rt(mt.from(t)),Ea(rt._WHITE),Ea(rt._WHITE.baseTexture)}return rt._WHITE}}class qr extends rt{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){const s=this.baseTexture.resolution,n=Math.round(t*s)/s,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),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 qr(new om(t))}}class lm{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Yt.NONE){const s=new om(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new qr(s)}getOptimalTexture(t,e,i=1,s=Yt.NONE){let n;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=ua(t),e=ua(e),n=((t&65535)<<16|e&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(t,e,i){const s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Yt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}lm.SCREEN_KEY=-1;class ov extends xr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class um extends xr{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Kt(this.vertices),this.uvBuffer=new Kt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class av{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Yt.NONE,this.sourceFrame=new dt,this.destinationFrame=new dt,this.bindingSourceFrame=new dt,this.bindingDestinationFrame=new dt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ca=[new lt,new lt,new lt,new lt],Tu=new Nt;class cm{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new lm,this.statePool=[],this.quad=new ov,this.quadUv=new um,this.tempRect=new dt,this.activeState={},this.globalUniforms=new ri({outputFrame:new dt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const i=this.renderer,s=this.defaultFilterStack,n=this.statePool.pop()||new av,o=i.renderTexture;let a,h;if(o.current){const g=o.current;a=g.resolution,h=g.multisample}else a=i.resolution,h=i.multisample;let l=e[0].resolution||a,u=e[0].multisample??h,c=e[0].padding,d=e[0].autoFit,p=e[0].legacy??!0;for(let g=1;g<e.length;g++){const y=e[g];l=Math.min(l,y.resolution||a),u=Math.min(u,y.multisample??h),c=this.useMaxPadding?Math.max(c,y.padding):c+y.padding,d=d&&y.autoFit,p=p||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=l,n.multisample=u,n.legacy=p,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(c);const m=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(Tu.copyFrom(i.projection.transform).invert(),m),d?(n.sourceFrame.fit(m),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(m)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,u),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const f=this.tempRect;f.x=0,f.y=0,f.width=n.sourceFrame.width,f.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,f),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;const n=s.inputSize,o=s.inputPixel,a=s.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*n[2]-.5*o[2],a[3]=e.sourceFrame.height*n[3]-.5*o[3],e.legacy){const l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,h.renderTexture,_i.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let c=0;for(c=0;c<i.length-1;++c){c===1&&e.multisample>1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),i[c].apply(this,l,u,_i.CLEAR,e);const d=l;l=u,u=d}i[c].apply(this,l,h.renderTexture,_i.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=_i.CLEAR){const{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0:t.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(e===_i.CLEAR||e===_i.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(bi.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(bi.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=e._texture,o=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Nt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Yt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Yt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=Ca[0],s=Ca[1],n=Ca[2],o=Ca[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),l=Math.max(i.x,s.x,n.x,o.x),u=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,e.height=u-h}roundFrame(t,e,i,s,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:h,d:l}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?Tu.copyFrom(n):Tu.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}cm.extension={type:J.RendererSystem,name:"filter"},it.add(cm);class hv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Yt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const lv=new dt;class dm{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new _u(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new dt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;q.PREFER_ENV===Ur.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){const{gl:s}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let o=0;o<t.colorTextures.length;o++){const a=t.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>i,a=e.height>>i,h=o/e.width;this.setViewport(e.x*h,e.y*h,o,a)}else{const o=t.width>>i,a=t.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(n.width!==i||n.height!==s||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,n=pl.COLOR|pl.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new hv(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const s=t.colorTextures;let n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let o=n.length;i.drawBuffers||(o=Math.min(o,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const a=[];for(let h=0;h<o;h++){const l=n[h],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),h===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,l.target,u._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH_STENCIL):t.depth&&t.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH24_STENCIL8):t.depth?(h=i.DEPTH_ATTACHMENT,l=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,l=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,l,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,l,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=Yt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Yt.NONE),i}blit(t,e,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;const u=s.colorTextures[0];if(!u)return;h.blitFramebuffer||(h.blitFramebuffer=new _u(s.width,s.height),h.blitFramebuffer.addColorTexture(0,u)),t=h.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=lv,e.width=s.width,e.height=s.height),i||(i=e);const l=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const i=t.width,s=t.height,n=this.gl,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,i,s):n.renderbufferStorage(n.RENDERBUFFER,h,i,s),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new dt}destroy(){this.renderer=null}}dm.extension={type:J.RendererSystem,name:"framebuffer"},it.add(dm);const wu={5126:4,5123:2,5121:1};class pm{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;q.PREFER_ENV===Ur.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n),t.drawElementsInstanced=(s,n,o,a,h)=>i.drawElementsInstancedANGLE(s,n,o,a,h),t.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=this;let s=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const o=s[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){const i=t.attributes,s=e.attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,s=e.attributeData,n=["g",t.id];for(const o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(t,e,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[h];if(u)return l[a.id]=u,u;const c=t.buffers,d=t.attributes,p={},m={};for(const f in c)p[f]=0,m[f]=0;for(const f in d)!d[f].size&&a.attributeData[f]?d[f].size=a.attributeData[f].size:d[f].size||console.warn(`PIXI Geometry attribute '${f}' size cannot be determined (likely the bound shader does not have the attribute)`),p[d[f].buffer]+=d[f].size*wu[d[f].type];for(const f in d){const g=d[f],y=g.size;g.stride===void 0&&(p[g.buffer]===y*wu[g.type]?g.stride=0:g.stride=p[g.buffer]),g.start===void 0&&(g.start=m[g.buffer],m[g.buffer]+=y*wu[g.type])}u=s.createVertexArray(),s.bindVertexArray(u);for(let f=0;f<c.length;f++){const g=c[f];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=u,l[h]=u,s.bindVertexArray(null),o.unbind(vi.ARRAY_BUFFER),u}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const l=n[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(n[h],e))}if(!e){for(const h in i)if(h[0]==="g"){const l=i[h];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,o=t.buffers,a=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in a){const u=a[l],c=o[u.buffer],d=c._glBuffers[s];if(e.attributeData[l]){h!==d&&(n.bind(c),h=d);const p=e.attributeData[l].location;if(i.enableVertexAttribArray(p),i.vertexAttribPointer(p,u.size,u.type||i.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)i.vertexAttribDivisor(p,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,h,(i||0)*a,s||1):n.drawElements(t,e||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),s||1):n.drawArrays(t,i,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}pm.extension={type:J.RendererSystem,name:"geometry"},it.add(pm);const fm=new Nt;class mm{constructor(t,e){this._texture=t,this.mapCoord=new Nt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let s=0;s<t.length;s+=2){const n=t[s],o=t[s+1];e[s]=n*i.a+o*i.c+i.tx,e[s+1]=n*i.b+o*i.d+i.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const s=e.orig,n=e.trim;n&&(fm.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(fm));const o=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/o.width,a[1]=(e._frame.y+h+l)/o.height,a[2]=(e._frame.x+e._frame.width-h+l)/o.width,a[3]=(e._frame.y+e._frame.height-h+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var uv=`varying vec2 vMaskCoord;
378
+ `;const xu=class Vo extends Ii{constructor(t,e,i){const s=qi.from(t||Vo.defaultVertexSrc,e||Vo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Vo.defaultResolution,this.multisample=Vo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ci}apply(t,e,i,s,n){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return nv}static get defaultFragmentSrc(){return sv}};xu.defaultResolution=1,xu.defaultMultisample=Yt.NONE;let ge=xu;class Sa{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Gt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:s}=t,n=i??e;n!==void 0&&(this.color=n),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}Sa.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Sa.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"background"},it.add(Sa);class sm{constructor(t){this.renderer=t,this.emptyRenderer=new wa(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){const{elements:n,ids:o,count:a}=t;let h=0;for(let l=0;l<a;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<s&&e[c]===u){o[l]=c;continue}for(;h<s;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,u._batchLocation=h,e[h]=u;break}}}destroy(){this.renderer=null}}sm.extension={type:J.RendererSystem,name:"batch"},it.add(sm);let nm=0;class Ea{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=nm++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=nm++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(q.PREFER_ENV>=Ur.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Ea.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ea.extension={type:J.RendererSystem,name:"context"},it.add(Ea);class _u{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new ri("disposeFramebuffer"),this.multisample=Yt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new mt(null,{scaleMode:Vi.NEAREST,resolution:1,mipmap:xi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new mt(null,{scaleMode:Vi.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:xi.OFF,format:H.DEPTH_COMPONENT,type:at.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const s=this.colorTextures[i],n=s.resolution;s.setSize(t/n,e/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class om extends mt{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],s=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:s,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Yt.NONE),super(null,t),this.mipmap=xi.OFF,this.valid=!0,this._clear=new Gt([0,0,0,0]),this.framebuffer=new _u(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class _r extends Yn{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.width,s=e.naturalHeight||e.videoHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=A1(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){const n=t.gl,o=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===_e.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=o,i.height=a,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class am extends _r{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;_r.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??q.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===_e.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0;const n=e._glTextures;for(const o in n){const a=n[o];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class vu{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,h=t.x/s+o,l=t.y/n+a;i=kt.add(i,kt.NW),this.x0=h+o*kt.uX(i),this.y0=l+a*kt.uY(i),i=kt.add(i,2),this.x1=h+o*kt.uX(i),this.y1=l+a*kt.uY(i),i=kt.add(i,2),this.x2=h+o*kt.uX(i),this.y2=l+a*kt.uY(i),i=kt.add(i,2),this.x3=h+o*kt.uX(i),this.y3=l+a*kt.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}vu.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const hm=new vu;function Ca(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class rt extends Dn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new dt(0,0,1,1)),t instanceof rt&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=hm,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=o?new lt(o.x,o.y):new lt(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&Ei[e.url]&&rt.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,rt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new rt(this.baseTexture,!this.noFrame&&t,e,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===hm&&(this._uvs=new vu),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof mt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${Hr()}`,mt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Hr()}`}n=t._pixiId}let o=Ei[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof mt)?(e.resolution||(e.resolution=$i(t)),o=new rt(new mt(t,e)),o.baseTexture.cacheId=n,mt.addToCache(o.baseTexture,n),rt.addToCache(o,n)):!o&&t instanceof mt&&(o=new rt(t),rt.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=rt.from(t,Object.assign({resourceOptions:i},e),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new rt(mt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new mt(t,Object.assign({scaleMode:mt.defaultOptions.scaleMode,resolution:$i(e)},s)),{resource:o}=n;o instanceof am&&(o.url=e);const a=new rt(n);return i||(i=e),mt.addToCache(a.baseTexture,i),rt.addToCache(a,i),i!==e&&(mt.addToCache(a.baseTexture,e),rt.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Ei[e]&&Ei[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Ei[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ei[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Ei[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Ei[t.textureCacheIds[e]]===t&&delete Ei[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:i,width:s,height:n}=t,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,u=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=s&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return rt._EMPTY||(rt._EMPTY=new rt(new mt),Ca(rt._EMPTY),Ca(rt._EMPTY.baseTexture)),rt._EMPTY}static get WHITE(){if(!rt._WHITE){const t=q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),rt._WHITE=new rt(mt.from(t)),Ca(rt._WHITE),Ca(rt._WHITE.baseTexture)}return rt._WHITE}}class qr extends rt{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){const s=this.baseTexture.resolution,n=Math.round(t*s)/s,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),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 qr(new om(t))}}class lm{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Yt.NONE){const s=new om(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new qr(s)}getOptimalTexture(t,e,i=1,s=Yt.NONE){let n;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=ca(t),e=ca(e),n=((t&65535)<<16|e&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(t,e,i){const s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Yt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}lm.SCREEN_KEY=-1;class ov extends xr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class um extends xr{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Kt(this.vertices),this.uvBuffer=new Kt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class av{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Yt.NONE,this.sourceFrame=new dt,this.destinationFrame=new dt,this.bindingSourceFrame=new dt,this.bindingDestinationFrame=new dt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ia=[new lt,new lt,new lt,new lt],Tu=new Nt;class cm{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new lm,this.statePool=[],this.quad=new ov,this.quadUv=new um,this.tempRect=new dt,this.activeState={},this.globalUniforms=new si({outputFrame:new dt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const i=this.renderer,s=this.defaultFilterStack,n=this.statePool.pop()||new av,o=i.renderTexture;let a,h;if(o.current){const g=o.current;a=g.resolution,h=g.multisample}else a=i.resolution,h=i.multisample;let l=e[0].resolution||a,u=e[0].multisample??h,c=e[0].padding,d=e[0].autoFit,p=e[0].legacy??!0;for(let g=1;g<e.length;g++){const y=e[g];l=Math.min(l,y.resolution||a),u=Math.min(u,y.multisample??h),c=this.useMaxPadding?Math.max(c,y.padding):c+y.padding,d=d&&y.autoFit,p=p||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=l,n.multisample=u,n.legacy=p,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(c);const m=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(Tu.copyFrom(i.projection.transform).invert(),m),d?(n.sourceFrame.fit(m),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(m)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,u),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const f=this.tempRect;f.x=0,f.y=0,f.width=n.sourceFrame.width,f.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,f),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;const n=s.inputSize,o=s.inputPixel,a=s.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*n[2]-.5*o[2],a[3]=e.sourceFrame.height*n[3]-.5*o[3],e.legacy){const l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,h.renderTexture,_i.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let c=0;for(c=0;c<i.length-1;++c){c===1&&e.multisample>1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),i[c].apply(this,l,u,_i.CLEAR,e);const d=l;l=u,u=d}i[c].apply(this,l,h.renderTexture,_i.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=_i.CLEAR){const{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0:t.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(e===_i.CLEAR||e===_i.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(bi.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(bi.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=e._texture,o=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Nt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Yt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Yt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=Ia[0],s=Ia[1],n=Ia[2],o=Ia[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),l=Math.max(i.x,s.x,n.x,o.x),u=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,e.height=u-h}roundFrame(t,e,i,s,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:h,d:l}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?Tu.copyFrom(n):Tu.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}cm.extension={type:J.RendererSystem,name:"filter"},it.add(cm);class hv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Yt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const lv=new dt;class dm{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new _u(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new dt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;q.PREFER_ENV===Ur.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){const{gl:s}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let o=0;o<t.colorTextures.length;o++){const a=t.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>i,a=e.height>>i,h=o/e.width;this.setViewport(e.x*h,e.y*h,o,a)}else{const o=t.width>>i,a=t.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(n.width!==i||n.height!==s||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,n=pl.COLOR|pl.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new hv(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const s=t.colorTextures;let n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let o=n.length;i.drawBuffers||(o=Math.min(o,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const a=[];for(let h=0;h<o;h++){const l=n[h],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),h===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,l.target,u._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH_STENCIL):t.depth&&t.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH24_STENCIL8):t.depth?(h=i.DEPTH_ATTACHMENT,l=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,l=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,l,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,l,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=Yt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Yt.NONE),i}blit(t,e,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;const u=s.colorTextures[0];if(!u)return;h.blitFramebuffer||(h.blitFramebuffer=new _u(s.width,s.height),h.blitFramebuffer.addColorTexture(0,u)),t=h.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=lv,e.width=s.width,e.height=s.height),i||(i=e);const l=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const i=t.width,s=t.height,n=this.gl,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,i,s):n.renderbufferStorage(n.RENDERBUFFER,h,i,s),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new dt}destroy(){this.renderer=null}}dm.extension={type:J.RendererSystem,name:"framebuffer"},it.add(dm);const wu={5126:4,5123:2,5121:1};class pm{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;q.PREFER_ENV===Ur.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n),t.drawElementsInstanced=(s,n,o,a,h)=>i.drawElementsInstancedANGLE(s,n,o,a,h),t.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=this;let s=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const o=s[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){const i=t.attributes,s=e.attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,s=e.attributeData,n=["g",t.id];for(const o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(t,e,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[h];if(u)return l[a.id]=u,u;const c=t.buffers,d=t.attributes,p={},m={};for(const f in c)p[f]=0,m[f]=0;for(const f in d)!d[f].size&&a.attributeData[f]?d[f].size=a.attributeData[f].size:d[f].size||console.warn(`PIXI Geometry attribute '${f}' size cannot be determined (likely the bound shader does not have the attribute)`),p[d[f].buffer]+=d[f].size*wu[d[f].type];for(const f in d){const g=d[f],y=g.size;g.stride===void 0&&(p[g.buffer]===y*wu[g.type]?g.stride=0:g.stride=p[g.buffer]),g.start===void 0&&(g.start=m[g.buffer],m[g.buffer]+=y*wu[g.type])}u=s.createVertexArray(),s.bindVertexArray(u);for(let f=0;f<c.length;f++){const g=c[f];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=u,l[h]=u,s.bindVertexArray(null),o.unbind(vi.ARRAY_BUFFER),u}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const l=n[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(n[h],e))}if(!e){for(const h in i)if(h[0]==="g"){const l=i[h];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,o=t.buffers,a=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in a){const u=a[l],c=o[u.buffer],d=c._glBuffers[s];if(e.attributeData[l]){h!==d&&(n.bind(c),h=d);const p=e.attributeData[l].location;if(i.enableVertexAttribArray(p),i.vertexAttribPointer(p,u.size,u.type||i.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)i.vertexAttribDivisor(p,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,h,(i||0)*a,s||1):n.drawElements(t,e||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),s||1):n.drawArrays(t,i,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}pm.extension={type:J.RendererSystem,name:"geometry"},it.add(pm);const fm=new Nt;class mm{constructor(t,e){this._texture=t,this.mapCoord=new Nt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let s=0;s<t.length;s+=2){const n=t[s],o=t[s+1];e[s]=n*i.a+o*i.c+i.tx,e[s+1]=n*i.b+o*i.d+i.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const s=e.orig,n=e.trim;n&&(fm.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(fm));const o=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/o.width,a[1]=(e._frame.y+h+l)/o.height,a[2]=(e._frame.x+e._frame.width-h+l)/o.width,a[3]=(e._frame.y+e._frame.height-h+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var uv=`varying vec2 vMaskCoord;
379
379
  varying vec2 vTextureCoord;
380
380
 
381
381
  uniform sampler2D uSampler;
@@ -416,7 +416,7 @@ void main(void)
416
416
  vTextureCoord = aTextureCoord;
417
417
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
418
418
  }
419
- `;class dv extends ge{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||cv,e||uv,i),this.maskSprite=s,this.maskMatrix=new Nt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new mm(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class pv{constructor(t=null){this.type=jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ge.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=jt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class gm{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new pv;n.pooled=!0,n.maskObject=e,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==jt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case jt.SCISSOR:this.renderer.scissor.push(i);break;case jt.STENCIL:this.renderer.stencil.push(i);break;case jt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case jt.COLOR:this.pushColorMask(i);break}i.type===jt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case jt.SCISSOR:this.renderer.scissor.pop(e);break;case jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case jt.SPRITE:this.popSpriteMask(e);break;case jt.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===jt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=jt.SCISSOR:t.type=jt.STENCIL:t.type=jt.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new dv])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}gm.extension={type:J.RendererSystem,name:"mask"},it.add(gm);class ym{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const bm=new Nt,xm=[],_m=class al extends ym{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,xm.pop()??new dt);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:s,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||al.isMatrixRotated(e.worldTransform)||al.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,n){al.isMatrixRotated(n)||(n=n?bm.copyFrom(n):bm.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,t),t.fit(s),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&&xm.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};_m.extension={type:J.RendererSystem,name:"scissor"};let fv=_m;it.add(fv);class vm extends ym{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}vm.extension={type:J.RendererSystem,name:"stencil"},it.add(vm);class Tm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}Tm.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_plugin"},it.add(Tm);class wm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Nt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}wm.extension={type:J.RendererSystem,name:"projection"},it.add(wm);const mv=new mu,Sm=new dt;class Em{constructor(t){this.renderer=t,this._tempMatrix=new Nt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Sm))||t.getLocalBounds(Sm,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=qr.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=mv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Em.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"textureGenerator"},it.add(Em);const ts=new dt,jn=new dt;class Cm{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new dt,this.destinationFrame=new dt,this.viewportFrame=new dt}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const s=this.renderer;this.current=t;let n,o,a;t?(n=t.baseTexture,a=n.resolution,e||(ts.width=t.frame.width,ts.height=t.frame.height,e=ts),i||(jn.x=t.frame.x,jn.y=t.frame.y,jn.width=e.width,jn.height=e.height,i=jn),o=n.framebuffer):(a=s.resolution,e||(ts.width=s._view.screen.width,ts.height=s._view.screen.height,e=ts),i||(i=ts,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,e,a,!o),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Gt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Cm.extension={type:J.RendererSystem,name:"renderTexture"},it.add(Cm);class gv{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 yv(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=t.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=im(t,n.type),a={type:o,name:n.name,size:tm(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function bv(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=im(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:$f(h,n.size)}}return e}function xv(r,t){var a;const e=Jf(r,r.VERTEX_SHADER,t.vertexSrc),i=Jf(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||z1(r,s,e,i),t.attributeData=yv(s,r),t.uniformData=bv(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,u)=>l>u?1:-1);for(let l=0;l<h.length;l++)t.attributeData[h[l]].location=l,r.bindAttribLocation(s,l,h[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:r.getUniformLocation(s,h),value:$f(l.type,l.size)}}return new gv(s,o)}function _v(r,t,e,i,s){e.buffer.update(s)}const vv={float:`
419
+ `;class dv extends ge{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||cv,e||uv,i),this.maskSprite=s,this.maskMatrix=new Nt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new mm(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class pv{constructor(t=null){this.type=jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ge.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=jt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class gm{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new pv;n.pooled=!0,n.maskObject=e,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==jt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case jt.SCISSOR:this.renderer.scissor.push(i);break;case jt.STENCIL:this.renderer.stencil.push(i);break;case jt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case jt.COLOR:this.pushColorMask(i);break}i.type===jt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case jt.SCISSOR:this.renderer.scissor.pop(e);break;case jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case jt.SPRITE:this.popSpriteMask(e);break;case jt.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===jt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=jt.SCISSOR:t.type=jt.STENCIL:t.type=jt.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new dv])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}gm.extension={type:J.RendererSystem,name:"mask"},it.add(gm);class ym{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const bm=new Nt,xm=[],_m=class al extends ym{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,xm.pop()??new dt);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:s,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||al.isMatrixRotated(e.worldTransform)||al.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,n){al.isMatrixRotated(n)||(n=n?bm.copyFrom(n):bm.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,t),t.fit(s),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&&xm.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};_m.extension={type:J.RendererSystem,name:"scissor"};let fv=_m;it.add(fv);class vm extends ym{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}vm.extension={type:J.RendererSystem,name:"stencil"},it.add(vm);class Tm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}Tm.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_plugin"},it.add(Tm);class wm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Nt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}wm.extension={type:J.RendererSystem,name:"projection"},it.add(wm);const mv=new mu,Sm=new dt;class Em{constructor(t){this.renderer=t,this._tempMatrix=new Nt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Sm))||t.getLocalBounds(Sm,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=qr.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=mv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Em.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"textureGenerator"},it.add(Em);const ts=new dt,Jn=new dt;class Cm{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new dt,this.destinationFrame=new dt,this.viewportFrame=new dt}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const s=this.renderer;this.current=t;let n,o,a;t?(n=t.baseTexture,a=n.resolution,e||(ts.width=t.frame.width,ts.height=t.frame.height,e=ts),i||(Jn.x=t.frame.x,Jn.y=t.frame.y,Jn.width=e.width,Jn.height=e.height,i=Jn),o=n.framebuffer):(a=s.resolution,e||(ts.width=s._view.screen.width,ts.height=s._view.screen.height,e=ts),i||(i=ts,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,e,a,!o),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Gt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Cm.extension={type:J.RendererSystem,name:"renderTexture"},it.add(Cm);class gv{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 yv(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=t.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=im(t,n.type),a={type:o,name:n.name,size:tm(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function bv(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=im(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:$f(h,n.size)}}return e}function xv(r,t){var a;const e=Jf(r,r.VERTEX_SHADER,t.vertexSrc),i=Jf(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||z1(r,s,e,i),t.attributeData=yv(s,r),t.uniformData=bv(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,u)=>l>u?1:-1);for(let l=0;l<h.length;l++)t.attributeData[h[l]].location=l,r.bindAttribLocation(s,l,h[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:r.getUniformLocation(s,h),value:$f(l.type,l.size)}}return new gv(s,o)}function _v(r,t,e,i,s){e.buffer.update(s)}const vv={float:`
420
420
  data[offset] = v;
421
421
  `,vec2:`
422
422
  data[offset] = v[0];
@@ -462,7 +462,7 @@ void main(void)
462
462
  var gl = renderer.gl
463
463
  var index = 0;
464
464
  var data = buffer.data;
465
- `];for(let o=0;o<i.length;o++){const a=i[o],h=r.uniforms[a.data.name],l=a.data.name;let u=!1;for(let c=0;c<Zs.length;c++){const d=Zs[c];if(d.codeUbo&&d.test(a.data,h)){n.push(`offset = ${a.offset/4};`,Zs[c].codeUbo(a.data.name,h)),u=!0;break}}if(!u)if(a.data.size>1){const c=tm(a.data.type),d=Math.max(Im[a.data.type]/16,1),p=c/d,m=(4-p%4)%4;n.push(`
465
+ `];for(let o=0;o<i.length;o++){const a=i[o],h=r.uniforms[a.data.name],l=a.data.name;let u=!1;for(let c=0;c<Vs.length;c++){const d=Vs[c];if(d.codeUbo&&d.test(a.data,h)){n.push(`offset = ${a.offset/4};`,Vs[c].codeUbo(a.data.name,h)),u=!0;break}}if(!u)if(a.data.size>1){const c=tm(a.data.type),d=Math.max(Im[a.data.type]/16,1),p=c/d,m=(4-p%4)%4;n.push(`
466
466
  cv = ud.${l}.value;
467
467
  v = uv.${l};
468
468
  offset = ${a.offset/4};
@@ -486,7 +486,7 @@ void main(void)
486
486
  `)}}return n.push(`
487
487
  renderer.buffer.update(buffer);
488
488
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
489
- `))}}let Ev=0;const Ia={textureCount:0,uboCount:0};class Am{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Ev++}systemCheck(){if(!J1())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Ia.textureCount=0,Ia.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ia)),s}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=K1(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Ia,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Sv(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=xv(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Am.extension={type:J.RendererSystem,name:"shader"},it.add(Am);class Aa{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Aa.defaultOptions={hello:!1},Aa.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"startup"},it.add(Aa);function Cv(r,t=[]){return t[ct.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.ADD]=[r.ONE,r.ONE],t[ct.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.NONE]=[0,0],t[ct.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[ct.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[ct.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[ct.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[ct.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[ct.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[ct.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[ct.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[ct.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[ct.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Iv=0,Av=1,Rv=2,Mv=3,Pv=4,Lv=5,Rm=class pp{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ct.NONE,this._blendEq=!1,this.map=[],this.map[Iv]=this.setBlend,this.map[Av]=this.setOffset,this.map[Rv]=this.setCullFace,this.map[Mv]=this.setDepthTest,this.map[Pv]=this.setFrontFace,this.map[Lv]=this.setDepthMask,this.checks=[],this.defaultState=new Ci,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Cv(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(pp.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(pp.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Rm.extension={type:J.RendererSystem,name:"state"};let Gv=Rm;it.add(Gv);class Nv extends Fn{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(const s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ii(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Jn=class hl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=hl.defaultMaxIdle,this.checkCountMax=hl.defaultCheckCountMax,this.mode=hl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==fl.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let s=0;s<e.length;s++){const n=e[s];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[s++]=e[n]);e.length=s}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Jn.defaultMode=fl.AUTO,Jn.defaultMaxIdle=60*60,Jn.defaultCheckCountMax=60*10,Jn.extension={type:J.RendererSystem,name:"textureGC"};let es=Jn;it.add(es);class Su{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=at.UNSIGNED_BYTE,this.internalFormat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16UI]:Q.UINT,[r.RGBA32I]:Q.INT,[r.RGBA32UI]:Q.UINT,[r.DEPTH_COMPONENT16]:Q.FLOAT,[r.DEPTH_COMPONENT24]:Q.FLOAT,[r.DEPTH_COMPONENT32F]:Q.FLOAT,[r.DEPTH_STENCIL]:Q.FLOAT,[r.DEPTH24_STENCIL8]:Q.FLOAT,[r.DEPTH32F_STENCIL8]:Q.FLOAT}:t={[r.RGB]:Q.FLOAT,[r.RGBA]:Q.FLOAT,[r.ALPHA]:Q.FLOAT,[r.LUMINANCE]:Q.FLOAT,[r.LUMINANCE_ALPHA]:Q.FLOAT,[r.DEPTH_STENCIL]:Q.FLOAT},t}function Dv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[at.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA8,[H.RGB]:r.RGB8,[H.RG]:r.RG8,[H.RED]:r.R8,[H.RGBA_INTEGER]:r.RGBA8UI,[H.RGB_INTEGER]:r.RGB8UI,[H.RG_INTEGER]:r.RG8UI,[H.RED_INTEGER]:r.R8UI,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[at.BYTE]:{[H.RGBA]:r.RGBA8_SNORM,[H.RGB]:r.RGB8_SNORM,[H.RG]:r.RG8_SNORM,[H.RED]:r.R8_SNORM,[H.RGBA_INTEGER]:r.RGBA8I,[H.RGB_INTEGER]:r.RGB8I,[H.RG_INTEGER]:r.RG8I,[H.RED_INTEGER]:r.R8I},[at.UNSIGNED_SHORT]:{[H.RGBA_INTEGER]:r.RGBA16UI,[H.RGB_INTEGER]:r.RGB16UI,[H.RG_INTEGER]:r.RG16UI,[H.RED_INTEGER]:r.R16UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[at.SHORT]:{[H.RGBA_INTEGER]:r.RGBA16I,[H.RGB_INTEGER]:r.RGB16I,[H.RG_INTEGER]:r.RG16I,[H.RED_INTEGER]:r.R16I},[at.UNSIGNED_INT]:{[H.RGBA_INTEGER]:r.RGBA32UI,[H.RGB_INTEGER]:r.RGB32UI,[H.RG_INTEGER]:r.RG32UI,[H.RED_INTEGER]:r.R32UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[at.INT]:{[H.RGBA_INTEGER]:r.RGBA32I,[H.RGB_INTEGER]:r.RGB32I,[H.RG_INTEGER]:r.RG32I,[H.RED_INTEGER]:r.R32I},[at.FLOAT]:{[H.RGBA]:r.RGBA32F,[H.RGB]:r.RGB32F,[H.RG]:r.RG32F,[H.RED]:r.R32F,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[at.HALF_FLOAT]:{[H.RGBA]:r.RGBA16F,[H.RGB]:r.RGB16F,[H.RG]:r.RG16F,[H.RED]:r.R16F},[at.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB565},[at.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA4},[at.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGB5_A1},[at.UNSIGNED_INT_2_10_10_10_REV]:{[H.RGBA]:r.RGB10_A2,[H.RGBA_INTEGER]:r.RGB10_A2UI},[at.UNSIGNED_INT_10F_11F_11F_REV]:{[H.RGB]:r.R11F_G11F_B10F},[at.UNSIGNED_INT_5_9_9_9_REV]:{[H.RGB]:r.RGB9_E5},[at.UNSIGNED_INT_24_8]:{[H.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[at.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[H.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[at.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA,[H.RGB]:r.RGB,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[at.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB},[at.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA},[at.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGBA}},t}class Mm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new mt,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=Dv(t),this.samplerTypes=Fv(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Su(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Su(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[s].samplerType!==Q.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Su(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??Q.FLOAT,this.webGLVersion===2&&t.type===at.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var s;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(s=t.resource)==null?void 0:s.upload(i,t,e))e.samplerType!==Q.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const s=this.managedTextures.indexOf(t);s!==-1&&Xs(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===xi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Ki.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==xi.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Vi.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Mm.extension={type:J.RendererSystem,name:"texture"},it.add(Mm);class Pm{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:s}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[s]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Pm.extension={type:J.RendererSystem,name:"transformFeedback"},it.add(Pm);class Ra{constructor(t){this.renderer=t}init(t){this.screen=new dt(0,0,t.width,t.height),this.element=t.view||q.ADAPTER.createCanvas(),this.resolution=t.resolution||q.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Ra.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Ra.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_view"},it.add(Ra),q.PREFER_ENV=Ur.WEBGL2,q.STRICT_TEXTURE_CACHE=!1,q.RENDER_OPTIONS={...Sa.defaultOptions,...wa.defaultOptions,...Ra.defaultOptions,...Aa.defaultOptions},Object.defineProperties(q,{WRAP_MODE:{get(){return mt.defaultOptions.wrapMode},set(r){Tt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),mt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return mt.defaultOptions.scaleMode},set(r){Tt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),mt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return mt.defaultOptions.mipmap},set(r){Tt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),mt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return mt.defaultOptions.anisotropicLevel},set(r){Tt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),mt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return Tt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ge.defaultResolution},set(r){ge.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return Tt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ge.defaultMultisample},set(r){ge.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Qr.defaultMaxTextures},set(r){Tt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Qr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Qr.defaultBatchSize},set(r){Tt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Qr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Qr.canUploadSameBuffer},set(r){Tt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Qr.canUploadSameBuffer=r}},GC_MODE:{get(){return es.defaultMode},set(r){Tt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),es.defaultMode=r}},GC_MAX_IDLE:{get(){return es.defaultMaxIdle},set(r){Tt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),es.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return es.defaultCheckCountMax},set(r){Tt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),es.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return qi.defaultVertexPrecision},set(r){Tt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),qi.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return qi.defaultFragmentPrecision},set(r){Tt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),qi.defaultFragmentPrecision=r}}});var is=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(is||{});class Eu{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Lm=class ke{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 Eu(null,null,1/0),this.deltaMS=1/ke.targetFPMS,this.elapsedMS=1/ke.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=is.NORMAL){return this._addListener(new Eu(t,e,i))}addOnce(t,e,i=is.NORMAL){return this._addListener(new Eu(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ke.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,ke.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!ke._shared){const t=ke._shared=new ke;t.autoStart=!0,t._protected=!0}return ke._shared}static get system(){if(!ke._system){const t=ke._system=new ke;t.autoStart=!0,t._protected=!0}return ke._system}};Lm.targetFPMS=.06;let ye=Lm;Object.defineProperties(q,{TARGET_FPMS:{get(){return ye.targetFPMS},set(r){Tt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ye.targetFPMS=r}}});class Gm{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,is.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ye.shared:new ye,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Gm.extension=J.Application,it.add(Gm);const Nm=[];it.handleByList(J.Renderer,Nm);function kv(r){for(const t of Nm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Ov=`attribute vec2 aVertexPosition;
489
+ `))}}let Ev=0;const Aa={textureCount:0,uboCount:0};class Am{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Ev++}systemCheck(){if(!J1())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Aa.textureCount=0,Aa.uboCount=0,this.syncUniformGroup(t.uniformGroup,Aa)),s}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=K1(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Aa,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Sv(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=xv(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Am.extension={type:J.RendererSystem,name:"shader"},it.add(Am);class Ra{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Ra.defaultOptions={hello:!1},Ra.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"startup"},it.add(Ra);function Cv(r,t=[]){return t[ct.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.ADD]=[r.ONE,r.ONE],t[ct.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ct.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_AL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RACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Iv=0,Av=1,Rv=2,Mv=3,Pv=4,Lv=5,Rm=class pp{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ct.NONE,this._blendEq=!1,this.map=[],this.map[Iv]=this.setBlend,this.map[Av]=this.setOffset,this.map[Rv]=this.setCullFace,this.map[Mv]=this.setDepthTest,this.map[Pv]=this.setFrontFace,this.map[Lv]=this.setDepthMask,this.checks=[],this.defaultState=new Ci,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Cv(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(pp.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(pp.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Rm.extension={type:J.RendererSystem,name:"state"};let Gv=Rm;it.add(Gv);class Nv extends Dn{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(const s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ri(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const $n=class hl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=hl.defaultMaxIdle,this.checkCountMax=hl.defaultCheckCountMax,this.mode=hl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==fl.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let s=0;s<e.length;s++){const n=e[s];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[s++]=e[n]);e.length=s}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};$n.defaultMode=fl.AUTO,$n.defaultMaxIdle=60*60,$n.defaultCheckCountMax=60*10,$n.extension={type:J.RendererSystem,name:"textureGC"};let es=$n;it.add(es);class Su{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=at.UNSIGNED_BYTE,this.internalFormat=H.RGBA,this.samplerType=0}}function Fv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:Q.FLOAT,[r.RGBA]:Q.FLOAT,[r.ALPHA]:Q.FLOAT,[r.LUMINANCE]:Q.FLOAT,[r.LUMINANCE_ALPHA]:Q.FLOAT,[r.R8]:Q.FLOAT,[r.R8_SNORM]:Q.FLOAT,[r.RG8]:Q.FLOAT,[r.RG8_SNORM]:Q.FLOAT,[r.RGB8]:Q.FLOAT,[r.RGB8_SNORM]:Q.FLOAT,[r.RGB565]:Q.FLOAT,[r.RGBA4]:Q.FLOAT,[r.RGB5_A1]:Q.FLOAT,[r.RGBA8]:Q.FLOAT,[r.RGBA8_SNORM]:Q.FLOAT,[r.RGB10_A2]:Q.FLOAT,[r.RGB10_A2UI]:Q.FLOAT,[r.SRGB8]:Q.FLOAT,[r.SRGB8_ALPHA8]:Q.FLOAT,[r.R16F]:Q.FLOAT,[r.RG16F]:Q.FLOAT,[r.RGB16F]:Q.FLOAT,[r.RGBA16F]:Q.FLOAT,[r.R32F]:Q.FLOAT,[r.RG32F]:Q.FLOAT,[r.RGB32F]:Q.FLOAT,[r.RGBA32F]:Q.FLOAT,[r.R11F_G11F_B10F]:Q.FLOAT,[r.RGB9_E5]:Q.FLOAT,[r.R8I]:Q.INT,[r.R8UI]:Q.UINT,[r.R16I]:Q.INT,[r.R16UI]:Q.UINT,[r.R32I]:Q.INT,[r.R32UI]:Q.UINT,[r.RG8I]:Q.INT,[r.RG8UI]:Q.UINT,[r.RG16I]:Q.INT,[r.RG16UI]:Q.UINT,[r.RG32I]:Q.INT,[r.RG32UI]:Q.UINT,[r.RGB8I]:Q.INT,[r.RGB8UI]:Q.UINT,[r.RGB16I]:Q.INT,[r.RGB16UI]:Q.UINT,[r.RGB32I]:Q.INT,[r.RGB32UI]:Q.UINT,[r.RGBA8I]:Q.INT,[r.RGBA8UI]:Q.UINT,[r.RGBA16I]:Q.INT,[r.RGBA16UI]:Q.UINT,[r.RGBA32I]:Q.INT,[r.RGBA32UI]:Q.UINT,[r.DEPTH_COMPONENT16]:Q.FLOAT,[r.DEPTH_COMPONENT24]:Q.FLOAT,[r.DEPTH_COMPONENT32F]:Q.FLOAT,[r.DEPTH_STENCIL]:Q.FLOAT,[r.DEPTH24_STENCIL8]:Q.FLOAT,[r.DEPTH32F_STENCIL8]:Q.FLOAT}:t={[r.RGB]:Q.FLOAT,[r.RGBA]:Q.FLOAT,[r.ALPHA]:Q.FLOAT,[r.LUMINANCE]:Q.FLOAT,[r.LUMINANCE_ALPHA]:Q.FLOAT,[r.DEPTH_STENCIL]:Q.FLOAT},t}function Dv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[at.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA8,[H.RGB]:r.RGB8,[H.RG]:r.RG8,[H.RED]:r.R8,[H.RGBA_INTEGER]:r.RGBA8UI,[H.RGB_INTEGER]:r.RGB8UI,[H.RG_INTEGER]:r.RG8UI,[H.RED_INTEGER]:r.R8UI,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[at.BYTE]:{[H.RGBA]:r.RGBA8_SNORM,[H.RGB]:r.RGB8_SNORM,[H.RG]:r.RG8_SNORM,[H.RED]:r.R8_SNORM,[H.RGBA_INTEGER]:r.RGBA8I,[H.RGB_INTEGER]:r.RGB8I,[H.RG_INTEGER]:r.RG8I,[H.RED_INTEGER]:r.R8I},[at.UNSIGNED_SHORT]:{[H.RGBA_INTEGER]:r.RGBA16UI,[H.RGB_INTEGER]:r.RGB16UI,[H.RG_INTEGER]:r.RG16UI,[H.RED_INTEGER]:r.R16UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[at.SHORT]:{[H.RGBA_INTEGER]:r.RGBA16I,[H.RGB_INTEGER]:r.RGB16I,[H.RG_INTEGER]:r.RG16I,[H.RED_INTEGER]:r.R16I},[at.UNSIGNED_INT]:{[H.RGBA_INTEGER]:r.RGBA32UI,[H.RGB_INTEGER]:r.RGB32UI,[H.RG_INTEGER]:r.RG32UI,[H.RED_INTEGER]:r.R32UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[at.INT]:{[H.RGBA_INTEGER]:r.RGBA32I,[H.RGB_INTEGER]:r.RGB32I,[H.RG_INTEGER]:r.RG32I,[H.RED_INTEGER]:r.R32I},[at.FLOAT]:{[H.RGBA]:r.RGBA32F,[H.RGB]:r.RGB32F,[H.RG]:r.RG32F,[H.RED]:r.R32F,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[at.HALF_FLOAT]:{[H.RGBA]:r.RGBA16F,[H.RGB]:r.RGB16F,[H.RG]:r.RG16F,[H.RED]:r.R16F},[at.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB565},[at.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA4},[at.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGB5_A1},[at.UNSIGNED_INT_2_10_10_10_REV]:{[H.RGBA]:r.RGB10_A2,[H.RGBA_INTEGER]:r.RGB10_A2UI},[at.UNSIGNED_INT_10F_11F_11F_REV]:{[H.RGB]:r.R11F_G11F_B10F},[at.UNSIGNED_INT_5_9_9_9_REV]:{[H.RGB]:r.RGB9_E5},[at.UNSIGNED_INT_24_8]:{[H.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[at.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[H.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[at.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA,[H.RGB]:r.RGB,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[at.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB},[at.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA},[at.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGBA}},t}class Mm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new mt,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=Dv(t),this.samplerTypes=Fv(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Su(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Su(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[s].samplerType!==Q.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Su(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??Q.FLOAT,this.webGLVersion===2&&t.type===at.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var s;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(s=t.resource)==null?void 0:s.upload(i,t,e))e.samplerType!==Q.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const s=this.managedTextures.indexOf(t);s!==-1&&Zs(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===xi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Ki.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==xi.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Vi.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Mm.extension={type:J.RendererSystem,name:"texture"},it.add(Mm);class Pm{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:s}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[s]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Pm.extension={type:J.RendererSystem,name:"transformFeedback"},it.add(Pm);class Ma{constructor(t){this.renderer=t}init(t){this.screen=new dt(0,0,t.width,t.height),this.element=t.view||q.ADAPTER.createCanvas(),this.resolution=t.resolution||q.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Ma.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Ma.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_view"},it.add(Ma),q.PREFER_ENV=Ur.WEBGL2,q.STRICT_TEXTURE_CACHE=!1,q.RENDER_OPTIONS={...Ea.defaultOptions,...Sa.defaultOptions,...Ma.defaultOptions,...Ra.defaultOptions},Object.defineProperties(q,{WRAP_MODE:{get(){return mt.defaultOptions.wrapMode},set(r){Tt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),mt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return mt.defaultOptions.scaleMode},set(r){Tt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),mt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return mt.defaultOptions.mipmap},set(r){Tt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),mt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return mt.defaultOptions.anisotropicLevel},set(r){Tt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),mt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return Tt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ge.defaultResolution},set(r){ge.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return Tt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ge.defaultMultisample},set(r){ge.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Qr.defaultMaxTextures},set(r){Tt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Qr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Qr.defaultBatchSize},set(r){Tt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Qr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Qr.canUploadSameBuffer},set(r){Tt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Qr.canUploadSameBuffer=r}},GC_MODE:{get(){return es.defaultMode},set(r){Tt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),es.defaultMode=r}},GC_MAX_IDLE:{get(){return es.defaultMaxIdle},set(r){Tt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),es.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return es.defaultCheckCountMax},set(r){Tt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),es.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return qi.defaultVertexPrecision},set(r){Tt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),qi.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return qi.defaultFragmentPrecision},set(r){Tt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),qi.defaultFragmentPrecision=r}}});var is=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(is||{});class Eu{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Lm=class We{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 Eu(null,null,1/0),this.deltaMS=1/We.targetFPMS,this.elapsedMS=1/We.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=is.NORMAL){return this._addListener(new Eu(t,e,i))}addOnce(t,e,i=is.NORMAL){return this._addListener(new Eu(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*We.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,We.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!We._shared){const t=We._shared=new We;t.autoStart=!0,t._protected=!0}return We._shared}static get system(){if(!We._system){const t=We._system=new We;t.autoStart=!0,t._protected=!0}return We._system}};Lm.targetFPMS=.06;let ye=Lm;Object.defineProperties(q,{TARGET_FPMS:{get(){return ye.targetFPMS},set(r){Tt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ye.targetFPMS=r}}});class Gm{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,is.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ye.shared:new ye,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Gm.extension=J.Application,it.add(Gm);const Nm=[];it.handleByList(J.Renderer,Nm);function kv(r){for(const t of Nm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Ov=`attribute vec2 aVertexPosition;
490
490
  attribute vec2 aTextureCoord;
491
491
 
492
492
  uniform mat3 projectionMatrix;
@@ -523,7 +523,7 @@ void main(void)
523
523
  gl_Position = filterVertexPosition();
524
524
  vTextureCoord = filterTextureCoord();
525
525
  }
526
- `;const Bv=Ov,Fm=Wv;class Dm{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Yt.HIGH?this.multisample=Yt.HIGH:e>=Yt.MEDIUM?this.multisample=Yt.MEDIUM:e>=Yt.LOW?this.multisample=Yt.LOW:this.multisample=Yt.NONE}destroy(){}}Dm.extension={type:J.RendererSystem,name:"_multisample"},it.add(Dm);class Uv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class km{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new Uv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}km.extension={type:J.RendererSystem,name:"buffer"},it.add(km);class Om{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Om.extension={type:J.RendererSystem,name:"objectRenderer"},it.add(Om);const Ma=class fp extends Nv{constructor(t){super(),this.type=Sp.WEBGL,t=Object.assign({},q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ri({projectionMatrix:new Nt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:fp.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(Tt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=fp.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:u1()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return Tt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return Tt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return Tt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return Tt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){Tt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return Tt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){Tt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return Tt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Ma.extension={type:J.Renderer,priority:1},Ma.__plugins={},Ma.__systems={};let Cu=Ma;it.handleByMap(J.RendererPlugin,Cu.__plugins),it.handleByMap(J.RendererSystem,Cu.__systems),it.add(Cu);class Wm extends Hn{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new mt;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof Hn?this.addResourceAt(t[i],i):this.addResourceAt(Hf(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class Xv extends Wm{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:s}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Ms.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let h=0;h<s;h++){const l=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0}}class Zv extends _r{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Bm=class Vo extends Wm{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==Vo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Vo.SIDES;a++)this.items[a].target=Ms.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Ms.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Ms.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){const s=this.itemDirtyIds;for(let n=0;n<Vo.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Vo.SIDES}};Bm.SIDES=6;let Vv=Bm;class Ks extends _r{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Ks.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await q.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===xe.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return Ks._EMPTY=Ks._EMPTY??q.ADAPTER.createCanvas(0,0),Ks._EMPTY}}const Iu=class ll extends _r{constructor(t,e){e=e||{},super(q.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},ll.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;_r.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${Hr()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=ll.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&ll.SVG_XML.test(t)}};Iu.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Iu.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Au=Iu;const Ru=class mp extends _r{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const s=t[0].src||t[0];_r.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:h}=t[n];if(a=a||t[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);h=h||mp.MIME_TYPES[u]||`video/${u}`}o.src=a,h&&(o.type=h),i.appendChild(o)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=ye.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(ye.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ye.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ye.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||mp.TYPES.includes(e)}};Ru.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ru.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Um=Ru;uu.push(Ks,am,Zv,Um,Au,ca,Vv,Xv);class Pa{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?dt.EMPTY:(t=t||new dt(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:i,b:s,c:n,d:o,tx:a,ty:h}=t,l=i*e.x+n*e.y+a,u=s*e.x+o*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,n){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,m=this.maxX,f=this.maxY,g=o*e+h*i+u,y=a*e+l*i+c;d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*s+h*i+u,y=a*s+l*i+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*e+h*n+u,y=a*e+l*n+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*s+h*n+u,y=a*s+l*n+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,this.minX=d,this.minY=p,this.maxX=m,this.maxY=f}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=e;h<i;h+=2){const l=t[h],u=t[h+1];s=l<s?l:s,n=u<n?u:n,o=l>o?l:o,a=u>a?u:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let p=this.minX,m=this.minY,f=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const _=e[y],b=e[y+1],v=a*_+l*b+c,S=u*b+h*_+d;p=Math.min(p,v-n),f=Math.max(f,v+n),m=Math.min(m,S-o),g=Math.max(g,S+o)}this.minX=p,this.minY=m,this.maxX=f,this.maxY=g}addBounds(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>u?o:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>u?o:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>s?this.maxY:s}}class Ot extends Fn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new mu,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 Pa,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(Ot.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new dt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new dt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Pa);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,s){return e&&(t=e.toGlobal(t,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,i=1,s=1,n=0,o=0,a=0,h=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Kv),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*O1}set angle(t){this.transform.rotation=t*W1}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class Kv extends Ot{constructor(){super(...arguments),this.sortDirty=null}}Ot.prototype.displayObjectUpdateTransform=Ot.prototype.updateTransform;const Hv=new Nt;function Yv(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Xm=class gp extends Ot{constructor(){super(),this.children=[],this.sortableChildren=gp.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i<s?i:s)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(t);Xs(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,Xs(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,Xs(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const i=t,s=e,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const s=this.children[e];s._lastSortedIndex=e,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(Yv),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const i=this.children[t];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const i=super.getLocalBounds(t);if(!e)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==gp.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=Hv.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],l=h.cullable;h.cullable=l||!this.cullArea,h.render(t),h.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(t)}}renderAdvanced(t){var n,o,a;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<e.length;h++)e[h].enabled&&this._enabledFilters.push(e[h])}const s=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==jt.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,i=this.removeChildren(0,this.children.length);if(e)for(let s=0;s<i.length;++s)i[s].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};Xm.defaultSortableChildren=!1;let Xt=Xm;Xt.prototype.containerUpdateTransform=Xt.prototype.updateTransform,Object.defineProperties(q,{SORTABLE_CHILDREN:{get(){return Xt.defaultSortableChildren},set(r){Tt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Xt.defaultSortableChildren=r}}});const $n=new lt,zv=new Uint16Array([0,1,2,0,2,3]);class ie extends Xt{constructor(t){super(),this._anchor=new Qi(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Gt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=ct.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||rt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=zv,this.pluginName="batch",this.isSprite=!0,this._roundPixels=q.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=yr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=yr(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let p=0,m=0,f=0,g=0;if(u?(m=u.x-d._x*c.width,p=m+u.width,g=u.y-d._y*c.height,f=g+u.height):(m=-d._x*c.width,p=m+c.width,g=-d._y*c.height,f=g+c.height),l[0]=i*m+n*g+a,l[1]=o*g+s*m+h,l[2]=i*p+n*g+a,l[3]=o*g+s*p+h,l[4]=i*p+n*f+a,l[5]=o*f+s*p+h,l[6]=i*m+n*f+a,l[7]=o*f+s*m+h,this._roundPixels){const y=q.RESOLUTION;for(let _=0;_<l.length;++_)l[_]=Math.round(l[_]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,l=n.d,u=n.tx,c=n.ty,d=-s._x*i.width,p=d+i.width,m=-s._y*i.height,f=m+i.height;if(e[0]=o*d+h*m+u,e[1]=l*m+a*d+c,e[2]=o*p+h*m+u,e[3]=l*m+a*p+c,e[4]=o*p+h*f+u,e[5]=l*f+a*p+c,e[6]=o*d+h*f+u,e[7]=l*f+a*d+c,this._roundPixels){const g=q.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*g)/g}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Pa),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new dt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,$n);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return $n.x>=s&&$n.x<s+e&&(n=-i*this.anchor.y,$n.y>=n&&$n.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof rt?t:rt.from(t,e);return new ie(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=yr(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=yr(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||rt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Zm=new Nt;Ot.prototype._cacheAsBitmap=!1,Ot.prototype._cacheData=null,Ot.prototype._cacheAsBitmapResolution=null,Ot.prototype._cacheAsBitmapMultisample=null;class jv{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(Ot.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new jv),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Ot.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Ot.prototype._initCachedDisplayObject=function(r){var d,p;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new dt,!0);if((p=this.filters)!=null&&p.length){const m=this.filters[0].padding;e.pad(m)}const i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=qr.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${Hr()}`;this._cacheData.textureCacheId=l,mt.addToCache(h.baseTexture,l),rt.addToCache(h,l);const u=this.transform.localTransform.copyTo(Zm).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:u,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new ie(h);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Ot.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Ot.prototype._initCachedDisplayObjectCanvas=function(r){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new dt,!0),e=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=qr.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Hr()}`;this._cacheData.textureCacheId=a,mt.addToCache(o.baseTexture,a),rt.addToCache(o,a);const h=Zm;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._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=e;const l=new ie(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Ot.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Ot.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Ot.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,mt.removeFromCache(this._cacheData.textureCacheId),rt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Ot.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Ot.prototype.name=null,Xt.prototype.getChildByName=function(r,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const s=this.children[e];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null},Ot.prototype.getGlobalPosition=function(r=new lt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Jv=`varying vec2 vTextureCoord;
526
+ `;const Bv=Ov,Fm=Wv;class Dm{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Yt.HIGH?this.multisample=Yt.HIGH:e>=Yt.MEDIUM?this.multisample=Yt.MEDIUM:e>=Yt.LOW?this.multisample=Yt.LOW:this.multisample=Yt.NONE}destroy(){}}Dm.extension={type:J.RendererSystem,name:"_multisample"},it.add(Dm);class Uv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class km{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new Uv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}km.extension={type:J.RendererSystem,name:"buffer"},it.add(km);class Om{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Om.extension={type:J.RendererSystem,name:"objectRenderer"},it.add(Om);const Pa=class fp extends Nv{constructor(t){super(),this.type=Sp.WEBGL,t=Object.assign({},q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new si({projectionMatrix:new Nt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:fp.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(Tt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=fp.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:u1()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return Tt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return Tt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return Tt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return Tt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){Tt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return Tt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){Tt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return Tt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Pa.extension={type:J.Renderer,priority:1},Pa.__plugins={},Pa.__systems={};let Cu=Pa;it.handleByMap(J.RendererPlugin,Cu.__plugins),it.handleByMap(J.RendererSystem,Cu.__systems),it.add(Cu);class Wm extends Yn{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new mt;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof Yn?this.addResourceAt(t[i],i):this.addResourceAt(Hf(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class Xv extends Wm{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:s}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Ps.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let h=0;h<s;h++){const l=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0}}class Zv extends _r{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Bm=class Ko extends Wm{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==Ko.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Ko.SIDES;a++)this.items[a].target=Ps.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Ps.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Ps.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){const s=this.itemDirtyIds;for(let n=0;n<Ko.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Ko.SIDES}};Bm.SIDES=6;let Vv=Bm;class Hs extends _r{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Hs.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await q.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===_e.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return Hs._EMPTY=Hs._EMPTY??q.ADAPTER.createCanvas(0,0),Hs._EMPTY}}const Iu=class ll extends _r{constructor(t,e){e=e||{},super(q.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},ll.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;_r.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${Hr()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=ll.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&ll.SVG_XML.test(t)}};Iu.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Iu.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Au=Iu;const Ru=class mp extends _r{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const s=t[0].src||t[0];_r.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:h}=t[n];if(a=a||t[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);h=h||mp.MIME_TYPES[u]||`video/${u}`}o.src=a,h&&(o.type=h),i.appendChild(o)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=ye.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(ye.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ye.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ye.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||mp.TYPES.includes(e)}};Ru.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ru.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Um=Ru;uu.push(Hs,am,Zv,Um,Au,da,Vv,Xv);class La{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?dt.EMPTY:(t=t||new dt(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:i,b:s,c:n,d:o,tx:a,ty:h}=t,l=i*e.x+n*e.y+a,u=s*e.x+o*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,n){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,m=this.maxX,f=this.maxY,g=o*e+h*i+u,y=a*e+l*i+c;d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*s+h*i+u,y=a*s+l*i+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*e+h*n+u,y=a*e+l*n+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*s+h*n+u,y=a*s+l*n+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,this.minX=d,this.minY=p,this.maxX=m,this.maxY=f}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=e;h<i;h+=2){const l=t[h],u=t[h+1];s=l<s?l:s,n=u<n?u:n,o=l>o?l:o,a=u>a?u:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let p=this.minX,m=this.minY,f=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const _=e[y],b=e[y+1],v=a*_+l*b+c,S=u*b+h*_+d;p=Math.min(p,v-n),f=Math.max(f,v+n),m=Math.min(m,S-o),g=Math.max(g,S+o)}this.minX=p,this.minY=m,this.maxX=f,this.maxY=g}addBounds(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>u?o:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>u?o:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>s?this.maxY:s}}class Ot extends Dn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new mu,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 La,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(Ot.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new dt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new dt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new La);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,s){return e&&(t=e.toGlobal(t,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,i=1,s=1,n=0,o=0,a=0,h=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Kv),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*O1}set angle(t){this.transform.rotation=t*W1}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class Kv extends Ot{constructor(){super(...arguments),this.sortDirty=null}}Ot.prototype.displayObjectUpdateTransform=Ot.prototype.updateTransform;const Hv=new Nt;function Yv(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Xm=class gp extends Ot{constructor(){super(),this.children=[],this.sortableChildren=gp.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i<s?i:s)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(t);Zs(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,Zs(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,Zs(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const i=t,s=e,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const s=this.children[e];s._lastSortedIndex=e,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(Yv),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const i=this.children[t];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const i=super.getLocalBounds(t);if(!e)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==gp.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=Hv.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],l=h.cullable;h.cullable=l||!this.cullArea,h.render(t),h.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(t)}}renderAdvanced(t){var n,o,a;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<e.length;h++)e[h].enabled&&this._enabledFilters.push(e[h])}const s=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==jt.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,i=this.removeChildren(0,this.children.length);if(e)for(let s=0;s<i.length;++s)i[s].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};Xm.defaultSortableChildren=!1;let Xt=Xm;Xt.prototype.containerUpdateTransform=Xt.prototype.updateTransform,Object.defineProperties(q,{SORTABLE_CHILDREN:{get(){return Xt.defaultSortableChildren},set(r){Tt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Xt.defaultSortableChildren=r}}});const Qn=new lt,zv=new Uint16Array([0,1,2,0,2,3]);class ie extends Xt{constructor(t){super(),this._anchor=new Qi(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Gt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=ct.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||rt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=zv,this.pluginName="batch",this.isSprite=!0,this._roundPixels=q.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=yr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=yr(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let p=0,m=0,f=0,g=0;if(u?(m=u.x-d._x*c.width,p=m+u.width,g=u.y-d._y*c.height,f=g+u.height):(m=-d._x*c.width,p=m+c.width,g=-d._y*c.height,f=g+c.height),l[0]=i*m+n*g+a,l[1]=o*g+s*m+h,l[2]=i*p+n*g+a,l[3]=o*g+s*p+h,l[4]=i*p+n*f+a,l[5]=o*f+s*p+h,l[6]=i*m+n*f+a,l[7]=o*f+s*m+h,this._roundPixels){const y=q.RESOLUTION;for(let _=0;_<l.length;++_)l[_]=Math.round(l[_]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,l=n.d,u=n.tx,c=n.ty,d=-s._x*i.width,p=d+i.width,m=-s._y*i.height,f=m+i.height;if(e[0]=o*d+h*m+u,e[1]=l*m+a*d+c,e[2]=o*p+h*m+u,e[3]=l*m+a*p+c,e[4]=o*p+h*f+u,e[5]=l*f+a*p+c,e[6]=o*d+h*f+u,e[7]=l*f+a*d+c,this._roundPixels){const g=q.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*g)/g}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new La),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new dt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Qn);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return Qn.x>=s&&Qn.x<s+e&&(n=-i*this.anchor.y,Qn.y>=n&&Qn.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof rt?t:rt.from(t,e);return new ie(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=yr(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=yr(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||rt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Zm=new Nt;Ot.prototype._cacheAsBitmap=!1,Ot.prototype._cacheData=null,Ot.prototype._cacheAsBitmapResolution=null,Ot.prototype._cacheAsBitmapMultisample=null;class jv{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(Ot.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new jv),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Ot.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Ot.prototype._initCachedDisplayObject=function(r){var d,p;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new dt,!0);if((p=this.filters)!=null&&p.length){const m=this.filters[0].padding;e.pad(m)}const i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=qr.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${Hr()}`;this._cacheData.textureCacheId=l,mt.addToCache(h.baseTexture,l),rt.addToCache(h,l);const u=this.transform.localTransform.copyTo(Zm).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:u,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new ie(h);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Ot.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Ot.prototype._initCachedDisplayObjectCanvas=function(r){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new dt,!0),e=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=qr.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Hr()}`;this._cacheData.textureCacheId=a,mt.addToCache(o.baseTexture,a),rt.addToCache(o,a);const h=Zm;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._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=e;const l=new ie(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Ot.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Ot.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Ot.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,mt.removeFromCache(this._cacheData.textureCacheId),rt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Ot.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Ot.prototype.name=null,Xt.prototype.getChildByName=function(r,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const s=this.children[e];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null},Ot.prototype.getGlobalPosition=function(r=new lt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Jv=`varying vec2 vTextureCoord;
527
527
 
528
528
  uniform sampler2D uSampler;
529
529
  uniform float uAlpha;
@@ -863,8 +863,8 @@ void main()
863
863
 
864
864
  gl_FragColor = color;
865
865
  }
866
- `;class dT extends ge{constructor(t=.5,e=Math.random()){super(Fm,cT,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const Vm={AlphaFilter:$v,BlurFilter:rT,BlurFilterPass:Mu,ColorMatrixFilter:Pu,DisplacementFilter:aT,FXAAFilter:uT,NoiseFilter:dT};Object.entries(Vm).forEach(([r,t])=>{Object.defineProperty(Vm,r,{get(){return Tt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class pT{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(ye.system.add(this.tickerUpdate,this,is.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ye.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const vr=new pT;class Qn{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Qn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new lt,this.page=new lt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class La extends Qn{constructor(){super(...arguments),this.client=new lt,this.movement=new lt,this.offset=new lt,this.global=new lt,this.screen=new lt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,h,l,u,c,d,p,m,f){throw new Error("Method not implemented.")}}class si extends La{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Hs extends La{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Hs.DOM_DELTA_PIXEL=0,Hs.DOM_DELTA_LINE=1,Hs.DOM_DELTA_PAGE=2;const fT=2048,mT=new lt,Lu=new lt;class gT{constructor(t){this.dispatch=new Fn,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){vr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,mT.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<fT&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(vr.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],p=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;const m=t.isInteractive();(p.length>0||m)&&(m&&this._allInteractiveElements.push(t),p.push(t)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:h&&!n(t,i)&&s(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(vr.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,i,s,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Lu),!t.hitArea.contains(Lu.x,Lu.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var h,l;if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const p=this.clonePointerEvent(e,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==n&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),i&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(c)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Hs)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const s=this.allocateEvent(si);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(Hs);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(si);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof si&&e instanceof si&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof La&&e instanceof La&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}const yT=1,bT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Gu=class yp{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new gT(null),vr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new si(null),this.rootWheelEvent=new Hs(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...yp.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,yp._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,vr.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,vr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;vr.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;vr.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=yT),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=bT[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Gu.extension={name:"events",type:[J.RendererSystem,J.CanvasRendererSystem]},Gu.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Nu=Gu;it.add(Nu);function Km(r){return r==="dynamic"||r==="static"}const xT={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??Km(Nu.defaultEventMode)},set interactive(r){Tt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Nu.defaultEventMode},set eventMode(r){this._internalInteractive=Km(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.on(r,t,s)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof Qn))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Ot.mixin(xT);const _T={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Ot.mixin(_T);const vT=9,Ga=100,TT=0,wT=0,Hm=2,Ym=1,ST=-1e3,ET=-1e3,CT=2;class zm{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Yi.tablet||Yi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ga}px`,e.style.height=`${Ga}px`,e.style.position="absolute",e.style.top=`${TT}px`,e.style.left=`${wT}px`,e.style.zIndex=Hm.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${Ym}px`,t.style.height=`${Ym}px`,t.style.position="absolute",t.style.top=`${ST}px`,t.style.left=`${ET}px`,t.style.zIndex=CT.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(Yi.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,l=s/o*h,u=n/a*h;let c=this.div;c.style.left=`${e}px`,c.style.top=`${i}px`,c.style.width=`${o}px`,c.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const p=this.children[d];if(p.renderId!==this.renderId)p._accessibleActive=!1,Xs(this.children,d,1),this.div.removeChild(p._accessibleDiv),this.pool.push(p._accessibleDiv),p._accessibleDiv=null,d--;else{c=p._accessibleDiv;let m=p.hitArea;const f=p.worldTransform;p.hitArea?(c.style.left=`${(f.tx+m.x*f.a)*l}px`,c.style.top=`${(f.ty+m.y*f.d)*u}px`,c.style.width=`${m.width*f.a*l}px`,c.style.height=`${m.height*f.d*u}px`):(m=p.getBounds(),this.capHitArea(m),c.style.left=`${m.x*l}px`,c.style.top=`${m.y*u}px`,c.style.width=`${m.width*l}px`,c.style.height=`${m.height*u}px`,c.title!==p.accessibleTitle&&p.accessibleTitle!==null&&(c.title=p.accessibleTitle),c.getAttribute("aria-label")!==p.accessibleHint&&p.accessibleHint!==null&&c.setAttribute("aria-label",p.accessibleHint)),(p.accessibleTitle!==c.title||p.tabIndex!==c.tabIndex)&&(c.title=p.accessibleTitle,c.tabIndex=p.tabIndex,this.debug&&this.updateDebugHTML(c))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Ga}px`,e.style.height=`${Ga}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Hm.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:i}=t.target,s=this.renderer.events.rootBoundary,n=Object.assign(new Qn(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===vT&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}zm.extension={name:"accessibility",type:[J.RendererPlugin,J.CanvasRendererPlugin]},it.add(zm);const jm=class bp{constructor(t){this.stage=new Xt,t=Object.assign({forceCanvas:!1},t),this.renderer=kv(t),bp._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const i=bp._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};jm._plugins=[];let Jm=jm;it.handleByList(J.Application,Jm._plugins);class $m{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}$m.extension=J.Application,it.add($m);const Qm={loader:J.LoadParser,resolver:J.ResolveParser,cache:J.CacheParser,detection:J.DetectionParser};it.handle(J.Asset,r=>{const t=r.ref;Object.entries(Qm).filter(([e])=>!!t[e]).forEach(([e,i])=>it.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(Qm).filter(e=>!!t[e]).forEach(e=>it.remove(t[e]))});class IT{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function Ys(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Tr(r,t){const e=r.split("?")[0],i=Jt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ni=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Fu=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function qm(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?qm(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function AT(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),qm(r,s,0,e,i)}else i.push(r);return i}const Na=r=>!Array.isArray(r);class RT{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=ni(t);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof rt){const a=e;i.forEach(h=>{a.baseTexture!==rt.EMPTY.baseTexture&&mt.addToCache(a.baseTexture,h),rt.addToCache(a,h)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const rs=new RT;class MT{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await n.load(t,e,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,s,e,this))&&(s=await l.parse(s,e,this)||s,i.parser=l)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Na(t),o=ni(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const u=Jt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),s[l.src]=await this.promiseCache[u].promise,e&&e(++i/a)}catch(c){throw delete this.promiseCache[u],delete s[l.src],new Error(`[Loader.load] Failed to load ${u}.
867
- ${c}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=ni(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Jt.toAbsolute(i.src),n=this.promiseCache[s];if(n){const h=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,h,i,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var oi=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(oi||{});const PT=".json",LT="application/json",GT={extension:{type:J.LoadParser,priority:oi.Low},name:"loadJson",test(r){return Ys(r,LT)||Tr(r,PT)},async load(r){return await(await q.ADAPTER.fetch(r)).json()}};it.add(GT);const NT=".txt",FT="text/plain",DT={name:"loadTxt",extension:{type:J.LoadParser,priority:oi.Low},test(r){return Ys(r,FT)||Tr(r,NT)},async load(r){return await(await q.ADAPTER.fetch(r)).text()}};it.add(DT);const kT=["normal","bold","100","200","300","400","500","600","700","800","900"],OT=[".ttf",".otf",".woff",".woff2"],WT=["font/ttf","font/otf","font/woff","font/woff2"],BT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function UT(r){const t=Jt.extname(r),e=Jt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(BT)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const XT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function ZT(r){return XT.test(r)?r:encodeURI(r)}const VT={extension:{type:J.LoadParser,priority:oi.Low},name:"loadWebFont",test(r){return Ys(r,WT)||Tr(r,OT)},async load(r,t){var i,s,n;const e=q.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??UT(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(u=>kT.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<h.length;u++){const c=h[u],d=new FontFace(a,`url(${ZT(r)})`,{...l,weight:c});await d.load(),e.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>q.ADAPTER.getFontFaceSet().delete(t))}};it.add(VT);let tg=0,Du;const KT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",HT={id:"checkImageBitmap",code:`
866
+ `;class dT extends ge{constructor(t=.5,e=Math.random()){super(Fm,cT,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const Vm={AlphaFilter:$v,BlurFilter:rT,BlurFilterPass:Mu,ColorMatrixFilter:Pu,DisplacementFilter:aT,FXAAFilter:uT,NoiseFilter:dT};Object.entries(Vm).forEach(([r,t])=>{Object.defineProperty(Vm,r,{get(){return Tt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class pT{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(ye.system.add(this.tickerUpdate,this,is.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ye.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const vr=new pT;class qn{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=qn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new lt,this.page=new lt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Ga extends qn{constructor(){super(...arguments),this.client=new lt,this.movement=new lt,this.offset=new lt,this.global=new lt,this.screen=new lt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,h,l,u,c,d,p,m,f){throw new Error("Method not implemented.")}}class ni extends Ga{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Ys extends Ga{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Ys.DOM_DELTA_PIXEL=0,Ys.DOM_DELTA_LINE=1,Ys.DOM_DELTA_PAGE=2;const fT=2048,mT=new lt,Lu=new lt;class gT{constructor(t){this.dispatch=new Dn,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){vr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,mT.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<fT&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(vr.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],p=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;const m=t.isInteractive();(p.length>0||m)&&(m&&this._allInteractiveElements.push(t),p.push(t)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:h&&!n(t,i)&&s(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(vr.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,i,s,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Lu),!t.hitArea.contains(Lu.x,Lu.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof ni)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var h,l;if(!(t instanceof ni)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const p=this.clonePointerEvent(e,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==n&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),i&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(c)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof ni)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof ni)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof ni)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof ni)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Ys)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const s=this.allocateEvent(ni);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(Ys);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(ni);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof ni&&e instanceof ni&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Ga&&e instanceof Ga&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}const yT=1,bT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Gu=class yp{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new gT(null),vr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ni(null),this.rootWheelEvent=new Ys(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...yp.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,yp._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,vr.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,vr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;vr.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;vr.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=yT),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=bT[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Gu.extension={name:"events",type:[J.RendererSystem,J.CanvasRendererSystem]},Gu.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Nu=Gu;it.add(Nu);function Km(r){return r==="dynamic"||r==="static"}const xT={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??Km(Nu.defaultEventMode)},set interactive(r){Tt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Nu.defaultEventMode},set eventMode(r){this._internalInteractive=Km(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.on(r,t,s)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof qn))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Ot.mixin(xT);const _T={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Ot.mixin(_T);const vT=9,Na=100,TT=0,wT=0,Hm=2,Ym=1,ST=-1e3,ET=-1e3,CT=2;class zm{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Yi.tablet||Yi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Na}px`,e.style.height=`${Na}px`,e.style.position="absolute",e.style.top=`${TT}px`,e.style.left=`${wT}px`,e.style.zIndex=Hm.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${Ym}px`,t.style.height=`${Ym}px`,t.style.position="absolute",t.style.top=`${ST}px`,t.style.left=`${ET}px`,t.style.zIndex=CT.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(Yi.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,l=s/o*h,u=n/a*h;let c=this.div;c.style.left=`${e}px`,c.style.top=`${i}px`,c.style.width=`${o}px`,c.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const p=this.children[d];if(p.renderId!==this.renderId)p._accessibleActive=!1,Zs(this.children,d,1),this.div.removeChild(p._accessibleDiv),this.pool.push(p._accessibleDiv),p._accessibleDiv=null,d--;else{c=p._accessibleDiv;let m=p.hitArea;const f=p.worldTransform;p.hitArea?(c.style.left=`${(f.tx+m.x*f.a)*l}px`,c.style.top=`${(f.ty+m.y*f.d)*u}px`,c.style.width=`${m.width*f.a*l}px`,c.style.height=`${m.height*f.d*u}px`):(m=p.getBounds(),this.capHitArea(m),c.style.left=`${m.x*l}px`,c.style.top=`${m.y*u}px`,c.style.width=`${m.width*l}px`,c.style.height=`${m.height*u}px`,c.title!==p.accessibleTitle&&p.accessibleTitle!==null&&(c.title=p.accessibleTitle),c.getAttribute("aria-label")!==p.accessibleHint&&p.accessibleHint!==null&&c.setAttribute("aria-label",p.accessibleHint)),(p.accessibleTitle!==c.title||p.tabIndex!==c.tabIndex)&&(c.title=p.accessibleTitle,c.tabIndex=p.tabIndex,this.debug&&this.updateDebugHTML(c))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Na}px`,e.style.height=`${Na}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Hm.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:i}=t.target,s=this.renderer.events.rootBoundary,n=Object.assign(new qn(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===vT&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}zm.extension={name:"accessibility",type:[J.RendererPlugin,J.CanvasRendererPlugin]},it.add(zm);const jm=class bp{constructor(t){this.stage=new Xt,t=Object.assign({forceCanvas:!1},t),this.renderer=kv(t),bp._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const i=bp._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};jm._plugins=[];let Jm=jm;it.handleByList(J.Application,Jm._plugins);class $m{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}$m.extension=J.Application,it.add($m);const Qm={loader:J.LoadParser,resolver:J.ResolveParser,cache:J.CacheParser,detection:J.DetectionParser};it.handle(J.Asset,r=>{const t=r.ref;Object.entries(Qm).filter(([e])=>!!t[e]).forEach(([e,i])=>it.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(Qm).filter(e=>!!t[e]).forEach(e=>it.remove(t[e]))});class IT{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function zs(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Tr(r,t){const e=r.split("?")[0],i=Jt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const oi=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Fu=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function qm(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?qm(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function AT(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),qm(r,s,0,e,i)}else i.push(r);return i}const Fa=r=>!Array.isArray(r);class RT{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=oi(t);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof rt){const a=e;i.forEach(h=>{a.baseTexture!==rt.EMPTY.baseTexture&&mt.addToCache(a.baseTexture,h),rt.addToCache(a,h)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const rs=new RT;class MT{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await n.load(t,e,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,s,e,this))&&(s=await l.parse(s,e,this)||s,i.parser=l)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Fa(t),o=oi(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const u=Jt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),s[l.src]=await this.promiseCache[u].promise,e&&e(++i/a)}catch(c){throw delete this.promiseCache[u],delete s[l.src],new Error(`[Loader.load] Failed to load ${u}.
867
+ ${c}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=oi(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Jt.toAbsolute(i.src),n=this.promiseCache[s];if(n){const h=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,h,i,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var ai=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ai||{});const PT=".json",LT="application/json",GT={extension:{type:J.LoadParser,priority:ai.Low},name:"loadJson",test(r){return zs(r,LT)||Tr(r,PT)},async load(r){return await(await q.ADAPTER.fetch(r)).json()}};it.add(GT);const NT=".txt",FT="text/plain",DT={name:"loadTxt",extension:{type:J.LoadParser,priority:ai.Low},test(r){return zs(r,FT)||Tr(r,NT)},async load(r){return await(await q.ADAPTER.fetch(r)).text()}};it.add(DT);const kT=["normal","bold","100","200","300","400","500","600","700","800","900"],OT=[".ttf",".otf",".woff",".woff2"],WT=["font/ttf","font/otf","font/woff","font/woff2"],BT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function UT(r){const t=Jt.extname(r),e=Jt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(BT)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const XT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function ZT(r){return XT.test(r)?r:encodeURI(r)}const VT={extension:{type:J.LoadParser,priority:ai.Low},name:"loadWebFont",test(r){return zs(r,WT)||Tr(r,OT)},async load(r,t){var i,s,n;const e=q.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??UT(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(u=>kT.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<h.length;u++){const c=h[u],d=new FontFace(a,`url(${ZT(r)})`,{...l,weight:c});await d.load(),e.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>q.ADAPTER.getFontFaceSet().delete(t))}};it.add(VT);let tg=0,Du;const KT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",HT={id:"checkImageBitmap",code:`
868
868
  async function checkImageBitmap()
869
869
  {
870
870
  try
@@ -919,8 +919,8 @@ ${c}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=ni
919
919
  id: event.data.id,
920
920
  });
921
921
  }
922
- };`};let ku;class zT{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const e=URL.createObjectURL(new Blob([HT.code],{type:"application/javascript"})),i=new Worker(e);i.addEventListener("message",s=>{i.terminate(),URL.revokeObjectURL(e),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Du===void 0&&(Du=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Du&&(ku||(ku=URL.createObjectURL(new Blob([YT.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(ku),t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((s,n)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[tg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:tg++,id:i})}}const eg=new zT;function qn(r,t,e){r.resource.internal=!0;const i=new rt(r),s=()=>{delete t.promiseCache[e],rs.has(e)&&rs.remove(e)};return i.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),i.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}const jT=[".jpeg",".jpg",".png",".webp",".avif"],JT=["image/jpeg","image/png","image/webp","image/avif"];async function $T(r){const t=await q.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Fa={name:"loadTextures",extension:{type:J.LoadParser,priority:oi.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Ys(r,JT)||Tr(r,jT)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await eg.isImageBitmapSupported()?s=await eg.loadImageBitmap(r):s=await $T(r):s=await new Promise((h,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=r,u.complete?h(u):(u.onload=()=>h(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=$i(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new mt(s,n);return o.resource.src=r,qn(o,e,r)},unload(r){r.destroy(!0)}};it.add(Fa);const QT=".svg",qT="image/svg+xml",tw={extension:{type:J.LoadParser,priority:oi.High},name:"loadSVG",test(r){return Ys(r,qT)||Tr(r,QT)},async testParse(r){return Au.test(r)},async parse(r,t,e){var n;const i=new Au(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new mt(i,{resolution:$i(r),...t==null?void 0:t.data});return s.resource.src=t.src,qn(s,e,t.src)},async load(r,t){return(await q.ADAPTER.fetch(r)).text()},unload:Fa.unload};it.add(tw);const ew=[".mp4",".m4v",".webm",".ogv"],iw=["video/mp4","video/webm","video/ogg"],rw={name:"loadVideo",extension:{type:J.LoadParser,priority:oi.High},config:{defaultAutoPlay:!0},test(r){return Ys(r,iw)||Tr(r,ew)},async load(r,t,e){var o;let i;const s=await(await q.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions},h=new Um(n,a);await h.load();const l=new mt(h,{alphaMode:await l1(),resolution:$i(r),...t==null?void 0:t.data});l.resource.src=r,i=qn(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};it.add(rw);class sw{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,name:i,src:s,srcs:n}=t;return ni(e||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(s=>{const n=s.src??s.srcs,o=s.alias??s.name;let a;if(typeof o=="string"){const h=this._createBundleAssetId(t,o);i.push(h),a=[o,h]}else{const h=o.map(l=>this._createBundleAssetId(t,l));i.push(...h),a=[...o,...h]}this.add({...s,alias:a,src:n})}):Object.keys(e).forEach(s=>{const n=[s,this._createBundleAssetId(t,s)];if(typeof e[s]=="string")this.add({alias:n,src:e[s]});else if(Array.isArray(e[s]))this.add({alias:n,src:e[s]});else{const o=e[s],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,s,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(Tt("7.2.0",`Assets.add now uses an object instead of individual parameters.
923
- Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},ni(o).forEach(h=>{const{src:l,srcs:u}=h;let{data:c,format:d,loadParser:p}=h;const m=ni(l||u).map(y=>typeof y=="string"?AT(y):Array.isArray(y)?y:[y]),f=this.getAlias(h);Array.isArray(f)?f.forEach(a):a(f);const g=[];m.forEach(y=>{y.forEach(_=>{let b={};if(typeof _!="object"){b.src=_;for(let v=0;v<this._parsers.length;v++){const S=this._parsers[v];if(S.test(_)){b=S.parse(_);break}}}else c=_.data??c,d=_.format??d,p=_.loadParser??p,b={...b,..._};if(!f)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:f,data:c,format:d,loadParser:p}),g.push(b)})}),f.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Na(t);t=ni(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(s,h)]=l}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Na(t);t=ni(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const u=n.filter(c=>c[h]?c[h]===l:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:s,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=Jt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??Jt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class nw{constructor(){this._detections=[],this._initialized=!1,this.resolver=new sw,this.loader=new MT,this.cache=rs,this._backgroundLoader=new IT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,s,n){this.resolver.add(t,e,i,s,n)}async load(t,e){this._initialized||await this.init();const i=Na(t),s=ni(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,h=0;const l=()=>{e==null||e(++a/h)},u=o.map(c=>{const d=s[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(p=>{n[c]=p})});return await Promise.all(u),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return rs.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=rs.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),s=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const o={};return i.forEach((a,h)=>{const l=n[a.src],u=[a.src];a.alias&&u.push(...a.alias),o[s[h]]=l,rs.set(u,l)}),o}async unload(t){this._initialized||await this.init();const e=ni(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=ni(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{rs.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}get preferWorkers(){return Fa.config.preferWorkers}set preferWorkers(t){Tt("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Da=new nw;it.handleByList(J.LoadParser,Da.loader.parsers).handleByList(J.ResolveParser,Da.resolver.parsers).handleByList(J.CacheParser,Da.cache.parsers).handleByList(J.DetectionParser,Da.detections);const ow={extension:J.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof rt),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};it.add(ow);async function ig(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const aw={extension:{type:J.DetectionParser,priority:1},test:async()=>ig("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};it.add(aw);const hw={extension:{type:J.DetectionParser,priority:0},test:async()=>ig("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};it.add(hw);const rg=["png","jpg","jpeg"],lw={extension:{type:J.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...rg],remove:async r=>r.filter(t=>!rg.includes(t))};it.add(lw);const uw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Ou(r){return uw?!1:document.createElement("video").canPlayType(r)!==""}const cw={extension:{type:J.DetectionParser,priority:0},test:async()=>Ou("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};it.add(cw);const dw={extension:{type:J.DetectionParser,priority:0},test:async()=>Ou("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};it.add(dw);const pw={extension:{type:J.DetectionParser,priority:0},test:async()=>Ou("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};it.add(pw);const fw={extension:J.ResolveParser,test:Fa.test,parse:r=>{var t;return{resolution:parseFloat(((t=q.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Jt.extname(r).slice(1),src:r}}};it.add(fw);var Ie=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r))(Ie||{});const ka={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35986:1,34798:1,37808:1};let tr,zs;function sg(){zs={s3tc:tr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:tr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:tr.getExtension("WEBGL_compressed_texture_etc"),etc1:tr.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:tr.getExtension("WEBGL_compressed_texture_pvrtc")||tr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:tr.getExtension("WEBGL_compressed_texture_atc"),astc:tr.getExtension("WEBGL_compressed_texture_astc")}}const mw={extension:{type:J.DetectionParser,priority:2},test:async()=>{const r=q.ADAPTER.createCanvas().getContext("webgl");return r?(tr=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{zs||sg();const t=[];for(const e in zs)zs[e]&&t.push(e);return[...t,...r]},remove:async r=>(zs||sg(),r.filter(t=>!(t in zs)))};it.add(mw);class gw extends ca{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,s;typeof t=="string"?(i=t,s=new Uint8Array):(i=null,s=t),super(s,e),this.origin=i,this.buffer=s?new ru(s):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new ru(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class ss extends gw{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=ss._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||ss._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const s=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;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=ss._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=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,i,s,n,o,a){const h=new Array(i);let l=t.byteOffset,u=o,c=a,d=u+s-1&~(s-1),p=c+n-1&~(n-1),m=d*p*ka[e];for(let f=0;f<i;f++)h[f]={levelID:f,levelWidth:i>1?u:d,levelHeight:i>1?c:p,levelBuffer:new Uint8Array(t.buffer,l,m)},l+=m,u=u>>1||1,c=c>>1||1,d=u+s-1&~(s-1),p=c+n-1&~(n-1),m=d*p*ka[e];return h}}const Wu=4,Oa=124,yw=32,ng=20,bw=542327876,Wa={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},xw={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},Ba={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},_w=1,vw=2,Tw=4,ww=64,Sw=512,Ew=131072,Cw=827611204,Iw=861165636,Aw=894720068,Rw=808540228,Mw=4,Pw={[Cw]:Ie.COMPRESSED_RGBA_S3TC_DXT1_EXT,[Iw]:Ie.COMPRESSED_RGBA_S3TC_DXT3_EXT,[Aw]:Ie.COMPRESSED_RGBA_S3TC_DXT5_EXT},Lw={70:Ie.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ie.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ie.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ie.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ie.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ie.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ie.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ie.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ie.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Gw(r){const t=new Uint32Array(r);if(t[0]!==bw)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Oa/Uint32Array.BYTES_PER_ELEMENT),i=e[Wa.HEIGHT],s=e[Wa.WIDTH],n=e[Wa.MIPMAP_COUNT],o=new Uint32Array(r,Wa.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,yw/Uint32Array.BYTES_PER_ELEMENT),a=o[_w];if(a&Tw){const h=o[xw.FOURCC];if(h!==Rw){const _=Pw[h],b=Wu+Oa,v=new Uint8Array(r,b);return[new ss(v,{format:_,width:s,height:i,levels:n})]}const l=Wu+Oa,u=new Uint32Array(t.buffer,l,ng/Uint32Array.BYTES_PER_ELEMENT),c=u[Ba.DXGI_FORMAT],d=u[Ba.RESOURCE_DIMENSION],p=u[Ba.MISC_FLAG],m=u[Ba.ARRAY_SIZE],f=Lw[c];if(f===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(p===Mw)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,y=Wu+Oa+ng;if(m===1)g.push(new Uint8Array(r,y));else{const _=ka[f];let b=0,v=s,S=i;for(let A=0;A<n;A++){const I=Math.max(1,v+3&-4),P=Math.max(1,S+3&-4),W=I*P*_;b+=W,v=v>>>1,S=S>>>1}let E=y;for(let A=0;A<m;A++)g.push(new Uint8Array(r,E,b)),E+=b}return g.map(_=>new ss(_,{format:f,width:s,height:i,levels:n}))}throw a&ww?new Error("DDSParser does not support uncompressed texture data."):a&Sw?new Error("DDSParser does not supported YUV uncompressed texture data."):a&Ew?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&vw?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const og=[171,75,84,88,32,49,49,187,13,10,26,10],Nw=67305985,ai={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},Bu=64,ag={[at.UNSIGNED_BYTE]:1,[at.UNSIGNED_SHORT]:2,[at.INT]:4,[at.UNSIGNED_INT]:4,[at.FLOAT]:4,[at.HALF_FLOAT]:8},Fw={[H.RGBA]:4,[H.RGB]:3,[H.RG]:2,[H.RED]:1,[H.LUMINANCE]:1,[H.LUMINANCE_ALPHA]:2,[H.ALPHA]:1},Dw={[at.UNSIGNED_SHORT_4_4_4_4]:2,[at.UNSIGNED_SHORT_5_5_5_1]:2,[at.UNSIGNED_SHORT_5_6_5]:2};function kw(r,t,e=!1){const i=new DataView(t);if(!Ow(r,i))return null;const s=i.getUint32(ai.ENDIANNESS,!0)===Nw,n=i.getUint32(ai.GL_TYPE,s),o=i.getUint32(ai.GL_FORMAT,s),a=i.getUint32(ai.GL_INTERNAL_FORMAT,s),h=i.getUint32(ai.PIXEL_WIDTH,s),l=i.getUint32(ai.PIXEL_HEIGHT,s)||1,u=i.getUint32(ai.PIXEL_DEPTH,s)||1,c=i.getUint32(ai.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(ai.NUMBER_OF_FACES,s),p=i.getUint32(ai.NUMBER_OF_MIPMAP_LEVELS,s),m=i.getUint32(ai.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const f=4,g=4,y=h+3&-4,_=l+3&-4,b=new Array(c);let v=h*l;n===0&&(v=y*_);let S;if(n!==0?ag[n]?S=ag[n]*Fw[o]:S=Dw[n]:S=ka[a],S===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const E=e?Bw(i,m,s):null;let A=v*S,I=h,P=l,W=y,D=_,L=Bu+m;for(let C=0;C<p;C++){const N=i.getUint32(L,s);let U=L+4;for(let K=0;K<c;K++){let Z=b[K];Z||(Z=b[K]=new Array(p)),Z[C]={levelID:C,levelWidth:p>1||n!==0?I:W,levelHeight:p>1||n!==0?P:D,levelBuffer:new Uint8Array(t,U,A)},U+=A}L+=N+4,L=L%4!==0?L+4-L%4:L,I=I>>1||1,P=P>>1||1,W=I+f-1&~(f-1),D=P+g-1&~(g-1),A=W*D*S}return n!==0?{uncompressed:b.map(C=>{let N=C[0].levelBuffer,U=!1;return n===at.FLOAT?N=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===at.UNSIGNED_INT?(U=!0,N=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===at.INT&&(U=!0,N=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new ca(N,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:U?Ww(o):o}}),kvData:E}:{compressed:b.map(C=>new ss(null,{format:a,width:h,height:l,levels:p,levelBuffers:C})),kvData:E}}function Ow(r,t){for(let e=0;e<og.length;e++)if(t.getUint8(e)!==og[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function Ww(r){switch(r){case H.RGBA:return H.RGBA_INTEGER;case H.RGB:return H.RGB_INTEGER;case H.RG:return H.RG_INTEGER;case H.RED:return H.RED_INTEGER;default:return r}}function Bw(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(Bu+s,e),o=Bu+s+4,a=3-(n+3)%4;if(n===0||n>t-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&r.getUint8(o+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(r.buffer,o,h)),u=new DataView(r.buffer,o+h+1,n-h-1);i.set(l,u),s+=4+n+a}return i}const Uw={extension:{type:J.LoadParser,priority:oi.High},name:"loadDDS",test(r){return Tr(r,".dds")},async load(r,t,e){const i=await(await q.ADAPTER.fetch(r)).arrayBuffer(),s=Gw(i).map(n=>{const o=new mt(n,{mipmap:xi.OFF,alphaMode:xe.NO_PREMULTIPLIED_ALPHA,resolution:$i(r),...t.data});return qn(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(Uw);const Xw={extension:{type:J.LoadParser,priority:oi.High},name:"loadKTX",test(r){return Tr(r,".ktx")},async load(r,t,e){const i=await(await q.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=kw(r,i),a=s??n,h={mipmap:xi.OFF,alphaMode:xe.NO_PREMULTIPLIED_ALPHA,resolution:$i(r),...t.data},l=a.map(u=>{a===n&&Object.assign(h,{type:u.type,format:u.format});const c=u.resource??u,d=new mt(c,h);return d.ktxKeyValueData=o,qn(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(Xw);const Zw={extension:J.ResolveParser,test:r=>{const t=Jt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=Jt.extname(r).slice(1);if(t==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((e=q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=q.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};it.add(Zw);const Ua=new dt,Vw=4,hg=class Ko{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,s){const n=new Image;return n.src=await this.base64(t,e,i,s),n}async base64(t,e,i,s){const n=this.canvas(t,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&Ko._flipY(i,s,n),a&&Ko._unpremultiplyAlpha(i);const h=new E1(s,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&Ko._flipY(i,s,n),a&&Ko._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,h=!1;t&&(t instanceof qr?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Ua.width=e.width,Ua.height=e.height,e=Ua)));const l=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===H.RGBA,!h){i.renderTexture.bind(a);const p=a.framebuffer.glFramebuffers[i.CONTEXT_UID];p.blitFramebuffer&&i.framebuffer.bind(p.blitFramebuffer)}}else s=i.resolution,e||(e=Ua,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const u=Math.max(Math.round(e.width*s),1),c=Math.max(Math.round(e.height*s),1),d=new Uint8Array(Vw*u*c);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const h=a*s,l=(i-a-1)*s;o.set(t.subarray(h,h+s)),t.copyWithin(h,l,l+s),t.set(o,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const s=t[i+3];if(s!==0){const n=255.001/s;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};hg.extension={name:"extract",type:J.RendererSystem};let Kw=hg;it.add(Kw);const Xa={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===ae.CIRC){const m=r.shape;e=m.x,i=m.y,o=a=m.radius,s=n=0}else if(r.type===ae.ELIP){const m=r.shape;e=m.x,i=m.y,o=m.width,a=m.height,s=n=0}else{const m=r.shape,f=m.width/2,g=m.height/2;e=m.x+f,i=m.y+g,o=a=Math.max(0,Math.min(m.radius,Math.min(f,g))),s=f-o,n=g-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(s?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let u=0,c=h*4+(s?2:0)+2,d=c,p=l;{const m=s+o,f=n,g=e+m,y=e-m,_=i+f;if(t[u++]=g,t[u++]=_,t[--c]=_,t[--c]=y,n){const b=i-f;t[d++]=y,t[d++]=b,t[--p]=b,t[--p]=g}}for(let m=1;m<h;m++){const f=Math.PI/2*(m/h),g=s+Math.cos(f)*o,y=n+Math.sin(f)*a,_=e+g,b=e-g,v=i+y,S=i-y;t[u++]=_,t[u++]=v,t[--c]=v,t[--c]=b,t[d++]=b,t[d++]=S,t[--p]=S,t[--p]=_}{const m=s,f=n+a,g=e+m,y=e-m,_=i+f,b=i-f;t[u++]=g,t[u++]=_,t[--p]=b,t[--p]=g,s&&(t[u++]=y,t[u++]=_,t[--p]=b,t[--p]=y)}},triangulate(r,t){const e=r.points,i=t.points,s=t.indices;if(e.length===0)return;let n=i.length/2;const o=n;let a,h;if(r.type!==ae.RREC){const u=r.shape;a=u.x,h=u.y}else{const u=r.shape;a=u.x+u.width/2,h=u.y+u.height/2}const l=r.matrix;i.push(r.matrix?l.a*a+l.c*h+l.tx:a,r.matrix?l.b*a+l.d*h+l.ty:h),n++,i.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)i.push(e[u],e[u+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function lg(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],h=r[s+1];i+=(a-n)*(h+o),n=a,o=h}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,h=n,l=n+1;[r[o],r[h]]=[r[h],r[o]],[r[a],r[l]]=[r[l],r[a]]}}}const ug={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const i=r.holes,s=t.points,n=t.indices;if(e.length>=6){lg(e,!1);const o=[];for(let l=0;l<i.length;l++){const u=i[l];lg(u.points,!0),o.push(e.length/2),e=e.concat(u.points)}const a=ex(e,o,2);if(!a)return;const h=s.length/2;for(let l=0;l<a.length;l+=3)n.push(a[l]+h),n.push(a[l+1]+h),n.push(a[l+2]+h);for(let l=0;l<e.length;l++)s.push(e[l])}}},Hw={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(e,i,e+s,i,e+s,i+n,e,i+n)},triangulate(r,t){const e=r.points,i=t.points;if(e.length===0)return;const s=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},Yw={build(r){Xa.build(r)},triangulate(r,t){Xa.triangulate(r,t)}};var Be=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Be||{}),wr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(wr||{});const js={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class cg{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,u=s-e,c=i-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const p=h*h+l*l,m=u*u+c*c,f=h*u+l*c,g=n*Math.sqrt(p)/d,y=n*Math.sqrt(m)/d,_=g*f/p,b=y*f/m,v=g*c+y*l,S=g*u+y*h,E=l*(y+_),A=h*(y+_),I=c*(g+b),P=u*(g+b),W=Math.atan2(A-S,E-v),D=Math.atan2(P-S,I-v);return{cx:v+t,cy:S+e,radius:n,startAngle:W,endAngle:D,anticlockwise:l*u>c*h}}static arc(t,e,i,s,n,o,a,h,l){const u=a-o,c=js._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/pa)*40),d=u/(c*2),p=d*2,m=Math.cos(d),f=Math.sin(d),g=c-1,y=g%1/g;for(let _=0;_<=g;++_){const b=_+y*_,v=d+o+p*b,S=Math.cos(v),E=-Math.sin(v);l.push((m*S+f*E)*n+i,(m*-E+f*S)*n+s)}}}class zw{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class Uu{static curveLength(t,e,i,s,n,o,a,h){let l=0,u=0,c=0,d=0,p=0,m=0,f=0,g=0,y=0,_=0,b=0,v=t,S=e;for(let E=1;E<=10;++E)u=E/10,c=u*u,d=c*u,p=1-u,m=p*p,f=m*p,g=f*t+3*m*u*i+3*p*c*n+d*a,y=f*e+3*m*u*s+3*p*c*o+d*h,_=v-g,b=S-y,v=g,S=y,l+=Math.sqrt(_*_+b*b);return l}static curveTo(t,e,i,s,n,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const u=js._segmentsCount(Uu.curveLength(h,l,t,e,i,s,n,o));let c=0,d=0,p=0,m=0,f=0;a.push(h,l);for(let g=1,y=0;g<=u;++g)y=g/u,c=1-y,d=c*c,p=d*c,m=y*y,f=m*y,a.push(p*h+3*d*y*t+3*c*m*i+f*n,p*l+3*d*y*e+3*c*m*s+f*o)}}function dg(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,u=r+e*n,c=t+i*n;let d,p;o?(d=i,p=-e):(d=-i,p=e);const m=h+d,f=l+p,g=u+d,y=c+p;return a.push(m,f,g,y),2}function ns(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let u=Math.atan2(h,l),c=Math.atan2(s-r,n-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let d=u;const p=c-u,m=Math.abs(p),f=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(f)/Math.PI>>0)+1,y=p/g;if(d+=y,a){o.push(r,t,e,i);for(let _=1,b=d;_<g;_++,b+=y)o.push(r,t,r+Math.sin(b)*f,t+Math.cos(b)*f);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let _=1,b=d;_<g;_++,b+=y)o.push(r+Math.sin(b)*f,t+Math.cos(b)*f,r,t);o.push(s,n,r,t)}return g*2}function jw(r,t){const e=r.shape;let i=r.points||e.points.slice();const s=t.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new lt(i[0],i[1]),a=new lt(i[i.length-2],i[i.length-1]),h=e.type!==ae.POLY||e.closeStroke,l=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const Z=(o.x+a.x)*.5,z=(a.y+o.y)*.5;i.unshift(Z,z),i.push(Z,z)}const u=t.points,c=i.length/2;let d=i.length;const p=u.length/2,m=n.width/2,f=m*m,g=n.miterLimit*n.miterLimit;let y=i[0],_=i[1],b=i[2],v=i[3],S=0,E=0,A=-(_-v),I=y-b,P=0,W=0,D=Math.sqrt(A*A+I*I);A/=D,I/=D,A*=m,I*=m;const L=n.alignment,C=(1-L)*2,N=L*2;h||(n.cap===wr.ROUND?d+=ns(y-A*(C-N)*.5,_-I*(C-N)*.5,y-A*C,_-I*C,y+A*N,_+I*N,u,!0)+2:n.cap===wr.SQUARE&&(d+=dg(y,_,A,I,C,N,!0,u))),u.push(y-A*C,_-I*C,y+A*N,_+I*N);for(let Z=1;Z<c-1;++Z){y=i[(Z-1)*2],_=i[(Z-1)*2+1],b=i[Z*2],v=i[Z*2+1],S=i[(Z+1)*2],E=i[(Z+1)*2+1],A=-(_-v),I=y-b,D=Math.sqrt(A*A+I*I),A/=D,I/=D,A*=m,I*=m,P=-(v-E),W=b-S,D=Math.sqrt(P*P+W*W),P/=D,W/=D,P*=m,W*=m;const z=b-y,k=_-v,F=b-S,G=E-v,V=z*F+k*G,$=k*F-G*z,ut=$<0;if(Math.abs($)<.001*Math.abs(V)){u.push(b-A*C,v-I*C,b+A*N,v+I*N),V>=0&&(n.join===Be.ROUND?d+=ns(b,v,b-A*C,v-I*C,b-P*C,v-W*C,u,!1)+4:d+=2,u.push(b-P*N,v-W*N,b+P*C,v+W*C));continue}const nt=(-A+y)*(-I+v)-(-A+b)*(-I+_),Ct=(-P+S)*(-W+v)-(-P+b)*(-W+E),Rt=(z*Ct-F*nt)/$,_t=(G*nt-k*Ct)/$,Y=(Rt-b)*(Rt-b)+(_t-v)*(_t-v),tt=b+(Rt-b)*C,et=v+(_t-v)*C,O=b-(Rt-b)*N,xt=v-(_t-v)*N,gt=Math.min(z*z+k*k,F*F+G*G),Mt=ut?C:N,Ut=gt+Mt*Mt*f,Ne=Y<=Ut;let pi=n.join;if(pi===Be.MITER&&Y/f>g&&(pi=Be.BEVEL),Ne)switch(pi){case Be.MITER:{u.push(tt,et,O,xt);break}case Be.BEVEL:{ut?u.push(tt,et,b+A*N,v+I*N,tt,et,b+P*N,v+W*N):u.push(b-A*C,v-I*C,O,xt,b-P*C,v-W*C,O,xt),d+=2;break}case Be.ROUND:{ut?(u.push(tt,et,b+A*N,v+I*N),d+=ns(b,v,b+A*N,v+I*N,b+P*N,v+W*N,u,!0)+4,u.push(tt,et,b+P*N,v+W*N)):(u.push(b-A*C,v-I*C,O,xt),d+=ns(b,v,b-A*C,v-I*C,b-P*C,v-W*C,u,!1)+4,u.push(b-P*C,v-W*C,O,xt));break}}else{switch(u.push(b-A*C,v-I*C,b+A*N,v+I*N),pi){case Be.MITER:{ut?u.push(O,xt,O,xt):u.push(tt,et,tt,et),d+=2;break}case Be.ROUND:{ut?d+=ns(b,v,b+A*N,v+I*N,b+P*N,v+W*N,u,!0)+2:d+=ns(b,v,b-A*C,v-I*C,b-P*C,v-W*C,u,!1)+2;break}}u.push(b-P*C,v-W*C,b+P*N,v+W*N),d+=2}}y=i[(c-2)*2],_=i[(c-2)*2+1],b=i[(c-1)*2],v=i[(c-1)*2+1],A=-(_-v),I=y-b,D=Math.sqrt(A*A+I*I),A/=D,I/=D,A*=m,I*=m,u.push(b-A*C,v-I*C,b+A*N,v+I*N),h||(n.cap===wr.ROUND?d+=ns(b-A*(C-N)*.5,v-I*(C-N)*.5,b-A*C,v-I*C,b+A*N,v+I*N,u,!1)+2:n.cap===wr.SQUARE&&(d+=dg(b,v,A,I,C,N,!1,u)));const U=t.indices,K=js.epsilon*js.epsilon;for(let Z=p;Z<d+p-2;++Z)y=u[Z*2],_=u[Z*2+1],b=u[(Z+1)*2],v=u[(Z+1)*2+1],S=u[(Z+2)*2],E=u[(Z+2)*2+1],!(Math.abs(y*(v-E)+b*(E-_)+S*(_-v))<K)&&U.push(Z,Z+1,Z+2)}function Jw(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==ae.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,h=s.length/2,l=o.length/2;let u=l;for(o.push(s[0],s[1]),e=1;e<h;e++)o.push(s[e*2],s[e*2+1]),a.push(u,u+1),u++;n&&a.push(u,l)}function pg(r,t){r.lineStyle.native?Jw(r,t):jw(r,t)}class Xu{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,h=e-2*s+o,l=2*i-2*t,u=2*s-2*e,c=4*(a*a+h*h),d=4*(a*l+h*u),p=l*l+u*u,m=2*Math.sqrt(c+d+p),f=Math.sqrt(c),g=2*c*f,y=2*Math.sqrt(p),_=d/f;return(g*m+f*d*(m-y)+(4*p*c-d*d)*Math.log((2*f+_+m)/(_+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=js._segmentsCount(Xu.curveLength(o,a,t,e,i,s));let l=0,u=0;for(let c=1;c<=h;++c){const d=c/h;l=o+(t-o)*d,u=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,u+(e+(s-e)*d-u)*d)}}}const Zu={[ae.POLY]:ug,[ae.CIRC]:Xa,[ae.ELIP]:Xa,[ae.RECT]:Hw,[ae.RREC]:Yw},fg=[],Za=[];class Va{constructor(t,e=null,i=null,s=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=s,this.type=t.type}clone(){return new Va(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const Js=new lt,mg=class Sb extends zf{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 Pa,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Za.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),fg.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,s=null){const n=new Va(t,e,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new Va(t,null,null,e),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let i=0;i<e.length;++i){const s=e[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,Js):Js.copyFrom(t),s.shape.contains(Js.x,Js.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(Js.x,Js.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],u=l.fillStyle,c=l.lineStyle;Zu[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const p=d===0?u:c;if(!p.visible)continue;const m=p.texture.baseTexture,f=this.indices.length,g=this.points.length/2;m.wrapMode=Ki.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,p)&&(i.end(f,g),i=null),i||(i=fg.pop()||new zw,i.begin(p,f,g),this.batches.push(i),s=p),this.addUvs(this.points,t,p.texture,g,y,p.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const i=this.graphicsData[t],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const s=t[e];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<Sb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++mt._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Za.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=Za.pop();s||(s=new du,s.texArray=new bu),s.texArray.count=0,s.start=0,s.size=0,s.type=bi.TRIANGLES;let n=0,o=null,a=0,h=!1,l=bi.TRIANGLES,u=0;this.drawCalls.push(s);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],p=8,m=d.style,f=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?bi.LINES:bi.TRIANGLES,o=null,n=p,t++),o!==f&&(o=f,f._batchEnabled!==t&&(n===p&&(t++,n=0,s.size>0&&(s=Za.pop(),s||(s=new du,s.texArray=new bu),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=l),f.touched=1,f._batchEnabled=t,f._batchLocation=n,f.wrapMode=Ki.REPEAT,s.texArray.elements[s.texArray.count++]=f,n++)),s.size+=d.size,u+=d.size,a=f._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}mt._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)o[h++]=t[l*2],o[h++]=t[l*2+1],o[h++]=e[l*2],o[h++]=e[l*2+1],a[h++]=i[l],o[h++]=s[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?ug.triangulate(t,this):Zu[t.type].triangulate(t,this)}processLine(t){pg(t,this);for(let e=0;e<t.holes.length;e++)pg(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];Zu[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){const s=t[i*2],n=t[i*2+1];t[i*2]=e.a*s+e.c*n+e.tx,t[i*2+1]=e.b*s+e.d*n+e.ty}}addColors(t,e,i,s,n=0){const o=Gt.shared.setValue(e).toLittleEndianNumber(),a=Gt.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let h=0;h<s;h++)t[n+h]=a}addTextureIds(t,e,i,s=0){t.length=Math.max(t.length,s+i);for(let n=0;n<i;n++)t[s+n]=e}addUvs(t,e,i,s,n,o=null){let a=0;const h=e.length,l=i.frame;for(;a<n;){let c=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const p=o.a*c+o.c*d+o.tx;d=o.b*c+o.d*d+o.ty,c=p}a++,e.push(c/l.width,d/l.height)}const u=i.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,i,h,n)}adjustUvs(t,e,i,s){const n=e.baseTexture,o=1e-6,a=i+s*2,h=e.frame,l=h.width/n.width,u=h.height/n.height;let c=h.x/h.width,d=h.y/h.height,p=Math.floor(t[i]+o),m=Math.floor(t[i+1]+o);for(let f=i+2;f<a;f+=2)p=Math.min(p,Math.floor(t[f]+o)),m=Math.min(m,Math.floor(t[f+1]+o));c-=p,d-=m;for(let f=i;f<a;f+=2)t[f]=(t[f]+c)*l,t[f+1]=(t[f+1]+d)*u}};mg.BATCHABLE_SIZE=100;let $w=mg;class Ka{constructor(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ka;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Vu extends Ka{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=wr.BUTT,this.join=Be.MITER,this.miterLimit=10}clone(){const t=new Vu;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=wr.BUTT,this.join=Be.MITER,this.miterLimit=10}}const Ku={},Hu=class ul extends Xt{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Ka,this._lineStyle=new Vu,this._matrix=null,this._holeMode=!1,this.state=Ci.for2d(),this._geometry=t||new $w,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Gt(16777215),this.blendMode=ct.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new ul(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:rt.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:wr.BUTT,join:Be.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Yr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Yr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Xu.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),Uu.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=cg.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:p}=a;this.arc(h,l,u,c,d,p)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=pa:o&&s<=n&&(s+=pa),n-s===0)return this;const a=t+Math.cos(s)*i,h=e+Math.sin(s)*i,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-a),d=Math.abs(u[u.length-1]-h);c<l&&d<l||u.push(a,h)}else this.moveTo(a,h),u=this.currentPath.points;return cg.arc(a,h,t,e,i,s,n,o,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:rt.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Gt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:rt.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new dt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new ya(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new ma(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new ga(t,e,i,s))}drawPolygon(...t){let e,i=!0;const s=t[0];s.points?(i=s.closeStroke,e=s.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Yr(e);return n.closeStroke=i,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===ae.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let s=0;s<i;s++){const n=t.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:a,blendMode:e,indices:l,uvs:h,_batchRGB:Gt.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,s=this.worldAlpha,n=e.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,Gt.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!Ku[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:ri.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Ku[i]=new Ii(a,o)}e=Ku[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:s,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,s,n)}containsPoint(t){return this.worldTransform.applyInverse(t,ul._TEMP_POINT),this._geometry.containsPoint(ul._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=Gt.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const p=l[d],m=l[d+1];u[c++]=i*p+n*m+a,u[c++]=o*m+s*p+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};Hu.curves=js,Hu._TEMP_POINT=new lt;let to=Hu;class Qw{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const Yu=new lt,gg=new Yr,yg=class Eb extends Xt{constructor(t,e,i,s=bi.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Ci.for2d(),this.drawMode=s,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=q.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===bi.TRIANGLES&&e.length<Eb.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,h=s.d,l=s.tx,u=s.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const p=e[d*2],m=e[d*2+1];c[d*2]=n*p+a*m+l,c[d*2+1]=o*p+h*m+u}if(this._roundPixels){const d=q.RESOLUTION;for(let p=0;p<c.length;++p)c[p]=Math.round(c[p]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Qw(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,Yu);const e=this.geometry.getBuffer("aVertexPosition").data,i=gg.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=s[a]*2,l=s[a+1]*2,u=s[a+2]*2;if(i[0]=e[h],i[1]=e[h+1],i[2]=e[l],i[3]=e[l+1],i[4]=e[u],i[5]=e[u+1],gg.contains(Yu.x,Yu.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};yg.BATCHABLE_SIZE=100;let zu=yg;class bg extends xr{constructor(t,e,i){super();const s=new Kt(t),n=new Kt(e,!0),o=new Kt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,at.FLOAT).addAttribute("aTextureCoord",n,2,!1,at.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var qw=`varying vec2 vTextureCoord;
922
+ };`};let ku;class zT{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const e=URL.createObjectURL(new Blob([HT.code],{type:"application/javascript"})),i=new Worker(e);i.addEventListener("message",s=>{i.terminate(),URL.revokeObjectURL(e),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Du===void 0&&(Du=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Du&&(ku||(ku=URL.createObjectURL(new Blob([YT.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(ku),t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((s,n)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[tg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:tg++,id:i})}}const eg=new zT;function to(r,t,e){r.resource.internal=!0;const i=new rt(r),s=()=>{delete t.promiseCache[e],rs.has(e)&&rs.remove(e)};return i.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),i.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}const jT=[".jpeg",".jpg",".png",".webp",".avif"],JT=["image/jpeg","image/png","image/webp","image/avif"];async function $T(r){const t=await q.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Da={name:"loadTextures",extension:{type:J.LoadParser,priority:ai.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return zs(r,JT)||Tr(r,jT)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await eg.isImageBitmapSupported()?s=await eg.loadImageBitmap(r):s=await $T(r):s=await new Promise((h,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=r,u.complete?h(u):(u.onload=()=>h(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=$i(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new mt(s,n);return o.resource.src=r,to(o,e,r)},unload(r){r.destroy(!0)}};it.add(Da);const QT=".svg",qT="image/svg+xml",tw={extension:{type:J.LoadParser,priority:ai.High},name:"loadSVG",test(r){return zs(r,qT)||Tr(r,QT)},async testParse(r){return Au.test(r)},async parse(r,t,e){var n;const i=new Au(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new mt(i,{resolution:$i(r),...t==null?void 0:t.data});return s.resource.src=t.src,to(s,e,t.src)},async load(r,t){return(await q.ADAPTER.fetch(r)).text()},unload:Da.unload};it.add(tw);const ew=[".mp4",".m4v",".webm",".ogv"],iw=["video/mp4","video/webm","video/ogg"],rw={name:"loadVideo",extension:{type:J.LoadParser,priority:ai.High},config:{defaultAutoPlay:!0},test(r){return zs(r,iw)||Tr(r,ew)},async load(r,t,e){var o;let i;const s=await(await q.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions},h=new Um(n,a);await h.load();const l=new mt(h,{alphaMode:await l1(),resolution:$i(r),...t==null?void 0:t.data});l.resource.src=r,i=to(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};it.add(rw);class sw{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,name:i,src:s,srcs:n}=t;return oi(e||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(s=>{const n=s.src??s.srcs,o=s.alias??s.name;let a;if(typeof o=="string"){const h=this._createBundleAssetId(t,o);i.push(h),a=[o,h]}else{const h=o.map(l=>this._createBundleAssetId(t,l));i.push(...h),a=[...o,...h]}this.add({...s,alias:a,src:n})}):Object.keys(e).forEach(s=>{const n=[s,this._createBundleAssetId(t,s)];if(typeof e[s]=="string")this.add({alias:n,src:e[s]});else if(Array.isArray(e[s]))this.add({alias:n,src:e[s]});else{const o=e[s],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,s,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(Tt("7.2.0",`Assets.add now uses an object instead of individual parameters.
923
+ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},oi(o).forEach(h=>{const{src:l,srcs:u}=h;let{data:c,format:d,loadParser:p}=h;const m=oi(l||u).map(y=>typeof y=="string"?AT(y):Array.isArray(y)?y:[y]),f=this.getAlias(h);Array.isArray(f)?f.forEach(a):a(f);const g=[];m.forEach(y=>{y.forEach(_=>{let b={};if(typeof _!="object"){b.src=_;for(let v=0;v<this._parsers.length;v++){const S=this._parsers[v];if(S.test(_)){b=S.parse(_);break}}}else c=_.data??c,d=_.format??d,p=_.loadParser??p,b={...b,..._};if(!f)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:f,data:c,format:d,loadParser:p}),g.push(b)})}),f.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Fa(t);t=oi(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(s,h)]=l}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Fa(t);t=oi(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const u=n.filter(c=>c[h]?c[h]===l:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:s,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=Jt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??Jt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class nw{constructor(){this._detections=[],this._initialized=!1,this.resolver=new sw,this.loader=new MT,this.cache=rs,this._backgroundLoader=new IT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,s,n){this.resolver.add(t,e,i,s,n)}async load(t,e){this._initialized||await this.init();const i=Fa(t),s=oi(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,h=0;const l=()=>{e==null||e(++a/h)},u=o.map(c=>{const d=s[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(p=>{n[c]=p})});return await Promise.all(u),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return rs.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=rs.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),s=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const o={};return i.forEach((a,h)=>{const l=n[a.src],u=[a.src];a.alias&&u.push(...a.alias),o[s[h]]=l,rs.set(u,l)}),o}async unload(t){this._initialized||await this.init();const e=oi(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=oi(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{rs.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}get preferWorkers(){return Da.config.preferWorkers}set preferWorkers(t){Tt("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const ka=new nw;it.handleByList(J.LoadParser,ka.loader.parsers).handleByList(J.ResolveParser,ka.resolver.parsers).handleByList(J.CacheParser,ka.cache.parsers).handleByList(J.DetectionParser,ka.detections);const ow={extension:J.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof rt),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};it.add(ow);async function ig(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const aw={extension:{type:J.DetectionParser,priority:1},test:async()=>ig("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};it.add(aw);const hw={extension:{type:J.DetectionParser,priority:0},test:async()=>ig("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};it.add(hw);const rg=["png","jpg","jpeg"],lw={extension:{type:J.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...rg],remove:async r=>r.filter(t=>!rg.includes(t))};it.add(lw);const uw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Ou(r){return uw?!1:document.createElement("video").canPlayType(r)!==""}const cw={extension:{type:J.DetectionParser,priority:0},test:async()=>Ou("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};it.add(cw);const dw={extension:{type:J.DetectionParser,priority:0},test:async()=>Ou("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};it.add(dw);const pw={extension:{type:J.DetectionParser,priority:0},test:async()=>Ou("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};it.add(pw);const fw={extension:J.ResolveParser,test:Da.test,parse:r=>{var t;return{resolution:parseFloat(((t=q.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Jt.extname(r).slice(1),src:r}}};it.add(fw);var Ae=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r))(Ae||{});const Oa={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};let tr,js;function sg(){js={s3tc:tr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:tr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:tr.getExtension("WEBGL_compressed_texture_etc"),etc1:tr.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:tr.getExtension("WEBGL_compressed_texture_pvrtc")||tr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:tr.getExtension("WEBGL_compressed_texture_atc"),astc:tr.getExtension("WEBGL_compressed_texture_astc")}}const mw={extension:{type:J.DetectionParser,priority:2},test:async()=>{const r=q.ADAPTER.createCanvas().getContext("webgl");return r?(tr=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{js||sg();const t=[];for(const e in js)js[e]&&t.push(e);return[...t,...r]},remove:async r=>(js||sg(),r.filter(t=>!(t in js)))};it.add(mw);class gw extends da{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,s;typeof t=="string"?(i=t,s=new Uint8Array):(i=null,s=t),super(s,e),this.origin=i,this.buffer=s?new ru(s):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new ru(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class ss extends gw{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=ss._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||ss._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const s=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;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=ss._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=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,i,s,n,o,a){const h=new Array(i);let l=t.byteOffset,u=o,c=a,d=u+s-1&~(s-1),p=c+n-1&~(n-1),m=d*p*Oa[e];for(let f=0;f<i;f++)h[f]={levelID:f,levelWidth:i>1?u:d,levelHeight:i>1?c:p,levelBuffer:new Uint8Array(t.buffer,l,m)},l+=m,u=u>>1||1,c=c>>1||1,d=u+s-1&~(s-1),p=c+n-1&~(n-1),m=d*p*Oa[e];return h}}const Wu=4,Wa=124,yw=32,ng=20,bw=542327876,Ba={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},xw={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},Ua={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},_w=1,vw=2,Tw=4,ww=64,Sw=512,Ew=131072,Cw=827611204,Iw=861165636,Aw=894720068,Rw=808540228,Mw=4,Pw={[Cw]:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,[Iw]:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,[Aw]:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT},Lw={70:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Gw(r){const t=new Uint32Array(r);if(t[0]!==bw)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Wa/Uint32Array.BYTES_PER_ELEMENT),i=e[Ba.HEIGHT],s=e[Ba.WIDTH],n=e[Ba.MIPMAP_COUNT],o=new Uint32Array(r,Ba.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,yw/Uint32Array.BYTES_PER_ELEMENT),a=o[_w];if(a&Tw){const h=o[xw.FOURCC];if(h!==Rw){const _=Pw[h],b=Wu+Wa,v=new Uint8Array(r,b);return[new ss(v,{format:_,width:s,height:i,levels:n})]}const l=Wu+Wa,u=new Uint32Array(t.buffer,l,ng/Uint32Array.BYTES_PER_ELEMENT),c=u[Ua.DXGI_FORMAT],d=u[Ua.RESOURCE_DIMENSION],p=u[Ua.MISC_FLAG],m=u[Ua.ARRAY_SIZE],f=Lw[c];if(f===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(p===Mw)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,y=Wu+Wa+ng;if(m===1)g.push(new Uint8Array(r,y));else{const _=Oa[f];let b=0,v=s,S=i;for(let I=0;I<n;I++){const A=Math.max(1,v+3&-4),P=Math.max(1,S+3&-4),O=A*P*_;b+=O,v=v>>>1,S=S>>>1}let E=y;for(let I=0;I<m;I++)g.push(new Uint8Array(r,E,b)),E+=b}return g.map(_=>new ss(_,{format:f,width:s,height:i,levels:n}))}throw a&ww?new Error("DDSParser does not support uncompressed texture data."):a&Sw?new Error("DDSParser does not supported YUV uncompressed texture data."):a&Ew?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&vw?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const og=[171,75,84,88,32,49,49,187,13,10,26,10],Nw=67305985,hi={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},Bu=64,ag={[at.UNSIGNED_BYTE]:1,[at.UNSIGNED_SHORT]:2,[at.INT]:4,[at.UNSIGNED_INT]:4,[at.FLOAT]:4,[at.HALF_FLOAT]:8},Fw={[H.RGBA]:4,[H.RGB]:3,[H.RG]:2,[H.RED]:1,[H.LUMINANCE]:1,[H.LUMINANCE_ALPHA]:2,[H.ALPHA]:1},Dw={[at.UNSIGNED_SHORT_4_4_4_4]:2,[at.UNSIGNED_SHORT_5_5_5_1]:2,[at.UNSIGNED_SHORT_5_6_5]:2};function kw(r,t,e=!1){const i=new DataView(t);if(!Ow(r,i))return null;const s=i.getUint32(hi.ENDIANNESS,!0)===Nw,n=i.getUint32(hi.GL_TYPE,s),o=i.getUint32(hi.GL_FORMAT,s),a=i.getUint32(hi.GL_INTERNAL_FORMAT,s),h=i.getUint32(hi.PIXEL_WIDTH,s),l=i.getUint32(hi.PIXEL_HEIGHT,s)||1,u=i.getUint32(hi.PIXEL_DEPTH,s)||1,c=i.getUint32(hi.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(hi.NUMBER_OF_FACES,s),p=i.getUint32(hi.NUMBER_OF_MIPMAP_LEVELS,s),m=i.getUint32(hi.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const f=4,g=4,y=h+3&-4,_=l+3&-4,b=new Array(c);let v=h*l;n===0&&(v=y*_);let S;if(n!==0?ag[n]?S=ag[n]*Fw[o]:S=Dw[n]:S=Oa[a],S===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const E=e?Bw(i,m,s):null;let I=v*S,A=h,P=l,O=y,W=_,L=Bu+m;for(let C=0;C<p;C++){const N=i.getUint32(L,s);let X=L+4;for(let K=0;K<c;K++){let Z=b[K];Z||(Z=b[K]=new Array(p)),Z[C]={levelID:C,levelWidth:p>1||n!==0?A:O,levelHeight:p>1||n!==0?P:W,levelBuffer:new Uint8Array(t,X,I)},X+=I}L+=N+4,L=L%4!==0?L+4-L%4:L,A=A>>1||1,P=P>>1||1,O=A+f-1&~(f-1),W=P+g-1&~(g-1),I=O*W*S}return n!==0?{uncompressed:b.map(C=>{let N=C[0].levelBuffer,X=!1;return n===at.FLOAT?N=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===at.UNSIGNED_INT?(X=!0,N=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===at.INT&&(X=!0,N=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new da(N,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:X?Ww(o):o}}),kvData:E}:{compressed:b.map(C=>new ss(null,{format:a,width:h,height:l,levels:p,levelBuffers:C})),kvData:E}}function Ow(r,t){for(let e=0;e<og.length;e++)if(t.getUint8(e)!==og[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function Ww(r){switch(r){case H.RGBA:return H.RGBA_INTEGER;case H.RGB:return H.RGB_INTEGER;case H.RG:return H.RG_INTEGER;case H.RED:return H.RED_INTEGER;default:return r}}function Bw(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(Bu+s,e),o=Bu+s+4,a=3-(n+3)%4;if(n===0||n>t-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&r.getUint8(o+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(r.buffer,o,h)),u=new DataView(r.buffer,o+h+1,n-h-1);i.set(l,u),s+=4+n+a}return i}const Uw={extension:{type:J.LoadParser,priority:ai.High},name:"loadDDS",test(r){return Tr(r,".dds")},async load(r,t,e){const i=await(await q.ADAPTER.fetch(r)).arrayBuffer(),s=Gw(i).map(n=>{const o=new mt(n,{mipmap:xi.OFF,alphaMode:_e.NO_PREMULTIPLIED_ALPHA,resolution:$i(r),...t.data});return to(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(Uw);const Xw={extension:{type:J.LoadParser,priority:ai.High},name:"loadKTX",test(r){return Tr(r,".ktx")},async load(r,t,e){const i=await(await q.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=kw(r,i),a=s??n,h={mipmap:xi.OFF,alphaMode:_e.NO_PREMULTIPLIED_ALPHA,resolution:$i(r),...t.data},l=a.map(u=>{a===n&&Object.assign(h,{type:u.type,format:u.format});const c=u.resource??u,d=new mt(c,h);return d.ktxKeyValueData=o,to(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(Xw);const Zw={extension:J.ResolveParser,test:r=>{const t=Jt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=Jt.extname(r).slice(1);if(t==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((e=q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=q.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};it.add(Zw);const Xa=new dt,Vw=4,hg=class Ho{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,s){const n=new Image;return n.src=await this.base64(t,e,i,s),n}async base64(t,e,i,s){const n=this.canvas(t,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&Ho._flipY(i,s,n),a&&Ho._unpremultiplyAlpha(i);const h=new E1(s,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&Ho._flipY(i,s,n),a&&Ho._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,h=!1;t&&(t instanceof qr?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Xa.width=e.width,Xa.height=e.height,e=Xa)));const l=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===H.RGBA,!h){i.renderTexture.bind(a);const p=a.framebuffer.glFramebuffers[i.CONTEXT_UID];p.blitFramebuffer&&i.framebuffer.bind(p.blitFramebuffer)}}else s=i.resolution,e||(e=Xa,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const u=Math.max(Math.round(e.width*s),1),c=Math.max(Math.round(e.height*s),1),d=new Uint8Array(Vw*u*c);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const h=a*s,l=(i-a-1)*s;o.set(t.subarray(h,h+s)),t.copyWithin(h,l,l+s),t.set(o,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const s=t[i+3];if(s!==0){const n=255.001/s;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};hg.extension={name:"extract",type:J.RendererSystem};let Kw=hg;it.add(Kw);const Za={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===he.CIRC){const m=r.shape;e=m.x,i=m.y,o=a=m.radius,s=n=0}else if(r.type===he.ELIP){const m=r.shape;e=m.x,i=m.y,o=m.width,a=m.height,s=n=0}else{const m=r.shape,f=m.width/2,g=m.height/2;e=m.x+f,i=m.y+g,o=a=Math.max(0,Math.min(m.radius,Math.min(f,g))),s=f-o,n=g-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(s?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let u=0,c=h*4+(s?2:0)+2,d=c,p=l;{const m=s+o,f=n,g=e+m,y=e-m,_=i+f;if(t[u++]=g,t[u++]=_,t[--c]=_,t[--c]=y,n){const b=i-f;t[d++]=y,t[d++]=b,t[--p]=b,t[--p]=g}}for(let m=1;m<h;m++){const f=Math.PI/2*(m/h),g=s+Math.cos(f)*o,y=n+Math.sin(f)*a,_=e+g,b=e-g,v=i+y,S=i-y;t[u++]=_,t[u++]=v,t[--c]=v,t[--c]=b,t[d++]=b,t[d++]=S,t[--p]=S,t[--p]=_}{const m=s,f=n+a,g=e+m,y=e-m,_=i+f,b=i-f;t[u++]=g,t[u++]=_,t[--p]=b,t[--p]=g,s&&(t[u++]=y,t[u++]=_,t[--p]=b,t[--p]=y)}},triangulate(r,t){const e=r.points,i=t.points,s=t.indices;if(e.length===0)return;let n=i.length/2;const o=n;let a,h;if(r.type!==he.RREC){const u=r.shape;a=u.x,h=u.y}else{const u=r.shape;a=u.x+u.width/2,h=u.y+u.height/2}const l=r.matrix;i.push(r.matrix?l.a*a+l.c*h+l.tx:a,r.matrix?l.b*a+l.d*h+l.ty:h),n++,i.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)i.push(e[u],e[u+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function lg(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],h=r[s+1];i+=(a-n)*(h+o),n=a,o=h}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,h=n,l=n+1;[r[o],r[h]]=[r[h],r[o]],[r[a],r[l]]=[r[l],r[a]]}}}const ug={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const i=r.holes,s=t.points,n=t.indices;if(e.length>=6){lg(e,!1);const o=[];for(let l=0;l<i.length;l++){const u=i[l];lg(u.points,!0),o.push(e.length/2),e=e.concat(u.points)}const a=ex(e,o,2);if(!a)return;const h=s.length/2;for(let l=0;l<a.length;l+=3)n.push(a[l]+h),n.push(a[l+1]+h),n.push(a[l+2]+h);for(let l=0;l<e.length;l++)s.push(e[l])}}},Hw={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(e,i,e+s,i,e+s,i+n,e,i+n)},triangulate(r,t){const e=r.points,i=t.points;if(e.length===0)return;const s=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},Yw={build(r){Za.build(r)},triangulate(r,t){Za.triangulate(r,t)}};var Xe=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Xe||{}),wr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(wr||{});const Js={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class cg{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,u=s-e,c=i-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const p=h*h+l*l,m=u*u+c*c,f=h*u+l*c,g=n*Math.sqrt(p)/d,y=n*Math.sqrt(m)/d,_=g*f/p,b=y*f/m,v=g*c+y*l,S=g*u+y*h,E=l*(y+_),I=h*(y+_),A=c*(g+b),P=u*(g+b),O=Math.atan2(I-S,E-v),W=Math.atan2(P-S,A-v);return{cx:v+t,cy:S+e,radius:n,startAngle:O,endAngle:W,anticlockwise:l*u>c*h}}static arc(t,e,i,s,n,o,a,h,l){const u=a-o,c=Js._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/fa)*40),d=u/(c*2),p=d*2,m=Math.cos(d),f=Math.sin(d),g=c-1,y=g%1/g;for(let _=0;_<=g;++_){const b=_+y*_,v=d+o+p*b,S=Math.cos(v),E=-Math.sin(v);l.push((m*S+f*E)*n+i,(m*-E+f*S)*n+s)}}}class zw{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class Uu{static curveLength(t,e,i,s,n,o,a,h){let l=0,u=0,c=0,d=0,p=0,m=0,f=0,g=0,y=0,_=0,b=0,v=t,S=e;for(let E=1;E<=10;++E)u=E/10,c=u*u,d=c*u,p=1-u,m=p*p,f=m*p,g=f*t+3*m*u*i+3*p*c*n+d*a,y=f*e+3*m*u*s+3*p*c*o+d*h,_=v-g,b=S-y,v=g,S=y,l+=Math.sqrt(_*_+b*b);return l}static curveTo(t,e,i,s,n,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const u=Js._segmentsCount(Uu.curveLength(h,l,t,e,i,s,n,o));let c=0,d=0,p=0,m=0,f=0;a.push(h,l);for(let g=1,y=0;g<=u;++g)y=g/u,c=1-y,d=c*c,p=d*c,m=y*y,f=m*y,a.push(p*h+3*d*y*t+3*c*m*i+f*n,p*l+3*d*y*e+3*c*m*s+f*o)}}function dg(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,u=r+e*n,c=t+i*n;let d,p;o?(d=i,p=-e):(d=-i,p=e);const m=h+d,f=l+p,g=u+d,y=c+p;return a.push(m,f,g,y),2}function ns(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let u=Math.atan2(h,l),c=Math.atan2(s-r,n-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let d=u;const p=c-u,m=Math.abs(p),f=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(f)/Math.PI>>0)+1,y=p/g;if(d+=y,a){o.push(r,t,e,i);for(let _=1,b=d;_<g;_++,b+=y)o.push(r,t,r+Math.sin(b)*f,t+Math.cos(b)*f);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let _=1,b=d;_<g;_++,b+=y)o.push(r+Math.sin(b)*f,t+Math.cos(b)*f,r,t);o.push(s,n,r,t)}return g*2}function jw(r,t){const e=r.shape;let i=r.points||e.points.slice();const s=t.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new lt(i[0],i[1]),a=new lt(i[i.length-2],i[i.length-1]),h=e.type!==he.POLY||e.closeStroke,l=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const Z=(o.x+a.x)*.5,z=(a.y+o.y)*.5;i.unshift(Z,z),i.push(Z,z)}const u=t.points,c=i.length/2;let d=i.length;const p=u.length/2,m=n.width/2,f=m*m,g=n.miterLimit*n.miterLimit;let y=i[0],_=i[1],b=i[2],v=i[3],S=0,E=0,I=-(_-v),A=y-b,P=0,O=0,W=Math.sqrt(I*I+A*A);I/=W,A/=W,I*=m,A*=m;const L=n.alignment,C=(1-L)*2,N=L*2;h||(n.cap===wr.ROUND?d+=ns(y-I*(C-N)*.5,_-A*(C-N)*.5,y-I*C,_-A*C,y+I*N,_+A*N,u,!0)+2:n.cap===wr.SQUARE&&(d+=dg(y,_,I,A,C,N,!0,u))),u.push(y-I*C,_-A*C,y+I*N,_+A*N);for(let Z=1;Z<c-1;++Z){y=i[(Z-1)*2],_=i[(Z-1)*2+1],b=i[Z*2],v=i[Z*2+1],S=i[(Z+1)*2],E=i[(Z+1)*2+1],I=-(_-v),A=y-b,W=Math.sqrt(I*I+A*A),I/=W,A/=W,I*=m,A*=m,P=-(v-E),O=b-S,W=Math.sqrt(P*P+O*O),P/=W,O/=W,P*=m,O*=m;const z=b-y,D=_-v,F=b-S,G=E-v,V=z*F+D*G,$=D*F-G*z,ut=$<0;if(Math.abs($)<.001*Math.abs(V)){u.push(b-I*C,v-A*C,b+I*N,v+A*N),V>=0&&(n.join===Xe.ROUND?d+=ns(b,v,b-I*C,v-A*C,b-P*C,v-O*C,u,!1)+4:d+=2,u.push(b-P*N,v-O*N,b+P*C,v+O*C));continue}const nt=(-I+y)*(-A+v)-(-I+b)*(-A+_),Ct=(-P+S)*(-O+v)-(-P+b)*(-O+E),Rt=(z*Ct-F*nt)/$,_t=(G*nt-D*Ct)/$,Y=(Rt-b)*(Rt-b)+(_t-v)*(_t-v),tt=b+(Rt-b)*C,et=v+(_t-v)*C,k=b-(Rt-b)*N,xt=v-(_t-v)*N,gt=Math.min(z*z+D*D,F*F+G*G),Mt=ut?C:N,Ut=gt+Mt*Mt*f,De=Y<=Ut;let pi=n.join;if(pi===Xe.MITER&&Y/f>g&&(pi=Xe.BEVEL),De)switch(pi){case Xe.MITER:{u.push(tt,et,k,xt);break}case Xe.BEVEL:{ut?u.push(tt,et,b+I*N,v+A*N,tt,et,b+P*N,v+O*N):u.push(b-I*C,v-A*C,k,xt,b-P*C,v-O*C,k,xt),d+=2;break}case Xe.ROUND:{ut?(u.push(tt,et,b+I*N,v+A*N),d+=ns(b,v,b+I*N,v+A*N,b+P*N,v+O*N,u,!0)+4,u.push(tt,et,b+P*N,v+O*N)):(u.push(b-I*C,v-A*C,k,xt),d+=ns(b,v,b-I*C,v-A*C,b-P*C,v-O*C,u,!1)+4,u.push(b-P*C,v-O*C,k,xt));break}}else{switch(u.push(b-I*C,v-A*C,b+I*N,v+A*N),pi){case Xe.MITER:{ut?u.push(k,xt,k,xt):u.push(tt,et,tt,et),d+=2;break}case Xe.ROUND:{ut?d+=ns(b,v,b+I*N,v+A*N,b+P*N,v+O*N,u,!0)+2:d+=ns(b,v,b-I*C,v-A*C,b-P*C,v-O*C,u,!1)+2;break}}u.push(b-P*C,v-O*C,b+P*N,v+O*N),d+=2}}y=i[(c-2)*2],_=i[(c-2)*2+1],b=i[(c-1)*2],v=i[(c-1)*2+1],I=-(_-v),A=y-b,W=Math.sqrt(I*I+A*A),I/=W,A/=W,I*=m,A*=m,u.push(b-I*C,v-A*C,b+I*N,v+A*N),h||(n.cap===wr.ROUND?d+=ns(b-I*(C-N)*.5,v-A*(C-N)*.5,b-I*C,v-A*C,b+I*N,v+A*N,u,!1)+2:n.cap===wr.SQUARE&&(d+=dg(b,v,I,A,C,N,!1,u)));const X=t.indices,K=Js.epsilon*Js.epsilon;for(let Z=p;Z<d+p-2;++Z)y=u[Z*2],_=u[Z*2+1],b=u[(Z+1)*2],v=u[(Z+1)*2+1],S=u[(Z+2)*2],E=u[(Z+2)*2+1],!(Math.abs(y*(v-E)+b*(E-_)+S*(_-v))<K)&&X.push(Z,Z+1,Z+2)}function Jw(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==he.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,h=s.length/2,l=o.length/2;let u=l;for(o.push(s[0],s[1]),e=1;e<h;e++)o.push(s[e*2],s[e*2+1]),a.push(u,u+1),u++;n&&a.push(u,l)}function pg(r,t){r.lineStyle.native?Jw(r,t):jw(r,t)}class Xu{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,h=e-2*s+o,l=2*i-2*t,u=2*s-2*e,c=4*(a*a+h*h),d=4*(a*l+h*u),p=l*l+u*u,m=2*Math.sqrt(c+d+p),f=Math.sqrt(c),g=2*c*f,y=2*Math.sqrt(p),_=d/f;return(g*m+f*d*(m-y)+(4*p*c-d*d)*Math.log((2*f+_+m)/(_+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=Js._segmentsCount(Xu.curveLength(o,a,t,e,i,s));let l=0,u=0;for(let c=1;c<=h;++c){const d=c/h;l=o+(t-o)*d,u=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,u+(e+(s-e)*d-u)*d)}}}const Zu={[he.POLY]:ug,[he.CIRC]:Za,[he.ELIP]:Za,[he.RECT]:Hw,[he.RREC]:Yw},fg=[],Va=[];class Ka{constructor(t,e=null,i=null,s=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=s,this.type=t.type}clone(){return new Ka(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const $s=new lt,mg=class Sb extends zf{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 La,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Va.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),fg.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,s=null){const n=new Ka(t,e,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new Ka(t,null,null,e),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let i=0;i<e.length;++i){const s=e[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,$s):$s.copyFrom(t),s.shape.contains($s.x,$s.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains($s.x,$s.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],u=l.fillStyle,c=l.lineStyle;Zu[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const p=d===0?u:c;if(!p.visible)continue;const m=p.texture.baseTexture,f=this.indices.length,g=this.points.length/2;m.wrapMode=Ki.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,p)&&(i.end(f,g),i=null),i||(i=fg.pop()||new zw,i.begin(p,f,g),this.batches.push(i),s=p),this.addUvs(this.points,t,p.texture,g,y,p.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const i=this.graphicsData[t],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const s=t[e];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<Sb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++mt._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Va.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=Va.pop();s||(s=new du,s.texArray=new bu),s.texArray.count=0,s.start=0,s.size=0,s.type=bi.TRIANGLES;let n=0,o=null,a=0,h=!1,l=bi.TRIANGLES,u=0;this.drawCalls.push(s);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],p=8,m=d.style,f=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?bi.LINES:bi.TRIANGLES,o=null,n=p,t++),o!==f&&(o=f,f._batchEnabled!==t&&(n===p&&(t++,n=0,s.size>0&&(s=Va.pop(),s||(s=new du,s.texArray=new bu),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=l),f.touched=1,f._batchEnabled=t,f._batchLocation=n,f.wrapMode=Ki.REPEAT,s.texArray.elements[s.texArray.count++]=f,n++)),s.size+=d.size,u+=d.size,a=f._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}mt._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)o[h++]=t[l*2],o[h++]=t[l*2+1],o[h++]=e[l*2],o[h++]=e[l*2+1],a[h++]=i[l],o[h++]=s[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?ug.triangulate(t,this):Zu[t.type].triangulate(t,this)}processLine(t){pg(t,this);for(let e=0;e<t.holes.length;e++)pg(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];Zu[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){const s=t[i*2],n=t[i*2+1];t[i*2]=e.a*s+e.c*n+e.tx,t[i*2+1]=e.b*s+e.d*n+e.ty}}addColors(t,e,i,s,n=0){const o=Gt.shared.setValue(e).toLittleEndianNumber(),a=Gt.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let h=0;h<s;h++)t[n+h]=a}addTextureIds(t,e,i,s=0){t.length=Math.max(t.length,s+i);for(let n=0;n<i;n++)t[s+n]=e}addUvs(t,e,i,s,n,o=null){let a=0;const h=e.length,l=i.frame;for(;a<n;){let c=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const p=o.a*c+o.c*d+o.tx;d=o.b*c+o.d*d+o.ty,c=p}a++,e.push(c/l.width,d/l.height)}const u=i.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,i,h,n)}adjustUvs(t,e,i,s){const n=e.baseTexture,o=1e-6,a=i+s*2,h=e.frame,l=h.width/n.width,u=h.height/n.height;let c=h.x/h.width,d=h.y/h.height,p=Math.floor(t[i]+o),m=Math.floor(t[i+1]+o);for(let f=i+2;f<a;f+=2)p=Math.min(p,Math.floor(t[f]+o)),m=Math.min(m,Math.floor(t[f+1]+o));c-=p,d-=m;for(let f=i;f<a;f+=2)t[f]=(t[f]+c)*l,t[f+1]=(t[f+1]+d)*u}};mg.BATCHABLE_SIZE=100;let $w=mg;class Ha{constructor(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ha;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=rt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Vu extends Ha{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=wr.BUTT,this.join=Xe.MITER,this.miterLimit=10}clone(){const t=new Vu;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=wr.BUTT,this.join=Xe.MITER,this.miterLimit=10}}const Ku={},Hu=class ul extends Xt{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Ha,this._lineStyle=new Vu,this._matrix=null,this._holeMode=!1,this.state=Ci.for2d(),this._geometry=t||new $w,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Gt(16777215),this.blendMode=ct.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new ul(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:rt.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:wr.BUTT,join:Xe.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Yr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Yr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Xu.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),Uu.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=cg.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:p}=a;this.arc(h,l,u,c,d,p)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=fa:o&&s<=n&&(s+=fa),n-s===0)return this;const a=t+Math.cos(s)*i,h=e+Math.sin(s)*i,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-a),d=Math.abs(u[u.length-1]-h);c<l&&d<l||u.push(a,h)}else this.moveTo(a,h),u=this.currentPath.points;return cg.arc(a,h,t,e,i,s,n,o,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:rt.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Gt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:rt.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new dt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new ba(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new ga(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new ya(t,e,i,s))}drawPolygon(...t){let e,i=!0;const s=t[0];s.points?(i=s.closeStroke,e=s.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Yr(e);return n.closeStroke=i,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===he.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let s=0;s<i;s++){const n=t.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:a,blendMode:e,indices:l,uvs:h,_batchRGB:Gt.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,s=this.worldAlpha,n=e.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,Gt.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!Ku[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:si.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Ku[i]=new Ii(a,o)}e=Ku[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:s,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,s,n)}containsPoint(t){return this.worldTransform.applyInverse(t,ul._TEMP_POINT),this._geometry.containsPoint(ul._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=Gt.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const p=l[d],m=l[d+1];u[c++]=i*p+n*m+a,u[c++]=o*m+s*p+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};Hu.curves=Js,Hu._TEMP_POINT=new lt;let eo=Hu;class Qw{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const Yu=new lt,gg=new Yr,yg=class Eb extends Xt{constructor(t,e,i,s=bi.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Ci.for2d(),this.drawMode=s,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=q.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===bi.TRIANGLES&&e.length<Eb.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,h=s.d,l=s.tx,u=s.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const p=e[d*2],m=e[d*2+1];c[d*2]=n*p+a*m+l,c[d*2+1]=o*p+h*m+u}if(this._roundPixels){const d=q.RESOLUTION;for(let p=0;p<c.length;++p)c[p]=Math.round(c[p]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Qw(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,Yu);const e=this.geometry.getBuffer("aVertexPosition").data,i=gg.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=s[a]*2,l=s[a+1]*2,u=s[a+2]*2;if(i[0]=e[h],i[1]=e[h+1],i[2]=e[l],i[3]=e[l+1],i[4]=e[u],i[5]=e[u+1],gg.contains(Yu.x,Yu.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};yg.BATCHABLE_SIZE=100;let zu=yg;class bg extends xr{constructor(t,e,i){super();const s=new Kt(t),n=new Kt(e,!0),o=new Kt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,at.FLOAT).addAttribute("aTextureCoord",n,2,!1,at.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var qw=`varying vec2 vTextureCoord;
924
924
  uniform vec4 uColor;
925
925
 
926
926
  uniform sampler2D uSampler;
@@ -977,8 +977,8 @@ void main(void){
977
977
  vTextureCoord = aTextureCoord;
978
978
  vColor = aColor * uColor;
979
979
  }
980
- `;class _g extends Ta{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Nt,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:at.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Ii.from(sS,rS,{}),this.state=Ci.for2d()}render(t){const e=t.children,i=t._maxSize,s=t._batchSize,n=this.renderer;let o=e.length;if(o===0)return;o>i&&!t.autoResize&&(o=i);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=kf(t.blendMode,l),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=Gt.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let p=0,m=0;p<o;p+=s,m+=1){let f=o-p;f>s&&(f=s),m>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[m];g.uploadDynamic(e,p,f);const y=t._bufferUpdateIDs[m]||0;d=d||g._updateID<y,d&&(g._updateID=t._updateID,g.uploadStatic(e,p,f)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,f*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let o=0;o<i;o+=s)e.push(new xg(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new xg(this.properties,i,e)}uploadVertices(t,e,i,s,n,o){let a=0,h=0,l=0,u=0;for(let c=0;c<i;++c){const d=t[e+c],p=d._texture,m=d.scale.x,f=d.scale.y,g=p.trim,y=p.orig;g?(h=g.x-d.anchor.x*y.width,a=h+g.width,u=g.y-d.anchor.y*y.height,l=u+g.height):(a=y.width*(1-d.anchor.x),h=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),u=y.height*-d.anchor.y),s[o]=h*m,s[o+1]=u*f,s[o+n]=a*m,s[o+n+1]=u*f,s[o+n*2]=a*m,s[o+n*2+1]=l*f,s[o+n*3]=h*m,s[o+n*3+1]=l*f,o+=n*4}}uploadPosition(t,e,i,s,n,o){for(let a=0;a<i;a++){const h=t[e+a].position;s[o]=h.x,s[o+1]=h.y,s[o+n]=h.x,s[o+n+1]=h.y,s[o+n*2]=h.x,s[o+n*2+1]=h.y,s[o+n*3]=h.x,s[o+n*3+1]=h.y,o+=n*4}}uploadRotation(t,e,i,s,n,o){for(let a=0;a<i;a++){const h=t[e+a].rotation;s[o]=h,s[o+n]=h,s[o+n*2]=h,s[o+n*3]=h,o+=n*4}}uploadUvs(t,e,i,s,n,o){for(let a=0;a<i;++a){const h=t[e+a]._texture._uvs;h?(s[o]=h.x0,s[o+1]=h.y0,s[o+n]=h.x1,s[o+n+1]=h.y1,s[o+n*2]=h.x2,s[o+n*2+1]=h.y2,s[o+n*3]=h.x3,s[o+n*3+1]=h.y3,o+=n*4):(s[o]=0,s[o+1]=0,s[o+n]=0,s[o+n+1]=0,s[o+n*2]=0,s[o+n*2+1]=0,s[o+n*3]=0,s[o+n*3+1]=0,o+=n*4)}}uploadTint(t,e,i,s,n,o){for(let a=0;a<i;++a){const h=t[e+a],l=Gt.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);s[o]=l,s[o+n]=l,s[o+n*2]=l,s[o+n*3]=l,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}_g.extension={name:"particle",type:J.RendererPlugin},it.add(_g);var Ha=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ha||{});const Ya={willReadFrequently:!0},Ai=class st{static get experimentalLetterSpacingSupported(){let t=st._experimentalLetterSpacingSupported;if(t!==void 0){const e=q.ADAPTER.getCanvasRenderingContext2D().prototype;t=st._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,i,s=st._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=st.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",Ya);a.font=n;const h=(i?st.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let m=0;m<h.length;m++){const f=st._measureText(h[m],e.letterSpacing,a);l[m]=f,u=Math.max(u,f)}let c=u+e.strokeThickness;e.dropShadow&&(c+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let p=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(d+e.leading);return e.dropShadow&&(p+=e.dropShadowDistance),new st(t,e,c,p,h,l,d+e.leading,u,o)}static _measureText(t,e,i){let s=!1;st.experimentalLetterSpacingSupported&&(st.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(st.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=st._canvas){const s=i.getContext("2d",Ya);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=st.collapseSpaces(u),d=st.collapseNewlines(u);let p=!c;const m=e.wordWrapWidth+l,f=st.tokenize(t);for(let g=0;g<f.length;g++){let y=f[g];if(st.isNewline(y)){if(!d){a+=st.addLine(o),p=!c,o="",n=0;continue}y=" "}if(c){const b=st.isBreakingSpace(y),v=st.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const _=st.getFromCache(y,l,h,s);if(_>m)if(o!==""&&(a+=st.addLine(o),o="",n=0),st.canBreakWords(y,e.breakWords)){const b=st.wordWrapSplit(y);for(let v=0;v<b.length;v++){let S=b[v],E=S,A=1;for(;b[v+A];){const P=b[v+A];if(!st.canBreakChars(E,P,y,v,e.breakWords))S+=P;else break;E=P,A++}v+=A-1;const I=st.getFromCache(S,l,h,s);I+n>m&&(a+=st.addLine(o),p=!1,o="",n=0),o+=S,n+=I}}else{o.length>0&&(a+=st.addLine(o),o="",n=0);const b=g===f.length-1;a+=st.addLine(y,!b),p=!1,o="",n=0}else _+n>m&&(p=!1,a+=st.addLine(o),o="",n=0),(o.length>0||!st.isBreakingSpace(y)||p)&&(o+=y,n+=_)}return a+=st.addLine(o,!1),a}static addLine(t,e=!0){return t=st.trimRight(t),t=e?`${t}
981
- `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=st._measureText(t,e,s)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!st.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:st._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:st._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(st.isBreakingSpace(n,o)||st.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return st.graphemeSegmenter(t)}static measureFont(t){if(st._fonts[t])return st._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=st._canvas,s=st._context;s.font=t;const n=st.METRICS_STRING+st.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(st.BASELINE_SYMBOL).width);const h=Math.ceil(st.HEIGHT_MULTIPLIER*a);if(a=a*st.BASELINE_MULTIPLIER|0,o===0||h===0)return st._fonts[t]=e,e;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,u=l.length,c=o*4;let d=0,p=0,m=!1;for(d=0;d<a;++d){for(let f=0;f<c;f+=4)if(l[p+f]!==255){m=!0;break}if(!m)p+=c;else break}for(e.ascent=a-d,p=u-c,m=!1,d=h;d>a;--d){for(let f=0;f<c;f+=4)if(l[p+f]!==255){m=!0;break}if(!m)p-=c;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,st._fonts[t]=e,e}static clearMetrics(t=""){t?delete st._fonts[t]:st._fonts={}}static get _canvas(){var t;if(!st.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",Ya))!=null&&t.measureText)return st.__canvas=i,i;e=q.ADAPTER.createCanvas()}catch{e=q.ADAPTER.createCanvas()}e.width=e.height=10,st.__canvas=e}return st.__canvas}static get _context(){return st.__context||(st.__context=st._canvas.getContext("2d",Ya)),st.__context}};Ai.METRICS_STRING="|ÉqÅ",Ai.BASELINE_SYMBOL="M",Ai.BASELINE_MULTIPLIER=1.4,Ai.HEIGHT_MULTIPLIER=2,Ai.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Ai.experimentalLetterSpacing=!1,Ai._fonts={},Ai._newlines=[10,13],Ai._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Sr=Ai;const nS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],vg=class Ho{constructor(t){this.styleID=0,this.reset(),$u(this,t,t)}clone(){const t={};return $u(t,this,Ho.defaultStyle),new Ho(t)}reset(){$u(this,Ho.defaultStyle,Ho.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=Ju(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=Ju(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){oS(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=Ju(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!nS.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};vg.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ha.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Er=vg;function Ju(r){const t=Gt.shared,e=i=>{const s=t.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function oS(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function $u(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const aS={texture:!0,children:!1,baseTexture:!0},Tg=class xp extends ie{constructor(t,e,i){let s=!1;i||(i=q.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=rt.from(i);n.orig=new dt,n.trim=new dt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=xp.defaultResolution??q.RESOLUTION,this._autoResolution=xp.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return Sr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){Tt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Sr.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const i=this.context,s=Sr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,h=s.lineHeight,l=s.lineWidths,u=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,p;const m=e.dropShadow?2:1;for(let f=0;f<m;++f){const g=e.dropShadow&&f===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,_=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,S=e.dropShadowBlur*this._resolution,E=e.dropShadowDistance*this._resolution;i.shadowColor=Gt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=S,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*E,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*E+_}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let b=(h-c.fontSize)/2;h-c.fontSize<0&&(b=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,p=e.strokeThickness/2+v*h+c.ascent+b,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Sr.experimentalLetterSpacingSupported&&(Sr.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const h=Sr.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<h.length;++c){const d=h[c];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let p="";for(let m=c+1;m<h.length;++m)p+=h[m];u=this.context.measureText(p).width,a+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=I1(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,i=this._style,s=i.trim?0:i.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){const s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,h=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,u=s.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let p=1;p<d;++p)c.push(p/d)}if(u.unshift(s[0]),c.unshift(0),u.push(s[s.length-1]),c.push(1),t.fillGradientType===Ha.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let p=0;p<e.length;p++){const m=i.lineHeight*(p-1)+d,f=i.lineHeight*p;let g=f;p>0&&m>f&&(g=(f+m)/2);const y=f+d,_=i.lineHeight*(p+1);let b=y;p+1<e.length&&_<y&&(b=(y+_)/2);const v=(b-g)/l;for(let S=0;S<u.length;S++){let E=0;typeof c[S]=="number"?E=c[S]:E=S/u.length;let A=Math.min(1,Math.max(0,g/l+E*v));A=Number(A.toFixed(5)),n.addColorStop(A,u[S])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=u.length+1;let p=1;for(let m=0;m<u.length;m++){let f;typeof c[m]=="number"?f=c[m]:f=p/d,n.addColorStop(f,u[m]),p++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},aS,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=yr(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=yr(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof Er?this._style=t:this._style=new Er(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Tg.defaultAutoResolution=!0;let wg=Tg;class hS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function lS(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof rt){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function uS(r,t){if(r.baseTexture instanceof mt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function cS(r,t){if(r._texture&&r._texture instanceof rt){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function dS(r,t){return t instanceof wg?(t.updateText(!0),!0):!1}function pS(r,t){if(t instanceof Er){const e=t.toFontString();return Sr.measureFont(e),!0}return!1}function fS(r,t){if(r instanceof wg){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function mS(r,t){return r instanceof Er?(t.includes(r)||t.push(r),!0):!1}const Sg=class Cb{constructor(t){this.limiter=new hS(Cb.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(fS),this.registerFindHook(mS),this.registerFindHook(lS),this.registerFindHook(uS),this.registerFindHook(cS),this.registerUploadHook(dS),this.registerUploadHook(pS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,ye.system.addOnce(this.tick,this,is.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)ye.system.addOnce(this.tick,this,is.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Xt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&ye.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}};Sg.uploadsPerFrame=4;let Qu=Sg;Object.defineProperties(q,{UPLOADS_PER_FRAME:{get(){return Qu.uploadsPerFrame},set(r){Tt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),Qu.uploadsPerFrame=r}}});function Eg(r,t){return t instanceof mt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function gS(r,t){if(!(t instanceof to))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&Eg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function yS(r,t){return r instanceof to?(t.push(r),!0):!1}class Cg extends Qu{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(yS),this.registerUploadHook(Eg),this.registerUploadHook(gS)}}Cg.extension={name:"prepare",type:J.RendererSystem},it.add(Cg);var bS=`#version 300 es
980
+ `;class _g extends wa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Nt,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:at.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Ii.from(sS,rS,{}),this.state=Ci.for2d()}render(t){const e=t.children,i=t._maxSize,s=t._batchSize,n=this.renderer;let o=e.length;if(o===0)return;o>i&&!t.autoResize&&(o=i);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=kf(t.blendMode,l),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=Gt.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let p=0,m=0;p<o;p+=s,m+=1){let f=o-p;f>s&&(f=s),m>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[m];g.uploadDynamic(e,p,f);const y=t._bufferUpdateIDs[m]||0;d=d||g._updateID<y,d&&(g._updateID=t._updateID,g.uploadStatic(e,p,f)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,f*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let o=0;o<i;o+=s)e.push(new xg(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new xg(this.properties,i,e)}uploadVertices(t,e,i,s,n,o){let a=0,h=0,l=0,u=0;for(let c=0;c<i;++c){const d=t[e+c],p=d._texture,m=d.scale.x,f=d.scale.y,g=p.trim,y=p.orig;g?(h=g.x-d.anchor.x*y.width,a=h+g.width,u=g.y-d.anchor.y*y.height,l=u+g.height):(a=y.width*(1-d.anchor.x),h=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),u=y.height*-d.anchor.y),s[o]=h*m,s[o+1]=u*f,s[o+n]=a*m,s[o+n+1]=u*f,s[o+n*2]=a*m,s[o+n*2+1]=l*f,s[o+n*3]=h*m,s[o+n*3+1]=l*f,o+=n*4}}uploadPosition(t,e,i,s,n,o){for(let a=0;a<i;a++){const h=t[e+a].position;s[o]=h.x,s[o+1]=h.y,s[o+n]=h.x,s[o+n+1]=h.y,s[o+n*2]=h.x,s[o+n*2+1]=h.y,s[o+n*3]=h.x,s[o+n*3+1]=h.y,o+=n*4}}uploadRotation(t,e,i,s,n,o){for(let a=0;a<i;a++){const h=t[e+a].rotation;s[o]=h,s[o+n]=h,s[o+n*2]=h,s[o+n*3]=h,o+=n*4}}uploadUvs(t,e,i,s,n,o){for(let a=0;a<i;++a){const h=t[e+a]._texture._uvs;h?(s[o]=h.x0,s[o+1]=h.y0,s[o+n]=h.x1,s[o+n+1]=h.y1,s[o+n*2]=h.x2,s[o+n*2+1]=h.y2,s[o+n*3]=h.x3,s[o+n*3+1]=h.y3,o+=n*4):(s[o]=0,s[o+1]=0,s[o+n]=0,s[o+n+1]=0,s[o+n*2]=0,s[o+n*2+1]=0,s[o+n*3]=0,s[o+n*3+1]=0,o+=n*4)}}uploadTint(t,e,i,s,n,o){for(let a=0;a<i;++a){const h=t[e+a],l=Gt.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);s[o]=l,s[o+n]=l,s[o+n*2]=l,s[o+n*3]=l,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}_g.extension={name:"particle",type:J.RendererPlugin},it.add(_g);var Ya=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ya||{});const za={willReadFrequently:!0},Ai=class st{static get experimentalLetterSpacingSupported(){let t=st._experimentalLetterSpacingSupported;if(t!==void 0){const e=q.ADAPTER.getCanvasRenderingContext2D().prototype;t=st._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,i,s=st._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=st.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",za);a.font=n;const h=(i?st.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let m=0;m<h.length;m++){const f=st._measureText(h[m],e.letterSpacing,a);l[m]=f,u=Math.max(u,f)}let c=u+e.strokeThickness;e.dropShadow&&(c+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let p=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(d+e.leading);return e.dropShadow&&(p+=e.dropShadowDistance),new st(t,e,c,p,h,l,d+e.leading,u,o)}static _measureText(t,e,i){let s=!1;st.experimentalLetterSpacingSupported&&(st.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(st.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=st._canvas){const s=i.getContext("2d",za);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=st.collapseSpaces(u),d=st.collapseNewlines(u);let p=!c;const m=e.wordWrapWidth+l,f=st.tokenize(t);for(let g=0;g<f.length;g++){let y=f[g];if(st.isNewline(y)){if(!d){a+=st.addLine(o),p=!c,o="",n=0;continue}y=" "}if(c){const b=st.isBreakingSpace(y),v=st.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const _=st.getFromCache(y,l,h,s);if(_>m)if(o!==""&&(a+=st.addLine(o),o="",n=0),st.canBreakWords(y,e.breakWords)){const b=st.wordWrapSplit(y);for(let v=0;v<b.length;v++){let S=b[v],E=S,I=1;for(;b[v+I];){const P=b[v+I];if(!st.canBreakChars(E,P,y,v,e.breakWords))S+=P;else break;E=P,I++}v+=I-1;const A=st.getFromCache(S,l,h,s);A+n>m&&(a+=st.addLine(o),p=!1,o="",n=0),o+=S,n+=A}}else{o.length>0&&(a+=st.addLine(o),o="",n=0);const b=g===f.length-1;a+=st.addLine(y,!b),p=!1,o="",n=0}else _+n>m&&(p=!1,a+=st.addLine(o),o="",n=0),(o.length>0||!st.isBreakingSpace(y)||p)&&(o+=y,n+=_)}return a+=st.addLine(o,!1),a}static addLine(t,e=!0){return t=st.trimRight(t),t=e?`${t}
981
+ `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=st._measureText(t,e,s)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!st.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:st._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:st._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(st.isBreakingSpace(n,o)||st.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return st.graphemeSegmenter(t)}static measureFont(t){if(st._fonts[t])return st._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=st._canvas,s=st._context;s.font=t;const n=st.METRICS_STRING+st.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(st.BASELINE_SYMBOL).width);const h=Math.ceil(st.HEIGHT_MULTIPLIER*a);if(a=a*st.BASELINE_MULTIPLIER|0,o===0||h===0)return st._fonts[t]=e,e;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,u=l.length,c=o*4;let d=0,p=0,m=!1;for(d=0;d<a;++d){for(let f=0;f<c;f+=4)if(l[p+f]!==255){m=!0;break}if(!m)p+=c;else break}for(e.ascent=a-d,p=u-c,m=!1,d=h;d>a;--d){for(let f=0;f<c;f+=4)if(l[p+f]!==255){m=!0;break}if(!m)p-=c;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,st._fonts[t]=e,e}static clearMetrics(t=""){t?delete st._fonts[t]:st._fonts={}}static get _canvas(){var t;if(!st.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",za))!=null&&t.measureText)return st.__canvas=i,i;e=q.ADAPTER.createCanvas()}catch{e=q.ADAPTER.createCanvas()}e.width=e.height=10,st.__canvas=e}return st.__canvas}static get _context(){return st.__context||(st.__context=st._canvas.getContext("2d",za)),st.__context}};Ai.METRICS_STRING="|ÉqÅ",Ai.BASELINE_SYMBOL="M",Ai.BASELINE_MULTIPLIER=1.4,Ai.HEIGHT_MULTIPLIER=2,Ai.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Ai.experimentalLetterSpacing=!1,Ai._fonts={},Ai._newlines=[10,13],Ai._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Sr=Ai;const nS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],vg=class Yo{constructor(t){this.styleID=0,this.reset(),$u(this,t,t)}clone(){const t={};return $u(t,this,Yo.defaultStyle),new Yo(t)}reset(){$u(this,Yo.defaultStyle,Yo.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=Ju(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=Ju(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){oS(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=Ju(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!nS.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};vg.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ya.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Er=vg;function Ju(r){const t=Gt.shared,e=i=>{const s=t.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function oS(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function $u(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const aS={texture:!0,children:!1,baseTexture:!0},Tg=class xp extends ie{constructor(t,e,i){let s=!1;i||(i=q.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=rt.from(i);n.orig=new dt,n.trim=new dt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=xp.defaultResolution??q.RESOLUTION,this._autoResolution=xp.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return Sr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){Tt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Sr.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const i=this.context,s=Sr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,h=s.lineHeight,l=s.lineWidths,u=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,p;const m=e.dropShadow?2:1;for(let f=0;f<m;++f){const g=e.dropShadow&&f===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,_=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,S=e.dropShadowBlur*this._resolution,E=e.dropShadowDistance*this._resolution;i.shadowColor=Gt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=S,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*E,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*E+_}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let b=(h-c.fontSize)/2;h-c.fontSize<0&&(b=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,p=e.strokeThickness/2+v*h+c.ascent+b,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Sr.experimentalLetterSpacingSupported&&(Sr.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const h=Sr.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<h.length;++c){const d=h[c];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let p="";for(let m=c+1;m<h.length;++m)p+=h[m];u=this.context.measureText(p).width,a+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=I1(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,i=this._style,s=i.trim?0:i.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){const s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,h=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,u=s.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let p=1;p<d;++p)c.push(p/d)}if(u.unshift(s[0]),c.unshift(0),u.push(s[s.length-1]),c.push(1),t.fillGradientType===Ya.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let p=0;p<e.length;p++){const m=i.lineHeight*(p-1)+d,f=i.lineHeight*p;let g=f;p>0&&m>f&&(g=(f+m)/2);const y=f+d,_=i.lineHeight*(p+1);let b=y;p+1<e.length&&_<y&&(b=(y+_)/2);const v=(b-g)/l;for(let S=0;S<u.length;S++){let E=0;typeof c[S]=="number"?E=c[S]:E=S/u.length;let I=Math.min(1,Math.max(0,g/l+E*v));I=Number(I.toFixed(5)),n.addColorStop(I,u[S])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=u.length+1;let p=1;for(let m=0;m<u.length;m++){let f;typeof c[m]=="number"?f=c[m]:f=p/d,n.addColorStop(f,u[m]),p++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},aS,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=yr(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=yr(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof Er?this._style=t:this._style=new Er(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Tg.defaultAutoResolution=!0;let wg=Tg;class hS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function lS(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof rt){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function uS(r,t){if(r.baseTexture instanceof mt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function cS(r,t){if(r._texture&&r._texture instanceof rt){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function dS(r,t){return t instanceof wg?(t.updateText(!0),!0):!1}function pS(r,t){if(t instanceof Er){const e=t.toFontString();return Sr.measureFont(e),!0}return!1}function fS(r,t){if(r instanceof wg){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function mS(r,t){return r instanceof Er?(t.includes(r)||t.push(r),!0):!1}const Sg=class Cb{constructor(t){this.limiter=new hS(Cb.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(fS),this.registerFindHook(mS),this.registerFindHook(lS),this.registerFindHook(uS),this.registerFindHook(cS),this.registerUploadHook(dS),this.registerUploadHook(pS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,ye.system.addOnce(this.tick,this,is.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)ye.system.addOnce(this.tick,this,is.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Xt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&ye.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}};Sg.uploadsPerFrame=4;let Qu=Sg;Object.defineProperties(q,{UPLOADS_PER_FRAME:{get(){return Qu.uploadsPerFrame},set(r){Tt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),Qu.uploadsPerFrame=r}}});function Eg(r,t){return t instanceof mt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function gS(r,t){if(!(t instanceof eo))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&Eg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function yS(r,t){return r instanceof eo?(t.push(r),!0):!1}class Cg extends Qu{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(yS),this.registerUploadHook(Eg),this.registerUploadHook(gS)}}Cg.extension={name:"prepare",type:J.RendererSystem},it.add(Cg);var bS=`#version 300 es
982
982
  #define SHADER_NAME Tiling-Sprite-100
983
983
 
984
984
  precision lowp float;
@@ -1092,7 +1092,7 @@ void main(void)
1092
1092
  vec4 texSample = texture2D(uSampler, vTextureCoord);
1093
1093
  gl_FragColor = texSample * uColor;
1094
1094
  }
1095
- `;const za=new Nt;class Ag extends Ta{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new um,this.state=Ci.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Ii.from(Ig,vS,e),this.shader=t.context.webGLVersion>1?Ii.from(xS,bS,e):Ii.from(Ig,_S,e)}render(t){const e=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=t._texture,h=a.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==Ki.CLAMP:h.wrapMode===Ki.CLAMP&&(h.wrapMode=Ki.REPEAT));const p=d?this.simpleShader:this.shader,m=a.width,f=a.height,g=t._width,y=t._height;za.set(u.a*m/g,u.b*m/y,u.c*f/g,u.d*f/y,u.tx/g,u.ty/y),za.invert(),d?za.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=za.toArray(!0),p.uniforms.uColor=Gt.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(p.uniforms.uColor),p.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),p.uniforms.uSampler=a,e.shader.bind(p),e.geometry.bind(i),this.state.blendMode=kf(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Ag.extension={name:"tilingSprite",type:J.RendererPlugin},it.add(Ag);const Rg=class Yo{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof rt?t:null,this.baseTexture=t instanceof mt?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const s=this.baseTexture.resource;this.resolution=this._updateResolution(i||(s?s.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let i=$i(t,null);return i===null&&(i=parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Yo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Yo.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],o=n.frame;if(o){let a=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new dt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new dt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new dt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new dt(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new rt(this.baseTexture,a,u,h,n.rotated?2:0,n.anchor,n.borders),rt.addToCache(this.textures[s],s.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Yo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Yo.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Rg.BATCH_SIZE=1e3;let Mg=Rg;const TS=["jpg","png","jpeg","avif","webp"];function Pg(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=Jt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Pg([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const wS={extension:J.Asset,cache:{test:r=>r instanceof Mg,getCacheableAssets:(r,t)=>Pg(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&TS.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:J.LoadParser,priority:oi.Normal},async testParse(r,t){return Jt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=Jt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=Fu(s,t.src);const n=(await e.load([s]))[s],o=new Mg(n.baseTexture,r,t.src);await o.parse();const a=(h=r==null?void 0:r.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(a)){const u=[];for(const d of a){if(typeof d!="string")continue;let p=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(p=Fu(p,t.src),u.push(e.load({src:p,data:{ignoreMultiPack:!0}})))}const c=await Promise.all(u);o.linkedSheets=c,c.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==d))})}return o},unload(r){r.destroy(!0)}}};it.add(wS);class ja{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Ja{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const u=a[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),p=parseFloat(d),m=isNaN(p)?d:p;h[c]=m}i[o].push(h)}const s=new ja;return i.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class qu{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new ja,i=t.getElementsByTagName("info"),s=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l<i.length;l++)e.info.push({face:i[l].getAttribute("face"),size:parseInt(i[l].getAttribute("size"),10)});for(let l=0;l<s.length;l++)e.common.push({lineHeight:parseInt(s[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<o.length;l++){const u=o[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)e.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)e.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return e}}class tc{static test(t){return typeof t=="string"&&t.includes("<font>")?qu.test(q.ADAPTER.parseXML(t)):!1}static parse(t){return qu.parse(q.ADAPTER.parseXML(t))}}const ec=[Ja,qu,tc];function SS(r){for(let t=0;t<ec.length;t++)if(ec[t].test(r))return ec[t];return null}function ES(r,t,e,i,s,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=r.width/i-h-l*2,c=r.height/i-h-l*2,d=o.slice(),p=e.fillGradientStops.slice();if(!p.length){const m=d.length+1;for(let f=1;f<m;++f)p.push(f/m)}if(d.unshift(o[0]),p.unshift(0),d.push(o[o.length-1]),p.push(1),e.fillGradientType===Ha.LINEAR_VERTICAL){a=t.createLinearGradient(u/2,l,u/2,c+l);let m=0;const f=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let _=0;_<d.length;_++){let b=0;typeof p[_]=="number"?b=p[_]:b=_/d.length;const v=y/c+b*f;let S=Math.max(m,v);S=Math.min(S,1),a.addColorStop(S,d[_]),m=S}}}else{a=t.createLinearGradient(l,c/2,u+l,c/2);const m=d.length+1;let f=1;for(let g=0;g<d.length;g++){let y;typeof p[g]=="number"?y=p[g]:y=f/m,a.addColorStop(y,d[g]),f++}}return a}function CS(r,t,e,i,s,n,o){const a=e.text,h=e.fontProperties;t.translate(i,s),t.scale(n,n);const l=o.strokeThickness/2,u=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=ES(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const c=o.dropShadowColor,d=o.dropShadowBlur*n,p=o.dropShadowDistance*n;t.shadowColor=Gt.shared.setValue(c).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*p,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*p}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,u+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,u+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function $a(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Lg(r){return Array.from?Array.from(r):r.split("")}function IS(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...Lg(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Cr=class Xi{constructor(t,e,i){var u;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=$i(o.file),l={};this._ownsTextures=i,this.font=s.face,this.size=s.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:p}=t.page[c];l[d]=e instanceof Array?e[c]:e[p],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=xe.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=xi.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:p}=t.char[c];let{x:m,y:f,width:g,height:y,xoffset:_,yoffset:b,xadvance:v}=t.char[c];m/=h,f/=h,g/=h,y/=h,_/=h,b/=h,v/=h;const S=new dt(m+l[p].frame.x/h,f+l[p].frame.y/h,g,y);this.chars[d]={xOffset:_,yOffset:b,xAdvance:v,kerning:{},texture:new rt(l[p].baseTexture,S),page:p}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:p,amount:m}=t.kerning[c];d/=h,p/=h,m/=h,this.chars[p]&&(this.chars[p].kerning[d]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((u=a==null?void 0:a.fieldType)==null?void 0:u.toLowerCase())??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,i){let s;if(t instanceof ja)s=t;else{const o=SS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof rt&&(e=[e]);const n=new Xi(s,e,i);return Xi.available[n.font]=n,n}static uninstall(t){const e=Xi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Xi.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},Xi.defaultOptions,i),u=IS(s),c=e instanceof Er?e:new Er(e),d=a,p=new ja;p.info[0]={face:c.fontFamily,size:c.fontSize},p.common[0]={lineHeight:c.fontSize};let m=0,f=0,g,y,_,b=0;const v=[];for(let E=0;E<u.length;E++){g||(g=q.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),_=new mt(g,{resolution:o,...l}),v.push(new rt(_)),p.page.push({id:v.length-1,file:""}));const A=u[E],I=Sr.measureText(A,c,!1,g),P=I.width,W=Math.ceil(I.height),D=Math.ceil((c.fontStyle==="italic"?2:1)*P);if(f>=h-W*o){if(f===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${A}')`);--E,g=null,y=null,_=null,f=0,m=0,b=0;continue}if(b=Math.max(W+I.fontProperties.descent,b),D*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${A}')`);--E,f+=b*o,f=Math.ceil(f),m=0,b=0;continue}CS(g,y,I,m,f,o,c);const L=$a(I.text);p.char.push({id:L,page:v.length-1,x:m/o,y:f/o,width:D,height:W,xoffset:0,yoffset:0,xadvance:P-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),m+=(D+2*n)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let E=0,A=u.length;E<A;E++){const I=u[E];for(let P=0;P<A;P++){const W=u[P],D=y.measureText(I).width,L=y.measureText(W).width,C=y.measureText(I+W).width-(D+L);C&&p.kerning.push({first:$a(I),second:$a(W),amount:C})}}const S=new Xi(p,v,!0);return Xi.available[t]!==void 0&&Xi.uninstall(t),Xi.available[t]=S,S}};Cr.ALPHA=[["a","z"],["A","Z"]," "],Cr.NUMERIC=[["0","9"]],Cr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Cr.ASCII=[[" ","~"]],Cr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Cr.ALPHANUMERIC},Cr.available={};let hi=Cr;var AS=`// Pixi texture info\r
1095
+ `;const ja=new Nt;class Ag extends wa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new um,this.state=Ci.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Ii.from(Ig,vS,e),this.shader=t.context.webGLVersion>1?Ii.from(xS,bS,e):Ii.from(Ig,_S,e)}render(t){const e=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=t._texture,h=a.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==Ki.CLAMP:h.wrapMode===Ki.CLAMP&&(h.wrapMode=Ki.REPEAT));const p=d?this.simpleShader:this.shader,m=a.width,f=a.height,g=t._width,y=t._height;ja.set(u.a*m/g,u.b*m/y,u.c*f/g,u.d*f/y,u.tx/g,u.ty/y),ja.invert(),d?ja.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=ja.toArray(!0),p.uniforms.uColor=Gt.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(p.uniforms.uColor),p.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),p.uniforms.uSampler=a,e.shader.bind(p),e.geometry.bind(i),this.state.blendMode=kf(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Ag.extension={name:"tilingSprite",type:J.RendererPlugin},it.add(Ag);const Rg=class zo{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof rt?t:null,this.baseTexture=t instanceof mt?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const s=this.baseTexture.resource;this.resolution=this._updateResolution(i||(s?s.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let i=$i(t,null);return i===null&&(i=parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=zo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=zo.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],o=n.frame;if(o){let a=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new dt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new dt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new dt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new dt(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new rt(this.baseTexture,a,u,h,n.rotated?2:0,n.anchor,n.borders),rt.addToCache(this.textures[s],s.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*zo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*zo.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Rg.BATCH_SIZE=1e3;let Mg=Rg;const TS=["jpg","png","jpeg","avif","webp"];function Pg(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=Jt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Pg([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const wS={extension:J.Asset,cache:{test:r=>r instanceof Mg,getCacheableAssets:(r,t)=>Pg(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&TS.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:J.LoadParser,priority:ai.Normal},async testParse(r,t){return Jt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=Jt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=Fu(s,t.src);const n=(await e.load([s]))[s],o=new Mg(n.baseTexture,r,t.src);await o.parse();const a=(h=r==null?void 0:r.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(a)){const u=[];for(const d of a){if(typeof d!="string")continue;let p=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(p=Fu(p,t.src),u.push(e.load({src:p,data:{ignoreMultiPack:!0}})))}const c=await Promise.all(u);o.linkedSheets=c,c.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==d))})}return o},unload(r){r.destroy(!0)}}};it.add(wS);class Ja{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class $a{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const u=a[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),p=parseFloat(d),m=isNaN(p)?d:p;h[c]=m}i[o].push(h)}const s=new Ja;return i.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class qu{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new Ja,i=t.getElementsByTagName("info"),s=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l<i.length;l++)e.info.push({face:i[l].getAttribute("face"),size:parseInt(i[l].getAttribute("size"),10)});for(let l=0;l<s.length;l++)e.common.push({lineHeight:parseInt(s[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<o.length;l++){const u=o[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)e.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)e.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return e}}class tc{static test(t){return typeof t=="string"&&t.includes("<font>")?qu.test(q.ADAPTER.parseXML(t)):!1}static parse(t){return qu.parse(q.ADAPTER.parseXML(t))}}const ec=[$a,qu,tc];function SS(r){for(let t=0;t<ec.length;t++)if(ec[t].test(r))return ec[t];return null}function ES(r,t,e,i,s,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=r.width/i-h-l*2,c=r.height/i-h-l*2,d=o.slice(),p=e.fillGradientStops.slice();if(!p.length){const m=d.length+1;for(let f=1;f<m;++f)p.push(f/m)}if(d.unshift(o[0]),p.unshift(0),d.push(o[o.length-1]),p.push(1),e.fillGradientType===Ya.LINEAR_VERTICAL){a=t.createLinearGradient(u/2,l,u/2,c+l);let m=0;const f=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let _=0;_<d.length;_++){let b=0;typeof p[_]=="number"?b=p[_]:b=_/d.length;const v=y/c+b*f;let S=Math.max(m,v);S=Math.min(S,1),a.addColorStop(S,d[_]),m=S}}}else{a=t.createLinearGradient(l,c/2,u+l,c/2);const m=d.length+1;let f=1;for(let g=0;g<d.length;g++){let y;typeof p[g]=="number"?y=p[g]:y=f/m,a.addColorStop(y,d[g]),f++}}return a}function CS(r,t,e,i,s,n,o){const a=e.text,h=e.fontProperties;t.translate(i,s),t.scale(n,n);const l=o.strokeThickness/2,u=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=ES(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const c=o.dropShadowColor,d=o.dropShadowBlur*n,p=o.dropShadowDistance*n;t.shadowColor=Gt.shared.setValue(c).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*p,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*p}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,u+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,u+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Qa(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Lg(r){return Array.from?Array.from(r):r.split("")}function IS(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...Lg(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Cr=class Xi{constructor(t,e,i){var u;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=$i(o.file),l={};this._ownsTextures=i,this.font=s.face,this.size=s.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:p}=t.page[c];l[d]=e instanceof Array?e[c]:e[p],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=_e.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=xi.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:p}=t.char[c];let{x:m,y:f,width:g,height:y,xoffset:_,yoffset:b,xadvance:v}=t.char[c];m/=h,f/=h,g/=h,y/=h,_/=h,b/=h,v/=h;const S=new dt(m+l[p].frame.x/h,f+l[p].frame.y/h,g,y);this.chars[d]={xOffset:_,yOffset:b,xAdvance:v,kerning:{},texture:new rt(l[p].baseTexture,S),page:p}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:p,amount:m}=t.kerning[c];d/=h,p/=h,m/=h,this.chars[p]&&(this.chars[p].kerning[d]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((u=a==null?void 0:a.fieldType)==null?void 0:u.toLowerCase())??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,i){let s;if(t instanceof Ja)s=t;else{const o=SS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof rt&&(e=[e]);const n=new Xi(s,e,i);return Xi.available[n.font]=n,n}static uninstall(t){const e=Xi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Xi.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},Xi.defaultOptions,i),u=IS(s),c=e instanceof Er?e:new Er(e),d=a,p=new Ja;p.info[0]={face:c.fontFamily,size:c.fontSize},p.common[0]={lineHeight:c.fontSize};let m=0,f=0,g,y,_,b=0;const v=[];for(let E=0;E<u.length;E++){g||(g=q.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),_=new mt(g,{resolution:o,...l}),v.push(new rt(_)),p.page.push({id:v.length-1,file:""}));const I=u[E],A=Sr.measureText(I,c,!1,g),P=A.width,O=Math.ceil(A.height),W=Math.ceil((c.fontStyle==="italic"?2:1)*P);if(f>=h-O*o){if(f===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${I}')`);--E,g=null,y=null,_=null,f=0,m=0,b=0;continue}if(b=Math.max(O+A.fontProperties.descent,b),W*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${I}')`);--E,f+=b*o,f=Math.ceil(f),m=0,b=0;continue}CS(g,y,A,m,f,o,c);const L=Qa(A.text);p.char.push({id:L,page:v.length-1,x:m/o,y:f/o,width:W,height:O,xoffset:0,yoffset:0,xadvance:P-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),m+=(W+2*n)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let E=0,I=u.length;E<I;E++){const A=u[E];for(let P=0;P<I;P++){const O=u[P],W=y.measureText(A).width,L=y.measureText(O).width,C=y.measureText(A+O).width-(W+L);C&&p.kerning.push({first:Qa(A),second:Qa(O),amount:C})}}const S=new Xi(p,v,!0);return Xi.available[t]!==void 0&&Xi.uninstall(t),Xi.available[t]=S,S}};Cr.ALPHA=[["a","z"],["A","Z"]," "],Cr.NUMERIC=[["0","9"]],Cr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Cr.ASCII=[[" ","~"]],Cr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Cr.ALPHANUMERIC},Cr.available={};let li=Cr;var AS=`// Pixi texture info\r
1096
1096
  varying vec2 vTextureCoord;\r
1097
1097
  uniform sampler2D uSampler;\r
1098
1098
  \r
@@ -1146,32 +1146,32 @@ void main(void)\r
1146
1146
  \r
1147
1147
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
1148
1148
  }\r
1149
- `;const Gg=[],Ng=[],Fg=[],Dg=class Ib extends Xt{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},Ib.styleDefaults,e);if(!hi.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Gt(s),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new Qi(()=>{this.dirty=!0},this,0,0),this._roundPixels=q.ROUND_PIXELS,this.dirty=!0,this._resolution=q.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var D;const t=hi.available[this._fontName],e=this.fontSize,i=e/t.size,s=new lt,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
1150
- `)||" ",l=Lg(h),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?Gg:Ng;let d=null,p=0,m=0,f=0,g=-1,y=0,_=0,b=0,v=0;for(let L=0;L<l.length;L++){const C=l[L],N=$a(C);if(/(?:\s)/.test(C)&&(g=L,y=p,v++),C==="\r"||C===`
1151
- `){o.push(p),a.push(-1),m=Math.max(m,p),++f,++_,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const U=t.chars[N];if(!U)continue;d&&U.kerning[d]&&(s.x+=U.kerning[d]);const K=Fg.pop()||{texture:rt.EMPTY,line:0,charCode:0,prevSpaces:0,position:new lt};K.texture=U.texture,K.line=f,K.charCode=N,K.position.x=Math.round(s.x+U.xOffset+this._letterSpacing/2),K.position.y=Math.round(s.y+U.yOffset),K.prevSpaces=v,n.push(K),p=K.position.x+Math.max(U.xAdvance-U.xOffset,U.texture.orig.width),s.x+=U.xAdvance+this._letterSpacing,b=Math.max(b,U.yOffset+U.texture.height),d=N,g!==-1&&u>0&&s.x>u&&(++_,Xs(n,1+g-_,1+L-g),L=g,g=-1,o.push(y),a.push(n.length>0?n[n.length-1].prevSpaces:0),m=Math.max(m,y),f++,s.x=0,s.y+=t.lineHeight,d=null,v=0)}const S=l[l.length-1];S!=="\r"&&S!==`
1152
- `&&(/(?:\s)/.test(S)&&(p=y),o.push(p),m=Math.max(m,p),a.push(-1));const E=[];for(let L=0;L<=f;L++){let C=0;this._align==="right"?C=m-o[L]:this._align==="center"?C=(m-o[L])/2:this._align==="justify"&&(C=a[L]<0?0:(m-o[L])/a[L]),E.push(C)}const A=n.length,I={},P=[],W=this._activePagesMeshData;c.push(...W);for(let L=0;L<A;L++){const C=n[L].texture,N=C.baseTexture.uid;if(!I[N]){let U=c.pop();if(!U){const Z=new bg;let z,k;t.distanceFieldType==="none"?(z=new ju(rt.EMPTY),k=ct.NORMAL):(z=new ju(rt.EMPTY,{program:qi.from(RS,AS),uniforms:{uFWidth:0}}),k=ct.NORMAL_NPM);const F=new zu(Z,z);F.blendMode=k,U={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:F,vertices:null,uvs:null,indices:null}}U.index=0,U.indexCount=0,U.vertexCount=0,U.uvsCount=0,U.total=0;const{_textureCache:K}=this;K[N]=K[N]||new rt(C.baseTexture),U.mesh.texture=K[N],U.mesh.tint=this._tintColor.value,P.push(U),I[N]=U}I[N].total++}for(let L=0;L<W.length;L++)P.includes(W[L])||this.removeChild(W[L].mesh);for(let L=0;L<P.length;L++)P[L].mesh.parent!==this&&this.addChild(P[L].mesh);this._activePagesMeshData=P;for(const L in I){const C=I[L],N=C.total;if(!(((D=C.indices)==null?void 0:D.length)>6*N)||C.vertices.length<zu.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*N),C.uvs=new Float32Array(4*2*N),C.indices=new Uint16Array(6*N);else{const U=C.total,K=C.vertices;for(let Z=U*4*2;Z<K.length;Z++)K[Z]=0}C.mesh.size=6*N}for(let L=0;L<A;L++){const C=n[L];let N=C.position.x+E[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(N=Math.round(N));const U=N*i,K=C.position.y*i,Z=C.texture,z=I[Z.baseTexture.uid],k=Z.frame,F=Z._uvs,G=z.index++;z.indices[G*6+0]=0+G*4,z.indices[G*6+1]=1+G*4,z.indices[G*6+2]=2+G*4,z.indices[G*6+3]=0+G*4,z.indices[G*6+4]=2+G*4,z.indices[G*6+5]=3+G*4,z.vertices[G*8+0]=U,z.vertices[G*8+1]=K,z.vertices[G*8+2]=U+k.width*i,z.vertices[G*8+3]=K,z.vertices[G*8+4]=U+k.width*i,z.vertices[G*8+5]=K+k.height*i,z.vertices[G*8+6]=U,z.vertices[G*8+7]=K+k.height*i,z.uvs[G*8+0]=F.x0,z.uvs[G*8+1]=F.y0,z.uvs[G*8+2]=F.x1,z.uvs[G*8+3]=F.y1,z.uvs[G*8+4]=F.x2,z.uvs[G*8+5]=F.y2,z.uvs[G*8+6]=F.x3,z.uvs[G*8+7]=F.y3}this._textWidth=m*i,this._textHeight=(s.y+t.lineHeight)*i;for(const L in I){const C=I[L];if(this.anchor.x!==0||this.anchor.y!==0){let Z=0;const z=this._textWidth*this.anchor.x,k=this._textHeight*this.anchor.y;for(let F=0;F<C.total;F++)C.vertices[Z++]-=z,C.vertices[Z++]-=k,C.vertices[Z++]-=z,C.vertices[Z++]-=k,C.vertices[Z++]-=z,C.vertices[Z++]-=k,C.vertices[Z++]-=z,C.vertices[Z++]-=k}this._maxLineHeight=b*i;const N=C.mesh.geometry.getBuffer("aVertexPosition"),U=C.mesh.geometry.getBuffer("aTextureCoord"),K=C.mesh.geometry.getIndex();N.data=C.vertices,U.data=C.uvs,K.data=C.indices,N.update(),U.update(),K.update()}for(let L=0;L<n.length;L++)Fg.push(n[L]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:i,size:s}=hi.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:h}=this.worldTransform,l=Math.sqrt(n*n+o*o),u=Math.sqrt(a*a+h*h),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/s,p=t._view.resolution;for(const m of this._activePagesMeshData)m.mesh.shader.uniforms.uFWidth=c*e*d*p}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=hi.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!hi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??hi.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,i=hi.available[this._fontName].distanceFieldType==="none"?Gg:Ng;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>e[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=rt.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Dg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let MS=Dg;const PS=[".xml",".fnt"],LS={extension:{type:J.LoadParser,priority:oi.Normal},name:"loadBitmapFont",test(r){return PS.includes(Jt.extname(r).toLowerCase())},async testParse(r){return Ja.test(r)||tc.test(r)},async parse(r,t,e){const i=Ja.test(r)?Ja.parse(r):tc.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=Jt.join(Jt.dirname(s),u);c=Fu(c,s),o.push(c)}const a=await e.load(o),h=o.map(l=>a[l]);return hi.install(i,h,!0)},async load(r,t){return(await q.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};it.add(LS);const ic=class Pn extends Er{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Pn(Object.keys(Pn.defaultOptions).reduce((e,i)=>({...e,[i]:t[i]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete Pn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Pn;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return q.ADAPTER.fetch(t).then(s=>s.blob()).then(async s=>new Promise((n,o)=>{const a=URL.createObjectURL(s),h=new FileReader;h.onload=()=>n([a,h.result]),h.onerror=o,h.readAsDataURL(s)})).then(async([s,n])=>{const o=Object.assign({family:Jt.basename(t,Jt.extname(t)),weight:"normal",style:"normal",display:"auto",src:s,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);i[t]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(i=>!this._overrides.includes(i));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(i=>this._overrides.includes(i));e.length>0&&(this._overrides=this._overrides.filter(i=>!e.includes(i)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t}
1149
+ `;const Gg=[],Ng=[],Fg=[],Dg=class Ib extends Xt{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},Ib.styleDefaults,e);if(!li.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Gt(s),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new Qi(()=>{this.dirty=!0},this,0,0),this._roundPixels=q.ROUND_PIXELS,this.dirty=!0,this._resolution=q.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var W;const t=li.available[this._fontName],e=this.fontSize,i=e/t.size,s=new lt,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
1150
+ `)||" ",l=Lg(h),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?Gg:Ng;let d=null,p=0,m=0,f=0,g=-1,y=0,_=0,b=0,v=0;for(let L=0;L<l.length;L++){const C=l[L],N=Qa(C);if(/(?:\s)/.test(C)&&(g=L,y=p,v++),C==="\r"||C===`
1151
+ `){o.push(p),a.push(-1),m=Math.max(m,p),++f,++_,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const X=t.chars[N];if(!X)continue;d&&X.kerning[d]&&(s.x+=X.kerning[d]);const K=Fg.pop()||{texture:rt.EMPTY,line:0,charCode:0,prevSpaces:0,position:new lt};K.texture=X.texture,K.line=f,K.charCode=N,K.position.x=Math.round(s.x+X.xOffset+this._letterSpacing/2),K.position.y=Math.round(s.y+X.yOffset),K.prevSpaces=v,n.push(K),p=K.position.x+Math.max(X.xAdvance-X.xOffset,X.texture.orig.width),s.x+=X.xAdvance+this._letterSpacing,b=Math.max(b,X.yOffset+X.texture.height),d=N,g!==-1&&u>0&&s.x>u&&(++_,Zs(n,1+g-_,1+L-g),L=g,g=-1,o.push(y),a.push(n.length>0?n[n.length-1].prevSpaces:0),m=Math.max(m,y),f++,s.x=0,s.y+=t.lineHeight,d=null,v=0)}const S=l[l.length-1];S!=="\r"&&S!==`
1152
+ `&&(/(?:\s)/.test(S)&&(p=y),o.push(p),m=Math.max(m,p),a.push(-1));const E=[];for(let L=0;L<=f;L++){let C=0;this._align==="right"?C=m-o[L]:this._align==="center"?C=(m-o[L])/2:this._align==="justify"&&(C=a[L]<0?0:(m-o[L])/a[L]),E.push(C)}const I=n.length,A={},P=[],O=this._activePagesMeshData;c.push(...O);for(let L=0;L<I;L++){const C=n[L].texture,N=C.baseTexture.uid;if(!A[N]){let X=c.pop();if(!X){const Z=new bg;let z,D;t.distanceFieldType==="none"?(z=new ju(rt.EMPTY),D=ct.NORMAL):(z=new ju(rt.EMPTY,{program:qi.from(RS,AS),uniforms:{uFWidth:0}}),D=ct.NORMAL_NPM);const F=new zu(Z,z);F.blendMode=D,X={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:F,vertices:null,uvs:null,indices:null}}X.index=0,X.indexCount=0,X.vertexCount=0,X.uvsCount=0,X.total=0;const{_textureCache:K}=this;K[N]=K[N]||new rt(C.baseTexture),X.mesh.texture=K[N],X.mesh.tint=this._tintColor.value,P.push(X),A[N]=X}A[N].total++}for(let L=0;L<O.length;L++)P.includes(O[L])||this.removeChild(O[L].mesh);for(let L=0;L<P.length;L++)P[L].mesh.parent!==this&&this.addChild(P[L].mesh);this._activePagesMeshData=P;for(const L in A){const C=A[L],N=C.total;if(!(((W=C.indices)==null?void 0:W.length)>6*N)||C.vertices.length<zu.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*N),C.uvs=new Float32Array(4*2*N),C.indices=new Uint16Array(6*N);else{const X=C.total,K=C.vertices;for(let Z=X*4*2;Z<K.length;Z++)K[Z]=0}C.mesh.size=6*N}for(let L=0;L<I;L++){const C=n[L];let N=C.position.x+E[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(N=Math.round(N));const X=N*i,K=C.position.y*i,Z=C.texture,z=A[Z.baseTexture.uid],D=Z.frame,F=Z._uvs,G=z.index++;z.indices[G*6+0]=0+G*4,z.indices[G*6+1]=1+G*4,z.indices[G*6+2]=2+G*4,z.indices[G*6+3]=0+G*4,z.indices[G*6+4]=2+G*4,z.indices[G*6+5]=3+G*4,z.vertices[G*8+0]=X,z.vertices[G*8+1]=K,z.vertices[G*8+2]=X+D.width*i,z.vertices[G*8+3]=K,z.vertices[G*8+4]=X+D.width*i,z.vertices[G*8+5]=K+D.height*i,z.vertices[G*8+6]=X,z.vertices[G*8+7]=K+D.height*i,z.uvs[G*8+0]=F.x0,z.uvs[G*8+1]=F.y0,z.uvs[G*8+2]=F.x1,z.uvs[G*8+3]=F.y1,z.uvs[G*8+4]=F.x2,z.uvs[G*8+5]=F.y2,z.uvs[G*8+6]=F.x3,z.uvs[G*8+7]=F.y3}this._textWidth=m*i,this._textHeight=(s.y+t.lineHeight)*i;for(const L in A){const C=A[L];if(this.anchor.x!==0||this.anchor.y!==0){let Z=0;const z=this._textWidth*this.anchor.x,D=this._textHeight*this.anchor.y;for(let F=0;F<C.total;F++)C.vertices[Z++]-=z,C.vertices[Z++]-=D,C.vertices[Z++]-=z,C.vertices[Z++]-=D,C.vertices[Z++]-=z,C.vertices[Z++]-=D,C.vertices[Z++]-=z,C.vertices[Z++]-=D}this._maxLineHeight=b*i;const N=C.mesh.geometry.getBuffer("aVertexPosition"),X=C.mesh.geometry.getBuffer("aTextureCoord"),K=C.mesh.geometry.getIndex();N.data=C.vertices,X.data=C.uvs,K.data=C.indices,N.update(),X.update(),K.update()}for(let L=0;L<n.length;L++)Fg.push(n[L]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:i,size:s}=li.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:h}=this.worldTransform,l=Math.sqrt(n*n+o*o),u=Math.sqrt(a*a+h*h),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/s,p=t._view.resolution;for(const m of this._activePagesMeshData)m.mesh.shader.uniforms.uFWidth=c*e*d*p}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=li.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!li.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??li.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,i=li.available[this._fontName].distanceFieldType==="none"?Gg:Ng;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>e[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=rt.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Dg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let MS=Dg;const PS=[".xml",".fnt"],LS={extension:{type:J.LoadParser,priority:ai.Normal},name:"loadBitmapFont",test(r){return PS.includes(Jt.extname(r).toLowerCase())},async testParse(r){return $a.test(r)||tc.test(r)},async parse(r,t,e){const i=$a.test(r)?$a.parse(r):tc.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=Jt.join(Jt.dirname(s),u);c=Fu(c,s),o.push(c)}const a=await e.load(o),h=o.map(l=>a[l]);return li.install(i,h,!0)},async load(r,t){return(await q.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};it.add(LS);const ic=class Ln extends Er{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Ln(Object.keys(Ln.defaultOptions).reduce((e,i)=>({...e,[i]:t[i]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete Ln.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Ln;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return q.ADAPTER.fetch(t).then(s=>s.blob()).then(async s=>new Promise((n,o)=>{const a=URL.createObjectURL(s),h=new FileReader;h.onload=()=>n([a,h.result]),h.onerror=o,h.readAsDataURL(s)})).then(async([s,n])=>{const o=Object.assign({family:Jt.basename(t,Jt.extname(t)),weight:"normal",style:"normal",display:"auto",src:s,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);i[t]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(i=>!this._overrides.includes(i));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(i=>this._overrides.includes(i));e.length>0&&(this._overrides=this._overrides.filter(i=>!e.includes(i)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t}
1153
1153
  @font-face {
1154
1154
  font-family: "${e.family}";
1155
1155
  src: url('${e.dataSrc}');
1156
1156
  font-weight: ${e.weight};
1157
1157
  font-style: ${e.style};
1158
1158
  font-display: ${e.display};
1159
- }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=v1(t)),typeof t=="number"?_1(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),s=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${i}px ${s}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,Pn.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=q.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};ic.availableFonts={},ic.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let rc=ic;const Qa=class Ln extends ie{constructor(t="",e={}){super(rt.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,s=rt.from(i,{scaleMode:q.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new dt,s.trim=new dt,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),u=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Ln.defaultMaxWidth,this.maxHeight=Ln.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Ln.defaultAutoResolution,this._resolution=Ln.defaultResolution??q.RESOLUTION,this.text=t,this.style=e}measureText(t){var u,c;const{text:e,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(s)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(u=this._style)==null?void 0:u.toCSS(s)}),this._styleElement.textContent=(c=this._style)==null?void 0:c.toGlobalCSS()),{width:h+i.padding*2,height:l+i.padding*2}}async updateText(t=!0){const{style:e,_image:i,_loadImage:s}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{s.onload=async()=>{if(a<this._updateID){h();return}await e.onBeforeDraw(),i.src=s.src,s.onload=null,s.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);s.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:i,resolution:s}=this,{padding:n}=t,{baseTexture:o}=e;e.trim.width=e._frame.width=i.width/s,e.trim.height=e._frame.height=i.height/s,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),o.setRealSize(i.width,i.height,s),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var i,s,n,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Ln.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=e,(s=this._svgRoot)==null||s.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(o=this._foreignObject)==null||o.remove(),this._foreignObject=e,(a=this._styleElement)==null||a.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=yr(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=yr(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&(t=t||{},t instanceof rc?(this.ownsStyle=!1,this._style=t):t instanceof Er?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=rc.from(t)):(this.ownsStyle=!0,this._style=new rc(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};Qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qa.defaultMaxWidth=2024,Qa.defaultMaxHeight=2024,Qa.defaultAutoResolution=!0;function GS(){const r=new Map;function t(o,a){const h=r.get(o);return h?h.add(a):r.set(o,new Set([a])),()=>i(o,a)}function e(o,a){const h=l=>{i(o,h),a(l)};t(o,h)}function i(o,a){var h;(h=r.get(o))==null||h.delete(a)}function s(o,a){var h;(h=r.get(o))==null||h.forEach(l=>l(a))}function n(){r.clear()}return{on:t,off:i,once:e,emit:s,clear:n}}const bt=GS();function Ue(r){let t;return new Promise(e=>{t=e,bt.on(r,t)}).then(e=>(bt.off(r,t),e))}let Ri=null;const kg=new ResizeObserver(()=>{Ri&&bt.emit("stageUpdated",Ri)});function NS(r){Ri=r,kg.observe(Ri),bt.emit("stageCreated",Ri)}function FS(){Ri&&kg.unobserve(Ri),Ri=null}async function sc(){return Ri||await Ue("stageCreated")}let Ae=null;async function DS(){const r=await sc();OS(r),bt.on("stageUpdated",WS)}function kS(){Ae&&(Ae.destroy(!0,{children:!0}),Ae=null)}function OS(r){Ae=new Jm({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:window.devicePixelRatio}),Ae.stage.sortableChildren=!0,r.appendChild(Ae.view),bt.emit("applicationCreated",Ae),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=Ae)}async function Xe(){return Ae||await Ue("applicationCreated")}function WS(r){Ae&&(Ae.resizeTo=r,bt.emit("applicationResized",Ae))}var qa={exports:{}};qa.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=800,n=16,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",u="[object Boolean]",c="[object Date]",d="[object Error]",p="[object Function]",m="[object GeneratorFunction]",f="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Proxy]",v="[object RegExp]",S="[object Set]",E="[object String]",A="[object Undefined]",I="[object WeakMap]",P="[object ArrayBuffer]",W="[object DataView]",D="[object Float32Array]",L="[object Float64Array]",C="[object Int8Array]",N="[object Int16Array]",U="[object Int32Array]",K="[object Uint8Array]",Z="[object Uint8ClampedArray]",z="[object Uint16Array]",k="[object Uint32Array]",F=/[\\^$.*+?()[\]{}|]/g,G=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,$={};$[D]=$[L]=$[C]=$[N]=$[U]=$[K]=$[Z]=$[z]=$[k]=!0,$[a]=$[h]=$[P]=$[u]=$[W]=$[c]=$[d]=$[p]=$[f]=$[g]=$[_]=$[v]=$[S]=$[E]=$[I]=!1;var ut=typeof ti=="object"&&ti&&ti.Object===Object&&ti,nt=typeof self=="object"&&self&&self.Object===Object&&self,Ct=ut||nt||Function("return this")(),Rt=t&&!t.nodeType&&t,_t=Rt&&!0&&r&&!r.nodeType&&r,Y=_t&&_t.exports===Rt,tt=Y&&ut.process,et=function(){try{var x=_t&&_t.require&&_t.require("util").types;return x||tt&&tt.binding&&tt.binding("util")}catch{}}(),O=et&&et.isTypedArray;function xt(x,w,M){switch(M.length){case 0:return x.call(w);case 1:return x.call(w,M[0]);case 2:return x.call(w,M[0],M[1]);case 3:return x.call(w,M[0],M[1],M[2])}return x.apply(w,M)}function gt(x,w){for(var M=-1,X=Array(x);++M<x;)X[M]=w(M);return X}function Mt(x){return function(w){return x(w)}}function Ut(x,w){return x==null?void 0:x[w]}function Ne(x,w){return function(M){return x(w(M))}}var pi=Array.prototype,Md=Function.prototype,bn=Object.prototype,Ro=Ct["__core-js_shared__"],xn=Md.toString,fi=bn.hasOwnProperty,Wh=function(){var x=/[^.]+$/.exec(Ro&&Ro.keys&&Ro.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),Bh=bn.toString,Pd=xn.call(Object),_n=RegExp("^"+xn.call(fi).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Or=Y?Ct.Buffer:void 0,Mo=Ct.Symbol,Fe=Ct.Uint8Array,Po=Or?Or.allocUnsafe:void 0,Lo=Ne(Object.getPrototypeOf,Object),Uh=Object.create,Xh=bn.propertyIsEnumerable,vn=pi.splice,ki=Mo?Mo.toStringTag:void 0,Ss=function(){try{var x=Bo(Object,"defineProperty");return x({},"",{}),x}catch{}}(),Ld=Or?Or.isBuffer:void 0,Oi=Math.max,Zh=Date.now,Vh=Bo(Ct,"Map"),Es=Bo(Object,"create"),Go=function(){function x(){}return function(w){if(!Ui(w))return{};if(Uh)return Uh(w);x.prototype=w;var M=new x;return x.prototype=void 0,M}}();function De(x){var w=-1,M=x==null?0:x.length;for(this.clear();++w<M;){var X=x[w];this.set(X[0],X[1])}}function No(){this.__data__=Es?Es(null):{},this.size=0}function Fo(x){var w=this.has(x)&&delete this.__data__[x];return this.size-=w?1:0,w}function Do(x){var w=this.__data__;if(Es){var M=w[x];return M===i?void 0:M}return fi.call(w,x)?w[x]:void 0}function Cs(x){var w=this.__data__;return Es?w[x]!==void 0:fi.call(w,x)}function Gd(x,w){var M=this.__data__;return this.size+=this.has(x)?0:1,M[x]=Es&&w===void 0?i:w,this}De.prototype.clear=No,De.prototype.delete=Fo,De.prototype.get=Do,De.prototype.has=Cs,De.prototype.set=Gd;function mi(x){var w=-1,M=x==null?0:x.length;for(this.clear();++w<M;){var X=x[w];this.set(X[0],X[1])}}function Nd(){this.__data__=[],this.size=0}function Fd(x){var w=this.__data__,M=Tn(w,x);if(M<0)return!1;var X=w.length-1;return M==X?w.pop():vn.call(w,M,1),--this.size,!0}function Dd(x){var w=this.__data__,M=Tn(w,x);return M<0?void 0:w[M][1]}function Kh(x){return Tn(this.__data__,x)>-1}function ko(x,w){var M=this.__data__,X=Tn(M,x);return X<0?(++this.size,M.push([x,w])):M[X][1]=w,this}mi.prototype.clear=Nd,mi.prototype.delete=Fd,mi.prototype.get=Dd,mi.prototype.has=Kh,mi.prototype.set=ko;function Ce(x){var w=-1,M=x==null?0:x.length;for(this.clear();++w<M;){var X=x[w];this.set(X[0],X[1])}}function kd(){this.size=0,this.__data__={hash:new De,map:new(Vh||mi),string:new De}}function Od(x){var w=Sn(this,x).delete(x);return this.size-=w?1:0,w}function Wd(x){return Sn(this,x).get(x)}function Bd(x){return Sn(this,x).has(x)}function Ud(x,w){var M=Sn(this,x),X=M.size;return M.set(x,w),this.size+=M.size==X?0:1,this}Ce.prototype.clear=kd,Ce.prototype.delete=Od,Ce.prototype.get=Wd,Ce.prototype.has=Bd,Ce.prototype.set=Ud;function fe(x){var w=this.__data__=new mi(x);this.size=w.size}function Xd(){this.__data__=new mi,this.size=0}function Zd(x){var w=this.__data__,M=w.delete(x);return this.size=w.size,M}function Vd(x){return this.__data__.get(x)}function Kd(x){return this.__data__.has(x)}function Hd(x,w){var M=this.__data__;if(M instanceof mi){var X=M.__data__;if(!Vh||X.length<e-1)return X.push([x,w]),this.size=++M.size,this;M=this.__data__=new Ce(X)}return M.set(x,w),this.size=M.size,this}fe.prototype.clear=Xd,fe.prototype.delete=Zd,fe.prototype.get=Vd,fe.prototype.has=Kd,fe.prototype.set=Hd;function ur(x,w){var M=In(x),X=!M&&gi(x),ht=!M&&!X&&qh(x),ft=!M&&!X&&!ht&&Br(x),yt=M||X||ht||ft,ot=yt?gt(x.length,String):[],vt=ot.length;for(var Ft in x)(w||fi.call(x,Ft))&&!(yt&&(Ft=="length"||ht&&(Ft=="offset"||Ft=="parent")||ft&&(Ft=="buffer"||Ft=="byteLength"||Ft=="byteOffset")||$h(Ft,vt)))&&ot.push(Ft);return ot}function Oo(x,w,M){(M!==void 0&&!Cn(x[w],M)||M===void 0&&!(w in x))&&Wo(x,w,M)}function Yd(x,w,M){var X=x[w];(!(fi.call(x,w)&&Cn(X,M))||M===void 0&&!(w in x))&&Wo(x,w,M)}function Tn(x,w){for(var M=x.length;M--;)if(Cn(x[M][0],w))return M;return-1}function Wo(x,w,M){w=="__proto__"&&Ss?Ss(x,w,{configurable:!0,enumerable:!0,value:M,writable:!0}):x[w]=M}var zd=ip();function cr(x){return x==null?x===void 0?A:y:ki&&ki in Object(x)?rp(x):op(x)}function Hh(x){return Wr(x)&&cr(x)==a}function jd(x){if(!Ui(x)||En(x))return!1;var w=As(x)?_n:G;return w.test(lp(x))}function Wi(x){return Wr(x)&&tl(x.length)&&!!$[cr(x)]}function Jd(x){if(!Ui(x))return np(x);var w=dr(x),M=[];for(var X in x)X=="constructor"&&(w||!fi.call(x,X))||M.push(X);return M}function Yh(x,w,M,X,ht){x!==w&&zd(w,function(ft,yt){if(ht||(ht=new fe),Ui(ft))$d(x,w,yt,M,Yh,X,ht);else{var ot=X?X(Uo(x,yt),ft,yt+"",x,w,ht):void 0;ot===void 0&&(ot=ft),Oo(x,yt,ot)}},rl)}function $d(x,w,M,X,ht,ft,yt){var ot=Uo(x,M),vt=Uo(w,M),Ft=yt.get(vt);if(Ft){Oo(x,M,Ft);return}var At=ft?ft(ot,vt,M+"",x,w,yt):void 0,ne=At===void 0;if(ne){var me=In(vt),Qe=!me&&qh(vt),qe=!me&&!Qe&&Br(vt);At=vt,me||Qe||qe?In(ot)?At=ot:An(ot)?At=Is(ot):Qe?(ne=!1,At=tp(vt,!0)):qe?(ne=!1,At=ep(vt,!0)):At=[]:el(vt)||gi(vt)?(At=ot,gi(ot)?At=il(ot):(!Ui(ot)||As(ot))&&(At=Jh(vt))):ne=!1}ne&&(yt.set(vt,At),ht(At,vt,X,ft,yt),yt.delete(vt)),Oo(x,M,At)}function Qd(x,w){return ap(Bi(x,w,T),x+"")}var qd=Ss?function(x,w){return Ss(x,"toString",{configurable:!0,enumerable:!1,value:cp(w),writable:!0})}:T;function tp(x,w){if(w)return x.slice();var M=x.length,X=Po?Po(M):new x.constructor(M);return x.copy(X),X}function wn(x){var w=new x.constructor(x.byteLength);return new Fe(w).set(new Fe(x)),w}function ep(x,w){var M=w?wn(x.buffer):x.buffer;return new x.constructor(M,x.byteOffset,x.length)}function Is(x,w){var M=-1,X=x.length;for(w||(w=Array(X));++M<X;)w[M]=x[M];return w}function zh(x,w,M,X){var ht=!M;M||(M={});for(var ft=-1,yt=w.length;++ft<yt;){var ot=w[ft],vt=X?X(M[ot],x[ot],ot,M,x):void 0;vt===void 0&&(vt=x[ot]),ht?Wo(M,ot,vt):Yd(M,ot,vt)}return M}function jh(x){return Qd(function(w,M){var X=-1,ht=M.length,ft=ht>1?M[ht-1]:void 0,yt=ht>2?M[2]:void 0;for(ft=x.length>3&&typeof ft=="function"?(ht--,ft):void 0,yt&&sp(M[0],M[1],yt)&&(ft=ht<3?void 0:ft,ht=1),w=Object(w);++X<ht;){var ot=M[X];ot&&x(w,ot,X,ft)}return w})}function ip(x){return function(w,M,X){for(var ht=-1,ft=Object(w),yt=X(w),ot=yt.length;ot--;){var vt=yt[x?ot:++ht];if(M(ft[vt],vt,ft)===!1)break}return w}}function Sn(x,w){var M=x.__data__;return Qh(w)?M[typeof w=="string"?"string":"hash"]:M.map}function Bo(x,w){var M=Ut(x,w);return jd(M)?M:void 0}function rp(x){var w=fi.call(x,ki),M=x[ki];try{x[ki]=void 0;var X=!0}catch{}var ht=Bh.call(x);return X&&(w?x[ki]=M:delete x[ki]),ht}function Jh(x){return typeof x.constructor=="function"&&!dr(x)?Go(Lo(x)):{}}function $h(x,w){var M=typeof x;return w=w??o,!!w&&(M=="number"||M!="symbol"&&V.test(x))&&x>-1&&x%1==0&&x<w}function sp(x,w,M){if(!Ui(M))return!1;var X=typeof w;return(X=="number"?Xo(M)&&$h(w,M.length):X=="string"&&w in M)?Cn(M[w],x):!1}function Qh(x){var w=typeof x;return w=="string"||w=="number"||w=="symbol"||w=="boolean"?x!=="__proto__":x===null}function En(x){return!!Wh&&Wh in x}function dr(x){var w=x&&x.constructor,M=typeof w=="function"&&w.prototype||bn;return x===M}function np(x){var w=[];if(x!=null)for(var M in Object(x))w.push(M);return w}function op(x){return Bh.call(x)}function Bi(x,w,M){return w=Oi(w===void 0?x.length-1:w,0),function(){for(var X=arguments,ht=-1,ft=Oi(X.length-w,0),yt=Array(ft);++ht<ft;)yt[ht]=X[w+ht];ht=-1;for(var ot=Array(w+1);++ht<w;)ot[ht]=X[ht];return ot[w]=M(yt),xt(x,this,ot)}}function Uo(x,w){if(!(w==="constructor"&&typeof x[w]=="function")&&w!="__proto__")return x[w]}var ap=hp(qd);function hp(x){var w=0,M=0;return function(){var X=Zh(),ht=n-(X-M);if(M=X,ht>0){if(++w>=s)return arguments[0]}else w=0;return x.apply(void 0,arguments)}}function lp(x){if(x!=null){try{return xn.call(x)}catch{}try{return x+""}catch{}}return""}function Cn(x,w){return x===w||x!==x&&w!==w}var gi=Hh(function(){return arguments}())?Hh:function(x){return Wr(x)&&fi.call(x,"callee")&&!Xh.call(x,"callee")},In=Array.isArray;function Xo(x){return x!=null&&tl(x.length)&&!As(x)}function An(x){return Wr(x)&&Xo(x)}var qh=Ld||R;function As(x){if(!Ui(x))return!1;var w=cr(x);return w==p||w==m||w==l||w==b}function tl(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=o}function Ui(x){var w=typeof x;return x!=null&&(w=="object"||w=="function")}function Wr(x){return x!=null&&typeof x=="object"}function el(x){if(!Wr(x)||cr(x)!=_)return!1;var w=Lo(x);if(w===null)return!0;var M=fi.call(w,"constructor")&&w.constructor;return typeof M=="function"&&M instanceof M&&xn.call(M)==Pd}var Br=O?Mt(O):Wi;function il(x){return zh(x,rl(x))}function rl(x){return Xo(x)?ur(x,!0):Jd(x)}var up=jh(function(x,w,M){Yh(x,w,M)});function cp(x){return function(){return x}}function T(x){return x}function R(){return!1}r.exports=up}(qa,qa.exports);var BS=qa.exports;const US=Nn(BS);let os=null;function XS(){os=j.effectScope()}function ZS(){os==null||os.stop(),os=null}async function VS(){return os||await Ue("scopeCreated")}let Ir=null;const Og={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,styles:{colorMode:"dark",rowGap:16,columnGap:32,textDefault:"#ffffff",textInverse:"#000000",nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBgColor:"#35363C",nodeToggleBorderRadius:6,nodeToggleBorderColor:"#51525C",nodeSelectedBorderColor:"#3fa2c3",nodeUnselectedAlpha:.2,edgeColor:"#51525C",guideLineWidth:1,guideLineColor:"#51525C",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:"#ADADAD",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"})}};function KS(r){const t=US({},Og,r);return t.styles.node=e=>{var i,s;return{...Og.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function HS(r){(await VS()).run(()=>{j.watch(()=>r.config,e=>{const i=KS(e);if(!Ir){Ir=i,bt.emit("configCreated",Ir);return}Object.assign(Ir,i),bt.emit("configUpdated",Ir)},{immediate:!0})})}function YS(){Ir=null}async function be(){return Ir||await Ue("configCreated")}async function Wg(r,t){const e=await be();let i,s=null;async function n(){try{s=await e.fetch(r),t(s)}catch(a){console.error(a)}s&&!s.end_time&&(i=setTimeout(()=>n(),zS(s)))}function o(){clearInterval(i)}return{start:n,stop:o}}function zS(r){const t=Math.floor(r.nodes.size/zo)*zo;return Math.max(zo,t)}function er(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Bg(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
1160
- * GSAP 3.12.2
1161
- * https://greensock.com
1159
+ }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=v1(t)),typeof t=="number"?_1(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),s=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${i}px ${s}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,Ln.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=q.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};ic.availableFonts={},ic.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let rc=ic;const qa=class Gn extends ie{constructor(t="",e={}){super(rt.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,s=rt.from(i,{scaleMode:q.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new dt,s.trim=new dt,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),u=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Gn.defaultMaxWidth,this.maxHeight=Gn.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Gn.defaultAutoResolution,this._resolution=Gn.defaultResolution??q.RESOLUTION,this.text=t,this.style=e}measureText(t){var u,c;const{text:e,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(s)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(u=this._style)==null?void 0:u.toCSS(s)}),this._styleElement.textContent=(c=this._style)==null?void 0:c.toGlobalCSS()),{width:h+i.padding*2,height:l+i.padding*2}}async updateText(t=!0){const{style:e,_image:i,_loadImage:s}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{s.onload=async()=>{if(a<this._updateID){h();return}await e.onBeforeDraw(),i.src=s.src,s.onload=null,s.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);s.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:i,resolution:s}=this,{padding:n}=t,{baseTexture:o}=e;e.trim.width=e._frame.width=i.width/s,e.trim.height=e._frame.height=i.height/s,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),o.setRealSize(i.width,i.height,s),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var i,s,n,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Gn.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=e,(s=this._svgRoot)==null||s.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(o=this._foreignObject)==null||o.remove(),this._foreignObject=e,(a=this._styleElement)==null||a.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=yr(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=yr(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&(t=t||{},t instanceof rc?(this.ownsStyle=!1,this._style=t):t instanceof Er?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=rc.from(t)):(this.ownsStyle=!0,this._style=new rc(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},qa.defaultMaxWidth=2024,qa.defaultMaxHeight=2024,qa.defaultAutoResolution=!0;function GS(){const r=new Map;function t(o,a){const h=r.get(o);return h?h.add(a):r.set(o,new Set([a])),()=>i(o,a)}function e(o,a){const h=l=>{i(o,h),a(l)};t(o,h)}function i(o,a){var h;(h=r.get(o))==null||h.delete(a)}function s(o,a){var h;(h=r.get(o))==null||h.forEach(l=>l(a))}function n(){r.clear()}return{on:t,off:i,once:e,emit:s,clear:n}}const bt=GS();function Ze(r){let t;return new Promise(e=>{t=e,bt.on(r,t)}).then(e=>(bt.off(r,t),e))}let Ri=null;const kg=new ResizeObserver(()=>{Ri&&bt.emit("stageUpdated",Ri)});function NS(r){Ri=r,kg.observe(Ri),bt.emit("stageCreated",Ri)}function FS(){Ri&&kg.unobserve(Ri),Ri=null}async function sc(){return Ri||await Ze("stageCreated")}let Re=null;async function DS(){const r=await sc();OS(r),bt.on("stageUpdated",WS)}function kS(){Re&&(Re.destroy(!0,{children:!0}),Re=null)}function OS(r){Re=new Jm({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:window.devicePixelRatio}),Re.stage.sortableChildren=!0,r.appendChild(Re.view),bt.emit("applicationCreated",Re),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=Re)}async function Ve(){return Re||await Ze("applicationCreated")}function WS(r){Re&&(Re.resizeTo=r,bt.emit("applicationResized",Re))}var th={exports:{}};th.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=800,n=16,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",u="[object Boolean]",c="[object Date]",d="[object Error]",p="[object Function]",m="[object GeneratorFunction]",f="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Proxy]",v="[object RegExp]",S="[object Set]",E="[object String]",I="[object Undefined]",A="[object WeakMap]",P="[object ArrayBuffer]",O="[object DataView]",W="[object Float32Array]",L="[object Float64Array]",C="[object Int8Array]",N="[object Int16Array]",X="[object Int32Array]",K="[object Uint8Array]",Z="[object Uint8ClampedArray]",z="[object Uint16Array]",D="[object Uint32Array]",F=/[\\^$.*+?()[\]{}|]/g,G=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,$={};$[W]=$[L]=$[C]=$[N]=$[X]=$[K]=$[Z]=$[z]=$[D]=!0,$[a]=$[h]=$[P]=$[u]=$[O]=$[c]=$[d]=$[p]=$[f]=$[g]=$[_]=$[v]=$[S]=$[E]=$[A]=!1;var ut=typeof ei=="object"&&ei&&ei.Object===Object&&ei,nt=typeof self=="object"&&self&&self.Object===Object&&self,Ct=ut||nt||Function("return this")(),Rt=t&&!t.nodeType&&t,_t=Rt&&!0&&r&&!r.nodeType&&r,Y=_t&&_t.exports===Rt,tt=Y&&ut.process,et=function(){try{var x=_t&&_t.require&&_t.require("util").types;return x||tt&&tt.binding&&tt.binding("util")}catch{}}(),k=et&&et.isTypedArray;function xt(x,w,M){switch(M.length){case 0:return x.call(w);case 1:return x.call(w,M[0]);case 2:return x.call(w,M[0],M[1]);case 3:return x.call(w,M[0],M[1],M[2])}return x.apply(w,M)}function gt(x,w){for(var M=-1,U=Array(x);++M<x;)U[M]=w(M);return U}function Mt(x){return function(w){return x(w)}}function Ut(x,w){return x==null?void 0:x[w]}function De(x,w){return function(M){return x(w(M))}}var pi=Array.prototype,Md=Function.prototype,xn=Object.prototype,Mo=Ct["__core-js_shared__"],_n=Md.toString,fi=xn.hasOwnProperty,Wh=function(){var x=/[^.]+$/.exec(Mo&&Mo.keys&&Mo.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),Bh=xn.toString,Pd=_n.call(Object),vn=RegExp("^"+_n.call(fi).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Or=Y?Ct.Buffer:void 0,Po=Ct.Symbol,ke=Ct.Uint8Array,Lo=Or?Or.allocUnsafe:void 0,Go=De(Object.getPrototypeOf,Object),Uh=Object.create,Xh=xn.propertyIsEnumerable,Tn=pi.splice,ki=Po?Po.toStringTag:void 0,Es=function(){try{var x=Uo(Object,"defineProperty");return x({},"",{}),x}catch{}}(),Ld=Or?Or.isBuffer:void 0,Oi=Math.max,Zh=Date.now,Vh=Uo(Ct,"Map"),Cs=Uo(Object,"create"),No=function(){function x(){}return function(w){if(!Ui(w))return{};if(Uh)return Uh(w);x.prototype=w;var M=new x;return x.prototype=void 0,M}}();function Oe(x){var w=-1,M=x==null?0:x.length;for(this.clear();++w<M;){var U=x[w];this.set(U[0],U[1])}}function Fo(){this.__data__=Cs?Cs(null):{},this.size=0}function Do(x){var w=this.has(x)&&delete this.__data__[x];return this.size-=w?1:0,w}function ko(x){var w=this.__data__;if(Cs){var M=w[x];return M===i?void 0:M}return fi.call(w,x)?w[x]:void 0}function Is(x){var w=this.__data__;return Cs?w[x]!==void 0:fi.call(w,x)}function Gd(x,w){var M=this.__data__;return this.size+=this.has(x)?0:1,M[x]=Cs&&w===void 0?i:w,this}Oe.prototype.clear=Fo,Oe.prototype.delete=Do,Oe.prototype.get=ko,Oe.prototype.has=Is,Oe.prototype.set=Gd;function mi(x){var w=-1,M=x==null?0:x.length;for(this.clear();++w<M;){var U=x[w];this.set(U[0],U[1])}}function Nd(){this.__data__=[],this.size=0}function Fd(x){var w=this.__data__,M=wn(w,x);if(M<0)return!1;var U=w.length-1;return M==U?w.pop():Tn.call(w,M,1),--this.size,!0}function Dd(x){var w=this.__data__,M=wn(w,x);return M<0?void 0:w[M][1]}function Kh(x){return wn(this.__data__,x)>-1}function Oo(x,w){var M=this.__data__,U=wn(M,x);return U<0?(++this.size,M.push([x,w])):M[U][1]=w,this}mi.prototype.clear=Nd,mi.prototype.delete=Fd,mi.prototype.get=Dd,mi.prototype.has=Kh,mi.prototype.set=Oo;function Ie(x){var w=-1,M=x==null?0:x.length;for(this.clear();++w<M;){var U=x[w];this.set(U[0],U[1])}}function kd(){this.size=0,this.__data__={hash:new Oe,map:new(Vh||mi),string:new Oe}}function Od(x){var w=En(this,x).delete(x);return this.size-=w?1:0,w}function Wd(x){return En(this,x).get(x)}function Bd(x){return En(this,x).has(x)}function Ud(x,w){var M=En(this,x),U=M.size;return M.set(x,w),this.size+=M.size==U?0:1,this}Ie.prototype.clear=kd,Ie.prototype.delete=Od,Ie.prototype.get=Wd,Ie.prototype.has=Bd,Ie.prototype.set=Ud;function fe(x){var w=this.__data__=new mi(x);this.size=w.size}function Xd(){this.__data__=new mi,this.size=0}function Zd(x){var w=this.__data__,M=w.delete(x);return this.size=w.size,M}function Vd(x){return this.__data__.get(x)}function Kd(x){return this.__data__.has(x)}function Hd(x,w){var M=this.__data__;if(M instanceof mi){var U=M.__data__;if(!Vh||U.length<e-1)return U.push([x,w]),this.size=++M.size,this;M=this.__data__=new Ie(U)}return M.set(x,w),this.size=M.size,this}fe.prototype.clear=Xd,fe.prototype.delete=Zd,fe.prototype.get=Vd,fe.prototype.has=Kd,fe.prototype.set=Hd;function ur(x,w){var M=An(x),U=!M&&gi(x),ht=!M&&!U&&qh(x),ft=!M&&!U&&!ht&&Br(x),yt=M||U||ht||ft,ot=yt?gt(x.length,String):[],vt=ot.length;for(var Ft in x)(w||fi.call(x,Ft))&&!(yt&&(Ft=="length"||ht&&(Ft=="offset"||Ft=="parent")||ft&&(Ft=="buffer"||Ft=="byteLength"||Ft=="byteOffset")||$h(Ft,vt)))&&ot.push(Ft);return ot}function Wo(x,w,M){(M!==void 0&&!In(x[w],M)||M===void 0&&!(w in x))&&Bo(x,w,M)}function Yd(x,w,M){var U=x[w];(!(fi.call(x,w)&&In(U,M))||M===void 0&&!(w in x))&&Bo(x,w,M)}function wn(x,w){for(var M=x.length;M--;)if(In(x[M][0],w))return M;return-1}function Bo(x,w,M){w=="__proto__"&&Es?Es(x,w,{configurable:!0,enumerable:!0,value:M,writable:!0}):x[w]=M}var zd=ip();function cr(x){return x==null?x===void 0?I:y:ki&&ki in Object(x)?rp(x):op(x)}function Hh(x){return Wr(x)&&cr(x)==a}function jd(x){if(!Ui(x)||Cn(x))return!1;var w=Rs(x)?vn:G;return w.test(lp(x))}function Wi(x){return Wr(x)&&tl(x.length)&&!!$[cr(x)]}function Jd(x){if(!Ui(x))return np(x);var w=dr(x),M=[];for(var U in x)U=="constructor"&&(w||!fi.call(x,U))||M.push(U);return M}function Yh(x,w,M,U,ht){x!==w&&zd(w,function(ft,yt){if(ht||(ht=new fe),Ui(ft))$d(x,w,yt,M,Yh,U,ht);else{var ot=U?U(Xo(x,yt),ft,yt+"",x,w,ht):void 0;ot===void 0&&(ot=ft),Wo(x,yt,ot)}},rl)}function $d(x,w,M,U,ht,ft,yt){var ot=Xo(x,M),vt=Xo(w,M),Ft=yt.get(vt);if(Ft){Wo(x,M,Ft);return}var At=ft?ft(ot,vt,M+"",x,w,yt):void 0,oe=At===void 0;if(oe){var me=An(vt),qe=!me&&qh(vt),ti=!me&&!qe&&Br(vt);At=vt,me||qe||ti?An(ot)?At=ot:Rn(ot)?At=As(ot):qe?(oe=!1,At=tp(vt,!0)):ti?(oe=!1,At=ep(vt,!0)):At=[]:el(vt)||gi(vt)?(At=ot,gi(ot)?At=il(ot):(!Ui(ot)||Rs(ot))&&(At=Jh(vt))):oe=!1}oe&&(yt.set(vt,At),ht(At,vt,U,ft,yt),yt.delete(vt)),Wo(x,M,At)}function Qd(x,w){return ap(Bi(x,w,T),x+"")}var qd=Es?function(x,w){return Es(x,"toString",{configurable:!0,enumerable:!1,value:cp(w),writable:!0})}:T;function tp(x,w){if(w)return x.slice();var M=x.length,U=Lo?Lo(M):new x.constructor(M);return x.copy(U),U}function Sn(x){var w=new x.constructor(x.byteLength);return new ke(w).set(new ke(x)),w}function ep(x,w){var M=w?Sn(x.buffer):x.buffer;return new x.constructor(M,x.byteOffset,x.length)}function As(x,w){var M=-1,U=x.length;for(w||(w=Array(U));++M<U;)w[M]=x[M];return w}function zh(x,w,M,U){var ht=!M;M||(M={});for(var ft=-1,yt=w.length;++ft<yt;){var ot=w[ft],vt=U?U(M[ot],x[ot],ot,M,x):void 0;vt===void 0&&(vt=x[ot]),ht?Bo(M,ot,vt):Yd(M,ot,vt)}return M}function jh(x){return Qd(function(w,M){var U=-1,ht=M.length,ft=ht>1?M[ht-1]:void 0,yt=ht>2?M[2]:void 0;for(ft=x.length>3&&typeof ft=="function"?(ht--,ft):void 0,yt&&sp(M[0],M[1],yt)&&(ft=ht<3?void 0:ft,ht=1),w=Object(w);++U<ht;){var ot=M[U];ot&&x(w,ot,U,ft)}return w})}function ip(x){return function(w,M,U){for(var ht=-1,ft=Object(w),yt=U(w),ot=yt.length;ot--;){var vt=yt[x?ot:++ht];if(M(ft[vt],vt,ft)===!1)break}return w}}function En(x,w){var M=x.__data__;return Qh(w)?M[typeof w=="string"?"string":"hash"]:M.map}function Uo(x,w){var M=Ut(x,w);return jd(M)?M:void 0}function rp(x){var w=fi.call(x,ki),M=x[ki];try{x[ki]=void 0;var U=!0}catch{}var ht=Bh.call(x);return U&&(w?x[ki]=M:delete x[ki]),ht}function Jh(x){return typeof x.constructor=="function"&&!dr(x)?No(Go(x)):{}}function $h(x,w){var M=typeof x;return w=w??o,!!w&&(M=="number"||M!="symbol"&&V.test(x))&&x>-1&&x%1==0&&x<w}function sp(x,w,M){if(!Ui(M))return!1;var U=typeof w;return(U=="number"?Zo(M)&&$h(w,M.length):U=="string"&&w in M)?In(M[w],x):!1}function Qh(x){var w=typeof x;return w=="string"||w=="number"||w=="symbol"||w=="boolean"?x!=="__proto__":x===null}function Cn(x){return!!Wh&&Wh in x}function dr(x){var w=x&&x.constructor,M=typeof w=="function"&&w.prototype||xn;return x===M}function np(x){var w=[];if(x!=null)for(var M in Object(x))w.push(M);return w}function op(x){return Bh.call(x)}function Bi(x,w,M){return w=Oi(w===void 0?x.length-1:w,0),function(){for(var U=arguments,ht=-1,ft=Oi(U.length-w,0),yt=Array(ft);++ht<ft;)yt[ht]=U[w+ht];ht=-1;for(var ot=Array(w+1);++ht<w;)ot[ht]=U[ht];return ot[w]=M(yt),xt(x,this,ot)}}function Xo(x,w){if(!(w==="constructor"&&typeof x[w]=="function")&&w!="__proto__")return x[w]}var ap=hp(qd);function hp(x){var w=0,M=0;return function(){var U=Zh(),ht=n-(U-M);if(M=U,ht>0){if(++w>=s)return arguments[0]}else w=0;return x.apply(void 0,arguments)}}function lp(x){if(x!=null){try{return _n.call(x)}catch{}try{return x+""}catch{}}return""}function In(x,w){return x===w||x!==x&&w!==w}var gi=Hh(function(){return arguments}())?Hh:function(x){return Wr(x)&&fi.call(x,"callee")&&!Xh.call(x,"callee")},An=Array.isArray;function Zo(x){return x!=null&&tl(x.length)&&!Rs(x)}function Rn(x){return Wr(x)&&Zo(x)}var qh=Ld||R;function Rs(x){if(!Ui(x))return!1;var w=cr(x);return w==p||w==m||w==l||w==b}function tl(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=o}function Ui(x){var w=typeof x;return x!=null&&(w=="object"||w=="function")}function Wr(x){return x!=null&&typeof x=="object"}function el(x){if(!Wr(x)||cr(x)!=_)return!1;var w=Go(x);if(w===null)return!0;var M=fi.call(w,"constructor")&&w.constructor;return typeof M=="function"&&M instanceof M&&_n.call(M)==Pd}var Br=k?Mt(k):Wi;function il(x){return zh(x,rl(x))}function rl(x){return Zo(x)?ur(x,!0):Jd(x)}var up=jh(function(x,w,M){Yh(x,w,M)});function cp(x){return function(){return x}}function T(x){return x}function R(){return!1}r.exports=up}(th,th.exports);var BS=th.exports;const US=Fn(BS);let os=null;function XS(){os=j.effectScope()}function ZS(){os==null||os.stop(),os=null}async function VS(){return os||await Ze("scopeCreated")}let Ir=null;const Og={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,styles:{colorMode:"dark",rowGap:16,columnGap:32,textDefault:"#ffffff",textInverse:"#000000",nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBgColor:"#35363C",nodeToggleBorderRadius:6,nodeToggleBorderColor:"#51525C",nodeSelectedBorderColor:"#3fa2c3",nodeUnselectedAlpha:.2,edgeColor:"#51525C",guideLineWidth:1,guideLineColor:"#51525C",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:"#ADADAD",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"})}};function KS(r){const t=US({},Og,r);return t.styles.node=e=>{var i,s;return{...Og.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function HS(r){(await VS()).run(()=>{j.watch(()=>r.config,e=>{const i=KS(e);if(!Ir){Ir=i,bt.emit("configCreated",Ir);return}Object.assign(Ir,i),bt.emit("configUpdated",Ir)},{immediate:!0})})}function YS(){Ir=null}async function be(){return Ir||await Ze("configCreated")}async function Wg(r,t){const e=await be();let i,s=null;async function n(){try{s=await e.fetch(r),t(s)}catch(a){console.error(a)}s&&!s.end_time&&(i=setTimeout(()=>n(),zS(s)))}function o(){clearInterval(i)}return{start:n,stop:o}}function zS(r){const t=Math.floor(r.nodes.size/jo)*jo;return Math.max(jo,t)}function er(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Bg(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
1160
+ * GSAP 3.12.3
1161
+ * https://gsap.com
1162
1162
  *
1163
1163
  * @license Copyright 2008-2023, GreenSock. All rights reserved.
1164
- * Subject to the terms at https://greensock.com/standard-license or for
1165
- * Club GreenSock members, the agreement issued with that membership.
1164
+ * Subject to the terms at https://gsap.com/standard-license or for
1165
+ * Club GSAP members, the agreement issued with that membership.
1166
1166
  * @author: Jack Doyle, jack@greensock.com
1167
- */var Re={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},$s={duration:.5,overwrite:!1,delay:0},nc,ce,Zt,Ze=1e8,Pt=1/Ze,oc=Math.PI*2,jS=oc/4,JS=0,Ug=Math.sqrt,$S=Math.cos,QS=Math.sin,re=function(t){return typeof t=="string"},Vt=function(t){return typeof t=="function"},ir=function(t){return typeof t=="number"},ac=function(t){return typeof t>"u"},Mi=function(t){return typeof t=="object"},_e=function(t){return t!==!1},hc=function(){return typeof window<"u"},th=function(t){return Vt(t)||re(t)},Xg=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},de=Array.isArray,lc=/(?:-?\.?\d|\.)+/gi,Zg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Qs=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,uc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Vg=/[+-]=-?[.\d]+/,Kg=/[^,'"\[\]\s]+/gi,qS=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Wt,Ve,cc,dc,Me={},eh={},Hg,Yg=function(t){return(eh=hs(t,Me))&&Se},pc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},ih=function(t,e){return!e&&console.warn(t)},zg=function(t,e){return t&&(Me[t]=e)&&eh&&(eh[t]=e)||Me},eo=function(){return 0},tE={suppressEvents:!0,isStart:!0,kill:!1},rh={suppressEvents:!0,kill:!1},eE={suppressEvents:!0},fc={},Ar=[],mc={},jg,Pe={},gc={},Jg=30,sh=[],yc="",bc=function(t){var e=t[0],i,s;if(Mi(e)||Vt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=sh.length;s--&&!sh[s].targetTest(e););i=sh[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new E0(t[s],i)))||t.splice(s,1);return t},as=function(t){return t._gsap||bc(Ye(t))[0]._gsap},$g=function(t,e,i){return(i=t[e])&&Vt(i)?t[e]():ac(i)&&t.getAttribute&&t.getAttribute(e)||i},ve=function(t,e){return(t=t.split(",")).forEach(e)||t},Ht=function(t){return Math.round(t*1e5)/1e5||0},he=function(t){return Math.round(t*1e7)/1e7||0},qs=function(t,e){var i=e.charAt(0),s=parseFloat(e.substr(2));return t=parseFloat(t),i==="+"?t+s:i==="-"?t-s:i==="*"?t*s:t/s},iE=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},nh=function(){var t=Ar.length,e=Ar.slice(0),i,s;for(mc={},Ar.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},Qg=function(t,e,i,s){Ar.length&&!ce&&nh(),t.render(e,i,s||ce&&e<0&&(t._initted||t._startAt)),Ar.length&&!ce&&nh()},qg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(Kg).length<2?e:re(t)?t.trim():t},t0=function(t){return t},Ke=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},rE=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},hs=function(t,e){for(var i in e)t[i]=e[i];return t},e0=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Mi(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},oh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},io=function(t){var e=t.parent||Wt,i=t.keyframes?rE(de(t.keyframes)):Ke;if(_e(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},sE=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},i0=function(t,e,i,s,n){i===void 0&&(i="_first"),s===void 0&&(s="_last");var o=t[s],a;if(n)for(a=e[n];o&&o[n]>a;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[s]=e,e._prev=o,e.parent=e._dp=t,e},ah=function(t,e,i,s){i===void 0&&(i="_first"),s===void 0&&(s="_last");var n=e._prev,o=e._next;n?n._next=o:t[i]===e&&(t[i]=o),o?o._prev=n:t[s]===e&&(t[s]=n),e._next=e._prev=e.parent=null},Rr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},ls=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},nE=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},xc=function(t,e,i,s){return t._startAt&&(ce?t._startAt.revert(rh):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},oE=function r(t){return!t||t._ts&&r(t.parent)},r0=function(t){return t._repeat?tn(t._tTime,t=t.duration()+t._rDelay)*t:0},tn=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},hh=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},lh=function(t){return t._end=he(t._start+(t._tDur/Math.abs(t._ts||t._rts||Pt)||0))},uh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=he(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),lh(t),i._dirty||ls(i,t)),t},s0=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=hh(t.rawTime(),e),(!e._dur||so(0,e.totalDuration(),i)-e._tTime>Pt)&&e.render(i,!0)),ls(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-Pt}},Pi=function(t,e,i,s){return e.parent&&Rr(e),e._start=he((ir(i)?i:i||t!==Wt?He(t,i,e):t._time)+e._delay),e._end=he(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),i0(t,e,"_first","_last",t._sort?"_start":0),_c(e)||(t._recent=e),s||s0(t,e),t._ts<0&&uh(t,t._tTime),t},n0=function(t,e){return(Me.ScrollTrigger||pc("scrollTrigger",e))&&Me.ScrollTrigger.create(e,t)},o0=function(t,e,i,s,n){if(Rc(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ce&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&jg!==Le.frame)return Ar.push(t),t._lazy=[n,s],1},aE=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},_c=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},hE=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&aE(t)&&!(!t._initted&&_c(t))||(t._ts<0||t._dp._ts<0)&&!_c(t))?0:1,a=t._rDelay,h=0,l,u,c;if(a&&t._repeat&&(h=so(0,t._tDur,e),u=tn(h,a),t._yoyo&&u&1&&(o=1-o),u!==tn(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ce||s||t._zTime===Pt||!e&&t._zTime){if(!t._initted&&o0(t,e,s,i,h))return;for(c=t._zTime,t._zTime=e||(i?Pt:0),i||(i=e&&!c),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=h,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&xc(t,e,i,!0),t._onUpdate&&!i&&ze(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&ze(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Rr(t,1),!i&&!ce&&(ze(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},lE=function(t,e,i){var s;if(i>e)for(s=t._first;s&&s._start<=i;){if(s.data==="isPause"&&s._start>e)return s;s=s._next}else for(s=t._last;s&&s._start>=i;){if(s.data==="isPause"&&s._start<e)return s;s=s._prev}},en=function(t,e,i,s){var n=t._repeat,o=he(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:he(o*(n+1)+t._rDelay*n):o,a>0&&!s&&uh(t,t._tTime=t._tDur*a),t.parent&&lh(t),i||ls(t.parent,t),t},a0=function(t){return t instanceof Te?ls(t):en(t,t._dur)},uE={_start:0,endTime:eo,totalDuration:eo},He=function r(t,e,i){var s=t.labels,n=t._recent||uE,o=t.duration()>=Ze?n.endTime(!1):t._dur,a,h,l;return re(e)&&(isNaN(e)||e in s)?(h=e.charAt(0),l=e.substr(-1)==="%",a=e.indexOf("="),h==="<"||h===">"?(a>=0&&(e=e.replace(/=/,"")),(h==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(a<0?n:i).totalDuration()/100:1)):a<0?(e in s||(s[e]=o),s[e]):(h=parseFloat(e.charAt(a-1)+e.substr(a+1)),l&&i&&(h=h/100*(de(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},ro=function(t,e,i){var s=ir(e[1]),n=(s?2:1)+(t<2?0:1),o=e[n],a,h;if(s&&(o.duration=e[1]),o.parent=i,t){for(a=o,h=i;h&&!("immediateRender"in a);)a=h.vars.defaults||{},h=_e(h.vars.inherit)&&h.parent;o.immediateRender=_e(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new zt(e[0],o,e[n+1])},Mr=function(t,e){return t||t===0?e(t):e},so=function(t,e,i){return i<t?t:i>e?e:i},pe=function(t,e){return!re(t)||!(e=qS.exec(t))?"":e[1]},cE=function(t,e,i){return Mr(i,function(s){return so(t,e,s)})},vc=[].slice,h0=function(t,e){return t&&Mi(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Mi(t[0]))&&!t.nodeType&&t!==Ve},dE=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return re(s)&&!e||h0(s,1)?(n=i).push.apply(n,Ye(s)):i.push(s)})||i},Ye=function(t,e,i){return Zt&&!e&&Zt.selector?Zt.selector(t):re(t)&&!i&&(cc||!sn())?vc.call((e||dc).querySelectorAll(t),0):de(t)?dE(t,i):h0(t)?vc.call(t,0):t?[t]:[]},Tc=function(t){return t=Ye(t)[0]||ih("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Ye(e,i.querySelectorAll?i:i===t?ih("Invalid scope")||dc.createElement("div"):t)}},l0=function(t){return t.sort(function(){return .5-Math.random()})},u0=function(t){if(Vt(t))return t;var e=Mi(t)?t:{each:t},i=us(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,u=s,c=s;return re(s)?u=c={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(u=s[0],c=s[1]),function(d,p,m){var f=(m||e).length,g=o[f],y,_,b,v,S,E,A,I,P;if(!g){if(P=e.grid==="auto"?0:(e.grid||[1,Ze])[1],!P){for(A=-Ze;A<(A=m[P++].getBoundingClientRect().left)&&P<f;);P--}for(g=o[f]=[],y=h?Math.min(P,f)*u-.5:s%P,_=P===Ze?0:h?f*c/P-.5:s/P|0,A=0,I=Ze,E=0;E<f;E++)b=E%P-y,v=_-(E/P|0),g[E]=S=l?Math.abs(l==="y"?v:b):Ug(b*b+v*v),S>A&&(A=S),S<I&&(I=S);s==="random"&&l0(g),g.max=A-I,g.min=I,g.v=f=(parseFloat(e.amount)||parseFloat(e.each)*(P>f?f-1:l?l==="y"?f/P:P:Math.max(P,f/P))||0)*(s==="edges"?-1:1),g.b=f<0?n-f:n,g.u=pe(e.amount||e.each)||0,i=i&&f<0?T0(i):i}return f=(g[d]-g.min)/g.max||0,he(g.b+(i?i(f):f)*g.v)+g.u}},wc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=he(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(ir(i)?0:pe(i))}},c0=function(t,e){var i=de(t),s,n;return!i&&Mi(t)&&(s=i=t.radius||Ze,t.values?(t=Ye(t.values),(n=!ir(t[0]))&&(s*=s)):t=wc(t.increment)),Mr(e,i?Vt(t)?function(o){return n=t(o),Math.abs(n-o)<=s?n:o}:function(o){for(var a=parseFloat(n?o.x:o),h=parseFloat(n?o.y:0),l=Ze,u=0,c=t.length,d,p;c--;)n?(d=t[c].x-a,p=t[c].y-h,d=d*d+p*p):d=Math.abs(t[c]-a),d<l&&(l=d,u=c);return u=!s||l<=s?t[u]:o,n||u===o||ir(o)?u:u+pe(o)}:wc(t))},d0=function(t,e,i,s){return Mr(de(t)?!e:i===!0?!!(i=0):!s,function(){return de(t)?t[~~(Math.random()*t.length)]:(i=i||1e-5)&&(s=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((t-i/2+Math.random()*(e-t+i*.99))/i)*i*s)/s})},pE=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(s){return e.reduce(function(n,o){return o(n)},s)}},fE=function(t,e){return function(i){return t(parseFloat(i))+(e||pe(i))}},mE=function(t,e,i){return f0(t,e,0,1,i)},p0=function(t,e,i){return Mr(i,function(s){return t[~~e(s)]})},gE=function r(t,e,i){var s=e-t;return de(t)?p0(t,r(0,t.length),e):Mr(i,function(n){return(s+(n-t)%s)%s+t})},yE=function r(t,e,i){var s=e-t,n=s*2;return de(t)?p0(t,r(0,t.length-1),e):Mr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},no=function(t){for(var e=0,i="",s,n,o,a;~(s=t.indexOf("random(",e));)o=t.indexOf(")",s),a=t.charAt(s+7)==="[",n=t.substr(s+7,o-s-7).match(a?Kg:lc),i+=t.substr(e,s-e)+d0(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},f0=function(t,e,i,s,n){var o=e-t,a=s-i;return Mr(n,function(h){return i+((h-t)/o*a||0)})},bE=function r(t,e,i,s){var n=isNaN(t+e)?0:function(p){return(1-p)*t+p*e};if(!n){var o=re(t),a={},h,l,u,c,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(de(t)&&!de(e)){for(u=[],c=t.length,d=c-2,l=1;l<c;l++)u.push(r(t[l-1],t[l]));c--,n=function(m){m*=c;var f=Math.min(d,~~m);return u[f](m-f)},i=e}else s||(t=hs(de(t)?[]:{},t));if(!u){for(h in e)Ic.call(a,t,h,"get",e[h]);n=function(m){return Lc(m,a)||(o?t.p:t)}}}return Mr(i,n)},m0=function(t,e,i){var s=t.labels,n=Ze,o,a,h;for(o in s)a=s[o]-e,a<0==!!i&&a&&n>(a=Math.abs(a))&&(h=o,n=a);return h},ze=function(t,e,i){var s=t.vars,n=s[e],o=Zt,a=t._ctx,h,l,u;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Ar.length&&nh(),a&&(Zt=a),u=h?n.apply(l,h):n.call(l),Zt=o,u},oo=function(t){return Rr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ce),t.progress()<1&&ze(t,"onInterrupt"),t},rn,g0=[],y0=function(t){if(hc()&&t){t=!t.name&&t.default||t;var e=t.name,i=Vt(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:eo,render:Lc,add:Ic,kill:NE,modifier:GE,rawVars:0},o={targetTest:0,get:0,getSetter:Pc,aliases:{},register:0};if(sn(),t!==s){if(Pe[e])return;Ke(s,Ke(oh(t,n),o)),hs(s.prototype,hs(n,oh(t,o))),Pe[s.prop=e]=s,t.targetTest&&(sh.push(s),fc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}zg(e,s),t.register&&t.register(Se,s,we)}else t&&g0.push(t)},Lt=255,ao={aqua:[0,Lt,Lt],lime:[0,Lt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Lt],navy:[0,0,128],white:[Lt,Lt,Lt],olive:[128,128,0],yellow:[Lt,Lt,0],orange:[Lt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Lt,0,0],pink:[Lt,192,203],cyan:[0,Lt,Lt],transparent:[Lt,Lt,Lt,0]},Sc=function(t,e,i){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(i-e)*t*6:t<.5?i:t*3<2?e+(i-e)*(2/3-t)*6:e)*Lt+.5|0},b0=function(t,e,i){var s=t?ir(t)?[t>>16,t>>8&Lt,t&Lt]:0:ao.black,n,o,a,h,l,u,c,d,p,m;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),ao[t])s=ao[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+n+n+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return s=parseInt(t.substr(1,6),16),[s>>16,s>>8&Lt,s&Lt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Lt,t&Lt]}else if(t.substr(0,3)==="hsl"){if(s=m=t.match(lc),!e)h=+s[0]%360/360,l=+s[1]/100,u=+s[2]/100,o=u<=.5?u*(l+1):u+l-u*l,n=u*2-o,s.length>3&&(s[3]*=1),s[0]=Sc(h+1/3,n,o),s[1]=Sc(h,n,o),s[2]=Sc(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(Zg),i&&s.length<4&&(s[3]=1),s}else s=t.match(lc)||ao.transparent;s=s.map(Number)}return e&&!m&&(n=s[0]/Lt,o=s[1]/Lt,a=s[2]/Lt,c=Math.max(n,o,a),d=Math.min(n,o,a),u=(c+d)/2,c===d?h=l=0:(p=c-d,l=u>.5?p/(2-c-d):p/(c+d),h=c===n?(o-a)/p+(o<a?6:0):c===o?(a-n)/p+2:(n-o)/p+4,h*=60),s[0]=~~(h+.5),s[1]=~~(l*100+.5),s[2]=~~(u*100+.5)),i&&s.length<4&&(s[3]=1),s},x0=function(t){var e=[],i=[],s=-1;return t.split(Pr).forEach(function(n){var o=n.match(Qs)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},_0=function(t,e,i){var s="",n=(t+s).match(Pr),o=e?"hsla(":"rgba(",a=0,h,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=b0(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(u=x0(t),h=i.c,h.join(s)!==u.c.join(s)))for(l=t.replace(Pr,"1").split(Qs),c=l.length-1;a<c;a++)s+=l[a]+(~h.indexOf(a)?n.shift()||o+"0,0,0,0)":(u.length?u:n.length?n:i).shift());if(!l)for(l=t.split(Pr),c=l.length-1;a<c;a++)s+=l[a]+n[a];return s+l[c]},Pr=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in ao)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),xE=/hsl[a]?\(/,v0=function(t){var e=t.join(" "),i;if(Pr.lastIndex=0,Pr.test(e))return i=xE.test(e),t[1]=_0(t[1],i),t[0]=_0(t[0],i,x0(t[1])),!0},ho,Le=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,o=n,a=[],h,l,u,c,d,p,m=function f(g){var y=r()-s,_=g===!0,b,v,S,E;if(y>t&&(i+=y-e),s+=y,S=s-i,b=S-o,(b>0||_)&&(E=++c.frame,d=S-c.time*1e3,c.time=S=S/1e3,o+=b+(b>=n?4:n-b),v=1),_||(h=l(f)),v)for(p=0;p<a.length;p++)a[p](S,d,E,g)};return c={time:0,frame:0,tick:function(){m(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){Hg&&(!cc&&hc()&&(Ve=cc=window,dc=Ve.document||{},Me.gsap=Se,(Ve.gsapVersions||(Ve.gsapVersions=[])).push(Se.version),Yg(eh||Ve.GreenSockGlobals||!Ve.gsap&&Ve||{}),u=Ve.requestAnimationFrame,g0.forEach(y0)),h&&c.sleep(),l=u||function(g){return setTimeout(g,o-c.time*1e3+1|0)},ho=1,m(2))},sleep:function(){(u?Ve.cancelAnimationFrame:clearTimeout)(h),ho=0,l=eo},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=c.time*1e3+n},add:function(g,y,_){var b=y?function(v,S,E,A){g(v,S,E,A),c.remove(b)}:g;return c.remove(g),a[_?"unshift":"push"](b),sn(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&p>=y&&p--},_listeners:a},c}(),sn=function(){return!ho&&Le.wake()},St={},_E=/^[\d.\-M][\d.\-,\s]/,vE=/["']/g,TE=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),s=i[0],n=1,o=i.length,a,h,l;n<o;n++)h=i[n],a=n!==o-1?h.lastIndexOf(","):h.length,l=h.substr(0,a),e[s]=isNaN(l)?l.replace(vE,"").trim():+l,s=h.substr(a+1).trim();return e},wE=function(t){var e=t.indexOf("(")+1,i=t.indexOf(")"),s=t.indexOf("(",e);return t.substring(e,~s&&s<i?t.indexOf(")",i+1):i)},SE=function(t){var e=(t+"").split("("),i=St[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[TE(e[1])]:wE(t).split(",").map(qg)):St._CE&&_E.test(t)?St._CE("",t):i},T0=function(t){return function(e){return 1-t(1-e)}},w0=function r(t,e){for(var i=t._first,s;i;)i instanceof Te?r(i,e):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==e&&(i.timeline?r(i.timeline,e):(s=i._ease,i._ease=i._yEase,i._yEase=s,i._yoyo=e)),i=i._next},us=function(t,e){return t&&(Vt(t)?t:St[t]||SE(t))||e},cs=function(t,e,i,s){i===void 0&&(i=function(h){return 1-e(1-h)}),s===void 0&&(s=function(h){return h<.5?e(h*2)/2:1-e((1-h)*2)/2});var n={easeIn:e,easeOut:i,easeInOut:s},o;return ve(t,function(a){St[a]=Me[a]=n,St[o=a.toLowerCase()]=i;for(var h in n)St[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=St[a+"."+h]=n[h]}),n},S0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Ec=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/oc*(Math.asin(1/s)||0),a=function(u){return u===1?1:s*Math.pow(2,-10*u)*QS((u-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:S0(a);return n=oc/n,h.config=function(l,u){return r(t,l,u)},h},Cc=function r(t,e){e===void 0&&(e=1.70158);var i=function(o){return o?--o*o*((e+1)*o+e)+1:0},s=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:S0(i);return s.config=function(n){return r(t,n)},s};ve("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;cs(r+",Power"+(e-1),t?function(i){return Math.pow(i,e)}:function(i){return i},function(i){return 1-Math.pow(1-i,e)},function(i){return i<.5?Math.pow(i*2,e)/2:1-Math.pow((1-i)*2,e)/2})}),St.Linear.easeNone=St.none=St.Linear.easeIn,cs("Elastic",Ec("in"),Ec("out"),Ec()),function(r,t){var e=1/t,i=2*e,s=2.5*e,n=function(a){return a<e?r*a*a:a<i?r*Math.pow(a-1.5/t,2)+.75:a<s?r*(a-=2.25/t)*a+.9375:r*Math.pow(a-2.625/t,2)+.984375};cs("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),cs("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),cs("Circ",function(r){return-(Ug(1-r*r)-1)}),cs("Sine",function(r){return r===1?1:-$S(r*jS)+1}),cs("Back",Cc("in"),Cc("out"),Cc()),St.SteppedEase=St.steps=Me.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,s=t+(e?0:1),n=e?1:0,o=1-Pt;return function(a){return((s*so(0,o,a)|0)+n)*i}}},$s.ease=St["quad.out"],ve("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return yc+=r+","+r+"Params,"});var E0=function(t,e){this.id=JS++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:$g,this.set=e?e.getSetter:Pc},lo=function(){function r(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,en(this,+e.duration,1,1),this.data=e.data,Zt&&(this._ctx=Zt,Zt.data.push(this)),ho||Le.wake()}var t=r.prototype;return t.delay=function(i){return i||i===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+i-this._delay),this._delay=i,this):this._delay},t.duration=function(i){return arguments.length?this.totalDuration(this._repeat>0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},t.totalDuration=function(i){return arguments.length?(this._dirty=0,en(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(sn(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(uh(this,i),!n._dp||n.parent||s0(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&Pi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Pt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),Qg(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+r0(this))%(this._dur+this._rDelay)||(i?this._dur:0),s):this._time},t.totalProgress=function(i,s){return arguments.length?this.totalTime(this.totalDuration()*i,s):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},t.progress=function(i,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+r0(this),s):this.duration()?Math.min(1,this._time/this._dur):this.ratio},t.iteration=function(i,s){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,s):this._repeat?tn(this._tTime,n)+1:1},t.timeScale=function(i){if(!arguments.length)return this._rts===-Pt?0:this._rts;if(this._rts===i)return this;var s=this.parent&&this._ts?hh(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Pt?0:this._rts,this.totalTime(so(-Math.abs(this._delay),this._tDur,s),!0),lh(this),nE(this)},t.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(sn(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Pt&&(this._tTime-=Pt)))),this):this._ps},t.startTime=function(i){if(arguments.length){this._start=i;var s=this.parent||this._dp;return s&&(s._sort||!this.parent)&&Pi(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(_e(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(i){var s=this.parent||this._dp;return s?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?hh(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=eE);var s=ce;return ce=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ce=s,this},t.globalTime=function(i){for(var s=this,n=arguments.length?i:s.rawTime();s;)n=s._start+n/(s._ts||1),s=s._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1/0:this._sat.globalTime(i):n},t.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,a0(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,a0(this),s?this.time(s):this}return this._rDelay},t.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},t.seek=function(i,s){return this.totalTime(He(this,i),_e(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,_e(s))},t.play=function(i,s){return i!=null&&this.seek(i,s),this.reversed(!1).paused(!1)},t.reverse=function(i,s){return i!=null&&this.seek(i||this.totalDuration(),s),this.reversed(!0).paused(!1)},t.pause=function(i,s){return i!=null&&this.seek(i,s),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-Pt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Pt,this},t.isActive=function(){var i=this.parent||this._dp,s=this._start,n;return!!(!i||this._ts&&this._initted&&i.isActive()&&(n=i.rawTime(!0))>=s&&n<this.endTime(!0)-Pt)},t.eventCallback=function(i,s,n){var o=this.vars;return arguments.length>1?(s?(o[i]=s,n&&(o[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=s)):delete o[i],this):o[i]},t.then=function(i){var s=this;return new Promise(function(n){var o=Vt(i)?i:t0,a=function(){var l=s.then;s.then=null,Vt(o)&&(o=o(s))&&(o.then||o===s)&&(s.then=l),n(o),s.then=l};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?a():s._prom=a})},t.kill=function(){oo(this)},r}();Ke(lo.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Pt,_prom:0,_ps:!1,_rts:1});var Te=function(r){Bg(t,r);function t(i,s){var n;return i===void 0&&(i={}),n=r.call(this,i)||this,n.labels={},n.smoothChildTiming=!!i.smoothChildTiming,n.autoRemoveChildren=!!i.autoRemoveChildren,n._sort=_e(i.sortChildren),Wt&&Pi(i.parent||Wt,er(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&n0(er(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return ro(0,arguments,this),this},e.from=function(s,n,o){return ro(1,arguments,this),this},e.fromTo=function(s,n,o,a){return ro(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,io(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new zt(s,n,He(this,o),1),this},e.call=function(s,n,o){return Pi(this,zt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,u){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=u,o.parent=this,new zt(s,o,He(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,u){return o.runBackwards=1,io(o).immediateRender=_e(o.immediateRender),this.staggerTo(s,n,o,a,h,l,u)},e.staggerFromTo=function(s,n,o,a,h,l,u,c){return a.startAt=o,io(a).immediateRender=_e(a.immediateRender),this.staggerTo(s,n,a,h,l,u,c)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=s<=0?0:he(s),c=this._zTime<0!=s<0&&(this._initted||!l),d,p,m,f,g,y,_,b,v,S,E,A;if(this!==Wt&&u>h&&s>=0&&(u=h),u!==this._tTime||o||c){if(a!==this._time&&l&&(u+=this._time-a,s+=this._time-a),d=u,v=this._start,b=this._ts,y=!b,c&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(E=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=he(u%g),u===h?(f=this._repeat,d=l):(f=~~(u/g),f&&f===u/g&&(d=l,f--),d>l&&(d=l)),S=tn(this._tTime,g),!a&&this._tTime&&S!==f&&this._tTime-S*g-this._dur<=0&&(S=f),E&&f&1&&(d=l-d,A=1),f!==S&&!this._lock){var I=E&&S&1,P=I===(E&&f&1);if(f<S&&(I=!I),a=I?0:u%l?l:u,this._lock=1,this.render(a||(A?0:he(f*g)),n,!l)._lock=0,this._tTime=u,!n&&this.parent&&ze(this,"onRepeat"),this.vars.repeatRefresh&&!A&&(this.invalidate()._lock=1),a&&a!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,h=this._tDur,P&&(this._lock=2,a=I?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!A&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;w0(this,A)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(_=lE(this,he(a),he(d)),_&&(u-=d-(d=_._start))),this._tTime=u,this._time=d,this._act=!b,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&d&&!n&&!f&&(ze(this,"onStart"),this._tTime!==u))return this;if(d>=a&&s>=0)for(p=this._first;p;){if(m=p._next,(p._act||d>=p._start)&&p._ts&&_!==p){if(p.parent!==this)return this.render(s,n,o);if(p.render(p._ts>0?(d-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(d-p._start)*p._ts,n,o),d!==this._time||!this._ts&&!y){_=0,m&&(u+=this._zTime=-Pt);break}}p=m}else{p=this._last;for(var W=s<0?s:d;p;){if(m=p._prev,(p._act||W<=p._end)&&p._ts&&_!==p){if(p.parent!==this)return this.render(s,n,o);if(p.render(p._ts>0?(W-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(W-p._start)*p._ts,n,o||ce&&(p._initted||p._startAt)),d!==this._time||!this._ts&&!y){_=0,m&&(u+=this._zTime=W?-Pt:Pt);break}}p=m}}if(_&&!n&&(this.pause(),_.render(d>=a?0:-Pt)._zTime=d>=a?1:-1,this._ts))return this._start=v,lh(this),this.render(s,n,o);this._onUpdate&&!n&&ze(this,"onUpdate",!0),(u===h&&this._tTime>=this.totalDuration()||!u&&a)&&(v===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(u===h&&this._ts>0||!u&&this._ts<0)&&Rr(this,1),!n&&!(s<0&&!a)&&(u||a||!h)&&(ze(this,u===h&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(s,n){var o=this;if(ir(n)||(n=He(this,n,s)),!(s instanceof lo)){if(de(s))return s.forEach(function(a){return o.add(a,n)}),this;if(re(s))return this.addLabel(s,n);if(Vt(s))s=zt.delayedCall(0,s);else return this}return this!==s?Pi(this,s,n):this},e.getChildren=function(s,n,o,a){s===void 0&&(s=!0),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=-Ze);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof zt?n&&h.push(l):(o&&h.push(l),s&&h.push.apply(h,l.getChildren(!0,n,o)))),l=l._next;return h},e.getById=function(s){for(var n=this.getChildren(1,1,1),o=n.length;o--;)if(n[o].vars.id===s)return n[o]},e.remove=function(s){return re(s)?this.removeLabel(s):Vt(s)?this.killTweensOf(s):(ah(this,s),s===this._recent&&(this._recent=this._last),ls(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=he(Le.time-(this._ts>0?s/this._ts:(this.totalDuration()-s)/-this._ts))),r.prototype.totalTime.call(this,s,n),this._forcing=0,this):this._tTime},e.addLabel=function(s,n){return this.labels[s]=He(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=zt.delayedCall(0,n||eo,o);return a.data="isPause",this._hasPause=1,Pi(this,a,He(this,s))},e.removePause=function(s){var n=this._first;for(s=He(this,s);n;)n._start===s&&n.data==="isPause"&&Rr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Lr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=Ye(s),h=this._first,l=ir(n),u;h;)h instanceof zt?iE(h._targets,a)&&(l?(!Lr||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(u=h.getTweensOf(a,n)).length&&o.push.apply(o,u),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=He(o,s),h=n,l=h.startAt,u=h.onStart,c=h.onStartParams,d=h.immediateRender,p,m=zt.to(o,Ke({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale())||Pt,onStart:function(){if(o.pause(),!p){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());m._dur!==g&&en(m,g,0,1).render(m._time,!0,!0),p=1}u&&u.apply(m,c||[])}},n));return d?m.render(0):m},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,Ke({startAt:{time:He(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),m0(this,He(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),m0(this,He(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Pt)},e.shiftChildren=function(s,n,o){o===void 0&&(o=0);for(var a=this._first,h=this.labels,l;a;)a._start>=o&&(a._start+=s,a._end+=s),a=a._next;if(n)for(l in h)h[l]>=o&&(h[l]+=s);return ls(this)},e.invalidate=function(s){var n=this._first;for(this._lock=0;n;)n.invalidate(s),n=n._next;return r.prototype.invalidate.call(this,s)},e.clear=function(s){s===void 0&&(s=!0);for(var n=this._first,o;n;)o=n._next,this.remove(n),n=o;return this._dp&&(this._time=this._tTime=this._pTime=0),s&&(this.labels={}),ls(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=Ze,l,u,c;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(c=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),u=a._start,u>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Pi(o,a,u-a._delay,1)._lock=0):h=u,u<0&&a._ts&&(n-=u,(!c&&!o._dp||c&&c.smoothChildTiming)&&(o._start+=u/o._ts,o._time-=u,o._tTime-=u),o.shiftChildren(-u,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;en(o,o===Wt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Wt._ts&&(Qg(Wt,hh(s,Wt)),jg=Le.frame),Le.frame>=Jg){Jg+=Re.autoSleep||120;var n=Wt._first;if((!n||!n._ts)&&Re.autoSleep&&Le._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||Le.sleep()}}},t}(lo);Ke(Te.prototype,{_lock:0,_hasPause:0,_forcing:0});var EE=function(t,e,i,s,n,o,a){var h=new we(this._pt,t,e,0,1,P0,null,n),l=0,u=0,c,d,p,m,f,g,y,_;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=no(s)),o&&(_=[i,s],o(_,t,e),i=_[0],s=_[1]),d=i.match(uc)||[];c=uc.exec(s);)m=c[0],f=s.substring(l,c.index),p?p=(p+1)%5:f.substr(-5)==="rgba("&&(p=1),m!==d[u++]&&(g=parseFloat(d[u-1])||0,h._pt={_next:h._pt,p:f||u===1?f:",",s:g,c:m.charAt(1)==="="?qs(g,m)-g:parseFloat(m)-g,m:p&&p<4?Math.round:0},l=uc.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(Vg.test(s)||y)&&(h.e=0),this._pt=h,h},Ic=function(t,e,i,s,n,o,a,h,l,u){Vt(s)&&(s=s(n||0,t,o));var c=t[e],d=i!=="get"?i:Vt(c)?l?t[e.indexOf("set")||!Vt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,p=Vt(c)?l?ME:R0:Mc,m;if(re(s)&&(~s.indexOf("random(")&&(s=no(s)),s.charAt(1)==="="&&(m=qs(d,s)+(pe(d)||0),(m||m===0)&&(s=m))),!u||d!==s||Ac)return!isNaN(d*s)&&s!==""?(m=new we(this._pt,t,e,+d||0,s-(d||0),typeof c=="boolean"?LE:M0,0,p),l&&(m.fp=l),a&&m.modifier(a,this,t),this._pt=m):(!c&&!(e in t)&&pc(e,s),EE.call(this,t,e,d,s,p,h||Re.stringFilter,l))},CE=function(t,e,i,s,n){if(Vt(t)&&(t=uo(t,n,e,i,s)),!Mi(t)||t.style&&t.nodeType||de(t)||Xg(t))return re(t)?uo(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=uo(t[a],n,e,i,s);return o},C0=function(t,e,i,s,n,o){var a,h,l,u;if(Pe[t]&&(a=new Pe[t]).init(n,a.rawVars?e[t]:CE(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new we(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==rn))for(l=i._ptLookup[i._targets.indexOf(n)],u=a._props.length;u--;)l[a._props[u]]=h;return a},Lr,Ac,Rc=function r(t,e,i){var s=t.vars,n=s.ease,o=s.startAt,a=s.immediateRender,h=s.lazy,l=s.onUpdate,u=s.onUpdateParams,c=s.callbackScope,d=s.runBackwards,p=s.yoyoEase,m=s.keyframes,f=s.autoRevert,g=t._dur,y=t._startAt,_=t._targets,b=t.parent,v=b&&b.data==="nested"?b.vars.targets:_,S=t._overwrite==="auto"&&!nc,E=t.timeline,A,I,P,W,D,L,C,N,U,K,Z,z,k;if(E&&(!m||!n)&&(n="none"),t._ease=us(n,$s.ease),t._yEase=p?T0(us(p===!0?n:p,$s.ease)):0,p&&t._yoyo&&!t._repeat&&(p=t._yEase,t._yEase=t._ease,t._ease=p),t._from=!E&&!!s.runBackwards,!E||m&&!s.stagger){if(N=_[0]?as(_[0]).harness:0,z=N&&s[N.prop],A=oh(s,fc),y&&(y._zTime<0&&y.progress(1),e<0&&d&&a&&!f?y.render(-1,!0):y.revert(d&&g?rh:tE),y._lazy=0),o){if(Rr(t._startAt=zt.set(_,Ke({data:"isStart",overwrite:!1,parent:b,immediateRender:!0,lazy:!y&&_e(h),startAt:null,delay:0,onUpdate:l,onUpdateParams:u,callbackScope:c,stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce||!a&&!f)&&t._startAt.revert(rh),a&&g&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(d&&g&&!y){if(e&&(a=!1),P=Ke({overwrite:!1,data:"isFromStart",lazy:a&&!y&&_e(h),immediateRender:a,stagger:0,parent:b},A),z&&(P[N.prop]=z),Rr(t._startAt=zt.set(_,P)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce?t._startAt.revert(rh):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Pt,Pt);else if(!e)return}for(t._pt=t._ptCache=0,h=g&&_e(h)||h&&!g,I=0;I<_.length;I++){if(D=_[I],C=D._gsap||bc(_)[I]._gsap,t._ptLookup[I]=K={},mc[C.id]&&Ar.length&&nh(),Z=v===_?I:v.indexOf(D),N&&(U=new N).init(D,z||A,t,Z,v)!==!1&&(t._pt=W=new we(t._pt,D,U.name,0,1,U.render,U,0,U.priority),U._props.forEach(function(F){K[F]=W}),U.priority&&(L=1)),!N||z)for(P in A)Pe[P]&&(U=C0(P,A,t,Z,D,v))?U.priority&&(L=1):K[P]=W=Ic.call(t,D,P,"get",A[P],Z,v,0,s.stringFilter);t._op&&t._op[I]&&t.kill(D,t._op[I]),S&&t._pt&&(Lr=t,Wt.killTweensOf(D,K,t.globalTime(e)),k=!t.parent,Lr=0),t._pt&&h&&(mc[C.id]=1)}L&&L0(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!k,m&&e<=0&&E.render(Ze,!0,!0)},IE=function(t,e,i,s,n,o,a){var h=(t._pt&&t._ptCache||(t._ptCache={}))[e],l,u,c,d;if(!h)for(h=t._ptCache[e]=[],c=t._ptLookup,d=t._targets.length;d--;){if(l=c[d][e],l&&l.d&&l.d._pt)for(l=l.d._pt;l&&l.p!==e&&l.fp!==e;)l=l._next;if(!l)return Ac=1,t.vars[e]="+=0",Rc(t,a),Ac=0,1;h.push(l)}for(d=h.length;d--;)u=h[d],l=u._pt||u,l.s=(s||s===0)&&!n?s:l.s+(s||0)+o*l.c,l.c=i-l.s,u.e&&(u.e=Ht(i)+pe(u.e)),u.b&&(u.b=l.s+pe(u.b))},AE=function(t,e){var i=t[0]?as(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=hs({},e);for(o in s)if(o in n)for(h=s[o].split(","),a=h.length;a--;)n[h[a]]=n[o];return n},RE=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(de(e))a=i[t]||(i[t]=[]),e.forEach(function(h,l){return a.push({t:l/(e.length-1)*100,v:h,e:n})});else for(o in e)a=i[o]||(i[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:e[o],e:n})},uo=function(t,e,i,s,n){return Vt(t)?t.call(e,i,s,n):re(t)&&~t.indexOf("random(")?no(t):t},I0=yc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",A0={};ve(I0+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return A0[r]=1});var zt=function(r){Bg(t,r);function t(i,s,n,o){var a;typeof s=="number"&&(n.duration=s,s=n,n=null),a=r.call(this,o?s:io(s))||this;var h=a.vars,l=h.duration,u=h.delay,c=h.immediateRender,d=h.stagger,p=h.overwrite,m=h.keyframes,f=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,_=s.parent||Wt,b=(de(i)||Xg(i)?ir(i[0]):"length"in s)?[i]:Ye(i),v,S,E,A,I,P,W,D;if(a._targets=b.length?bc(b):ih("GSAP target "+i+" not found. https://greensock.com",!Re.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=p,m||d||th(l)||th(u)){if(s=a.vars,v=a.timeline=new Te({data:"nested",defaults:f||{},targets:_&&_.data==="nested"?_.vars.targets:b}),v.kill(),v.parent=v._dp=er(a),v._start=0,d||th(l)||th(u)){if(A=b.length,W=d&&u0(d),Mi(d))for(I in d)~I0.indexOf(I)&&(D||(D={}),D[I]=d[I]);for(S=0;S<A;S++)E=oh(s,A0),E.stagger=0,y&&(E.yoyoEase=y),D&&hs(E,D),P=b[S],E.duration=+uo(l,er(a),S,P,b),E.delay=(+uo(u,er(a),S,P,b)||0)-a._delay,!d&&A===1&&E.delay&&(a._delay=u=E.delay,a._start+=u,E.delay=0),v.to(P,E,W?W(S,P,b):0),v._ease=St.none;v.duration()?l=u=0:a.timeline=0}else if(m){io(Ke(v.vars.defaults,{ease:"none"})),v._ease=us(m.ease||s.ease||"none");var L=0,C,N,U;if(de(m))m.forEach(function(K){return v.to(b,K,">")}),v.duration();else{E={};for(I in m)I==="ease"||I==="easeEach"||RE(I,m[I],E,m.easeEach);for(I in E)for(C=E[I].sort(function(K,Z){return K.t-Z.t}),L=0,S=0;S<C.length;S++)N=C[S],U={ease:N.e,duration:(N.t-(S?C[S-1].t:0))/100*l},U[I]=N.v,v.to(b,U,L),L+=U.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return p===!0&&!nc&&(Lr=er(a),Wt.killTweensOf(b),Lr=0),Pi(_,er(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(c||!l&&!m&&a._start===he(_._time)&&_e(c)&&oE(er(a))&&_.data!=="nested")&&(a._tTime=-Pt,a.render(Math.max(0,-u)||0)),g&&n0(er(a),g),a}var e=t.prototype;return e.render=function(s,n,o){var a=this._time,h=this._tDur,l=this._dur,u=s<0,c=s>h-Pt&&!u?h:s<Pt?0:s,d,p,m,f,g,y,_,b,v;if(!l)hE(this,s,n,o);else if(c!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u){if(d=c,b=this.timeline,this._repeat){if(f=l+this._rDelay,this._repeat<-1&&u)return this.totalTime(f*100+s,n,o);if(d=he(c%f),c===h?(m=this._repeat,d=l):(m=~~(c/f),m&&m===c/f&&(d=l,m--),d>l&&(d=l)),y=this._yoyo&&m&1,y&&(v=this._yEase,d=l-d),g=tn(this._tTime,f),d===a&&!o&&this._initted)return this._tTime=c,this;m!==g&&(b&&this._yEase&&w0(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&(this._lock=o=1,this.render(he(f*m),!0).invalidate()._lock=0))}if(!this._initted){if(o0(this,u?s:d,o,n,c))return this._tTime=0,this;if(a!==this._time)return this;if(l!==this._dur)return this.render(s,n,o)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=_=(v||this._ease)(d/l),this._from&&(this.ratio=_=1-_),d&&!a&&!n&&!m&&(ze(this,"onStart"),this._tTime!==c))return this;for(p=this._pt;p;)p.r(_,p.d),p=p._next;b&&b.render(s<0?s:!d&&y?-Pt:b._dur*b._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(u&&xc(this,s,n,o),ze(this,"onUpdate")),this._repeat&&m!==g&&this.vars.onRepeat&&!n&&this.parent&&ze(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&xc(this,s,!0,!0),(s||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&Rr(this,1),!n&&!(u&&!a)&&(c||a||y)&&(ze(this,c===h?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(s){return(!s||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(s),r.prototype.invalidate.call(this,s)},e.resetTo=function(s,n,o,a){ho||Le.wake(),this._ts||this.play();var h=Math.min(this._dur,(this._dp._time-this._start)*this._ts),l;return this._initted||Rc(this,h),l=this._ease(h/this._dur),IE(this,s,n,o,a,l,h)?this.resetTo(s,n,o,a):(uh(this,0),this.parent||i0(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(s,n){if(n===void 0&&(n="all"),!s&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?oo(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Lr&&Lr.vars.overwrite!==!0)._first||oo(this),this.parent&&o!==this.timeline.totalDuration()&&en(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?Ye(s):a,l=this._ptLookup,u=this._pt,c,d,p,m,f,g,y;if((!n||n==="all")&&sE(a,h))return n==="all"&&(this._pt=0),oo(this);for(c=this._op=this._op||[],n!=="all"&&(re(n)&&(f={},ve(n,function(_){return f[_]=1}),n=f),n=AE(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(c[y]=n,m=d,p={}):(p=c[y]=c[y]||{},m=n);for(f in m)g=d&&d[f],g&&((!("kill"in g.d)||g.d.kill(f)===!0)&&ah(this,g,"_pt"),delete d[f]),p!=="all"&&(p[f]=1)}return this._initted&&!this._pt&&u&&oo(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return ro(1,arguments)},t.delayedCall=function(s,n,o,a){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:n,onReverseComplete:n,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(s,n,o){return ro(2,arguments)},t.set=function(s,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(s,n)},t.killTweensOf=function(s,n,o){return Wt.killTweensOf(s,n,o)},t}(lo);Ke(zt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ve("staggerTo,staggerFrom,staggerFromTo",function(r){zt[r]=function(){var t=new Te,e=vc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Mc=function(t,e,i){return t[e]=i},R0=function(t,e,i){return t[e](i)},ME=function(t,e,i,s){return t[e](s.fp,i)},PE=function(t,e,i){return t.setAttribute(e,i)},Pc=function(t,e){return Vt(t[e])?R0:ac(t[e])&&t.setAttribute?PE:Mc},M0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},LE=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},P0=function(t,e){var i=e._pt,s="";if(!t&&e.b)s=e.b;else if(t===1&&e.e)s=e.e;else{for(;i;)s=i.p+(i.m?i.m(i.s+i.c*t):Math.round((i.s+i.c*t)*1e4)/1e4)+s,i=i._next;s+=e.c}e.set(e.t,e.p,s,e)},Lc=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},GE=function(t,e,i,s){for(var n=this._pt,o;n;)o=n._next,n.p===s&&n.modifier(t,e,i),n=o},NE=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?ah(this,e,"_pt"):e.dep||(i=1),e=s;return!i},FE=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},L0=function(t){for(var e=t._pt,i,s,n,o;e;){for(i=e._next,s=n;s&&s.pr>e.pr;)s=s._next;(e._prev=s?s._prev:o)?e._prev._next=e:n=e,(e._next=s)?s._prev=e:o=e,e=i}t._pt=n},we=function(){function r(e,i,s,n,o,a,h,l,u){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||M0,this.d=h||this,this.set=l||Mc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(i,s,n){this.mSet=this.mSet||this.set,this.set=FE,this.m=i,this.mt=n,this.tween=s},r}();ve(yc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(r){return fc[r]=1}),Me.TweenMax=Me.TweenLite=zt,Me.TimelineLite=Me.TimelineMax=Te,Wt=new Te({sortChildren:!1,defaults:$s,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Re.stringFilter=v0;var ds=[],ch={},DE=[],G0=0,kE=0,Gc=function(t){return(ch[t]||DE).map(function(e){return e()})},Nc=function(){var t=Date.now(),e=[];t-G0>2&&(Gc("matchMediaInit"),ds.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Ve.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Gc("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i)}),G0=t,Gc("matchMedia"))},N0=function(){function r(e,i){this.selector=i&&Tc(i),this.data=[],this._r=[],this.isReverted=!1,this.id=kE++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Vt(i)&&(n=s,s=i,i=Vt);var o=this,a=function(){var l=Zt,u=o.selector,c;return l&&l!==o&&l.data.push(o),n&&(o.selector=Tc(n)),Zt=o,c=s.apply(o,arguments),Vt(c)&&o._r.push(c),Zt=l,o.selector=u,o.isReverted=!1,c};return o.last=a,i===Vt?a(o):i?o[i]=a:a},t.ignore=function(i){var s=Zt;Zt=null,i(this),Zt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof zt&&!(s.parent&&s.parent.data==="nested")&&i.push(s)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,s){var n=this;if(i){var o=this.getTweens();this.data.forEach(function(h){h.data==="isFlip"&&(h.revert(),h.getChildren(!0,!0,!1).forEach(function(l){return o.splice(o.indexOf(l),1)}))}),o.map(function(h){return{g:h.globalTime(0),t:h}}).sort(function(h,l){return l.g-h.g||-1/0}).forEach(function(h){return h.t.revert(i)}),this.data.forEach(function(h){return!(h instanceof zt)&&h.revert&&h.revert(i)}),this._r.forEach(function(h){return h(i,n)}),this.isReverted=!0}else this.data.forEach(function(h){return h.kill&&h.kill()});if(this.clear(),s)for(var a=ds.length;a--;)ds[a].id===this.id&&ds.splice(a,1)},t.revert=function(i){this.kill(i||{})},r}(),OE=function(){function r(e){this.contexts=[],this.scope=e}var t=r.prototype;return t.add=function(i,s,n){Mi(i)||(i={matches:i});var o=new N0(0,n||this.scope),a=o.conditions={},h,l,u;Zt&&!o.selector&&(o.selector=Zt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?u=1:(h=Ve.matchMedia(i[l]),h&&(ds.indexOf(o)<0&&ds.push(o),(a[l]=h.matches)&&(u=1),h.addListener?h.addListener(Nc):h.addEventListener("change",Nc)));return u&&s(o),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),dh={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach(function(s){return y0(s)})},timeline:function(t){return new Te(t)},getTweensOf:function(t,e){return Wt.getTweensOf(t,e)},getProperty:function(t,e,i,s){re(t)&&(t=Ye(t)[0]);var n=as(t||{}).get,o=i?t0:qg;return i==="native"&&(i=""),t&&(e?o((Pe[e]&&Pe[e].get||n)(t,e,i,s)):function(a,h,l){return o((Pe[a]&&Pe[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=Ye(t),t.length>1){var s=t.map(function(u){return Se.quickSetter(u,e,i)}),n=s.length;return function(u){for(var c=n;c--;)s[c](u)}}t=t[0]||{};var o=Pe[e],a=as(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(u){var c=new o;rn._pt=0,c.init(t,i?u+i:u,rn,0,[t]),c.render(1,c),rn._pt&&Lc(1,rn)}:a.set(t,h);return o?l:function(u){return l(t,h,i?u+i:u,a,1)}},quickTo:function(t,e,i){var s,n=Se.to(t,hs((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,u){return n.resetTo(e,h,l,u)};return o.tween=n,o},isTweening:function(t){return Wt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=us(t.ease,$s.ease)),e0($s,t||{})},config:function(t){return e0(Re,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,s=t.plugins,n=t.defaults,o=t.extendTimeline;(s||"").split(",").forEach(function(a){return a&&!Pe[a]&&!Me[a]&&ih(e+" effect requires "+a+" plugin.")}),gc[e]=function(a,h,l){return i(Ye(a),Ke(h||{},n),l)},o&&(Te.prototype[e]=function(a,h,l){return this.add(gc[e](a,Mi(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){St[t]=us(e)},parseEase:function(t,e){return arguments.length?us(t,e):St},getById:function(t){return Wt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new Te(t),s,n;for(i.smoothChildTiming=_e(t.smoothChildTiming),Wt.remove(i),i._dp=0,i._time=i._tTime=Wt._time,s=Wt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof zt&&s.vars.onComplete===s._targets[0]))&&Pi(i,s,s._start-s._delay),s=n;return Pi(Wt,i,0),i},context:function(t,e){return t?new N0(t,e):Zt},matchMedia:function(t){return new OE(t)},matchMediaRefresh:function(){return ds.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||Nc()},addEventListener:function(t,e){var i=ch[t]||(ch[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=ch[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:gE,wrapYoyo:yE,distribute:u0,random:d0,snap:c0,normalize:mE,getUnit:pe,clamp:cE,splitColor:b0,toArray:Ye,selector:Tc,mapRange:f0,pipe:pE,unitize:fE,interpolate:bE,shuffle:l0},install:Yg,effects:gc,ticker:Le,updateRoot:Te.updateRoot,plugins:Pe,globalTimeline:Wt,core:{PropTween:we,globals:zg,Tween:zt,Timeline:Te,Animation:lo,getCache:as,_removeLinkedListItem:ah,reverting:function(){return ce},context:function(t){return t&&Zt&&(Zt.data.push(t),t._ctx=Zt),Zt},suppressOverwrites:function(t){return nc=t}}};ve("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return dh[r]=zt[r]}),Le.add(Te.updateRoot),rn=dh.to({},{duration:0});var WE=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},BE=function(t,e){var i=t._targets,s,n,o;for(s in e)for(n=i.length;n--;)o=t._ptLookup[n][s],o&&(o=o.d)&&(o._pt&&(o=WE(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},Fc=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(re(n)&&(h={},ve(n,function(u){return h[u]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}BE(a,n)}}}},Se=dh.registerPlugin({name:"attr",init:function(t,e,i,s,n){var o,a,h;this.tween=i;for(o in e)h=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(h||0)+"",e[o],s,n,0,0,o),a.op=o,a.b=h,this._props.push(o)},render:function(t,e){for(var i=e._pt;i;)ce?i.set(i.t,i.p,i.b,i):i.r(t,i.d),i=i._next}},{name:"endArray",init:function(t,e){for(var i=e.length;i--;)this.add(t,i,t[i]||0,e[i],0,0,0,0,0,1)}},Fc("roundProps",wc),Fc("modifiers"),Fc("snap",c0))||dh;zt.version=Te.version=Se.version="3.12.2",Hg=1,hc()&&sn(),St.Power0,St.Power1,St.Power2,St.Power3,St.Power4,St.Linear,St.Quad,St.Cubic,St.Quart,St.Quint,St.Strong,St.Elastic,St.Back,St.SteppedEase,St.Bounce,St.Sine,St.Expo,St.Circ;/*!
1168
- * CSSPlugin 3.12.2
1169
- * https://greensock.com
1167
+ */var Me={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Qs={duration:.5,overwrite:!1,delay:0},nc,ce,Zt,Ke=1e8,Pt=1/Ke,oc=Math.PI*2,jS=oc/4,JS=0,Ug=Math.sqrt,$S=Math.cos,QS=Math.sin,re=function(t){return typeof t=="string"},Vt=function(t){return typeof t=="function"},ir=function(t){return typeof t=="number"},ac=function(t){return typeof t>"u"},Mi=function(t){return typeof t=="object"},ve=function(t){return t!==!1},hc=function(){return typeof window<"u"},eh=function(t){return Vt(t)||re(t)},Xg=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},de=Array.isArray,lc=/(?:-?\.?\d|\.)+/gi,Zg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,qs=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,uc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Vg=/[+-]=-?[.\d]+/,Kg=/[^,'"\[\]\s]+/gi,qS=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Wt,He,cc,dc,Pe={},ih={},Hg,Yg=function(t){return(ih=hs(t,Pe))&&Se},pc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},io=function(t,e){return!e&&console.warn(t)},zg=function(t,e){return t&&(Pe[t]=e)&&ih&&(ih[t]=e)||Pe},ro=function(){return 0},tE={suppressEvents:!0,isStart:!0,kill:!1},rh={suppressEvents:!0,kill:!1},eE={suppressEvents:!0},fc={},Ar=[],mc={},jg,Le={},gc={},Jg=30,sh=[],yc="",bc=function(t){var e=t[0],i,s;if(Mi(e)||Vt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=sh.length;s--&&!sh[s].targetTest(e););i=sh[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new E0(t[s],i)))||t.splice(s,1);return t},as=function(t){return t._gsap||bc(je(t))[0]._gsap},$g=function(t,e,i){return(i=t[e])&&Vt(i)?t[e]():ac(i)&&t.getAttribute&&t.getAttribute(e)||i},Te=function(t,e){return(t=t.split(",")).forEach(e)||t},Ht=function(t){return Math.round(t*1e5)/1e5||0},se=function(t){return Math.round(t*1e7)/1e7||0},tn=function(t,e){var i=e.charAt(0),s=parseFloat(e.substr(2));return t=parseFloat(t),i==="+"?t+s:i==="-"?t-s:i==="*"?t*s:t/s},iE=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},nh=function(){var t=Ar.length,e=Ar.slice(0),i,s;for(mc={},Ar.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},Qg=function(t,e,i,s){Ar.length&&!ce&&nh(),t.render(e,i,s||ce&&e<0&&(t._initted||t._startAt)),Ar.length&&!ce&&nh()},qg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(Kg).length<2?e:re(t)?t.trim():t},t0=function(t){return t},Ye=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},rE=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},hs=function(t,e){for(var i in e)t[i]=e[i];return t},e0=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Mi(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},oh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},so=function(t){var e=t.parent||Wt,i=t.keyframes?rE(de(t.keyframes)):Ye;if(ve(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},sE=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},i0=function(t,e,i,s,n){i===void 0&&(i="_first"),s===void 0&&(s="_last");var o=t[s],a;if(n)for(a=e[n];o&&o[n]>a;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[s]=e,e._prev=o,e.parent=e._dp=t,e},ah=function(t,e,i,s){i===void 0&&(i="_first"),s===void 0&&(s="_last");var n=e._prev,o=e._next;n?n._next=o:t[i]===e&&(t[i]=o),o?o._prev=n:t[s]===e&&(t[s]=n),e._next=e._prev=e.parent=null},Rr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},ls=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},nE=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},xc=function(t,e,i,s){return t._startAt&&(ce?t._startAt.revert(rh):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},oE=function r(t){return!t||t._ts&&r(t.parent)},r0=function(t){return t._repeat?en(t._tTime,t=t.duration()+t._rDelay)*t:0},en=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},hh=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},lh=function(t){return t._end=se(t._start+(t._tDur/Math.abs(t._ts||t._rts||Pt)||0))},uh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=se(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),lh(t),i._dirty||ls(i,t)),t},s0=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=hh(t.rawTime(),e),(!e._dur||oo(0,e.totalDuration(),i)-e._tTime>Pt)&&e.render(i,!0)),ls(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-Pt}},Pi=function(t,e,i,s){return e.parent&&Rr(e),e._start=se((ir(i)?i:i||t!==Wt?ze(t,i,e):t._time)+e._delay),e._end=se(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),i0(t,e,"_first","_last",t._sort?"_start":0),_c(e)||(t._recent=e),s||s0(t,e),t._ts<0&&uh(t,t._tTime),t},n0=function(t,e){return(Pe.ScrollTrigger||pc("scrollTrigger",e))&&Pe.ScrollTrigger.create(e,t)},o0=function(t,e,i,s,n){if(Rc(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ce&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&jg!==Ne.frame)return Ar.push(t),t._lazy=[n,s],1},aE=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},_c=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},hE=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&aE(t)&&!(!t._initted&&_c(t))||(t._ts<0||t._dp._ts<0)&&!_c(t))?0:1,a=t._rDelay,h=0,l,u,c;if(a&&t._repeat&&(h=oo(0,t._tDur,e),u=en(h,a),t._yoyo&&u&1&&(o=1-o),u!==en(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ce||s||t._zTime===Pt||!e&&t._zTime){if(!t._initted&&o0(t,e,s,i,h))return;for(c=t._zTime,t._zTime=e||(i?Pt:0),i||(i=e&&!c),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=h,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&xc(t,e,i,!0),t._onUpdate&&!i&&Ge(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&Ge(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Rr(t,1),!i&&!ce&&(Ge(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},lE=function(t,e,i){var s;if(i>e)for(s=t._first;s&&s._start<=i;){if(s.data==="isPause"&&s._start>e)return s;s=s._next}else for(s=t._last;s&&s._start>=i;){if(s.data==="isPause"&&s._start<e)return s;s=s._prev}},rn=function(t,e,i,s){var n=t._repeat,o=se(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:se(o*(n+1)+t._rDelay*n):o,a>0&&!s&&uh(t,t._tTime=t._tDur*a),t.parent&&lh(t),i||ls(t.parent,t),t},a0=function(t){return t instanceof xe?ls(t):rn(t,t._dur)},uE={_start:0,endTime:ro,totalDuration:ro},ze=function r(t,e,i){var s=t.labels,n=t._recent||uE,o=t.duration()>=Ke?n.endTime(!1):t._dur,a,h,l;return re(e)&&(isNaN(e)||e in s)?(h=e.charAt(0),l=e.substr(-1)==="%",a=e.indexOf("="),h==="<"||h===">"?(a>=0&&(e=e.replace(/=/,"")),(h==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(a<0?n:i).totalDuration()/100:1)):a<0?(e in s||(s[e]=o),s[e]):(h=parseFloat(e.charAt(a-1)+e.substr(a+1)),l&&i&&(h=h/100*(de(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},no=function(t,e,i){var s=ir(e[1]),n=(s?2:1)+(t<2?0:1),o=e[n],a,h;if(s&&(o.duration=e[1]),o.parent=i,t){for(a=o,h=i;h&&!("immediateRender"in a);)a=h.vars.defaults||{},h=ve(h.vars.inherit)&&h.parent;o.immediateRender=ve(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new zt(e[0],o,e[n+1])},Mr=function(t,e){return t||t===0?e(t):e},oo=function(t,e,i){return i<t?t:i>e?e:i},pe=function(t,e){return!re(t)||!(e=qS.exec(t))?"":e[1]},cE=function(t,e,i){return Mr(i,function(s){return oo(t,e,s)})},vc=[].slice,h0=function(t,e){return t&&Mi(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Mi(t[0]))&&!t.nodeType&&t!==He},dE=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return re(s)&&!e||h0(s,1)?(n=i).push.apply(n,je(s)):i.push(s)})||i},je=function(t,e,i){return Zt&&!e&&Zt.selector?Zt.selector(t):re(t)&&!i&&(cc||!nn())?vc.call((e||dc).querySelectorAll(t),0):de(t)?dE(t,i):h0(t)?vc.call(t,0):t?[t]:[]},Tc=function(t){return t=je(t)[0]||io("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return je(e,i.querySelectorAll?i:i===t?io("Invalid scope")||dc.createElement("div"):t)}},l0=function(t){return t.sort(function(){return .5-Math.random()})},u0=function(t){if(Vt(t))return t;var e=Mi(t)?t:{each:t},i=us(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,u=s,c=s;return re(s)?u=c={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(u=s[0],c=s[1]),function(d,p,m){var f=(m||e).length,g=o[f],y,_,b,v,S,E,I,A,P;if(!g){if(P=e.grid==="auto"?0:(e.grid||[1,Ke])[1],!P){for(I=-Ke;I<(I=m[P++].getBoundingClientRect().left)&&P<f;);P<f&&P--}for(g=o[f]=[],y=h?Math.min(P,f)*u-.5:s%P,_=P===Ke?0:h?f*c/P-.5:s/P|0,I=0,A=Ke,E=0;E<f;E++)b=E%P-y,v=_-(E/P|0),g[E]=S=l?Math.abs(l==="y"?v:b):Ug(b*b+v*v),S>I&&(I=S),S<A&&(A=S);s==="random"&&l0(g),g.max=I-A,g.min=A,g.v=f=(parseFloat(e.amount)||parseFloat(e.each)*(P>f?f-1:l?l==="y"?f/P:P:Math.max(P,f/P))||0)*(s==="edges"?-1:1),g.b=f<0?n-f:n,g.u=pe(e.amount||e.each)||0,i=i&&f<0?T0(i):i}return f=(g[d]-g.min)/g.max||0,se(g.b+(i?i(f):f)*g.v)+g.u}},wc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=se(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(ir(i)?0:pe(i))}},c0=function(t,e){var i=de(t),s,n;return!i&&Mi(t)&&(s=i=t.radius||Ke,t.values?(t=je(t.values),(n=!ir(t[0]))&&(s*=s)):t=wc(t.increment)),Mr(e,i?Vt(t)?function(o){return n=t(o),Math.abs(n-o)<=s?n:o}:function(o){for(var a=parseFloat(n?o.x:o),h=parseFloat(n?o.y:0),l=Ke,u=0,c=t.length,d,p;c--;)n?(d=t[c].x-a,p=t[c].y-h,d=d*d+p*p):d=Math.abs(t[c]-a),d<l&&(l=d,u=c);return u=!s||l<=s?t[u]:o,n||u===o||ir(o)?u:u+pe(o)}:wc(t))},d0=function(t,e,i,s){return Mr(de(t)?!e:i===!0?!!(i=0):!s,function(){return de(t)?t[~~(Math.random()*t.length)]:(i=i||1e-5)&&(s=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((t-i/2+Math.random()*(e-t+i*.99))/i)*i*s)/s})},pE=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(s){return e.reduce(function(n,o){return o(n)},s)}},fE=function(t,e){return function(i){return t(parseFloat(i))+(e||pe(i))}},mE=function(t,e,i){return f0(t,e,0,1,i)},p0=function(t,e,i){return Mr(i,function(s){return t[~~e(s)]})},gE=function r(t,e,i){var s=e-t;return de(t)?p0(t,r(0,t.length),e):Mr(i,function(n){return(s+(n-t)%s)%s+t})},yE=function r(t,e,i){var s=e-t,n=s*2;return de(t)?p0(t,r(0,t.length-1),e):Mr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},ao=function(t){for(var e=0,i="",s,n,o,a;~(s=t.indexOf("random(",e));)o=t.indexOf(")",s),a=t.charAt(s+7)==="[",n=t.substr(s+7,o-s-7).match(a?Kg:lc),i+=t.substr(e,s-e)+d0(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},f0=function(t,e,i,s,n){var o=e-t,a=s-i;return Mr(n,function(h){return i+((h-t)/o*a||0)})},bE=function r(t,e,i,s){var n=isNaN(t+e)?0:function(p){return(1-p)*t+p*e};if(!n){var o=re(t),a={},h,l,u,c,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(de(t)&&!de(e)){for(u=[],c=t.length,d=c-2,l=1;l<c;l++)u.push(r(t[l-1],t[l]));c--,n=function(m){m*=c;var f=Math.min(d,~~m);return u[f](m-f)},i=e}else s||(t=hs(de(t)?[]:{},t));if(!u){for(h in e)Ic.call(a,t,h,"get",e[h]);n=function(m){return Lc(m,a)||(o?t.p:t)}}}return Mr(i,n)},m0=function(t,e,i){var s=t.labels,n=Ke,o,a,h;for(o in s)a=s[o]-e,a<0==!!i&&a&&n>(a=Math.abs(a))&&(h=o,n=a);return h},Ge=function(t,e,i){var s=t.vars,n=s[e],o=Zt,a=t._ctx,h,l,u;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Ar.length&&nh(),a&&(Zt=a),u=h?n.apply(l,h):n.call(l),Zt=o,u},ho=function(t){return Rr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ce),t.progress()<1&&Ge(t,"onInterrupt"),t},sn,g0=[],y0=function(t){if(hc()&&t){t=!t.name&&t.default||t;var e=t.name,i=Vt(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:ro,render:Lc,add:Ic,kill:NE,modifier:GE,rawVars:0},o={targetTest:0,get:0,getSetter:Pc,aliases:{},register:0};if(nn(),t!==s){if(Le[e])return;Ye(s,Ye(oh(t,n),o)),hs(s.prototype,hs(n,oh(t,o))),Le[s.prop=e]=s,t.targetTest&&(sh.push(s),fc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}zg(e,s),t.register&&t.register(Se,s,we)}else t&&g0.push(t)},Lt=255,lo={aqua:[0,Lt,Lt],lime:[0,Lt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Lt],navy:[0,0,128],white:[Lt,Lt,Lt],olive:[128,128,0],yellow:[Lt,Lt,0],orange:[Lt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Lt,0,0],pink:[Lt,192,203],cyan:[0,Lt,Lt],transparent:[Lt,Lt,Lt,0]},Sc=function(t,e,i){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(i-e)*t*6:t<.5?i:t*3<2?e+(i-e)*(2/3-t)*6:e)*Lt+.5|0},b0=function(t,e,i){var s=t?ir(t)?[t>>16,t>>8&Lt,t&Lt]:0:lo.black,n,o,a,h,l,u,c,d,p,m;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),lo[t])s=lo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+n+n+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return s=parseInt(t.substr(1,6),16),[s>>16,s>>8&Lt,s&Lt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Lt,t&Lt]}else if(t.substr(0,3)==="hsl"){if(s=m=t.match(lc),!e)h=+s[0]%360/360,l=+s[1]/100,u=+s[2]/100,o=u<=.5?u*(l+1):u+l-u*l,n=u*2-o,s.length>3&&(s[3]*=1),s[0]=Sc(h+1/3,n,o),s[1]=Sc(h,n,o),s[2]=Sc(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(Zg),i&&s.length<4&&(s[3]=1),s}else s=t.match(lc)||lo.transparent;s=s.map(Number)}return e&&!m&&(n=s[0]/Lt,o=s[1]/Lt,a=s[2]/Lt,c=Math.max(n,o,a),d=Math.min(n,o,a),u=(c+d)/2,c===d?h=l=0:(p=c-d,l=u>.5?p/(2-c-d):p/(c+d),h=c===n?(o-a)/p+(o<a?6:0):c===o?(a-n)/p+2:(n-o)/p+4,h*=60),s[0]=~~(h+.5),s[1]=~~(l*100+.5),s[2]=~~(u*100+.5)),i&&s.length<4&&(s[3]=1),s},x0=function(t){var e=[],i=[],s=-1;return t.split(Pr).forEach(function(n){var o=n.match(qs)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},_0=function(t,e,i){var s="",n=(t+s).match(Pr),o=e?"hsla(":"rgba(",a=0,h,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=b0(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(u=x0(t),h=i.c,h.join(s)!==u.c.join(s)))for(l=t.replace(Pr,"1").split(qs),c=l.length-1;a<c;a++)s+=l[a]+(~h.indexOf(a)?n.shift()||o+"0,0,0,0)":(u.length?u:n.length?n:i).shift());if(!l)for(l=t.split(Pr),c=l.length-1;a<c;a++)s+=l[a]+n[a];return s+l[c]},Pr=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in lo)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),xE=/hsl[a]?\(/,v0=function(t){var e=t.join(" "),i;if(Pr.lastIndex=0,Pr.test(e))return i=xE.test(e),t[1]=_0(t[1],i),t[0]=_0(t[0],i,x0(t[1])),!0},uo,Ne=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,o=n,a=[],h,l,u,c,d,p,m=function f(g){var y=r()-s,_=g===!0,b,v,S,E;if(y>t&&(i+=y-e),s+=y,S=s-i,b=S-o,(b>0||_)&&(E=++c.frame,d=S-c.time*1e3,c.time=S=S/1e3,o+=b+(b>=n?4:n-b),v=1),_||(h=l(f)),v)for(p=0;p<a.length;p++)a[p](S,d,E,g)};return c={time:0,frame:0,tick:function(){m(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){Hg&&(!cc&&hc()&&(He=cc=window,dc=He.document||{},Pe.gsap=Se,(He.gsapVersions||(He.gsapVersions=[])).push(Se.version),Yg(ih||He.GreenSockGlobals||!He.gsap&&He||{}),u=He.requestAnimationFrame,g0.forEach(y0)),h&&c.sleep(),l=u||function(g){return setTimeout(g,o-c.time*1e3+1|0)},uo=1,m(2))},sleep:function(){(u?He.cancelAnimationFrame:clearTimeout)(h),uo=0,l=ro},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=c.time*1e3+n},add:function(g,y,_){var b=y?function(v,S,E,I){g(v,S,E,I),c.remove(b)}:g;return c.remove(g),a[_?"unshift":"push"](b),nn(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&p>=y&&p--},_listeners:a},c}(),nn=function(){return!uo&&Ne.wake()},St={},_E=/^[\d.\-M][\d.\-,\s]/,vE=/["']/g,TE=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),s=i[0],n=1,o=i.length,a,h,l;n<o;n++)h=i[n],a=n!==o-1?h.lastIndexOf(","):h.length,l=h.substr(0,a),e[s]=isNaN(l)?l.replace(vE,"").trim():+l,s=h.substr(a+1).trim();return e},wE=function(t){var e=t.indexOf("(")+1,i=t.indexOf(")"),s=t.indexOf("(",e);return t.substring(e,~s&&s<i?t.indexOf(")",i+1):i)},SE=function(t){var e=(t+"").split("("),i=St[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[TE(e[1])]:wE(t).split(",").map(qg)):St._CE&&_E.test(t)?St._CE("",t):i},T0=function(t){return function(e){return 1-t(1-e)}},w0=function r(t,e){for(var i=t._first,s;i;)i instanceof xe?r(i,e):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==e&&(i.timeline?r(i.timeline,e):(s=i._ease,i._ease=i._yEase,i._yEase=s,i._yoyo=e)),i=i._next},us=function(t,e){return t&&(Vt(t)?t:St[t]||SE(t))||e},cs=function(t,e,i,s){i===void 0&&(i=function(h){return 1-e(1-h)}),s===void 0&&(s=function(h){return h<.5?e(h*2)/2:1-e((1-h)*2)/2});var n={easeIn:e,easeOut:i,easeInOut:s},o;return Te(t,function(a){St[a]=Pe[a]=n,St[o=a.toLowerCase()]=i;for(var h in n)St[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=St[a+"."+h]=n[h]}),n},S0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Ec=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/oc*(Math.asin(1/s)||0),a=function(u){return u===1?1:s*Math.pow(2,-10*u)*QS((u-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:S0(a);return n=oc/n,h.config=function(l,u){return r(t,l,u)},h},Cc=function r(t,e){e===void 0&&(e=1.70158);var i=function(o){return o?--o*o*((e+1)*o+e)+1:0},s=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:S0(i);return s.config=function(n){return r(t,n)},s};Te("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;cs(r+",Power"+(e-1),t?function(i){return Math.pow(i,e)}:function(i){return i},function(i){return 1-Math.pow(1-i,e)},function(i){return i<.5?Math.pow(i*2,e)/2:1-Math.pow((1-i)*2,e)/2})}),St.Linear.easeNone=St.none=St.Linear.easeIn,cs("Elastic",Ec("in"),Ec("out"),Ec()),function(r,t){var e=1/t,i=2*e,s=2.5*e,n=function(a){return a<e?r*a*a:a<i?r*Math.pow(a-1.5/t,2)+.75:a<s?r*(a-=2.25/t)*a+.9375:r*Math.pow(a-2.625/t,2)+.984375};cs("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),cs("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),cs("Circ",function(r){return-(Ug(1-r*r)-1)}),cs("Sine",function(r){return r===1?1:-$S(r*jS)+1}),cs("Back",Cc("in"),Cc("out"),Cc()),St.SteppedEase=St.steps=Pe.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,s=t+(e?0:1),n=e?1:0,o=1-Pt;return function(a){return((s*oo(0,o,a)|0)+n)*i}}},Qs.ease=St["quad.out"],Te("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return yc+=r+","+r+"Params,"});var E0=function(t,e){this.id=JS++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:$g,this.set=e?e.getSetter:Pc},co=function(){function r(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,rn(this,+e.duration,1,1),this.data=e.data,Zt&&(this._ctx=Zt,Zt.data.push(this)),uo||Ne.wake()}var t=r.prototype;return t.delay=function(i){return i||i===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+i-this._delay),this._delay=i,this):this._delay},t.duration=function(i){return arguments.length?this.totalDuration(this._repeat>0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},t.totalDuration=function(i){return arguments.length?(this._dirty=0,rn(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(nn(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(uh(this,i),!n._dp||n.parent||s0(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&Pi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Pt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),Qg(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+r0(this))%(this._dur+this._rDelay)||(i?this._dur:0),s):this._time},t.totalProgress=function(i,s){return arguments.length?this.totalTime(this.totalDuration()*i,s):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},t.progress=function(i,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+r0(this),s):this.duration()?Math.min(1,this._time/this._dur):this.ratio},t.iteration=function(i,s){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,s):this._repeat?en(this._tTime,n)+1:1},t.timeScale=function(i,s){if(!arguments.length)return this._rts===-Pt?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?hh(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Pt?0:this._rts,this.totalTime(oo(-Math.abs(this._delay),this._tDur,n),s!==!1),lh(this),nE(this)},t.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(nn(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Pt&&(this._tTime-=Pt)))),this):this._ps},t.startTime=function(i){if(arguments.length){this._start=i;var s=this.parent||this._dp;return s&&(s._sort||!this.parent)&&Pi(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(ve(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(i){var s=this.parent||this._dp;return s?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?hh(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=eE);var s=ce;return ce=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ce=s,this},t.globalTime=function(i){for(var s=this,n=arguments.length?i:s.rawTime();s;)n=s._start+n/(Math.abs(s._ts)||1),s=s._dp;return!this.parent&&this._sat?this._sat.globalTime(i):n},t.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,a0(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,a0(this),s?this.time(s):this}return this._rDelay},t.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},t.seek=function(i,s){return this.totalTime(ze(this,i),ve(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,ve(s))},t.play=function(i,s){return i!=null&&this.seek(i,s),this.reversed(!1).paused(!1)},t.reverse=function(i,s){return i!=null&&this.seek(i||this.totalDuration(),s),this.reversed(!0).paused(!1)},t.pause=function(i,s){return i!=null&&this.seek(i,s),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-Pt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Pt,this},t.isActive=function(){var i=this.parent||this._dp,s=this._start,n;return!!(!i||this._ts&&this._initted&&i.isActive()&&(n=i.rawTime(!0))>=s&&n<this.endTime(!0)-Pt)},t.eventCallback=function(i,s,n){var o=this.vars;return arguments.length>1?(s?(o[i]=s,n&&(o[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=s)):delete o[i],this):o[i]},t.then=function(i){var s=this;return new Promise(function(n){var o=Vt(i)?i:t0,a=function(){var l=s.then;s.then=null,Vt(o)&&(o=o(s))&&(o.then||o===s)&&(s.then=l),n(o),s.then=l};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?a():s._prom=a})},t.kill=function(){ho(this)},r}();Ye(co.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Pt,_prom:0,_ps:!1,_rts:1});var xe=function(r){Bg(t,r);function t(i,s){var n;return i===void 0&&(i={}),n=r.call(this,i)||this,n.labels={},n.smoothChildTiming=!!i.smoothChildTiming,n.autoRemoveChildren=!!i.autoRemoveChildren,n._sort=ve(i.sortChildren),Wt&&Pi(i.parent||Wt,er(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&n0(er(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return no(0,arguments,this),this},e.from=function(s,n,o){return no(1,arguments,this),this},e.fromTo=function(s,n,o,a){return no(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,so(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new zt(s,n,ze(this,o),1),this},e.call=function(s,n,o){return Pi(this,zt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,u){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=u,o.parent=this,new zt(s,o,ze(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,u){return o.runBackwards=1,so(o).immediateRender=ve(o.immediateRender),this.staggerTo(s,n,o,a,h,l,u)},e.staggerFromTo=function(s,n,o,a,h,l,u,c){return a.startAt=o,so(a).immediateRender=ve(a.immediateRender),this.staggerTo(s,n,a,h,l,u,c)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=s<=0?0:se(s),c=this._zTime<0!=s<0&&(this._initted||!l),d,p,m,f,g,y,_,b,v,S,E,I;if(this!==Wt&&u>h&&s>=0&&(u=h),u!==this._tTime||o||c){if(a!==this._time&&l&&(u+=this._time-a,s+=this._time-a),d=u,v=this._start,b=this._ts,y=!b,c&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(E=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=se(u%g),u===h?(f=this._repeat,d=l):(f=~~(u/g),f&&f===u/g&&(d=l,f--),d>l&&(d=l)),S=en(this._tTime,g),!a&&this._tTime&&S!==f&&this._tTime-S*g-this._dur<=0&&(S=f),E&&f&1&&(d=l-d,I=1),f!==S&&!this._lock){var A=E&&S&1,P=A===(E&&f&1);if(f<S&&(A=!A),a=A?0:u%l?l:u,this._lock=1,this.render(a||(I?0:se(f*g)),n,!l)._lock=0,this._tTime=u,!n&&this.parent&&Ge(this,"onRepeat"),this.vars.repeatRefresh&&!I&&(this.invalidate()._lock=1),a&&a!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,h=this._tDur,P&&(this._lock=2,a=A?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!I&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;w0(this,I)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(_=lE(this,se(a),se(d)),_&&(u-=d-(d=_._start))),this._tTime=u,this._time=d,this._act=!b,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&d&&!n&&!f&&(Ge(this,"onStart"),this._tTime!==u))return this;if(d>=a&&s>=0)for(p=this._first;p;){if(m=p._next,(p._act||d>=p._start)&&p._ts&&_!==p){if(p.parent!==this)return this.render(s,n,o);if(p.render(p._ts>0?(d-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(d-p._start)*p._ts,n,o),d!==this._time||!this._ts&&!y){_=0,m&&(u+=this._zTime=-Pt);break}}p=m}else{p=this._last;for(var O=s<0?s:d;p;){if(m=p._prev,(p._act||O<=p._end)&&p._ts&&_!==p){if(p.parent!==this)return this.render(s,n,o);if(p.render(p._ts>0?(O-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(O-p._start)*p._ts,n,o||ce&&(p._initted||p._startAt)),d!==this._time||!this._ts&&!y){_=0,m&&(u+=this._zTime=O?-Pt:Pt);break}}p=m}}if(_&&!n&&(this.pause(),_.render(d>=a?0:-Pt)._zTime=d>=a?1:-1,this._ts))return this._start=v,lh(this),this.render(s,n,o);this._onUpdate&&!n&&Ge(this,"onUpdate",!0),(u===h&&this._tTime>=this.totalDuration()||!u&&a)&&(v===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(u===h&&this._ts>0||!u&&this._ts<0)&&Rr(this,1),!n&&!(s<0&&!a)&&(u||a||!h)&&(Ge(this,u===h&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(s,n){var o=this;if(ir(n)||(n=ze(this,n,s)),!(s instanceof co)){if(de(s))return s.forEach(function(a){return o.add(a,n)}),this;if(re(s))return this.addLabel(s,n);if(Vt(s))s=zt.delayedCall(0,s);else return this}return this!==s?Pi(this,s,n):this},e.getChildren=function(s,n,o,a){s===void 0&&(s=!0),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=-Ke);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof zt?n&&h.push(l):(o&&h.push(l),s&&h.push.apply(h,l.getChildren(!0,n,o)))),l=l._next;return h},e.getById=function(s){for(var n=this.getChildren(1,1,1),o=n.length;o--;)if(n[o].vars.id===s)return n[o]},e.remove=function(s){return re(s)?this.removeLabel(s):Vt(s)?this.killTweensOf(s):(ah(this,s),s===this._recent&&(this._recent=this._last),ls(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=se(Ne.time-(this._ts>0?s/this._ts:(this.totalDuration()-s)/-this._ts))),r.prototype.totalTime.call(this,s,n),this._forcing=0,this):this._tTime},e.addLabel=function(s,n){return this.labels[s]=ze(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=zt.delayedCall(0,n||ro,o);return a.data="isPause",this._hasPause=1,Pi(this,a,ze(this,s))},e.removePause=function(s){var n=this._first;for(s=ze(this,s);n;)n._start===s&&n.data==="isPause"&&Rr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Lr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=je(s),h=this._first,l=ir(n),u;h;)h instanceof zt?iE(h._targets,a)&&(l?(!Lr||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(u=h.getTweensOf(a,n)).length&&o.push.apply(o,u),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=ze(o,s),h=n,l=h.startAt,u=h.onStart,c=h.onStartParams,d=h.immediateRender,p,m=zt.to(o,Ye({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale())||Pt,onStart:function(){if(o.pause(),!p){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());m._dur!==g&&rn(m,g,0,1).render(m._time,!0,!0),p=1}u&&u.apply(m,c||[])}},n));return d?m.render(0):m},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,Ye({startAt:{time:ze(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),m0(this,ze(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),m0(this,ze(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Pt)},e.shiftChildren=function(s,n,o){o===void 0&&(o=0);for(var a=this._first,h=this.labels,l;a;)a._start>=o&&(a._start+=s,a._end+=s),a=a._next;if(n)for(l in h)h[l]>=o&&(h[l]+=s);return ls(this)},e.invalidate=function(s){var n=this._first;for(this._lock=0;n;)n.invalidate(s),n=n._next;return r.prototype.invalidate.call(this,s)},e.clear=function(s){s===void 0&&(s=!0);for(var n=this._first,o;n;)o=n._next,this.remove(n),n=o;return this._dp&&(this._time=this._tTime=this._pTime=0),s&&(this.labels={}),ls(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=Ke,l,u,c;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(c=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),u=a._start,u>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Pi(o,a,u-a._delay,1)._lock=0):h=u,u<0&&a._ts&&(n-=u,(!c&&!o._dp||c&&c.smoothChildTiming)&&(o._start+=u/o._ts,o._time-=u,o._tTime-=u),o.shiftChildren(-u,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;rn(o,o===Wt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Wt._ts&&(Qg(Wt,hh(s,Wt)),jg=Ne.frame),Ne.frame>=Jg){Jg+=Me.autoSleep||120;var n=Wt._first;if((!n||!n._ts)&&Me.autoSleep&&Ne._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||Ne.sleep()}}},t}(co);Ye(xe.prototype,{_lock:0,_hasPause:0,_forcing:0});var EE=function(t,e,i,s,n,o,a){var h=new we(this._pt,t,e,0,1,P0,null,n),l=0,u=0,c,d,p,m,f,g,y,_;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=ao(s)),o&&(_=[i,s],o(_,t,e),i=_[0],s=_[1]),d=i.match(uc)||[];c=uc.exec(s);)m=c[0],f=s.substring(l,c.index),p?p=(p+1)%5:f.substr(-5)==="rgba("&&(p=1),m!==d[u++]&&(g=parseFloat(d[u-1])||0,h._pt={_next:h._pt,p:f||u===1?f:",",s:g,c:m.charAt(1)==="="?tn(g,m)-g:parseFloat(m)-g,m:p&&p<4?Math.round:0},l=uc.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(Vg.test(s)||y)&&(h.e=0),this._pt=h,h},Ic=function(t,e,i,s,n,o,a,h,l,u){Vt(s)&&(s=s(n||0,t,o));var c=t[e],d=i!=="get"?i:Vt(c)?l?t[e.indexOf("set")||!Vt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,p=Vt(c)?l?ME:R0:Mc,m;if(re(s)&&(~s.indexOf("random(")&&(s=ao(s)),s.charAt(1)==="="&&(m=tn(d,s)+(pe(d)||0),(m||m===0)&&(s=m))),!u||d!==s||Ac)return!isNaN(d*s)&&s!==""?(m=new we(this._pt,t,e,+d||0,s-(d||0),typeof c=="boolean"?LE:M0,0,p),l&&(m.fp=l),a&&m.modifier(a,this,t),this._pt=m):(!c&&!(e in t)&&pc(e,s),EE.call(this,t,e,d,s,p,h||Me.stringFilter,l))},CE=function(t,e,i,s,n){if(Vt(t)&&(t=po(t,n,e,i,s)),!Mi(t)||t.style&&t.nodeType||de(t)||Xg(t))return re(t)?po(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=po(t[a],n,e,i,s);return o},C0=function(t,e,i,s,n,o){var a,h,l,u;if(Le[t]&&(a=new Le[t]).init(n,a.rawVars?e[t]:CE(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new we(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==sn))for(l=i._ptLookup[i._targets.indexOf(n)],u=a._props.length;u--;)l[a._props[u]]=h;return a},Lr,Ac,Rc=function r(t,e,i){var s=t.vars,n=s.ease,o=s.startAt,a=s.immediateRender,h=s.lazy,l=s.onUpdate,u=s.runBackwards,c=s.yoyoEase,d=s.keyframes,p=s.autoRevert,m=t._dur,f=t._startAt,g=t._targets,y=t.parent,_=y&&y.data==="nested"?y.vars.targets:g,b=t._overwrite==="auto"&&!nc,v=t.timeline,S,E,I,A,P,O,W,L,C,N,X,K,Z;if(v&&(!d||!n)&&(n="none"),t._ease=us(n,Qs.ease),t._yEase=c?T0(us(c===!0?n:c,Qs.ease)):0,c&&t._yoyo&&!t._repeat&&(c=t._yEase,t._yEase=t._ease,t._ease=c),t._from=!v&&!!s.runBackwards,!v||d&&!s.stagger){if(L=g[0]?as(g[0]).harness:0,K=L&&s[L.prop],S=oh(s,fc),f&&(f._zTime<0&&f.progress(1),e<0&&u&&a&&!p?f.render(-1,!0):f.revert(u&&m?rh:tE),f._lazy=0),o){if(Rr(t._startAt=zt.set(g,Ye({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!f&&ve(h),startAt:null,delay:0,onUpdate:l&&function(){return Ge(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce||!a&&!p)&&t._startAt.revert(rh),a&&m&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(u&&m&&!f){if(e&&(a=!1),I=Ye({overwrite:!1,data:"isFromStart",lazy:a&&!f&&ve(h),immediateRender:a,stagger:0,parent:y},S),K&&(I[L.prop]=K),Rr(t._startAt=zt.set(g,I)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce?t._startAt.revert(rh):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Pt,Pt);else if(!e)return}for(t._pt=t._ptCache=0,h=m&&ve(h)||h&&!m,E=0;E<g.length;E++){if(P=g[E],W=P._gsap||bc(g)[E]._gsap,t._ptLookup[E]=N={},mc[W.id]&&Ar.length&&nh(),X=_===g?E:_.indexOf(P),L&&(C=new L).init(P,K||S,t,X,_)!==!1&&(t._pt=A=new we(t._pt,P,C.name,0,1,C.render,C,0,C.priority),C._props.forEach(function(z){N[z]=A}),C.priority&&(O=1)),!L||K)for(I in S)Le[I]&&(C=C0(I,S,t,X,P,_))?C.priority&&(O=1):N[I]=A=Ic.call(t,P,I,"get",S[I],X,_,0,s.stringFilter);t._op&&t._op[E]&&t.kill(P,t._op[E]),b&&t._pt&&(Lr=t,Wt.killTweensOf(P,N,t.globalTime(e)),Z=!t.parent,Lr=0),t._pt&&h&&(mc[W.id]=1)}O&&L0(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!Z,d&&e<=0&&v.render(Ke,!0,!0)},IE=function(t,e,i,s,n,o,a,h){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],u,c,d,p;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,p=t._targets.length;p--;){if(u=d[p][e],u&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==e&&u.fp!==e;)u=u._next;if(!u)return Ac=1,t.vars[e]="+=0",Rc(t,a),Ac=0,h?io(e+" not eligible for reset"):1;l.push(u)}for(p=l.length;p--;)c=l[p],u=c._pt||c,u.s=(s||s===0)&&!n?s:u.s+(s||0)+o*u.c,u.c=i-u.s,c.e&&(c.e=Ht(i)+pe(c.e)),c.b&&(c.b=u.s+pe(c.b))},AE=function(t,e){var i=t[0]?as(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=hs({},e);for(o in s)if(o in n)for(h=s[o].split(","),a=h.length;a--;)n[h[a]]=n[o];return n},RE=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(de(e))a=i[t]||(i[t]=[]),e.forEach(function(h,l){return a.push({t:l/(e.length-1)*100,v:h,e:n})});else for(o in e)a=i[o]||(i[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:e[o],e:n})},po=function(t,e,i,s,n){return Vt(t)?t.call(e,i,s,n):re(t)&&~t.indexOf("random(")?ao(t):t},I0=yc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",A0={};Te(I0+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return A0[r]=1});var zt=function(r){Bg(t,r);function t(i,s,n,o){var a;typeof s=="number"&&(n.duration=s,s=n,n=null),a=r.call(this,o?s:so(s))||this;var h=a.vars,l=h.duration,u=h.delay,c=h.immediateRender,d=h.stagger,p=h.overwrite,m=h.keyframes,f=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,_=s.parent||Wt,b=(de(i)||Xg(i)?ir(i[0]):"length"in s)?[i]:je(i),v,S,E,I,A,P,O,W;if(a._targets=b.length?bc(b):io("GSAP target "+i+" not found. https://gsap.com",!Me.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=p,m||d||eh(l)||eh(u)){if(s=a.vars,v=a.timeline=new xe({data:"nested",defaults:f||{},targets:_&&_.data==="nested"?_.vars.targets:b}),v.kill(),v.parent=v._dp=er(a),v._start=0,d||eh(l)||eh(u)){if(I=b.length,O=d&&u0(d),Mi(d))for(A in d)~I0.indexOf(A)&&(W||(W={}),W[A]=d[A]);for(S=0;S<I;S++)E=oh(s,A0),E.stagger=0,y&&(E.yoyoEase=y),W&&hs(E,W),P=b[S],E.duration=+po(l,er(a),S,P,b),E.delay=(+po(u,er(a),S,P,b)||0)-a._delay,!d&&I===1&&E.delay&&(a._delay=u=E.delay,a._start+=u,E.delay=0),v.to(P,E,O?O(S,P,b):0),v._ease=St.none;v.duration()?l=u=0:a.timeline=0}else if(m){so(Ye(v.vars.defaults,{ease:"none"})),v._ease=us(m.ease||s.ease||"none");var L=0,C,N,X;if(de(m))m.forEach(function(K){return v.to(b,K,">")}),v.duration();else{E={};for(A in m)A==="ease"||A==="easeEach"||RE(A,m[A],E,m.easeEach);for(A in E)for(C=E[A].sort(function(K,Z){return K.t-Z.t}),L=0,S=0;S<C.length;S++)N=C[S],X={ease:N.e,duration:(N.t-(S?C[S-1].t:0))/100*l},X[A]=N.v,v.to(b,X,L),L+=X.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return p===!0&&!nc&&(Lr=er(a),Wt.killTweensOf(b),Lr=0),Pi(_,er(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(c||!l&&!m&&a._start===se(_._time)&&ve(c)&&oE(er(a))&&_.data!=="nested")&&(a._tTime=-Pt,a.render(Math.max(0,-u)||0)),g&&n0(er(a),g),a}var e=t.prototype;return e.render=function(s,n,o){var a=this._time,h=this._tDur,l=this._dur,u=s<0,c=s>h-Pt&&!u?h:s<Pt?0:s,d,p,m,f,g,y,_,b,v;if(!l)hE(this,s,n,o);else if(c!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u){if(d=c,b=this.timeline,this._repeat){if(f=l+this._rDelay,this._repeat<-1&&u)return this.totalTime(f*100+s,n,o);if(d=se(c%f),c===h?(m=this._repeat,d=l):(m=~~(c/f),m&&m===se(c/f)&&(d=l,m--),d>l&&(d=l)),y=this._yoyo&&m&1,y&&(v=this._yEase,d=l-d),g=en(this._tTime,f),d===a&&!o&&this._initted&&m===g)return this._tTime=c,this;m!==g&&(b&&this._yEase&&w0(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==l&&this._initted&&(this._lock=o=1,this.render(se(f*m),!0).invalidate()._lock=0))}if(!this._initted){if(o0(this,u?s:d,o,n,c))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&m!==g))return this;if(l!==this._dur)return this.render(s,n,o)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=_=(v||this._ease)(d/l),this._from&&(this.ratio=_=1-_),d&&!a&&!n&&!m&&(Ge(this,"onStart"),this._tTime!==c))return this;for(p=this._pt;p;)p.r(_,p.d),p=p._next;b&&b.render(s<0?s:!d&&y?-Pt:b._dur*b._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(u&&xc(this,s,n,o),Ge(this,"onUpdate")),this._repeat&&m!==g&&this.vars.onRepeat&&!n&&this.parent&&Ge(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&xc(this,s,!0,!0),(s||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&Rr(this,1),!n&&!(u&&!a)&&(c||a||y)&&(Ge(this,c===h?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(s){return(!s||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(s),r.prototype.invalidate.call(this,s)},e.resetTo=function(s,n,o,a,h){uo||Ne.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),u;return this._initted||Rc(this,l),u=this._ease(l/this._dur),IE(this,s,n,o,a,u,l,h)?this.resetTo(s,n,o,a,1):(uh(this,0),this.parent||i0(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(s,n){if(n===void 0&&(n="all"),!s&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?ho(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Lr&&Lr.vars.overwrite!==!0)._first||ho(this),this.parent&&o!==this.timeline.totalDuration()&&rn(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?je(s):a,l=this._ptLookup,u=this._pt,c,d,p,m,f,g,y;if((!n||n==="all")&&sE(a,h))return n==="all"&&(this._pt=0),ho(this);for(c=this._op=this._op||[],n!=="all"&&(re(n)&&(f={},Te(n,function(_){return f[_]=1}),n=f),n=AE(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(c[y]=n,m=d,p={}):(p=c[y]=c[y]||{},m=n);for(f in m)g=d&&d[f],g&&((!("kill"in g.d)||g.d.kill(f)===!0)&&ah(this,g,"_pt"),delete d[f]),p!=="all"&&(p[f]=1)}return this._initted&&!this._pt&&u&&ho(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return no(1,arguments)},t.delayedCall=function(s,n,o,a){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:n,onReverseComplete:n,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(s,n,o){return no(2,arguments)},t.set=function(s,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(s,n)},t.killTweensOf=function(s,n,o){return Wt.killTweensOf(s,n,o)},t}(co);Ye(zt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Te("staggerTo,staggerFrom,staggerFromTo",function(r){zt[r]=function(){var t=new xe,e=vc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Mc=function(t,e,i){return t[e]=i},R0=function(t,e,i){return t[e](i)},ME=function(t,e,i,s){return t[e](s.fp,i)},PE=function(t,e,i){return t.setAttribute(e,i)},Pc=function(t,e){return Vt(t[e])?R0:ac(t[e])&&t.setAttribute?PE:Mc},M0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},LE=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},P0=function(t,e){var i=e._pt,s="";if(!t&&e.b)s=e.b;else if(t===1&&e.e)s=e.e;else{for(;i;)s=i.p+(i.m?i.m(i.s+i.c*t):Math.round((i.s+i.c*t)*1e4)/1e4)+s,i=i._next;s+=e.c}e.set(e.t,e.p,s,e)},Lc=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},GE=function(t,e,i,s){for(var n=this._pt,o;n;)o=n._next,n.p===s&&n.modifier(t,e,i),n=o},NE=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?ah(this,e,"_pt"):e.dep||(i=1),e=s;return!i},FE=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},L0=function(t){for(var e=t._pt,i,s,n,o;e;){for(i=e._next,s=n;s&&s.pr>e.pr;)s=s._next;(e._prev=s?s._prev:o)?e._prev._next=e:n=e,(e._next=s)?s._prev=e:o=e,e=i}t._pt=n},we=function(){function r(e,i,s,n,o,a,h,l,u){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||M0,this.d=h||this,this.set=l||Mc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(i,s,n){this.mSet=this.mSet||this.set,this.set=FE,this.m=i,this.mt=n,this.tween=s},r}();Te(yc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(r){return fc[r]=1}),Pe.TweenMax=Pe.TweenLite=zt,Pe.TimelineLite=Pe.TimelineMax=xe,Wt=new xe({sortChildren:!1,defaults:Qs,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Me.stringFilter=v0;var ds=[],ch={},DE=[],G0=0,kE=0,Gc=function(t){return(ch[t]||DE).map(function(e){return e()})},Nc=function(){var t=Date.now(),e=[];t-G0>2&&(Gc("matchMediaInit"),ds.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=He.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Gc("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),G0=t,Gc("matchMedia"))},N0=function(){function r(e,i){this.selector=i&&Tc(i),this.data=[],this._r=[],this.isReverted=!1,this.id=kE++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Vt(i)&&(n=s,s=i,i=Vt);var o=this,a=function(){var l=Zt,u=o.selector,c;return l&&l!==o&&l.data.push(o),n&&(o.selector=Tc(n)),Zt=o,c=s.apply(o,arguments),Vt(c)&&o._r.push(c),Zt=l,o.selector=u,o.isReverted=!1,c};return o.last=a,i===Vt?a(o,function(h){return o.add(null,h)}):i?o[i]=a:a},t.ignore=function(i){var s=Zt;Zt=null,i(this),Zt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof zt&&!(s.parent&&s.parent.data==="nested")&&i.push(s)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,s){var n=this;if(i?function(){for(var a=n.getTweens(),h=n.data.length,l;h--;)l=n.data[h],l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(u){return a.splice(a.indexOf(u),1)}));for(a.map(function(u){return{g:u._dur||u._delay||u._sat&&!u._sat.vars.immediateRender?u.globalTime(0):-1/0,t:u}}).sort(function(u,c){return c.g-u.g||-1/0}).forEach(function(u){return u.t.revert(i)}),h=n.data.length;h--;)l=n.data[h],l instanceof xe?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof zt)&&l.revert&&l.revert(i);n._r.forEach(function(u){return u(i,n)}),n.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=ds.length;o--;)ds[o].id===this.id&&ds.splice(o,1)},t.revert=function(i){this.kill(i||{})},r}(),OE=function(){function r(e){this.contexts=[],this.scope=e}var t=r.prototype;return t.add=function(i,s,n){Mi(i)||(i={matches:i});var o=new N0(0,n||this.scope),a=o.conditions={},h,l,u;Zt&&!o.selector&&(o.selector=Zt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?u=1:(h=He.matchMedia(i[l]),h&&(ds.indexOf(o)<0&&ds.push(o),(a[l]=h.matches)&&(u=1),h.addListener?h.addListener(Nc):h.addEventListener("change",Nc)));return u&&s(o,function(c){return o.add(null,c)}),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),dh={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach(function(s){return y0(s)})},timeline:function(t){return new xe(t)},getTweensOf:function(t,e){return Wt.getTweensOf(t,e)},getProperty:function(t,e,i,s){re(t)&&(t=je(t)[0]);var n=as(t||{}).get,o=i?t0:qg;return i==="native"&&(i=""),t&&(e?o((Le[e]&&Le[e].get||n)(t,e,i,s)):function(a,h,l){return o((Le[a]&&Le[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=je(t),t.length>1){var s=t.map(function(u){return Se.quickSetter(u,e,i)}),n=s.length;return function(u){for(var c=n;c--;)s[c](u)}}t=t[0]||{};var o=Le[e],a=as(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(u){var c=new o;sn._pt=0,c.init(t,i?u+i:u,sn,0,[t]),c.render(1,c),sn._pt&&Lc(1,sn)}:a.set(t,h);return o?l:function(u){return l(t,h,i?u+i:u,a,1)}},quickTo:function(t,e,i){var s,n=Se.to(t,hs((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,u){return n.resetTo(e,h,l,u)};return o.tween=n,o},isTweening:function(t){return Wt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=us(t.ease,Qs.ease)),e0(Qs,t||{})},config:function(t){return e0(Me,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,s=t.plugins,n=t.defaults,o=t.extendTimeline;(s||"").split(",").forEach(function(a){return a&&!Le[a]&&!Pe[a]&&io(e+" effect requires "+a+" plugin.")}),gc[e]=function(a,h,l){return i(je(a),Ye(h||{},n),l)},o&&(xe.prototype[e]=function(a,h,l){return this.add(gc[e](a,Mi(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){St[t]=us(e)},parseEase:function(t,e){return arguments.length?us(t,e):St},getById:function(t){return Wt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new xe(t),s,n;for(i.smoothChildTiming=ve(t.smoothChildTiming),Wt.remove(i),i._dp=0,i._time=i._tTime=Wt._time,s=Wt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof zt&&s.vars.onComplete===s._targets[0]))&&Pi(i,s,s._start-s._delay),s=n;return Pi(Wt,i,0),i},context:function(t,e){return t?new N0(t,e):Zt},matchMedia:function(t){return new OE(t)},matchMediaRefresh:function(){return ds.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||Nc()},addEventListener:function(t,e){var i=ch[t]||(ch[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=ch[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:gE,wrapYoyo:yE,distribute:u0,random:d0,snap:c0,normalize:mE,getUnit:pe,clamp:cE,splitColor:b0,toArray:je,selector:Tc,mapRange:f0,pipe:pE,unitize:fE,interpolate:bE,shuffle:l0},install:Yg,effects:gc,ticker:Ne,updateRoot:xe.updateRoot,plugins:Le,globalTimeline:Wt,core:{PropTween:we,globals:zg,Tween:zt,Timeline:xe,Animation:co,getCache:as,_removeLinkedListItem:ah,reverting:function(){return ce},context:function(t){return t&&Zt&&(Zt.data.push(t),t._ctx=Zt),Zt},suppressOverwrites:function(t){return nc=t}}};Te("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return dh[r]=zt[r]}),Ne.add(xe.updateRoot),sn=dh.to({},{duration:0});var WE=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},BE=function(t,e){var i=t._targets,s,n,o;for(s in e)for(n=i.length;n--;)o=t._ptLookup[n][s],o&&(o=o.d)&&(o._pt&&(o=WE(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},Fc=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(re(n)&&(h={},Te(n,function(u){return h[u]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}BE(a,n)}}}},Se=dh.registerPlugin({name:"attr",init:function(t,e,i,s,n){var o,a,h;this.tween=i;for(o in e)h=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(h||0)+"",e[o],s,n,0,0,o),a.op=o,a.b=h,this._props.push(o)},render:function(t,e){for(var i=e._pt;i;)ce?i.set(i.t,i.p,i.b,i):i.r(t,i.d),i=i._next}},{name:"endArray",init:function(t,e){for(var i=e.length;i--;)this.add(t,i,t[i]||0,e[i],0,0,0,0,0,1)}},Fc("roundProps",wc),Fc("modifiers"),Fc("snap",c0))||dh;zt.version=xe.version=Se.version="3.12.3",Hg=1,hc()&&nn(),St.Power0,St.Power1,St.Power2,St.Power3,St.Power4,St.Linear,St.Quad,St.Cubic,St.Quart,St.Quint,St.Strong,St.Elastic,St.Back,St.SteppedEase,St.Bounce,St.Sine,St.Expo,St.Circ;/*!
1168
+ * CSSPlugin 3.12.3
1169
+ * https://gsap.com
1170
1170
  *
1171
1171
  * Copyright 2008-2023, GreenSock. All rights reserved.
1172
- * Subject to the terms at https://greensock.com/standard-license or for
1173
- * Club GreenSock members, the agreement issued with that membership.
1172
+ * Subject to the terms at https://gsap.com/standard-license or for
1173
+ * Club GSAP members, the agreement issued with that membership.
1174
1174
  * @author: Jack Doyle, jack@greensock.com
1175
- */var F0,Gr,nn,Dc,ps,D0,kc,UE=function(){return typeof window<"u"},rr={},fs=180/Math.PI,on=Math.PI/180,an=Math.atan2,k0=1e8,Oc=/([A-Z])/g,XE=/(left|right|width|margin|padding|x)/i,ZE=/[\s,\(]\S/,Li={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Wc=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},VE=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},KE=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},HE=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},O0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},W0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},YE=function(t,e,i){return t.style[e]=i},zE=function(t,e,i){return t.style.setProperty(e,i)},jE=function(t,e,i){return t._gsap[e]=i},JE=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},$E=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},QE=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Bt="transform",li=Bt+"Origin",qE=function r(t,e){var i=this,s=this.target,n=s.style;if(t in rr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Li[t]||t,~t.indexOf(",")?t.split(",").forEach(function(o){return i.tfm[o]=sr(s,o)}):this.tfm[t]=s._gsap.x?s._gsap[t]:sr(s,t);else return Li.transform.split(",").forEach(function(o){return r.call(i,o,e)});if(this.props.indexOf(Bt)>=0)return;s._gsap.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(li,e,"")),t=Bt}(n||e)&&this.props.push(t,e,n[t])},B0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},tC=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(Oc,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=kc(),(!n||!n.isStart)&&!i[Bt]&&(B0(i),s.uncache=1)}},U0=function(t,e){var i={target:t,props:[],revert:tC,save:qE};return t._gsap||Se.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},X0,Bc=function(t,e){var i=Gr.createElementNS?Gr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Gr.createElement(t);return i.style?i:Gr.createElement(t)},Gi=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Oc,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,hn(e)||e,1)||""},Z0="O,Moz,ms,Ms,Webkit".split(","),hn=function(t,e,i){var s=e||ps,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(Z0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?Z0[o]:"")+t},Uc=function(){UE()&&window.document&&(F0=window,Gr=F0.document,nn=Gr.documentElement,ps=Bc("div")||{style:{}},Bc("div"),Bt=hn(Bt),li=Bt+"Origin",ps.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",X0=!!hn("perspective"),kc=Se.core.reverting,Dc=1)},Xc=function r(t){var e=Bc("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(nn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),nn.removeChild(e),this.style.cssText=n,o},V0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},K0=function(t){var e;try{e=t.getBBox()}catch{e=Xc.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===Xc||(e=Xc.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+V0(t,["x","cx","x1"])||0,y:+V0(t,["y","cy","y1"])||0,width:0,height:0}:e},H0=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&K0(t))},co=function(t,e){if(e){var i=t.style;e in rr&&e!==li&&(e=Bt),i.removeProperty?((e.substr(0,2)==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(e.replace(Oc,"-$1").toLowerCase())):i.removeAttribute(e)}},Nr=function(t,e,i,s,n,o){var a=new we(t._pt,e,i,0,1,o?W0:O0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},Y0={deg:1,rad:1,turn:1},eC={grid:1,flex:1},Fr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ps.style,h=XE.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(h?"Width":"Height"),c=100,d=s==="px",p=s==="%",m,f,g,y;return s===o||!n||Y0[s]||Y0[o]?n:(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&H0(t),(p||o==="%")&&(rr[e]||~e.indexOf("adius"))?(m=y?t.getBBox()[h?"width":"height"]:t[u],Ht(p?n/m*c:n/100*m)):(a[h?"width":"height"]=c+(d?o:s),f=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(f=(t.ownerSVGElement||{}).parentNode),(!f||f===Gr||!f.appendChild)&&(f=Gr.body),g=f._gsap,g&&p&&g.width&&h&&g.time===Le.time&&!g.uncache?Ht(n/g.width*c):((p||o==="%")&&!eC[Gi(f,"display")]&&(a.position=Gi(t,"position")),f===t&&(a.position="static"),f.appendChild(ps),m=ps[u],f.removeChild(ps),a.position="absolute",h&&p&&(g=as(f),g.time=Le.time,g.width=f[u]),Ht(d?m*n/c:m&&n?c/m*n:0))))},sr=function(t,e,i,s){var n;return Dc||Uc(),e in Li&&e!=="transform"&&(e=Li[e],~e.indexOf(",")&&(e=e.split(",")[0])),rr[e]&&e!=="transform"?(n=fo(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:fh(Gi(t,li))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=ph[e]&&ph[e](t,e,i)||Gi(t,e)||$g(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Fr(t,e,n,i)+i:n},iC=function(t,e,i,s){if(!i||i==="none"){var n=hn(e,t,1),o=n&&Gi(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Gi(t,"borderTopColor"))}var a=new we(this._pt,t.style,e,0,1,P0),h=0,l=0,u,c,d,p,m,f,g,y,_,b,v,S;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(t.style[e]=s,s=Gi(t,e)||s,t.style[e]=i),u=[i,s],v0(u),i=u[0],s=u[1],d=i.match(Qs)||[],S=s.match(Qs)||[],S.length){for(;c=Qs.exec(s);)g=c[0],_=s.substring(h,c.index),m?m=(m+1)%5:(_.substr(-5)==="rgba("||_.substr(-5)==="hsla(")&&(m=1),g!==(f=d[l++]||"")&&(p=parseFloat(f)||0,v=f.substr((p+"").length),g.charAt(1)==="="&&(g=qs(p,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=Qs.lastIndex-b.length,b||(b=b||Re.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(p=Fr(t,e,f,b)||0),a._pt={_next:a._pt,p:_||l===1?_:",",s:p,c:y-p,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?W0:O0;return Vg.test(s)&&(a.e=0),this._pt=a,a},z0={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},rC=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=z0[i]||i,e[1]=z0[s]||s,e.join(" ")},sC=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],rr[a]&&(h=1,a=a==="transformOrigin"?li:Bt),co(i,a);h&&(co(i,Bt),o&&(o.svg&&i.removeAttribute("transform"),fo(i,1),o.uncache=1,B0(s)))}},ph={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new we(t._pt,e,i,0,0,sC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},po=[1,0,0,1,0,0],j0={},J0=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},$0=function(t){var e=Gi(t,Bt);return J0(e)?po:e.substr(7).match(Zg).map(Ht)},Zc=function(t,e){var i=t._gsap||as(t),s=t.style,n=$0(t),o,a,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?po:n):(n===po&&!t.offsetParent&&t!==nn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,nn.appendChild(t)),n=$0(t),h?s.display=h:co(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):nn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Vc=function(t,e,i,s,n,o){var a=t._gsap,h=n||Zc(t,!0),l=a.xOrigin||0,u=a.yOrigin||0,c=a.xOffset||0,d=a.yOffset||0,p=h[0],m=h[1],f=h[2],g=h[3],y=h[4],_=h[5],b=e.split(" "),v=parseFloat(b[0])||0,S=parseFloat(b[1])||0,E,A,I,P;i?h!==po&&(A=p*g-m*f)&&(I=v*(g/A)+S*(-f/A)+(f*_-g*y)/A,P=v*(-m/A)+S*(p/A)-(p*_-m*y)/A,v=I,S=P):(E=K0(t),v=E.x+(~b[0].indexOf("%")?v/100*E.width:v),S=E.y+(~(b[1]||b[0]).indexOf("%")?S/100*E.height:S)),s||s!==!1&&a.smooth?(y=v-l,_=S-u,a.xOffset=c+(y*p+_*f)-y,a.yOffset=d+(y*m+_*g)-_):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=S,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[li]="0px 0px",o&&(Nr(o,a,"xOrigin",l,v),Nr(o,a,"yOrigin",u,S),Nr(o,a,"xOffset",c,a.xOffset),Nr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+S)},fo=function(t,e){var i=t._gsap||new E0(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Gi(t,li)||"0",u,c,d,p,m,f,g,y,_,b,v,S,E,A,I,P,W,D,L,C,N,U,K,Z,z,k,F,G,V,$,ut,nt;return u=c=d=f=g=y=_=b=v=0,p=m=1,i.svg=!!(t.getCTM&&H0(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Bt]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Bt]!=="none"?h[Bt]:"")),s.scale=s.rotate=s.translate="none"),A=Zc(t,i.svg),i.svg&&(i.uncache?(z=t.getBBox(),l=i.xOrigin-z.x+"px "+(i.yOrigin-z.y)+"px",Z=""):Z=!e&&t.getAttribute("data-svg-origin"),Vc(t,Z||l,!!Z||i.originIsAbsolute,i.smooth!==!1,A)),S=i.xOrigin||0,E=i.yOrigin||0,A!==po&&(D=A[0],L=A[1],C=A[2],N=A[3],u=U=A[4],c=K=A[5],A.length===6?(p=Math.sqrt(D*D+L*L),m=Math.sqrt(N*N+C*C),f=D||L?an(L,D)*fs:0,_=C||N?an(C,N)*fs+f:0,_&&(m*=Math.abs(Math.cos(_*on))),i.svg&&(u-=S-(S*D+E*C),c-=E-(S*L+E*N))):(nt=A[6],$=A[7],F=A[8],G=A[9],V=A[10],ut=A[11],u=A[12],c=A[13],d=A[14],I=an(nt,V),g=I*fs,I&&(P=Math.cos(-I),W=Math.sin(-I),Z=U*P+F*W,z=K*P+G*W,k=nt*P+V*W,F=U*-W+F*P,G=K*-W+G*P,V=nt*-W+V*P,ut=$*-W+ut*P,U=Z,K=z,nt=k),I=an(-C,V),y=I*fs,I&&(P=Math.cos(-I),W=Math.sin(-I),Z=D*P-F*W,z=L*P-G*W,k=C*P-V*W,ut=N*W+ut*P,D=Z,L=z,C=k),I=an(L,D),f=I*fs,I&&(P=Math.cos(I),W=Math.sin(I),Z=D*P+L*W,z=U*P+K*W,L=L*P-D*W,K=K*P-U*W,D=Z,U=z),g&&Math.abs(g)+Math.abs(f)>359.9&&(g=f=0,y=180-y),p=Ht(Math.sqrt(D*D+L*L+C*C)),m=Ht(Math.sqrt(K*K+nt*nt)),I=an(U,K),_=Math.abs(I)>2e-4?I*fs:0,v=ut?1/(ut<0?-ut:ut):0),i.svg&&(Z=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!J0(Gi(t,Bt)),Z&&t.setAttribute("transform",Z))),Math.abs(_)>90&&Math.abs(_)<270&&(n?(p*=-1,_+=f<=0?180:-180,f+=f<=0?180:-180):(m*=-1,_+=_<=0?180:-180)),e=e||i.uncache,i.x=u-((i.xPercent=u&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=c-((i.yPercent=c&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=Ht(p),i.scaleY=Ht(m),i.rotation=Ht(f)+a,i.rotationX=Ht(g)+a,i.rotationY=Ht(y)+a,i.skewX=_+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||0)&&(s[li]=fh(l)),i.xOffset=i.yOffset=0,i.force3D=Re.force3D,i.renderTransform=i.svg?oC:X0?Q0:nC,i.uncache=0,i},fh=function(t){return(t=t.split(" "))[0]+" "+t[1]},Kc=function(t,e,i){var s=pe(e);return Ht(parseFloat(e)+parseFloat(Fr(t,"x",i+"px",s)))+s},nC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Q0(t,e)},ms="0deg",mo="0px",gs=") ",Q0=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,u=i.rotationY,c=i.rotationX,d=i.skewX,p=i.skewY,m=i.scaleX,f=i.scaleY,g=i.transformPerspective,y=i.force3D,_=i.target,b=i.zOrigin,v="",S=y==="auto"&&t&&t!==1||y===!0;if(b&&(c!==ms||u!==ms)){var E=parseFloat(u)*on,A=Math.sin(E),I=Math.cos(E),P;E=parseFloat(c)*on,P=Math.cos(E),o=Kc(_,o,A*P*-b),a=Kc(_,a,-Math.sin(E)*-b),h=Kc(_,h,I*P*-b+b)}g!==mo&&(v+="perspective("+g+gs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(S||o!==mo||a!==mo||h!==mo)&&(v+=h!==mo||S?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+gs),l!==ms&&(v+="rotate("+l+gs),u!==ms&&(v+="rotateY("+u+gs),c!==ms&&(v+="rotateX("+c+gs),(d!==ms||p!==ms)&&(v+="skew("+d+", "+p+gs),(m!==1||f!==1)&&(v+="scale("+m+", "+f+gs),_.style[Bt]=v||"translate(0, 0)"},oC=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,u=i.skewY,c=i.scaleX,d=i.scaleY,p=i.target,m=i.xOrigin,f=i.yOrigin,g=i.xOffset,y=i.yOffset,_=i.forceCSS,b=parseFloat(o),v=parseFloat(a),S,E,A,I,P;h=parseFloat(h),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,h+=u),h||l?(h*=on,l*=on,S=Math.cos(h)*c,E=Math.sin(h)*c,A=Math.sin(h-l)*-d,I=Math.cos(h-l)*d,l&&(u*=on,P=Math.tan(l-u),P=Math.sqrt(1+P*P),A*=P,I*=P,u&&(P=Math.tan(u),P=Math.sqrt(1+P*P),S*=P,E*=P)),S=Ht(S),E=Ht(E),A=Ht(A),I=Ht(I)):(S=c,I=d,E=A=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Fr(p,"x",o,"px"),v=Fr(p,"y",a,"px")),(m||f||g||y)&&(b=Ht(b+m-(m*S+f*A)+g),v=Ht(v+f-(m*E+f*I)+y)),(s||n)&&(P=p.getBBox(),b=Ht(b+s/100*P.width),v=Ht(v+n/100*P.height)),P="matrix("+S+","+E+","+A+","+I+","+b+","+v+")",p.setAttribute("transform",P),_&&(p.style[Bt]=P)},aC=function(t,e,i,s,n){var o=360,a=re(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?fs:1),l=h-s,u=s+l+"deg",c,d;return a&&(c=n.split("_")[1],c==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),c==="cw"&&l<0?l=(l+o*k0)%o-~~(l/o)*o:c==="ccw"&&l>0&&(l=(l-o*k0)%o-~~(l/o)*o)),t._pt=d=new we(t._pt,e,i,s,l,VE),d.e=u,d.u="deg",t._props.push(i),d},q0=function(t,e){for(var i in e)t[i]=e[i];return t},hC=function(t,e,i){var s=q0({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,u,c,d,p,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Bt]=e,a=fo(i,1),co(i,Bt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Bt],o[Bt]=e,a=fo(i,1),o[Bt]=l);for(h in rr)l=s[h],u=a[h],l!==u&&n.indexOf(h)<0&&(p=pe(l),m=pe(u),c=p!==m?Fr(i,h,l,m):parseFloat(l),d=parseFloat(u),t._pt=new we(t._pt,a,h,c,d-c,Wc),t._pt.u=m||0,t._props.push(h));q0(a,s)};ve("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});ph[t>1?"border"+r:r]=function(a,h,l,u,c){var d,p;if(arguments.length<4)return d=o.map(function(m){return sr(a,m,l)}),p=d.join(" "),p.split(d[0]).length===5?d[0]:p;d=(u+"").split(" "),p={},o.forEach(function(m,f){return p[m]=d[f]=d[f]||d[(f-1)/2|0]}),a.init(h,p,c)}});var ty={name:"css",register:Uc,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,u,c,d,p,m,f,g,y,_,b,v,S,E,A,I;Dc||Uc(),this.styles=this.styles||U0(t),I=this.styles.props,this.tween=i;for(f in e)if(f!=="autoRound"&&(u=e[f],!(Pe[f]&&C0(f,e,i,s,t,n)))){if(p=typeof u,m=ph[f],p==="function"&&(u=u.call(i,s,t,n),p=typeof u),p==="string"&&~u.indexOf("random(")&&(u=no(u)),m)m(this,t,f,u,i)&&(A=1);else if(f.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(f)+"").trim(),u+="",Pr.lastIndex=0,Pr.test(l)||(g=pe(l),y=pe(u)),y?g!==y&&(l=Fr(t,f,l,y)+y):g&&(u+=g),this.add(a,"setProperty",l,u,s,n,0,0,f),o.push(f),I.push(f,0,a[f]);else if(p!=="undefined"){if(h&&f in h?(l=typeof h[f]=="function"?h[f].call(i,s,t,n):h[f],re(l)&&~l.indexOf("random(")&&(l=no(l)),pe(l+"")||(l+=Re.units[f]||pe(sr(t,f))||""),(l+"").charAt(1)==="="&&(l=sr(t,f))):l=sr(t,f),d=parseFloat(l),_=p==="string"&&u.charAt(1)==="="&&u.substr(0,2),_&&(u=u.substr(2)),c=parseFloat(u),f in Li&&(f==="autoAlpha"&&(d===1&&sr(t,"visibility")==="hidden"&&c&&(d=0),I.push("visibility",0,a.visibility),Nr(this,a,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),f!=="scale"&&f!=="transform"&&(f=Li[f],~f.indexOf(",")&&(f=f.split(",")[0]))),b=f in rr,b){if(this.styles.save(f),v||(S=t._gsap,S.renderTransform&&!e.parseTransform||fo(t,e.parseTransform),E=e.smoothOrigin!==!1&&S.smooth,v=this._pt=new we(this._pt,a,Bt,0,1,S.renderTransform,S,0,-1),v.dep=1),f==="scale")this._pt=new we(this._pt,S,"scaleY",S.scaleY,(_?qs(S.scaleY,_+c):c)-S.scaleY||0,Wc),this._pt.u=0,o.push("scaleY",f),f+="X";else if(f==="transformOrigin"){I.push(li,0,a[li]),u=rC(u),S.svg?Vc(t,u,0,E,0,this):(y=parseFloat(u.split(" ")[2])||0,y!==S.zOrigin&&Nr(this,S,"zOrigin",S.zOrigin,y),Nr(this,a,f,fh(l),fh(u)));continue}else if(f==="svgOrigin"){Vc(t,u,1,E,0,this);continue}else if(f in j0){aC(this,S,f,d,_?qs(d,_+u):u);continue}else if(f==="smoothOrigin"){Nr(this,S,"smooth",S.smooth,u);continue}else if(f==="force3D"){S[f]=u;continue}else if(f==="transform"){hC(this,u,t);continue}}else f in a||(f=hn(f)||f);if(b||(c||c===0)&&(d||d===0)&&!ZE.test(u)&&f in a)g=(l+"").substr((d+"").length),c||(c=0),y=pe(u)||(f in Re.units?Re.units[f]:g),g!==y&&(d=Fr(t,f,l,y)),this._pt=new we(this._pt,b?S:a,f,d,(_?qs(d,_+c):c)-d,!b&&(y==="px"||f==="zIndex")&&e.autoRound!==!1?HE:Wc),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=KE);else if(f in a)iC.call(this,t,f,l,_?_+u:u);else if(f in t)this.add(t,f,l||t[f],_?_+u:u,s,n);else if(f!=="parseTransform"){pc(f,u);continue}b||(f in a?I.push(f,0,a[f]):I.push(f,1,l||t[f])),o.push(f)}}A&&L0(this)},render:function(t,e){if(e.tween._time||!kc())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:sr,aliases:Li,getSetter:function(t,e,i){var s=Li[e];return s&&s.indexOf(",")<0&&(e=s),e in rr&&e!==li&&(t._gsap.x||sr(t,"x"))?i&&D0===i?e==="scale"?JE:jE:(D0=i||{})&&(e==="scale"?$E:QE):t.style&&!ac(t.style[e])?YE:~e.indexOf("-")?zE:Pc(t,e)},core:{_removeProperty:co,_getMatrix:Zc}};Se.utils.checkPrefix=hn,Se.core.getStyleSaver=U0,function(r,t,e,i){var s=ve(r+","+t+","+e,function(n){rr[n]=1});ve(t,function(n){Re.units[n]="deg",j0[n]=1}),Li[s[13]]=r+","+t,ve(i,function(n){var o=n.split(":");Li[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),ve("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Re.units[r]="px"}),Se.registerPlugin(ty);var ey=Se.registerPlugin(ty)||Se;ey.core.Tween;const ys=new dt;class lC{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,ys),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=ys.right>t.left&&ys.left<t.right&&ys.bottom>t.top&&ys.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(ys):e.getBounds(!0,ys);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}var mh={exports:{}};mh.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",u="[object Boolean]",c="[object Date]",d="[object Error]",p="[object Function]",m="[object GeneratorFunction]",f="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Promise]",v="[object Proxy]",S="[object RegExp]",E="[object Set]",A="[object String]",I="[object Symbol]",P="[object Undefined]",W="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",C="[object Float32Array]",N="[object Float64Array]",U="[object Int8Array]",K="[object Int16Array]",Z="[object Int32Array]",z="[object Uint8Array]",k="[object Uint8ClampedArray]",F="[object Uint16Array]",G="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,$=/^\[object .+?Constructor\]$/,ut=/^(?:0|[1-9]\d*)$/,nt={};nt[C]=nt[N]=nt[U]=nt[K]=nt[Z]=nt[z]=nt[k]=nt[F]=nt[G]=!0,nt[a]=nt[h]=nt[D]=nt[u]=nt[L]=nt[c]=nt[d]=nt[p]=nt[f]=nt[g]=nt[_]=nt[S]=nt[E]=nt[A]=nt[W]=!1;var Ct=typeof ti=="object"&&ti&&ti.Object===Object&&ti,Rt=typeof self=="object"&&self&&self.Object===Object&&self,_t=Ct||Rt||Function("return this")(),Y=t&&!t.nodeType&&t,tt=Y&&!0&&r&&!r.nodeType&&r,et=tt&&tt.exports===Y,O=et&&Ct.process,xt=function(){try{return O&&O.binding&&O.binding("util")}catch{}}(),gt=xt&&xt.isTypedArray;function Mt(T,R){for(var x=-1,w=T==null?0:T.length,M=0,X=[];++x<w;){var ht=T[x];R(ht,x,T)&&(X[M++]=ht)}return X}function Ut(T,R){for(var x=-1,w=R.length,M=T.length;++x<w;)T[M+x]=R[x];return T}function Ne(T,R){for(var x=-1,w=T==null?0:T.length;++x<w;)if(R(T[x],x,T))return!0;return!1}function pi(T,R){for(var x=-1,w=Array(T);++x<T;)w[x]=R(x);return w}function Md(T){return function(R){return T(R)}}function bn(T,R){return T.has(R)}function Ro(T,R){return T==null?void 0:T[R]}function xn(T){var R=-1,x=Array(T.size);return T.forEach(function(w,M){x[++R]=[M,w]}),x}function fi(T,R){return function(x){return T(R(x))}}function Wh(T){var R=-1,x=Array(T.size);return T.forEach(function(w){x[++R]=w}),x}var Bh=Array.prototype,Pd=Function.prototype,_n=Object.prototype,Or=_t["__core-js_shared__"],Mo=Pd.toString,Fe=_n.hasOwnProperty,Po=function(){var T=/[^.]+$/.exec(Or&&Or.keys&&Or.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Lo=_n.toString,Uh=RegExp("^"+Mo.call(Fe).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xh=et?_t.Buffer:void 0,vn=_t.Symbol,ki=_t.Uint8Array,Ss=_n.propertyIsEnumerable,Ld=Bh.splice,Oi=vn?vn.toStringTag:void 0,Zh=Object.getOwnPropertySymbols,Vh=Xh?Xh.isBuffer:void 0,Es=fi(Object.keys,Object),Go=dr(_t,"DataView"),De=dr(_t,"Map"),No=dr(_t,"Promise"),Fo=dr(_t,"Set"),Do=dr(_t,"WeakMap"),Cs=dr(Object,"create"),Gd=gi(Go),mi=gi(De),Nd=gi(No),Fd=gi(Fo),Dd=gi(Do),Kh=vn?vn.prototype:void 0,ko=Kh?Kh.valueOf:void 0;function Ce(T){var R=-1,x=T==null?0:T.length;for(this.clear();++R<x;){var w=T[R];this.set(w[0],w[1])}}function kd(){this.__data__=Cs?Cs(null):{},this.size=0}function Od(T){var R=this.has(T)&&delete this.__data__[T];return this.size-=R?1:0,R}function Wd(T){var R=this.__data__;if(Cs){var x=R[T];return x===i?void 0:x}return Fe.call(R,T)?R[T]:void 0}function Bd(T){var R=this.__data__;return Cs?R[T]!==void 0:Fe.call(R,T)}function Ud(T,R){var x=this.__data__;return this.size+=this.has(T)?0:1,x[T]=Cs&&R===void 0?i:R,this}Ce.prototype.clear=kd,Ce.prototype.delete=Od,Ce.prototype.get=Wd,Ce.prototype.has=Bd,Ce.prototype.set=Ud;function fe(T){var R=-1,x=T==null?0:T.length;for(this.clear();++R<x;){var w=T[R];this.set(w[0],w[1])}}function Xd(){this.__data__=[],this.size=0}function Zd(T){var R=this.__data__,x=wn(R,T);if(x<0)return!1;var w=R.length-1;return x==w?R.pop():Ld.call(R,x,1),--this.size,!0}function Vd(T){var R=this.__data__,x=wn(R,T);return x<0?void 0:R[x][1]}function Kd(T){return wn(this.__data__,T)>-1}function Hd(T,R){var x=this.__data__,w=wn(x,T);return w<0?(++this.size,x.push([T,R])):x[w][1]=R,this}fe.prototype.clear=Xd,fe.prototype.delete=Zd,fe.prototype.get=Vd,fe.prototype.has=Kd,fe.prototype.set=Hd;function ur(T){var R=-1,x=T==null?0:T.length;for(this.clear();++R<x;){var w=T[R];this.set(w[0],w[1])}}function Oo(){this.size=0,this.__data__={hash:new Ce,map:new(De||fe),string:new Ce}}function Yd(T){var R=En(this,T).delete(T);return this.size-=R?1:0,R}function Tn(T){return En(this,T).get(T)}function Wo(T){return En(this,T).has(T)}function zd(T,R){var x=En(this,T),w=x.size;return x.set(T,R),this.size+=x.size==w?0:1,this}ur.prototype.clear=Oo,ur.prototype.delete=Yd,ur.prototype.get=Tn,ur.prototype.has=Wo,ur.prototype.set=zd;function cr(T){var R=-1,x=T==null?0:T.length;for(this.__data__=new ur;++R<x;)this.add(T[R])}function Hh(T){return this.__data__.set(T,i),this}function jd(T){return this.__data__.has(T)}cr.prototype.add=cr.prototype.push=Hh,cr.prototype.has=jd;function Wi(T){var R=this.__data__=new fe(T);this.size=R.size}function Jd(){this.__data__=new fe,this.size=0}function Yh(T){var R=this.__data__,x=R.delete(T);return this.size=R.size,x}function $d(T){return this.__data__.get(T)}function Qd(T){return this.__data__.has(T)}function qd(T,R){var x=this.__data__;if(x instanceof fe){var w=x.__data__;if(!De||w.length<e-1)return w.push([T,R]),this.size=++x.size,this;x=this.__data__=new ur(w)}return x.set(T,R),this.size=x.size,this}Wi.prototype.clear=Jd,Wi.prototype.delete=Yh,Wi.prototype.get=$d,Wi.prototype.has=Qd,Wi.prototype.set=qd;function tp(T,R){var x=An(T),w=!x&&Xo(T),M=!x&&!w&&As(T),X=!x&&!w&&!M&&il(T),ht=x||w||M||X,ft=ht?pi(T.length,String):[],yt=ft.length;for(var ot in T)(R||Fe.call(T,ot))&&!(ht&&(ot=="length"||M&&(ot=="offset"||ot=="parent")||X&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||Uo(ot,yt)))&&ft.push(ot);return ft}function wn(T,R){for(var x=T.length;x--;)if(In(T[x][0],R))return x;return-1}function ep(T,R,x){var w=R(T);return An(T)?w:Ut(w,x(T))}function Is(T){return T==null?T===void 0?P:y:Oi&&Oi in Object(T)?np(T):Cn(T)}function zh(T){return Br(T)&&Is(T)==a}function jh(T,R,x,w,M){return T===R?!0:T==null||R==null||!Br(T)&&!Br(R)?T!==T&&R!==R:ip(T,R,x,w,jh,M)}function ip(T,R,x,w,M,X){var ht=An(T),ft=An(R),yt=ht?h:Bi(T),ot=ft?h:Bi(R);yt=yt==a?_:yt,ot=ot==a?_:ot;var vt=yt==_,Ft=ot==_,At=yt==ot;if(At&&As(T)){if(!As(R))return!1;ht=!0,vt=!1}if(At&&!vt)return X||(X=new Wi),ht||il(T)?Jh(T,R,x,w,M,X):$h(T,R,yt,x,w,M,X);if(!(x&s)){var ne=vt&&Fe.call(T,"__wrapped__"),me=Ft&&Fe.call(R,"__wrapped__");if(ne||me){var Qe=ne?T.value():T,qe=me?R.value():R;return X||(X=new Wi),M(Qe,qe,x,w,X)}}return At?(X||(X=new Wi),sp(T,R,x,w,M,X)):!1}function Sn(T){if(!el(T)||hp(T))return!1;var R=Ui(T)?Uh:$;return R.test(gi(T))}function Bo(T){return Br(T)&&Wr(T.length)&&!!nt[Is(T)]}function rp(T){if(!lp(T))return Es(T);var R=[];for(var x in Object(T))Fe.call(T,x)&&x!="constructor"&&R.push(x);return R}function Jh(T,R,x,w,M,X){var ht=x&s,ft=T.length,yt=R.length;if(ft!=yt&&!(ht&&yt>ft))return!1;var ot=X.get(T);if(ot&&X.get(R))return ot==R;var vt=-1,Ft=!0,At=x&n?new cr:void 0;for(X.set(T,R),X.set(R,T);++vt<ft;){var ne=T[vt],me=R[vt];if(w)var Qe=ht?w(me,ne,vt,R,T,X):w(ne,me,vt,T,R,X);if(Qe!==void 0){if(Qe)continue;Ft=!1;break}if(At){if(!Ne(R,function(qe,Rs){if(!bn(At,Rs)&&(ne===qe||M(ne,qe,x,w,X)))return At.push(Rs)})){Ft=!1;break}}else if(!(ne===me||M(ne,me,x,w,X))){Ft=!1;break}}return X.delete(T),X.delete(R),Ft}function $h(T,R,x,w,M,X,ht){switch(x){case L:if(T.byteLength!=R.byteLength||T.byteOffset!=R.byteOffset)return!1;T=T.buffer,R=R.buffer;case D:return!(T.byteLength!=R.byteLength||!X(new ki(T),new ki(R)));case u:case c:case g:return In(+T,+R);case d:return T.name==R.name&&T.message==R.message;case S:case A:return T==R+"";case f:var ft=xn;case E:var yt=w&s;if(ft||(ft=Wh),T.size!=R.size&&!yt)return!1;var ot=ht.get(T);if(ot)return ot==R;w|=n,ht.set(T,R);var vt=Jh(ft(T),ft(R),w,M,X,ht);return ht.delete(T),vt;case I:if(ko)return ko.call(T)==ko.call(R)}return!1}function sp(T,R,x,w,M,X){var ht=x&s,ft=Qh(T),yt=ft.length,ot=Qh(R),vt=ot.length;if(yt!=vt&&!ht)return!1;for(var Ft=yt;Ft--;){var At=ft[Ft];if(!(ht?At in R:Fe.call(R,At)))return!1}var ne=X.get(T);if(ne&&X.get(R))return ne==R;var me=!0;X.set(T,R),X.set(R,T);for(var Qe=ht;++Ft<yt;){At=ft[Ft];var qe=T[At],Rs=R[At];if(w)var wb=ht?w(Rs,qe,At,R,T,X):w(qe,Rs,At,T,R,X);if(!(wb===void 0?qe===Rs||M(qe,Rs,x,w,X):wb)){me=!1;break}Qe||(Qe=At=="constructor")}if(me&&!Qe){var sl=T.constructor,nl=R.constructor;sl!=nl&&"constructor"in T&&"constructor"in R&&!(typeof sl=="function"&&sl instanceof sl&&typeof nl=="function"&&nl instanceof nl)&&(me=!1)}return X.delete(T),X.delete(R),me}function Qh(T){return ep(T,rl,op)}function En(T,R){var x=T.__data__;return ap(R)?x[typeof R=="string"?"string":"hash"]:x.map}function dr(T,R){var x=Ro(T,R);return Sn(x)?x:void 0}function np(T){var R=Fe.call(T,Oi),x=T[Oi];try{T[Oi]=void 0;var w=!0}catch{}var M=Lo.call(T);return w&&(R?T[Oi]=x:delete T[Oi]),M}var op=Zh?function(T){return T==null?[]:(T=Object(T),Mt(Zh(T),function(R){return Ss.call(T,R)}))}:up,Bi=Is;(Go&&Bi(new Go(new ArrayBuffer(1)))!=L||De&&Bi(new De)!=f||No&&Bi(No.resolve())!=b||Fo&&Bi(new Fo)!=E||Do&&Bi(new Do)!=W)&&(Bi=function(T){var R=Is(T),x=R==_?T.constructor:void 0,w=x?gi(x):"";if(w)switch(w){case Gd:return L;case mi:return f;case Nd:return b;case Fd:return E;case Dd:return W}return R});function Uo(T,R){return R=R??o,!!R&&(typeof T=="number"||ut.test(T))&&T>-1&&T%1==0&&T<R}function ap(T){var R=typeof T;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?T!=="__proto__":T===null}function hp(T){return!!Po&&Po in T}function lp(T){var R=T&&T.constructor,x=typeof R=="function"&&R.prototype||_n;return T===x}function Cn(T){return Lo.call(T)}function gi(T){if(T!=null){try{return Mo.call(T)}catch{}try{return T+""}catch{}}return""}function In(T,R){return T===R||T!==T&&R!==R}var Xo=zh(function(){return arguments}())?zh:function(T){return Br(T)&&Fe.call(T,"callee")&&!Ss.call(T,"callee")},An=Array.isArray;function qh(T){return T!=null&&Wr(T.length)&&!Ui(T)}var As=Vh||cp;function tl(T,R){return jh(T,R)}function Ui(T){if(!el(T))return!1;var R=Is(T);return R==p||R==m||R==l||R==v}function Wr(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function el(T){var R=typeof T;return T!=null&&(R=="object"||R=="function")}function Br(T){return T!=null&&typeof T=="object"}var il=gt?Md(gt):Bo;function rl(T){return qh(T)?tp(T):rp(T)}function up(){return[]}function cp(){return!1}r.exports=tl}(mh,mh.exports);var uC=mh.exports;const iy=Nn(uC);var cC=Object.defineProperty,dC=(r,t,e)=>t in r?cC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,B=(r,t,e)=>(dC(r,typeof t!="symbol"?t+"":t,e),e);class je{constructor(t){B(this,"parent"),B(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var pC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ry={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-u)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(pC)})(ry);const sy=ry.exports;function gh(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return sy[r]}else return sy[t]}const fC={removeOnInterrupt:!1,ease:"linear",time:1e3};class mC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"startX"),B(this,"startY"),B(this,"deltaX"),B(this,"deltaY"),B(this,"keepCenter"),B(this,"startWidth",null),B(this,"startHeight",null),B(this,"deltaWidth",null),B(this,"deltaHeight",null),B(this,"width",null),B(this,"height",null),B(this,"time",0),this.options=Object.assign({},fC,e),this.options.ease=gh(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new lt(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new lt(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const gC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class yC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"left"),B(this,"top"),B(this,"right"),B(this,"bottom"),B(this,"underflowX"),B(this,"underflowY"),B(this,"ease"),B(this,"toX"),B(this,"toY"),this.options=Object.assign({},gC,e),this.ease=gh(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new lt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new lt(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new lt(0,0),bottomRight:new lt(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const bC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class xC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"last"),B(this,"noUnderflow"),B(this,"underflowX"),B(this,"underflowY"),this.options=Object.assign({},bC,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new lt(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const _C={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class vC extends je{constructor(t,e={}){super(t),B(this,"options"),this.options=Object.assign({},_C,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const TC={friction:.98,bounce:.8,minSpeed:.01},Dr=16;class wC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"x"),B(this,"y"),B(this,"percentChangeX"),B(this,"percentChangeY"),B(this,"saved"),B(this,"timeSinceRelease"),this.options=Object.assign({},TC,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Dr/o*(Math.pow(n,s/Dr)-Math.pow(n,i/Dr)),this.x*=Math.pow(this.percentChangeX,t/Dr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Dr/o*(Math.pow(n,s/Dr)-Math.pow(n,i/Dr)),this.y*=Math.pow(this.percentChangeY,t/Dr)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const SC={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class EC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"moved"),B(this,"reverse"),B(this,"xDirection"),B(this,"yDirection"),B(this,"keyIsPressed"),B(this,"mouse"),B(this,"underflowX"),B(this,"underflowY"),B(this,"last"),B(this,"current"),B(this,"windowEventHandlers",[]),this.options=Object.assign({},SC,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new lt(this.last.x,this.last.y),world:this.parent.toWorld(new lt(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new lt(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const CC={speed:0,acceleration:null,radius:null};class IC extends je{constructor(t,e,i={}){super(t),B(this,"options"),B(this,"target"),B(this,"velocity"),this.target=e,this.options=Object.assign({},CC,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const u=Math.cos(a)*this.velocity.x,c=Math.sin(a)*this.velocity.y,d=Math.abs(u)>Math.abs(n)?i:e.x+u,p=Math.abs(c)>Math.abs(o)?s:e.y+c;this.parent.moveCenter(d,p),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,u=Math.abs(h)>Math.abs(n)?i:e.x+h,c=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(u,c),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const AC={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class RC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"reverse"),B(this,"radiusSquared"),B(this,"left"),B(this,"top"),B(this,"right"),B(this,"bottom"),B(this,"horizontal"),B(this,"vertical"),this.options=Object.assign({},AC,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const MC={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class PC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"active",!1),B(this,"pinching",!1),B(this,"moved",!1),B(this,"lastCenter"),this.options=Object.assign({},MC,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new lt(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let u=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));u=u===0?u=1e-10:u;const c=(1-a/u)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=c),this.isAxisY()&&(this.parent.scale.y+=c),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const p=this.parent.toGlobal(h);this.parent.x+=(l.x-p.x)*this.options.factor,this.parent.y+=(l.y-p.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const LC={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class GC extends je{constructor(t,e,i,s={}){super(t),B(this,"options"),B(this,"ease"),B(this,"x"),B(this,"y"),B(this,"percent"),B(this,"snapping"),B(this,"deltaX"),B(this,"deltaY"),B(this,"startX"),B(this,"startY"),this.options=Object.assign({},LC,s),this.ease=gh(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const u=this.ease(e.time,0,1,this.options.time);s=o+h*u,n=a+l*u}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const NC={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class FC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"ease"),B(this,"xScale"),B(this,"yScale"),B(this,"xIndependent"),B(this,"yIndependent"),B(this,"snapping"),this.options=Object.assign({},NC,e),this.ease=gh(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const DC={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class kC extends je{constructor(t,e={}){super(t),B(this,"options"),B(this,"smoothing"),B(this,"smoothingCenter"),B(this,"smoothingCount"),B(this,"keyIsPressed"),this.options=Object.assign({},DC,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class OC{constructor(t){B(this,"viewport"),B(this,"clickedAvailable"),B(this,"isMouseDown"),B(this,"last"),B(this,"wheelFunction"),B(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.eventMode="static",this.viewport.forceHitArea||(this.viewport.hitArea=new dt(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new lt;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const go=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class WC{constructor(t){B(this,"plugins"),B(this,"list"),B(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=go.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=go.indexOf(t);n!==-1&&go.splice(n,1),go.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of go)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const BC={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:ye.shared,allowPreserveDragOutside:!1};class UC extends Xt{constructor(t){super(),B(this,"moving"),B(this,"screenWidth"),B(this,"screenHeight"),B(this,"threshold"),B(this,"input"),B(this,"plugins"),B(this,"zooming"),B(this,"lastViewport"),B(this,"options"),B(this,"_dirty"),B(this,"_forceHitArea"),B(this,"_hitAreaDefault"),B(this,"_pause"),B(this,"tickerFunction"),B(this,"_worldWidth"),B(this,"_worldHeight"),B(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...BC,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new OC(this),this.plugins=new WC(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new dt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new dt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new lt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new lt(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new lt(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new lt(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new FC(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new lt(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new dt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new EC(this,t)),this}clamp(t){return this.plugins.add("clamp",new xC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new wC(this,t)),this}bounce(t){return this.plugins.add("bounce",new yC(this,t)),this}pinch(t){return this.plugins.add("pinch",new PC(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new GC(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new IC(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new kC(this,t)),this}animate(t){return this.plugins.add("animate",new mC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new vC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new RC(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function yh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function XC(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Hc(r){let t,e,i;r.length!==2?(t=yh,e=(a,h)=>yh(r(a),h),i=(a,h)=>r(a)-h):(t=r===yh||r===XC?r:ZC,e=r,i=r);function s(a,h,l=0,u=a.length){if(l<u){if(t(h,h)!==0)return u;do{const c=l+u>>>1;e(a[c],h)<0?l=c+1:u=c}while(l<u)}return l}function n(a,h,l=0,u=a.length){if(l<u){if(t(h,h)!==0)return u;do{const c=l+u>>>1;e(a[c],h)<=0?l=c+1:u=c}while(l<u)}return l}function o(a,h,l=0,u=a.length){const c=s(a,h,l,u-1);return c>l&&i(a[c-1],h)>-i(a[c],h)?c-1:c}return{left:s,center:o,right:n}}function ZC(){return 0}function VC(r){return r===null?NaN:+r}const KC=Hc(yh).right;Hc(VC).center;const HC=KC,YC=Math.sqrt(50),zC=Math.sqrt(10),jC=Math.sqrt(2);function bh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=YC?10:n>=zC?5:n>=jC?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?bh(r,t,e*2):[a,h,l]}function JC(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?bh(t,r,e):bh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function Yc(r,t,e){return t=+t,r=+r,e=+e,bh(r,t,e)[2]}function zc(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?Yc(t,r,e):Yc(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function jc(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function ny(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function yo(){}var bo=.7,xh=1/bo,ln="\\s*([+-]?\\d+)\\s*",xo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ni="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$C=/^#([0-9a-f]{3,8})$/,QC=new RegExp(`^rgb\\(${ln},${ln},${ln}\\)$`),qC=new RegExp(`^rgb\\(${Ni},${Ni},${Ni}\\)$`),tI=new RegExp(`^rgba\\(${ln},${ln},${ln},${xo}\\)$`),eI=new RegExp(`^rgba\\(${Ni},${Ni},${Ni},${xo}\\)$`),iI=new RegExp(`^hsl\\(${xo},${Ni},${Ni}\\)$`),rI=new RegExp(`^hsla\\(${xo},${Ni},${Ni},${xo}\\)$`),oy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};jc(yo,_o,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ay,formatHex:ay,formatHex8:sI,formatHsl:nI,formatRgb:hy,toString:hy});function ay(){return this.rgb().formatHex()}function sI(){return this.rgb().formatHex8()}function nI(){return py(this).formatHsl()}function hy(){return this.rgb().formatRgb()}function _o(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=$C.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?ly(t):e===3?new Ee(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?_h(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?_h(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=QC.exec(r))?new Ee(t[1],t[2],t[3],1):(t=qC.exec(r))?new Ee(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tI.exec(r))?_h(t[1],t[2],t[3],t[4]):(t=eI.exec(r))?_h(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=iI.exec(r))?dy(t[1],t[2]/100,t[3]/100,1):(t=rI.exec(r))?dy(t[1],t[2]/100,t[3]/100,t[4]):oy.hasOwnProperty(r)?ly(oy[r]):r==="transparent"?new Ee(NaN,NaN,NaN,0):null}function ly(r){return new Ee(r>>16&255,r>>8&255,r&255,1)}function _h(r,t,e,i){return i<=0&&(r=t=e=NaN),new Ee(r,t,e,i)}function oI(r){return r instanceof yo||(r=_o(r)),r?(r=r.rgb(),new Ee(r.r,r.g,r.b,r.opacity)):new Ee}function Jc(r,t,e,i){return arguments.length===1?oI(r):new Ee(r,t,e,i??1)}function Ee(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}jc(Ee,Jc,ny(yo,{brighter(r){return r=r==null?xh:Math.pow(xh,r),new Ee(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?bo:Math.pow(bo,r),new Ee(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ee(bs(this.r),bs(this.g),bs(this.b),vh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:uy,formatHex:uy,formatHex8:aI,formatRgb:cy,toString:cy}));function uy(){return`#${xs(this.r)}${xs(this.g)}${xs(this.b)}`}function aI(){return`#${xs(this.r)}${xs(this.g)}${xs(this.b)}${xs((isNaN(this.opacity)?1:this.opacity)*255)}`}function cy(){const r=vh(this.opacity);return`${r===1?"rgb(":"rgba("}${bs(this.r)}, ${bs(this.g)}, ${bs(this.b)}${r===1?")":`, ${r})`}`}function vh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function bs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function xs(r){return r=bs(r),(r<16?"0":"")+r.toString(16)}function dy(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new ui(r,t,e,i)}function py(r){if(r instanceof ui)return new ui(r.h,r.s,r.l,r.opacity);if(r instanceof yo||(r=_o(r)),!r)return new ui;if(r instanceof ui)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new ui(o,a,h,r.opacity)}function hI(r,t,e,i){return arguments.length===1?py(r):new ui(r,t,e,i??1)}function ui(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}jc(ui,hI,ny(yo,{brighter(r){return r=r==null?xh:Math.pow(xh,r),new ui(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?bo:Math.pow(bo,r),new ui(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Ee($c(r>=240?r-240:r+120,s,i),$c(r,s,i),$c(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new ui(fy(this.h),Th(this.s),Th(this.l),vh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=vh(this.opacity);return`${r===1?"hsl(":"hsla("}${fy(this.h)}, ${Th(this.s)*100}%, ${Th(this.l)*100}%${r===1?")":`, ${r})`}`}}));function fy(r){return r=(r||0)%360,r<0?r+360:r}function Th(r){return Math.max(0,Math.min(1,r||0))}function $c(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const Qc=r=>()=>r;function lI(r,t){return function(e){return r+e*t}}function uI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function cI(r){return(r=+r)==1?my:function(t,e){return e-t?uI(t,e,r):Qc(isNaN(t)?e:t)}}function my(r,t){var e=t-r;return e?lI(r,e):Qc(isNaN(r)?t:r)}const gy=function r(t){var e=cI(t);function i(s,n){var o=e((s=Jc(s)).r,(n=Jc(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=my(s.opacity,n.opacity);return function(u){return s.r=o(u),s.g=a(u),s.b=h(u),s.opacity=l(u),s+""}}return i.gamma=r,i}(1);function dI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function pI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function fI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=ed(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function mI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function wh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function gI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=ed(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var qc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,td=new RegExp(qc.source,"g");function yI(r){return function(){return r}}function bI(r){return function(t){return r(t)+""}}function xI(r,t){var e=qc.lastIndex=td.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=qc.exec(r))&&(s=td.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:wh(i,s)})),e=td.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?bI(h[0].x):yI(t):(t=h.length,function(l){for(var u=0,c;u<t;++u)a[(c=h[u]).i]=c.x(l);return a.join("")})}function ed(r,t){var e=typeof t,i;return t==null||e==="boolean"?Qc(t):(e==="number"?wh:e==="string"?(i=_o(t))?(t=i,gy):xI:t instanceof _o?gy:t instanceof Date?mI:pI(t)?dI:Array.isArray(t)?fI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?gI:wh)(r,t)}function _I(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function vI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Sh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function un(r){return r=Sh(Math.abs(r)),r?r[1]:NaN}function TI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function wI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var SI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Eh(r){if(!(t=SI.exec(r)))throw new Error("invalid format: "+r);var t;return new id({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Eh.prototype=id.prototype;function id(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}id.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function EI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var yy;function CI(r,t){var e=Sh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(yy=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+Sh(r,Math.max(0,t+n-1))[0]}function by(r,t){var e=Sh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const xy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:vI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>by(r*100,t),r:by,s:CI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function _y(r){return r}var vy=Array.prototype.map,Ty=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function II(r){var t=r.grouping===void 0||r.thousands===void 0?_y:TI(vy.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?_y:wI(vy.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(c){c=Eh(c);var d=c.fill,p=c.align,m=c.sign,f=c.symbol,g=c.zero,y=c.width,_=c.comma,b=c.precision,v=c.trim,S=c.type;S==="n"?(_=!0,S="g"):xy[S]||(b===void 0&&(b=12),v=!0,S="g"),(g||d==="0"&&p==="=")&&(g=!0,d="0",p="=");var E=f==="$"?e:f==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",A=f==="$"?i:/[%p]/.test(S)?o:"",I=xy[S],P=/[defgprs%]/.test(S);b=b===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function W(D){var L=E,C=A,N,U,K;if(S==="c")C=I(D)+C,D="";else{D=+D;var Z=D<0||1/D<0;if(D=isNaN(D)?h:I(Math.abs(D),b),v&&(D=EI(D)),Z&&+D==0&&m!=="+"&&(Z=!1),L=(Z?m==="("?m:a:m==="-"||m==="("?"":m)+L,C=(S==="s"?Ty[8+yy/3]:"")+C+(Z&&m==="("?")":""),P){for(N=-1,U=D.length;++N<U;)if(K=D.charCodeAt(N),48>K||K>57){C=(K===46?s+D.slice(N+1):D.slice(N))+C,D=D.slice(0,N);break}}}_&&!g&&(D=t(D,1/0));var z=L.length+D.length+C.length,k=z<y?new Array(y-z+1).join(d):"";switch(_&&g&&(D=t(k+D,k.length?y-C.length:1/0),k=""),p){case"<":D=L+D+C+k;break;case"=":D=L+k+D+C;break;case"^":D=k.slice(0,z=k.length>>1)+L+D+C+k.slice(z);break;default:D=k+L+D+C;break}return n(D)}return W.toString=function(){return c+""},W}function u(c,d){var p=l((c=Eh(c),c.type="f",c)),m=Math.max(-8,Math.min(8,Math.floor(un(d)/3)))*3,f=Math.pow(10,-m),g=Ty[8+m/3];return function(y){return p(f*y)+g}}return{format:l,formatPrefix:u}}var Ch,wy,Sy;AI({thousands:",",grouping:[3],currency:["$",""]});function AI(r){return Ch=II(r),wy=Ch.format,Sy=Ch.formatPrefix,Ch}function RI(r){return Math.max(0,-un(Math.abs(r)))}function MI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(un(t)/3)))*3-un(Math.abs(r)))}function PI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,un(t)-un(r))+1}function Ey(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function LI(r){return function(){return r}}function GI(r){return+r}var Cy=[0,1];function cn(r){return r}function rd(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:LI(isNaN(t)?NaN:.5)}function NI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function FI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=rd(s,i),n=e(o,n)):(i=rd(i,s),n=e(n,o)),function(a){return n(i(a))}}function DI(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=rd(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=HC(r,a,1,i)-1;return n[h](s[h](a))}}function Iy(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function kI(){var r=Cy,t=Cy,e=ed,i,s,n,o=cn,a,h,l;function u(){var d=Math.min(r.length,t.length);return o!==cn&&(o=NI(r[0],r[d-1])),a=d>2?DI:FI,h=l=null,c}function c(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return c.invert=function(d){return o(s((l||(l=a(t,r.map(i),wh)))(d)))},c.domain=function(d){return arguments.length?(r=Array.from(d,GI),u()):r.slice()},c.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},c.rangeRound=function(d){return t=Array.from(d),e=_I,u()},c.clamp=function(d){return arguments.length?(o=d?!0:cn,u()):o!==cn},c.interpolate=function(d){return arguments.length?(e=d,u()):e},c.unknown=function(d){return arguments.length?(n=d,c):n},function(d,p){return i=d,s=p,u()}}function Ay(){return kI()(cn,cn)}function OI(r,t,e,i){var s=zc(r,t,e),n;switch(i=Eh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=MI(s,o))&&(i.precision=n),Sy(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=PI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=RI(s))&&(i.precision=n-(i.type==="%")*2);break}}return wy(i)}function WI(r){var t=r.domain;return r.ticks=function(e){var i=t();return JC(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return OI(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,u=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);u-- >0;){if(l=Yc(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Ry(){var r=Ay();return r.copy=function(){return Iy(r,Ry())},Ey.apply(r,arguments),WI(r)}function BI(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const sd=new Date,nd=new Date;function $t(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>$t(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(sd.setTime(+n),nd.setTime(+o),r(sd),r(nd),Math.floor(e(sd,nd))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Ih=$t(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Ih.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?$t(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Ih),Ih.range;const nr=1e3,Je=nr*60,or=Je*60,ar=or*24,od=ar*7,My=ar*30,ad=ar*365,dn=$t(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*nr)},(r,t)=>(t-r)/nr,r=>r.getUTCSeconds());dn.range;const hd=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*nr)},(r,t)=>{r.setTime(+r+t*Je)},(r,t)=>(t-r)/Je,r=>r.getMinutes());hd.range,$t(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*Je)},(r,t)=>(t-r)/Je,r=>r.getUTCMinutes()).range;const ld=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*nr-r.getMinutes()*Je)},(r,t)=>{r.setTime(+r+t*or)},(r,t)=>(t-r)/or,r=>r.getHours());ld.range,$t(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*or)},(r,t)=>(t-r)/or,r=>r.getUTCHours()).range;const vo=$t(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*Je)/ar,r=>r.getDate()-1);vo.range;const ud=$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ar,r=>r.getUTCDate()-1);ud.range,$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ar,r=>Math.floor(r/ar)).range;function _s(r){return $t(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Je)/od)}const Ah=_s(0),Rh=_s(1),UI=_s(2),XI=_s(3),pn=_s(4),ZI=_s(5),VI=_s(6);Ah.range,Rh.range,UI.range,XI.range,pn.range,ZI.range,VI.range;function vs(r){return $t(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/od)}const Py=vs(0),Mh=vs(1),KI=vs(2),HI=vs(3),fn=vs(4),YI=vs(5),zI=vs(6);Py.range,Mh.range,KI.range,HI.range,fn.range,YI.range,zI.range;const cd=$t(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());cd.range,$t(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const hr=$t(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());hr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),hr.range;const Ts=$t(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());Ts.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),Ts.range;function jI(r,t,e,i,s,n){const o=[[dn,1,nr],[dn,5,5*nr],[dn,15,15*nr],[dn,30,30*nr],[n,1,Je],[n,5,5*Je],[n,15,15*Je],[n,30,30*Je],[s,1,or],[s,3,3*or],[s,6,6*or],[s,12,12*or],[i,1,ar],[i,2,2*ar],[e,1,od],[t,1,My],[t,3,3*My],[r,1,ad]];function a(l,u,c){const d=u<l;d&&([l,u]=[u,l]);const p=c&&typeof c.range=="function"?c:h(l,u,c),m=p?p.range(l,+u+1):[];return d?m.reverse():m}function h(l,u,c){const d=Math.abs(u-l)/c,p=Hc(([,,g])=>g).right(o,d);if(p===o.length)return r.every(zc(l/ad,u/ad,c));if(p===0)return Ih.every(Math.max(zc(l,u,c),1));const[m,f]=o[d/o[p-1][2]<o[p][2]/d?p-1:p];return m.every(f)}return[a,h]}const[JI,$I]=jI(hr,cd,Ah,vo,ld,hd);function dd(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function pd(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function To(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function QI(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=wo(s),u=So(s),c=wo(n),d=So(n),p=wo(o),m=So(o),f=wo(a),g=So(a),y=wo(h),_=So(h),b={a:Z,A:z,b:k,B:F,c:null,d:ky,e:ky,f:vA,g:PA,G:GA,H:bA,I:xA,j:_A,L:Oy,m:TA,M:wA,p:G,q:V,Q:Vy,s:Ky,S:SA,u:EA,U:CA,V:IA,w:AA,W:RA,x:null,X:null,y:MA,Y:LA,Z:NA,"%":Zy},v={a:$,A:ut,b:nt,B:Ct,c:null,d:By,e:By,f:OA,g:zA,G:JA,H:FA,I:DA,j:kA,L:Uy,m:WA,M:BA,p:Rt,q:_t,Q:Vy,s:Ky,S:UA,u:XA,U:ZA,V:VA,w:KA,W:HA,x:null,X:null,y:YA,Y:jA,Z:$A,"%":Zy},S={a:W,A:D,b:L,B:C,c:N,d:Fy,e:Fy,f:fA,g:Ny,G:Gy,H:Dy,I:Dy,j:uA,L:pA,m:lA,M:cA,p:P,q:hA,Q:gA,s:yA,S:dA,u:rA,U:sA,V:nA,w:iA,W:oA,x:U,X:K,y:Ny,Y:Gy,Z:aA,"%":mA};b.x=E(e,b),b.X=E(i,b),b.c=E(t,b),v.x=E(e,v),v.X=E(i,v),v.c=E(t,v);function E(Y,tt){return function(et){var O=[],xt=-1,gt=0,Mt=Y.length,Ut,Ne,pi;for(et instanceof Date||(et=new Date(+et));++xt<Mt;)Y.charCodeAt(xt)===37&&(O.push(Y.slice(gt,xt)),(Ne=Ly[Ut=Y.charAt(++xt)])!=null?Ut=Y.charAt(++xt):Ne=Ut==="e"?" ":"0",(pi=tt[Ut])&&(Ut=pi(et,Ne)),O.push(Ut),gt=xt+1);return O.push(Y.slice(gt,xt)),O.join("")}}function A(Y,tt){return function(et){var O=To(1900,void 0,1),xt=I(O,Y,et+="",0),gt,Mt;if(xt!=et.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(tt&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(gt=pd(To(O.y,0,1)),Mt=gt.getUTCDay(),gt=Mt>4||Mt===0?Mh.ceil(gt):Mh(gt),gt=ud.offset(gt,(O.V-1)*7),O.y=gt.getUTCFullYear(),O.m=gt.getUTCMonth(),O.d=gt.getUTCDate()+(O.w+6)%7):(gt=dd(To(O.y,0,1)),Mt=gt.getDay(),gt=Mt>4||Mt===0?Rh.ceil(gt):Rh(gt),gt=vo.offset(gt,(O.V-1)*7),O.y=gt.getFullYear(),O.m=gt.getMonth(),O.d=gt.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),Mt="Z"in O?pd(To(O.y,0,1)).getUTCDay():dd(To(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(Mt+5)%7:O.w+O.U*7-(Mt+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,pd(O)):dd(O)}}function I(Y,tt,et,O){for(var xt=0,gt=tt.length,Mt=et.length,Ut,Ne;xt<gt;){if(O>=Mt)return-1;if(Ut=tt.charCodeAt(xt++),Ut===37){if(Ut=tt.charAt(xt++),Ne=S[Ut in Ly?tt.charAt(xt++):Ut],!Ne||(O=Ne(Y,et,O))<0)return-1}else if(Ut!=et.charCodeAt(O++))return-1}return O}function P(Y,tt,et){var O=l.exec(tt.slice(et));return O?(Y.p=u.get(O[0].toLowerCase()),et+O[0].length):-1}function W(Y,tt,et){var O=p.exec(tt.slice(et));return O?(Y.w=m.get(O[0].toLowerCase()),et+O[0].length):-1}function D(Y,tt,et){var O=c.exec(tt.slice(et));return O?(Y.w=d.get(O[0].toLowerCase()),et+O[0].length):-1}function L(Y,tt,et){var O=y.exec(tt.slice(et));return O?(Y.m=_.get(O[0].toLowerCase()),et+O[0].length):-1}function C(Y,tt,et){var O=f.exec(tt.slice(et));return O?(Y.m=g.get(O[0].toLowerCase()),et+O[0].length):-1}function N(Y,tt,et){return I(Y,t,tt,et)}function U(Y,tt,et){return I(Y,e,tt,et)}function K(Y,tt,et){return I(Y,i,tt,et)}function Z(Y){return o[Y.getDay()]}function z(Y){return n[Y.getDay()]}function k(Y){return h[Y.getMonth()]}function F(Y){return a[Y.getMonth()]}function G(Y){return s[+(Y.getHours()>=12)]}function V(Y){return 1+~~(Y.getMonth()/3)}function $(Y){return o[Y.getUTCDay()]}function ut(Y){return n[Y.getUTCDay()]}function nt(Y){return h[Y.getUTCMonth()]}function Ct(Y){return a[Y.getUTCMonth()]}function Rt(Y){return s[+(Y.getUTCHours()>=12)]}function _t(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var tt=E(Y+="",b);return tt.toString=function(){return Y},tt},parse:function(Y){var tt=A(Y+="",!1);return tt.toString=function(){return Y},tt},utcFormat:function(Y){var tt=E(Y+="",v);return tt.toString=function(){return Y},tt},utcParse:function(Y){var tt=A(Y+="",!0);return tt.toString=function(){return Y},tt}}}var Ly={"-":"",_:" ",0:"0"},se=/^\s*\d+/,qI=/^%/,tA=/[\\^$*+?|[\]().{}]/g;function It(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function eA(r){return r.replace(tA,"\\$&")}function wo(r){return new RegExp("^(?:"+r.map(eA).join("|")+")","i")}function So(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function iA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function rA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function sA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function nA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function oA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Gy(r,t,e){var i=se.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Ny(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function aA(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function hA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function lA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Fy(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function uA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Dy(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function cA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function dA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function pA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function fA(r,t,e){var i=se.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function mA(r,t,e){var i=qI.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function gA(r,t,e){var i=se.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function yA(r,t,e){var i=se.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function ky(r,t){return It(r.getDate(),t,2)}function bA(r,t){return It(r.getHours(),t,2)}function xA(r,t){return It(r.getHours()%12||12,t,2)}function _A(r,t){return It(1+vo.count(hr(r),r),t,3)}function Oy(r,t){return It(r.getMilliseconds(),t,3)}function vA(r,t){return Oy(r,t)+"000"}function TA(r,t){return It(r.getMonth()+1,t,2)}function wA(r,t){return It(r.getMinutes(),t,2)}function SA(r,t){return It(r.getSeconds(),t,2)}function EA(r){var t=r.getDay();return t===0?7:t}function CA(r,t){return It(Ah.count(hr(r)-1,r),t,2)}function Wy(r){var t=r.getDay();return t>=4||t===0?pn(r):pn.ceil(r)}function IA(r,t){return r=Wy(r),It(pn.count(hr(r),r)+(hr(r).getDay()===4),t,2)}function AA(r){return r.getDay()}function RA(r,t){return It(Rh.count(hr(r)-1,r),t,2)}function MA(r,t){return It(r.getFullYear()%100,t,2)}function PA(r,t){return r=Wy(r),It(r.getFullYear()%100,t,2)}function LA(r,t){return It(r.getFullYear()%1e4,t,4)}function GA(r,t){var e=r.getDay();return r=e>=4||e===0?pn(r):pn.ceil(r),It(r.getFullYear()%1e4,t,4)}function NA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+It(t/60|0,"0",2)+It(t%60,"0",2)}function By(r,t){return It(r.getUTCDate(),t,2)}function FA(r,t){return It(r.getUTCHours(),t,2)}function DA(r,t){return It(r.getUTCHours()%12||12,t,2)}function kA(r,t){return It(1+ud.count(Ts(r),r),t,3)}function Uy(r,t){return It(r.getUTCMilliseconds(),t,3)}function OA(r,t){return Uy(r,t)+"000"}function WA(r,t){return It(r.getUTCMonth()+1,t,2)}function BA(r,t){return It(r.getUTCMinutes(),t,2)}function UA(r,t){return It(r.getUTCSeconds(),t,2)}function XA(r){var t=r.getUTCDay();return t===0?7:t}function ZA(r,t){return It(Py.count(Ts(r)-1,r),t,2)}function Xy(r){var t=r.getUTCDay();return t>=4||t===0?fn(r):fn.ceil(r)}function VA(r,t){return r=Xy(r),It(fn.count(Ts(r),r)+(Ts(r).getUTCDay()===4),t,2)}function KA(r){return r.getUTCDay()}function HA(r,t){return It(Mh.count(Ts(r)-1,r),t,2)}function YA(r,t){return It(r.getUTCFullYear()%100,t,2)}function zA(r,t){return r=Xy(r),It(r.getUTCFullYear()%100,t,2)}function jA(r,t){return It(r.getUTCFullYear()%1e4,t,4)}function JA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?fn(r):fn.ceil(r),It(r.getUTCFullYear()%1e4,t,4)}function $A(){return"+0000"}function Zy(){return"%"}function Vy(r){return+r}function Ky(r){return Math.floor(+r/1e3)}var mn,Hy;QA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function QA(r){return mn=QI(r),Hy=mn.format,mn.parse,mn.utcFormat,mn.utcParse,mn}function qA(r){return new Date(r)}function tR(r){return r instanceof Date?+r:+new Date(+r)}function Yy(r,t,e,i,s,n,o,a,h,l){var u=Ay(),c=u.invert,d=u.domain,p=l(".%L"),m=l(":%S"),f=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),_=l("%b %d"),b=l("%B"),v=l("%Y");function S(E){return(h(E)<E?p:a(E)<E?m:o(E)<E?f:n(E)<E?g:i(E)<E?s(E)<E?y:_:e(E)<E?b:v)(E)}return u.invert=function(E){return new Date(c(E))},u.domain=function(E){return arguments.length?d(Array.from(E,tR)):d().map(qA)},u.ticks=function(E){var A=d();return r(A[0],A[A.length-1],E??10)},u.tickFormat=function(E,A){return A==null?S:l(A)},u.nice=function(E){var A=d();return(!E||typeof E.range!="function")&&(E=t(A[0],A[A.length-1],E??10)),E?d(BI(A,E)):u},u.copy=function(){return Iy(u,Yy(r,t,e,i,s,n,o,a,h,l))},u}function eR(){return Ey.apply(Yy(JI,$I,hr,cd,Ah,vo,ld,hd,dn,Hy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Eo(r,t,e){this.k=r,this.x=t,this.y=e}Eo.prototype={constructor:Eo,scale:function(r){return r===1?this:new Eo(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new Eo(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Eo.prototype;function zy(r){return r.mode==="temporal"||r.mode==="left-aligned"?iR(r):rR(r)}function iR({domain:r,range:t}){return eR().domain(r).range(t)}function rR({domain:r,range:t}){return Ry().domain(r).range(t)}function fd(r){return{mode:pt.horizontal,range:uM(),domain:cM(r)}}function sR(){return{mode:pt.vertical}}let gn=null;async function nR(){const r=await Id();jy(r.start_time),bt.on("layoutSettingsUpdated",()=>jy(r.start_time))}function oR(){gn=null}async function Co(){return gn||await Ue("scaleCreated")}async function jy(r){await Di();const t=gn?"scaleUpdated":"scaleCreated",e=fd(r);gn=zy(e),bt.emit(t,gn)}let Ge=null,md=null;async function aR(){const r=await Xe(),t=await sc();Ge=new UC({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Ge.zIndex=1,Ge.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),r.stage.addChild(Ge),bt.emit("viewportCreated",Ge),bt.on("applicationResized",dR),bt.on("scaleUpdated",()=>Ph()),uR()}function hR(){Ge=null,md=null}async function gd({animate:r}={}){const t=await $e(),e=await be(),i=t.getChildByName(_p);if(!i)throw new Error("Nodes container not found");const s=e.styles.guideTextSize+e.styles.guideTextTopPadding;mR();const{x:n,y:o,width:a,height:h}=i.getLocalBounds(),l=a+e.styles.columnGap*2,u=h+e.styles.rowGap*2+s*2,c=t.findFit(l,u);!a||!h||t.animate({position:{x:n+a/2,y:o+h/2-s},scale:Math.min(c,1),time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{bd(),Ph()}})}async function $e(){return Ge||await Ue("viewportCreated")}function Jy(r){iy(md,r)||(md=r,bt.emit("viewportDateRangeUpdated",r))}function lR({xOffset:r,yOffset:t}){if(!Ge)return;const{x:e,y:i}=Ge.transform.position;Ge.setTransform(e+r,i+t,Ge.transform.scale.x,Ge.transform.scale.y)}async function uR(){const r=await $e();Ph(),r.on("moved",()=>Ph())}async function Ph(){const r=await $y();r&&Jy(r)}async function $y(){const r=await $e(),t=await Co(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function cR(r){const t=await $y(),e=await Di();if(r===void 0||e.isDependency()||iy(r,t))return;const i=await $e(),s=await Co(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;Jy(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function dR(){const r=await Xe(),t=await $e(),e=await sc(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),lR({xOffset:a,yOffset:h})}class yd{constructor(){dp(this,"status","visible");dp(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Fi=null,ci=null,lr=null,di=null;async function pR(){const r=await $e(),t=await Xe();Fi=new lC({toggle:"renderable"}),ci=new yd,di=new yd,lr=new yd,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2;di==null||di.toggle(e),ci==null||ci.toggle(i),lr==null||lr.toggle(s),Fi==null||Fi.cull(t.renderer.screen),r.dirty=!1}}),bt.emit("cullCreated",Fi),bt.emit("labelCullCreated",ci),bt.emit("edgeCullCreated",di),bt.emit("toggleCullCreated",lr)}function fR(){Fi=null,ci==null||ci.clear(),ci=null,di==null||di.clear(),di=null,lr==null||lr.clear(),lr=null}async function bd(){const r=await $e();r.dirty=!0}function mR(){Fi&&Fi.uncull()}async function Qy(){return Fi||await Ue("cullCreated")}async function gR(){return di||await Ue("edgeCullCreated")}async function qy(){return ci||await Ue("labelCullCreated")}async function tb(){const r=await Di(),t=await be();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ey.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{bd()}})}return{animate:e}}let Lh=new Map;function yR(){Lh=new Map}async function xd(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Lh.has(e))return Lh.get(e);const i=await r(...t);return Lh.set(e,i),i}async function bR({size:r,stroke:t=1,radius:e=0}){const i=await Xe(),s=new to;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new dt(0,0,r,r),resolution:10})}async function eb(r){return await xd(bR,[r])}var Gh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Gh||{});function ib(){const r=new ie;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await eb(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function xR(){const r=await Xe(),t=new to;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t)}async function _d(){return await xd(xR,[])}function vd(r,t){return Array.from({length:r},(e,i)=>t(i))}const _R=8,vR=2;async function TR(){const r=await be(),t=await Qy(),e=await gR(),{animate:i}=await tb(),s=new Xt,{element:n,render:o}=await ib(),a=await _d(),h=vd(20,()=>new lt),l=new iS(a,h);let u=!1;s.name=Rb,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function c(){return await o({size:10,rotate:Gh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,f){const g=p(f);u||await c();for(const[y,_]of h.entries()){const{x:b,y:v}=g[y];i(_,{x:b,y:v},!u)}i(s,{x:m.x,y:m.y},!u),i(n,{x:f.x-_R,y:f.y},!u),u=!0}function p({x:m,y:f}){const g=[],y={x:0,y:0},_={x:m-vR,y:f},b={x:rb(y.x,{source:y,target:_}),y:y.y},v={x:rb(_.x,{source:y,target:_},!0),y:_.y};for(const[S]of h.entries()){if(S===h.length-1){g[S]=_;continue}const E=wR(S,{source:y,target:_,sourceBezier:b,targetBezier:v});g[S]=E}return g}return{element:s,render:c,setPosition:d}}function rb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function wR(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,u=n.y+(o.y-n.y)*e,c=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,p=a+(l-a)*e,m=h+(u-h)*e,f=l+(c-l)*e,g=u+(d-u)*e,y=p+(f-p)*e,_=m+(g-m)*e;return{x:y,y:_}}function Td(){const r=new Xt,t=new ie,e=new ie,i=new ie,s=new ie,n=new ie,o=new ie,a=new ie,h=new ie;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(p){const{radius:m=0,color:f="#fff",stroke:g,width:y,height:_}=p,b=Math.min(y,_),v=m*2>b?b/2:m,E=await eb({size:v,radius:m,stroke:g}),A=await _d();return u({texture:E,width:y,height:_,size:v}),c({texture:A,width:y,height:_,size:v,stroke:g}),d(f),r}function u({texture:p,width:m,height:f,size:g}){t.texture=p,e.texture=p,i.texture=p,s.texture=p,t.position.set(0,0),e.position.set(m-g,0),i.position.set(0,f-g),s.position.set(m-g,f-g)}function c({texture:p,size:m,width:f,height:g,stroke:y}){const _=Math.max(g-m*2,0),b=Math.max(f-m*2,0);a.texture=p,n.texture=p,o.texture=p,h.texture=p,n.position.set(0,m),n.height=_,n.width=y,o.position.set(f-y,m),o.height=_,o.width=y,a.position.set(m,0),a.width=b,a.height=y,h.position.set(m,g-y),h.width=b,h.height=y}function d(p){t.tint=p,e.tint=p,i.tint=p,s.tint=p,a.tint=p,n.tint=p,o.tint=p,h.tint=p}return{element:r,render:l}}var sb={exports:{}};(function(r){(function(){function t(f,g){document.addEventListener?f.addEventListener("scroll",g,!1):f.attachEvent("scroll",g)}function e(f){document.body?f():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),f()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),f())})}function i(f){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(f)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(f,g){f.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(f){var g=f.g.offsetWidth,y=g+100;return f.j.style.width=y+"px",f.i.scrollLeft=y,f.h.scrollLeft=f.h.scrollWidth+100,f.l!==g?(f.l=g,!0):!1}function o(f,g){function y(){var b=_;n(b)&&b.g.parentNode!==null&&g(b.l)}var _=f;t(f.h,y),t(f.i,y),n(f)}function a(f,g,y){g=g||{},y=y||window,this.family=f,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,u=null,c=null;function d(f){return l===null&&(p(f)&&/Apple/.test(window.navigator.vendor)?(f=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!f&&603>parseInt(f[1],10)):l=!1),l}function p(f){return c===null&&(c=!!f.document.fonts),c}function m(f,g){var y=f.style,_=f.weight;if(u===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}u=b.style.font!==""}return[y,_,u?f.stretch:"","100px",g].join(" ")}a.prototype.load=function(f,g){var y=this,_=f||"BESbswy",b=0,v=g||3e3,S=new Date().getTime();return new Promise(function(E,A){if(p(y.context)&&!d(y.context)){var I=new Promise(function(W,D){function L(){new Date().getTime()-S>=v?D(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),_).then(function(C){1<=C.length?W():setTimeout(L,25)},D)}L()}),P=new Promise(function(W,D){b=setTimeout(function(){D(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([P,I]).then(function(){clearTimeout(b),E(y)},A)}else e(function(){function W(){var V;(V=U!=-1&&K!=-1||U!=-1&&Z!=-1||K!=-1&&Z!=-1)&&((V=U!=K&&U!=Z&&K!=Z)||(h===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=h&&(U==z&&K==z&&Z==z||U==k&&K==k&&Z==k||U==F&&K==F&&Z==F)),V=!V),V&&(G.parentNode!==null&&G.parentNode.removeChild(G),clearTimeout(b),E(y))}function D(){if(new Date().getTime()-S>=v)G.parentNode!==null&&G.parentNode.removeChild(G),A(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(U=L.g.offsetWidth,K=C.g.offsetWidth,Z=N.g.offsetWidth,W()),b=setTimeout(D,50)}}var L=new i(_),C=new i(_),N=new i(_),U=-1,K=-1,Z=-1,z=-1,k=-1,F=-1,G=document.createElement("div");G.dir="ltr",s(L,m(y,"sans-serif")),s(C,m(y,"serif")),s(N,m(y,"monospace")),G.appendChild(L.g),G.appendChild(C.g),G.appendChild(N.g),y.context.document.body.appendChild(G),z=L.g.offsetWidth,k=C.g.offsetWidth,F=N.g.offsetWidth,D(),o(L,function(V){U=V,W()}),s(L,m(y,'"'+y.family+'",sans-serif')),o(C,function(V){K=V,W()}),s(C,m(y,'"'+y.family+'",serif')),o(N,function(V){Z=V,W()}),s(N,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(sb);var SR=sb.exports;const ER=Nn(SR),nb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},ob={resolution:4,chars:hi.ASCII},ab="sans-serif",hb={inter:RR(nb.inter)};let wd=!1;async function CR(){const r=Object.values(nb);await Promise.all(r.map(t=>IR(t))),wd=!0,bt.emit("fontsLoaded",hb)}async function IR(r){const{fontFamily:t,...e}=r,i=new ER(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${ab}`),hi.from(t,{fontFamily:ab,...e},ob);return}hi.from(t,r,ob)}function AR(){wd=!1}async function lb(){return wd?hb:await Ue("fontsLoaded")}function RR(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new MS(s,i)}async function ub(){const{inter:r}=await lb(),t=await qy(),e=r("");t.add(e);async function i(s){return e.text=s,await e}return{element:e,render:i}}async function MR({height:r,radius:t}){const e=await Xe(),i=new to;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new dt(0,0,t,r),resolution:10})}async function PR(r){return await xd(MR,[r])}function LR(){const r=new ie,t=new ie;async function e(i){const s=await PR(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function Sd(){const r=await _d();return new ie(r)}async function cb(){const r=new Xt,t=await Sd(),{left:e,right:i,render:s}=await LR();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:u,visible:c}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=c,t.width=l,t.height=h.height,t.x=u,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),u=o(h.capRight,h.radius);let c=0;l&&(c+=h.radius),u&&(c+=h.radius);const d=Math.max(h.width-c,0),p=d>0,m=l?h.radius:0;return{width:d,visible:p,x:m}}return{element:r,render:n}}async function GR(){const r=await be(),t=await qy(),e=new Xt,{element:i,render:s}=await ib(),{element:n,render:o}=await cb(),{element:a,render:h}=await Td();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",c),e.on("mouseout",d);async function u({inside:p,isOpen:m}){l=p;const f={size:10,stroke:2,rotate:m?Gh.Up:Gh.Down},g=await s(f),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},_=await o(y);_.alpha=p?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=p?0:1;const v={y:_.height/2,x:_.width/2},S=f.size/4;return g.x=v.x,g.y=m?v.y+S:v.y-S,e}function c(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:u}}let yn=null,Nh=!1;async function NR(){const r=await $e();r.on("click",()=>Ed(null)),r.on("drag-start",()=>{Nh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Nh=!1})})}function FR(){yn=null,Nh=!1}function Ed(r){if(Nh||Cd(r))return;if(yn=r,r===null){bt.emit("nodeSelected",null);return}const{id:t,kind:e}=r;bt.emit("nodeSelected",{id:t,kind:e})}function Cd(r){return(r==null?void 0:r.id)===(yn==null?void 0:yn.id)}function DR(){return yn}const Fh=4,kR=2;async function db(){const r=await be(),t=await Di(),e=new Xt,{element:i,render:s}=await cb(),{element:n,render:o}=await Td();e.addChild(i),n.position.set(-Fh,-Fh);async function a(u){const{background:c="#fff"}=r.styles.node(u),{nodeHeight:d,nodeRadius:p}=r.styles,m=l(u,p),f=u.state_type!=="RUNNING"||t.isDependency();return await s({width:m,height:d,radius:p,background:c,capRight:f}),await h(u,m,d),i}async function h(u,c,d){if(!Cd(u)){e.removeChild(n);return}e.addChild(n),await o({stroke:kR,radius:r.styles.nodeBorderRadius,width:c+Fh*2,height:d+Fh*2,color:r.styles.nodeSelectedBorderColor})}function l(u,c){const d=Ad();if(pt.isTemporal()||pt.isLeftAligned()){const p=u.start_time,m=u.end_time??new Date,g=Tp(m,p)/zo*d;return Math.max(g,c*2)}return d}return{element:e,render:a}}class pb extends Xt{updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function OR(r){const t=new pb,e=await be(),{element:i,render:s}=await db(),{element:n,render:o}=await ub(),{element:a,render:h,getSize:l,stopWorker:u}=await _b(),{element:c,render:d}=await GR(),{element:p,render:m}=await Td(),{start:f,stop:g}=await Wg(r.id,L=>{h(L)});let y=r,_=!1;t.addChild(p),t.addChild(i),t.addChild(n),t.addChild(c),c.on("click",L=>{L.stopPropagation(),v()}),a.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},a.on("rendered",()=>{bd(),W()});async function b(L){return y=L,await s(L),await I(),await P(L),await S(L),t}async function v(){_?await A():await E()}async function S(L){const{background:C="#fff"}=e.styles.node(L),N=4,{width:U,height:K}=l(),Z=K+e.styles.nodeHeight+e.styles.nodesPadding*2+N*2,z=e.styles.nodeHeight,k=_?-N:N,F=Math.max(i.width,U),G=_?F+N*2:i.width-N*2;(await m({width:G,height:_?Z:z,stroke:_?2:1,radius:e.styles.nodeBorderRadius,color:C})).position.set(k,k)}async function E(){_=!0,t.addChild(a),await Promise.all([f(),b(y)]),W()}async function A(){_=!1,t.removeChild(a),u(),await Promise.all([g(),b(y)]),W()}async function I(){const L=e.styles.nodeToggleSize,C=e.styles.nodeHeight-L,N=i.width>L,U=await d({inside:N,isOpen:_});return U.x=N?C/2:i.width+e.styles.nodePadding,U.y=C/2,U}async function P(L){const C=await o(L.label),N=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,U=e.styles.nodePadding,K=c.x+c.width+U,Z=i.width+U,z=i.width>K+C.width+U,k=e.styles.nodeHeight/2-C.height/2,F=z?K:Math.max(Z,K);return C.position={x:F,y:k},C.tint=z?N:e.styles.textDefault,C}function W(){S(y);const L=D();t.emit("resized",L)}function D(){const L=l(),C=_?L.height+e.styles.nodesPadding*2:0,N=_?L.width:0;return{height:e.styles.nodeHeight+C,width:Math.max(N,t.width)}}return{kind:"flow-run",element:t,bar:i,render:b}}async function WR(){const r=await be(),t=new pb,{element:e,render:i}=await ub(),{element:s,render:n}=await db();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,u=s.width>l+e.width+l,c=u?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:c,y:d},e.tint=u?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}async function BR(){const r=await Xe(),t=await $e(),e=await Di(),i=await be(),{inter:s}=await lb(),n=new Xt,o=await Sd();n.addChild(o);const a=s("");n.addChild(a);let h=await Co(),l,u;bt.on("scaleUpdated",f=>h=f),r.ticker.add(()=>{e.disableGuides||(m(),n.height!==r.screen.height&&d())});function c(f,g){l=f,u=g,d(),p(f)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function p(f){a.text=u(f),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function m(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:c}}class fb extends Error{constructor(){super("Layout is not temporal")}}function UR(r){return r.toLocaleTimeString()}function mb(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function XR(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function ZR(r){return r.getHours()===0&&r.getMinutes()===0?`${Dh.date(r)}
1176
- ${mb(r)}`:mb(r)}const Dh={timeBySeconds:UR,timeByMinutesWithDates:ZR,date:XR},Qt={seconds:"seconds",minutes:"minutes",date:"date"},Io={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},Et={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},gb=[{ceiling:Et.second*4,increment:Et.second,labelFormat:Qt.seconds},{ceiling:Et.second*8,increment:Et.second*5,labelFormat:Qt.seconds},{ceiling:Et.second*13,increment:Et.second*10,labelFormat:Qt.seconds},{ceiling:Et.second*20,increment:Et.second*15,labelFormat:Qt.seconds},{ceiling:Et.second*45,increment:Et.second*30,labelFormat:Qt.seconds},{ceiling:Et.minute*4,increment:Et.minute,labelFormat:Qt.minutes},{ceiling:Et.minute*8,increment:Et.minute*5,labelFormat:Qt.minutes},{ceiling:Et.minute*13,increment:Et.minute*10,labelFormat:Qt.minutes},{ceiling:Et.minute*28,increment:Et.minute*15,labelFormat:Qt.minutes},{ceiling:Et.hour*1.24,increment:Et.minute*30,labelFormat:Qt.minutes},{ceiling:Et.hour*3,increment:Et.hour,labelFormat:Qt.minutes},{ceiling:Et.hour*8,increment:Et.hour*2,getAnchor:Io.day,labelFormat:Qt.minutes},{ceiling:Et.hour*13,increment:Et.hour*6,getAnchor:Io.day,labelFormat:Qt.minutes},{ceiling:Et.hour*22,increment:Et.hour*12,getAnchor:Io.day,labelFormat:Qt.minutes},{ceiling:Et.day*4,increment:Et.day,getAnchor:Io.day,labelFormat:Qt.date},{ceiling:Et.week*2,increment:Et.week,getAnchor:Io.week,labelFormat:Qt.date},{ceiling:1/0,increment:Et.week*4,labelFormat:Qt.date}],VR=300;async function KR(){const r=await $e(),t=await Di(),e=new Xt,i=new Map;let s=await Co();bt.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:p,labelFormat:m}=a(),f=c(d,p);u(f,m)}catch(d){if(d instanceof fb)return;console.error(d)}}async function o(){const d=[];vd(30,async p=>{const m=BR();d.push(m);const f=await m;e.addChild(f.element),i.set(p,f)}),await Promise.all(d)}function a(){const d=r.left-VR,p=s.invert(d),m=s.invert(d+260/r.scale.x);if(!(p instanceof Date)||!(m instanceof Date))throw new fb;const f=m.getTime()-p.getTime(),{increment:g,getAnchor:y,labelFormat:_}=h(f);return{anchor:y(p),increment:g,labelFormat:l(_)}}function h(d){const p=gb.find(m=>m.ceiling>d)??gb[0];return p.getAnchor||(p.getAnchor=m=>Math.floor(m.getTime()/p.increment)*p.increment),p}function l(d){switch(d){case Qt.minutes:return Dh.timeByMinutesWithDates;case Qt.date:return Dh.date;default:return Dh.timeBySeconds}}function u(d,p){const m=new Map(i.entries()),f=Array.from(m.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(m.has(g)){const _=m.get(g);i.set(g,_),_.render(new Date(g),p);continue}const y=m.get(f.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),p),i.set(g,y)}}function c(d,p){return vd(30,m=>d+p*m)}return{element:e,render:n}}async function HR(){const r=await Xe(),{element:t,render:e}=await KR();r.stage.addChild(t),e(),bt.on("viewportDateRangeUpdated",()=>e()),bt.on("layoutSettingsUpdated",()=>e()),bt.on("configUpdated",()=>e())}function ZM(){}const YR=80;async function zR(){const r=await Xe(),t=await $e(),e=await Di(),i=await be(),s=await Sd();let n=await Co();bt.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.styles.playheadWidth,s.height=r.stage.height,s.tint=i.styles.playheadColor,s.position.x=n(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(s.position.x>0&&s.position.x<r.screen.width)||!(s.position.x>r.screen.width-YR))return;const u=t.left;t.zoomPercent(-.1,!0),t.left=u}return{element:s,render:o}}async function jR(){const r=await Xe(),t=await Id(),{element:e,render:i}=await zR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),bt.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function VM(){}function JR({stage:r,props:t}){DS(),aR(),nR(),HR(),iM(),jR(),XS(),CR(),NS(r),HS(t),pR(),hM(),NR()}function $R(){bt.clear();try{kS(),hR(),oR(),FS(),rM(),YS(),ZS(),AR(),fR(),lM(),FR(),yR()}catch(r){console.error(r)}}async function QR(r){const t=await be(),e=await Xe(),i=await Qy(),{animate:s}=await tb(),{element:n,render:o,bar:a}=await g(r);let h=r,l=null,u=!1,c=!1;i.add(n),n.eventMode="static",n.cursor="pointer",n.name=Ab,n.on("click",b=>{b.stopPropagation(),Ed(h)}),r.end_time||p(),bt.on("nodeSelected",()=>{const b=Cd(r);b!==u&&(u=b,o(h))});async function d(b){h=b;const v=y(b);return v===l||(l=v,await o(b),b.end_time&&m()),n}function p(){e.ticker.add(f)}function m(){e.ticker.remove(f)}function f(){d(r)}async function g(b){const{kind:v}=b;switch(v){case"task-run":return await WR();case"flow-run":return await OR(b);default:const S=v;throw new Error(`switch does not have case for value: ${S}`)}}function y(b){const v=b.end_time??new Date;return[b.state_type,v.getTime(),pt.horizontal,pt.horizontalScaleMultiplier,t.styles.colorMode].join("-")}function _({x:b,y:v}){s(n,{x:b,y:v},!c),c=!0}return{element:n,render:d,bar:a,setPosition:_}}function yb({gap:r=0,minimum:t=0}={}){const e=new Map;function i(u){const c=e.get(u)??[];return Math.max(...c.values(),j.toValue(t))+j.toValue(r)}function s(u){let c=0;for(let d=0;d<u;d++)c+=i(d);return c}function n(u){return s(u+1)-j.toValue(r)}function o({axis:u,nodeId:c,offset:d}){const p=e.get(u)??new Map;p.set(c,d),e.set(u,p)}function a({axis:u,nodeId:c}){let d,p;for(const[m,f]of e.entries())if(f.has(c)){d=m,p=f.get(c);break}d===u||d===void 0||p===void 0||(h({axis:d,nodeId:c}),o({axis:u,nodeId:c,offset:p}))}function h({axis:u,nodeId:c}){var d;(d=e.get(u))==null||d.delete(c)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function qR(r){throw new Error(`switch does not have case for value: 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3N0TWVzc2FnZShuKX1hc3luYyBmdW5jdGlvbiBTbyhuKXtjb25zdHtkYXRhOmV9PW4sdD13byhuKSxyPWF3YWl0IENvKG4sdCksbz1uZXcgTWFwO2xldCBpPTAsYT0wO2Zvcihjb25zdFt1LGxdb2YgZS5ub2Rlcyl7Y29uc3QgZj10LmdldCh1KSxnPXIuZ2V0KHUpO2lmKGY9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiBob3Jpem9udGFsIGxheW91dDogU2tpcHBpbmcgJHtsLmxhYmVsfWApO2NvbnRpbnVlfWlmKGc9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiB2ZXJ0aWNhbCBsYXlvdXQ6IFNraXBwaW5nICR7bC5sYWJlbH1gKTtjb250aW51ZX1pPU1hdGgubWF4KGksZyksYT1NYXRoLm1heChhLGYuY29sdW1uKSxvLnNldCh1LHsuLi5mLHk6Zyxyb3c6Z30pfWtvKHt0eXBlOiJsYXlvdXQiLGxheW91dDp7bWF4Um93OmksbWF4Q29sdW1uOmEscG9zaXRpb25zOm99fSl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLXNkX0hraDUwLmpzLm1hcAo=",xb=typeof window<"u"&&window.Blob&&new Blob([atob(bb)],{type:"text/javascript;charset=utf-8"});function tM(r){let t;try{if(t=xb&&(window.URL||window.webkitURL).createObjectURL(xb),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:application/javascript;base64,"+bb,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function eM(r){const t=new tM;return t.onmessage=r,t}async function _b(){const r=new Map,t=new Map,e=new Xt,i=new Xt,s=await be();let n=null;const o=yb({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=yb({gap:()=>s.styles.columnGap,minimum:()=>Ad()});let h=null,l=null;e.name=_p,bt.on("layoutUpdated",()=>{o.clear(),a.clear()}),bt.on("layoutSettingsUpdated",()=>{l&&e.parent&&u(l),C()}),bt.on("nodeSelected",()=>{C()});async function u(k){c(),l=k,h=null,await Promise.all([p(k),f(k)]),y(k)}function c(){n||(n=eM(D))}function d(){n&&(n.terminate(),n=null)}async function p(k){const F=[];for(const G of k.nodes.values())F.push(m(G));await Promise.all(F)}async function m(k){const{render:F}=await v(k);return await F(k)}async function f(k){if((await Di()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const G=[];for(const[V,{children:$}]of k.nodes)for(const{id:ut}of $)G.push(g(V,ut));await Promise.all(G)}async function g(k,F){const G=`${k}_${F}`;if(t.has(G))return;const V=await TR();t.has(G)||(t.set(G,V),i.addChild(V.element))}function y(k){if(!n)throw new Error("Layout worker not initialized");const F=new Map;for(const[G,{element:V}]of r)F.set(G,V.width);n.postMessage({type:"layout",data:k,widths:F,horizontalSettings:fd(k.start_time),verticalSettings:sR()})}function _(){if(h)for(const[k,F]of t){const[G,V]=k.split("_"),$=h.positions.get(G),ut=h.positions.get(V),nt=r.get(G);if(!$||!ut){console.warn(`Could not find edge in layout: Skipping ${k}`);continue}if(!nt){console.warn(`Could not find parent node in nodes: Skipping ${G}`);continue}const Ct=nt.bar.width,Rt=E($),_t={x:Rt.x+Ct,y:Rt.y+s.styles.nodeHeight/2},Y=E(ut),tt={x:Y.x-_t.x,y:Y.y-_t.y+s.styles.nodeHeight/2};F.setPosition(_t,tt)}}function b(){if(h){for(const[k,F]of r){const G=h.positions.get(k);if(!G){console.warn(`Could not find node in layout: Skipping ${k}`);continue}const V=E(G);F.setPosition(V),o.updateNodeAxis({nodeId:k,axis:G.y}),a.updateNodeAxis({nodeId:k,axis:G.column})}_(),e.emit("rendered"),e.emit("resized",W())}}async function v(k){const F=r.get(k.id);if(F)return F;const G=await QR(k);return G.element.on("resized",V=>S(k.id,V)),r.set(k.id,G),e.addChild(G.element),G}function S(k,F){if(!h)return;const G=r.get(k),V=h.positions.get(k);!G||!V||(o.setOffset({nodeId:k,axis:V.y,offset:F.height}),a.setOffset({nodeId:k,axis:V.column,offset:F.width}),b())}function E(k){const F=o.getTotalOffset(k.y);return{x:A(k),y:F}}function A(k){return pt.isDependency()?a.getTotalOffset(k.column):k.x}function I(){return h?o.getTotalValue(h.maxRow):0}function P(){if(!h||!l)return 0;if(pt.isDependency())return a.getTotalValue(h.maxColumn);const k=fd(l.start_time),F=zy(k),G=F(l.end_time??new Date),V=F(l.start_time);return G-V}function W(){return{width:P(),height:I()}}function D({data:k}){const{type:F}=k;switch(F){case"layout":L(k);return;default:qR(F)}}function L(k){h=k.layout,b()}async function C(){const k=await Di(),F=DR();if(!F||k.disableEdges){N([]);return}const G=Z(F.id);N(G)}function N(k){U(k),K(k)}function U(k){for(const[F,{element:G}]of r){if(k.length===0||k.includes(F)){G.alpha=1;continue}G.alpha=s.styles.nodeUnselectedAlpha}}function K(k){for(const[F,{element:G}]of t){const[V,$]=F.split("_");if(k.length===0||k.includes(V)&&k.includes($)){G.alpha=1;continue}G.alpha=s.styles.nodeUnselectedAlpha}}function Z(k){const F=z(k,"parents"),G=z(k,"children");return[k,...F,...G]}function z(k,F){const G=l==null?void 0:l.nodes.get(k);if(!G)return[];const V=[];for(const{id:$}of G[F])V.push($),V.push(...z($,F));return V}return{element:e,stopWorker:d,getSize:W,render:u}}let Ao=null,kr=null,ws=null;async function iM(){const r=await $e(),t=await be(),{element:e,render:i}=await _b();r.addChild(e),e.alpha=0;const s=await Wg(t.runId,async n=>{const o=kr?"runDataUpdated":"runDataCreated";kr=n,bt.emit(o,kr),await Di(),i(n)});bt.on("configUpdated",()=>{kr&&i(kr)}),ws=e,Ao=s.stop,ws.once("rendered",()=>sM()),bt.on("layoutUpdated",()=>nM()),s.start()}function rM(){Ao==null||Ao(),Ao=null,ws=null,kr=null}async function Id(){return kr||await Ue("runDataCreated")}function sM(){gd(),ye.shared.addOnce(()=>{ws&&(ws.alpha=1)})}async function nM(){if(!ws)return;const r=await be();ws.once("rendered",()=>{setTimeout(()=>{gd({animate:!0})},r.animationDuration)})}function oM(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function aM({start_time:r,end_time:t,nodes:e},i,s){const n=Nb(t??new Date,r),o=i.styles.nodeHeight+i.styles.rowGap,a=.5;return e.size*o*a*s/(n*20)}async function hM(){const r=await Id(),t=await be(),e=await Xe(),i=e.view.width/e.view.height,s=aM(r,t,i);kh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(pt.disableAnimations=!0),oM(r.nodes)>t.disableEdgesThreshold&&(pt.disableEdges=!0)}function lM(){pt.horizontal="temporal",pt.vertical="nearest-parent",pt.horizontalScaleMultiplierDefault=0,pt.horizontalScaleMultiplier=0,pt.disableAnimations=!1,pt.disableEdges=!1,pt.disableGuides=!1}const pt=j.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableEdges:!1,disableGuides:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"},isLeftAligned(){return this.horizontal==="left-aligned"}});async function Di(){return Rd()?pt:await Ue("layoutSettingsCreated")}function Ad(){return pt.isDependency()?200:20*pt.horizontalScaleMultiplier}function uM(){return[0,Ad()]}function cM(r){if(pt.isDependency())return[0,1];const t=r,e=Pb(t,1);return[t,e]}function kh(r,t=!1){if(pt.horizontalScaleMultiplier===r)return;const e=Oh();pt.horizontalScaleMultiplier=r,t&&(pt.horizontalScaleMultiplierDefault=r),e()}function dM(){kh(pt.horizontalScaleMultiplierDefault)}function pM(r){if(pt.horizontal===r)return;const t=Oh();pt.horizontal=r,pt.disableGuides=pt.isDependency()||pt.isLeftAligned(),t()}function fM(r){if(pt.vertical===r)return;const t=Oh();pt.vertical=r,t()}function mM(r){if(pt.disableEdges===r)return;const t=Oh();pt.disableEdges=r,t()}function Oh(){const r=Rd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=pt;return()=>{Rd()&&bt.emit(r,pt),(t!==pt.horizontal||e!==pt.vertical)&&bt.emit("layoutUpdated")}}function Rd(){return pt.horizontalScaleMultiplier!==0}function vb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const gM={class:"flex items-center gap-2"},yM=j.defineComponent({__name:"RunGraphSettings",setup(r){const t=[Zi.positions.topRight,Zi.positions.bottomRight,Zi.positions.topLeft,Zi.positions.bottomLeft],e=[{label:"Temporal dependency",value:"temporal_nearest-parent"},{label:"Temporal sequence",value:"temporal_waterfall"},{label:"Dependency grid",value:"dependency_nearest-parent"},{label:"Sequential grid",value:"dependency_waterfall"},{label:"Comparative duration",value:"left-aligned_duration-sorted"}],i=j.computed({get(){return`${pt.horizontal}_${pt.vertical}`},set(l){const[u,c]=l.split("_");pM(u),fM(c)}}),s=j.computed({get(){return pt.disableEdges},set(l){mM(l)}});function n(){const u=pt.horizontalScaleMultiplier*1.25;kh(u)}function o(){const l=Math.abs(-.75),u=pt.horizontalScaleMultiplier*l;kh(u)}pr.useKeyDown(["-","="],a);function a(l){if(!(vb(l.target)||l.metaKey||l.ctrlKey))switch(l.key){case"-":o();break;case"=":n();break}}function h(){dM()}return(l,u)=>{const c=j.resolveComponent("p-radio-group"),d=j.resolveComponent("p-label"),p=j.resolveComponent("p-divider"),m=j.resolveComponent("p-checkbox"),f=j.resolveComponent("p-overflow-menu");return j.openBlock(),j.createBlock(j.unref(Zi.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:j.withCtx(({toggle:g})=>[j.createVNode(j.unref(Zi.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:g},null,8,["onClick"])]),default:j.withCtx(()=>[j.createVNode(f,{class:"run-graph-settings__menu"},{default:j.withCtx(()=>[j.createVNode(d,{label:"Layout"},{default:j.withCtx(()=>[j.createVNode(c,{modelValue:i.value,"onUpdate:modelValue":u[0]||(u[0]=g=>i.value=g),options:e},{label:j.withCtx(({option:g})=>[j.createTextVNode(j.toDisplayString(g.label),1)]),_:1},8,["modelValue"])]),_:1}),j.unref(pt).isTemporal()||j.unref(pt).isLeftAligned()?(j.openBlock(),j.createElementBlock(j.Fragment,{key:0},[j.createVNode(p),j.createVNode(d,{label:"Scaling"},{default:j.withCtx(()=>[j.createElementVNode("div",gM,[j.createVNode(j.unref(Zi.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:o}),j.createVNode(j.unref(Zi.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:n}),j.createVNode(j.unref(Zi.PButton),{small:"",onClick:h},{default:j.withCtx(()=>[j.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):j.createCommentVNode("",!0),j.createVNode(p),j.createVNode(m,{modelValue:s.value,"onUpdate:modelValue":u[1]||(u[1]=g=>s.value=g),label:"Hide dependency arrows"},null,8,["modelValue"])]),_:1})]),_:1})}}}),bM={class:"run-graph__actions"},xM=j.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=j.ref(),s=j.ref(!1),n=j.computed({get(){return e.fullscreen??s.value},set(u){s.value=u,t("update:fullscreen",u)}});j.watch(()=>e.selected,u=>Ed(u)),bt.on("nodeSelected",u=>t("update:selected",u)),j.watch(()=>e.viewport,u=>cR(u));const o=j.computed(()=>({root:{"run-graph--fullscreen":n.value}}));bt.on("viewportDateRangeUpdated",u=>t("update:viewport",u));function a(){gd({animate:!0})}function h(){n.value=!n.value}j.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");JR({stage:i.value,props:e})}),j.onBeforeUnmount(()=>{$R()}),pr.useKeyDown(["c","f","Escape"],l);function l(u){if(!(vb(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(u,c)=>{const d=j.resolveComponent("p-button");return j.openBlock(),j.createElementBlock("div",{class:j.normalizeClass(["run-graph",o.value.root])},[j.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),j.createElementVNode("div",bM,[j.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),j.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),j.createVNode(yM)])],2)}}}),Tb=["flow-run","task-run"];function _M(r){return Tb.includes(r)}oe.RunGraph=xM,oe.isRunGraphNodeType=_M,oe.runGraphNodeKinds=Tb,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
1175
+ */var F0,Gr,on,Dc,ps,D0,kc,UE=function(){return typeof window<"u"},rr={},fs=180/Math.PI,an=Math.PI/180,hn=Math.atan2,k0=1e8,Oc=/([A-Z])/g,XE=/(left|right|width|margin|padding|x)/i,ZE=/[\s,\(]\S/,Li={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Wc=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},VE=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},KE=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},HE=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},O0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},W0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},YE=function(t,e,i){return t.style[e]=i},zE=function(t,e,i){return t.style.setProperty(e,i)},jE=function(t,e,i){return t._gsap[e]=i},JE=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},$E=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},QE=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Bt="transform",Ee=Bt+"Origin",qE=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in rr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Li[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=sr(s,a)}):this.tfm[t]=o.x?o[t]:sr(s,t),t===Ee&&(this.tfm.zOrigin=o.zOrigin);else return Li.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Bt)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Ee,e,"")),t=Bt}(n||e)&&this.props.push(t,e,n[t])},B0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},tC=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(Oc,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=kc(),(!n||!n.isStart)&&!i[Bt]&&(B0(i),s.zOrigin&&i[Ee]&&(i[Ee]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},U0=function(t,e){var i={target:t,props:[],revert:tC,save:qE};return t._gsap||Se.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},X0,Bc=function(t,e){var i=Gr.createElementNS?Gr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Gr.createElement(t);return i&&i.style?i:Gr.createElement(t)},Gi=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Oc,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,ln(e)||e,1)||""},Z0="O,Moz,ms,Ms,Webkit".split(","),ln=function(t,e,i){var s=e||ps,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(Z0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?Z0[o]:"")+t},Uc=function(){UE()&&window.document&&(F0=window,Gr=F0.document,on=Gr.documentElement,ps=Bc("div")||{style:{}},Bc("div"),Bt=ln(Bt),Ee=Bt+"Origin",ps.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",X0=!!ln("perspective"),kc=Se.core.reverting,Dc=1)},Xc=function r(t){var e=Bc("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(on.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),on.removeChild(e),this.style.cssText=n,o},V0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},K0=function(t){var e;try{e=t.getBBox()}catch{e=Xc.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===Xc||(e=Xc.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+V0(t,["x","cx","x1"])||0,y:+V0(t,["y","cy","y1"])||0,width:0,height:0}:e},H0=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&K0(t))},ms=function(t,e){if(e){var i=t.style,s;e in rr&&e!==Ee&&(e=Bt),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Oc,"-$1").toLowerCase())):i.removeAttribute(e)}},Nr=function(t,e,i,s,n,o){var a=new we(t._pt,e,i,0,1,o?W0:O0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},Y0={deg:1,rad:1,turn:1},eC={grid:1,flex:1},Fr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ps.style,h=XE.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(h?"Width":"Height"),c=100,d=s==="px",p=s==="%",m,f,g,y;if(s===o||!n||Y0[s]||Y0[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&H0(t),(p||o==="%")&&(rr[e]||~e.indexOf("adius")))return m=y?t.getBBox()[h?"width":"height"]:t[u],Ht(p?n/m*c:n/100*m);if(a[h?"width":"height"]=c+(d?o:s),f=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(f=(t.ownerSVGElement||{}).parentNode),(!f||f===Gr||!f.appendChild)&&(f=Gr.body),g=f._gsap,g&&p&&g.width&&h&&g.time===Ne.time&&!g.uncache)return Ht(n/g.width*c);if(p&&(e==="height"||e==="width")){var _=t.style[e];t.style[e]=c+s,m=t[u],_?t.style[e]=_:ms(t,e)}else(p||o==="%")&&!eC[Gi(f,"display")]&&(a.position=Gi(t,"position")),f===t&&(a.position="static"),f.appendChild(ps),m=ps[u],f.removeChild(ps),a.position="absolute";return h&&p&&(g=as(f),g.time=Ne.time,g.width=f[u]),Ht(d?m*n/c:m&&n?c/m*n:0)},sr=function(t,e,i,s){var n;return Dc||Uc(),e in Li&&e!=="transform"&&(e=Li[e],~e.indexOf(",")&&(e=e.split(",")[0])),rr[e]&&e!=="transform"?(n=mo(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:fh(Gi(t,Ee))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=ph[e]&&ph[e](t,e,i)||Gi(t,e)||$g(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Fr(t,e,n,i)+i:n},iC=function(t,e,i,s){if(!i||i==="none"){var n=ln(e,t,1),o=n&&Gi(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Gi(t,"borderTopColor"))}var a=new we(this._pt,t.style,e,0,1,P0),h=0,l=0,u,c,d,p,m,f,g,y,_,b,v,S;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(f=t.style[e],t.style[e]=s,s=Gi(t,e)||s,f?t.style[e]=f:ms(t,e)),u=[i,s],v0(u),i=u[0],s=u[1],d=i.match(qs)||[],S=s.match(qs)||[],S.length){for(;c=qs.exec(s);)g=c[0],_=s.substring(h,c.index),m?m=(m+1)%5:(_.substr(-5)==="rgba("||_.substr(-5)==="hsla(")&&(m=1),g!==(f=d[l++]||"")&&(p=parseFloat(f)||0,v=f.substr((p+"").length),g.charAt(1)==="="&&(g=tn(p,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=qs.lastIndex-b.length,b||(b=b||Me.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(p=Fr(t,e,f,b)||0),a._pt={_next:a._pt,p:_||l===1?_:",",s:p,c:y-p,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?W0:O0;return Vg.test(s)&&(a.e=0),this._pt=a,a},z0={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},rC=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=z0[i]||i,e[1]=z0[s]||s,e.join(" ")},sC=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],rr[a]&&(h=1,a=a==="transformOrigin"?Ee:Bt),ms(i,a);h&&(ms(i,Bt),o&&(o.svg&&i.removeAttribute("transform"),mo(i,1),o.uncache=1,B0(s)))}},ph={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new we(t._pt,e,i,0,0,sC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},fo=[1,0,0,1,0,0],j0={},J0=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},$0=function(t){var e=Gi(t,Bt);return J0(e)?fo:e.substr(7).match(Zg).map(Ht)},Zc=function(t,e){var i=t._gsap||as(t),s=t.style,n=$0(t),o,a,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?fo:n):(n===fo&&!t.offsetParent&&t!==on&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,on.appendChild(t)),n=$0(t),h?s.display=h:ms(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):on.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Vc=function(t,e,i,s,n,o){var a=t._gsap,h=n||Zc(t,!0),l=a.xOrigin||0,u=a.yOrigin||0,c=a.xOffset||0,d=a.yOffset||0,p=h[0],m=h[1],f=h[2],g=h[3],y=h[4],_=h[5],b=e.split(" "),v=parseFloat(b[0])||0,S=parseFloat(b[1])||0,E,I,A,P;i?h!==fo&&(I=p*g-m*f)&&(A=v*(g/I)+S*(-f/I)+(f*_-g*y)/I,P=v*(-m/I)+S*(p/I)-(p*_-m*y)/I,v=A,S=P):(E=K0(t),v=E.x+(~b[0].indexOf("%")?v/100*E.width:v),S=E.y+(~(b[1]||b[0]).indexOf("%")?S/100*E.height:S),!("xOrigin"in a)&&(v||S)&&(v-=E.x,S-=E.y)),s||s!==!1&&a.smooth?(y=v-l,_=S-u,a.xOffset=c+(y*p+_*f)-y,a.yOffset=d+(y*m+_*g)-_):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=S,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Ee]="0px 0px",o&&(Nr(o,a,"xOrigin",l,v),Nr(o,a,"yOrigin",u,S),Nr(o,a,"xOffset",c,a.xOffset),Nr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+S)},mo=function(t,e){var i=t._gsap||new E0(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Gi(t,Ee)||"0",u,c,d,p,m,f,g,y,_,b,v,S,E,I,A,P,O,W,L,C,N,X,K,Z,z,D,F,G,V,$,ut,nt;return u=c=d=f=g=y=_=b=v=0,p=m=1,i.svg=!!(t.getCTM&&H0(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Bt]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Bt]!=="none"?h[Bt]:"")),s.scale=s.rotate=s.translate="none"),I=Zc(t,i.svg),i.svg&&(i.uncache?(z=t.getBBox(),l=i.xOrigin-z.x+"px "+(i.yOrigin-z.y)+"px",Z=""):Z=!e&&t.getAttribute("data-svg-origin"),Vc(t,Z||l,!!Z||i.originIsAbsolute,i.smooth!==!1,I)),S=i.xOrigin||0,E=i.yOrigin||0,I!==fo&&(W=I[0],L=I[1],C=I[2],N=I[3],u=X=I[4],c=K=I[5],I.length===6?(p=Math.sqrt(W*W+L*L),m=Math.sqrt(N*N+C*C),f=W||L?hn(L,W)*fs:0,_=C||N?hn(C,N)*fs+f:0,_&&(m*=Math.abs(Math.cos(_*an))),i.svg&&(u-=S-(S*W+E*C),c-=E-(S*L+E*N))):(nt=I[6],$=I[7],F=I[8],G=I[9],V=I[10],ut=I[11],u=I[12],c=I[13],d=I[14],A=hn(nt,V),g=A*fs,A&&(P=Math.cos(-A),O=Math.sin(-A),Z=X*P+F*O,z=K*P+G*O,D=nt*P+V*O,F=X*-O+F*P,G=K*-O+G*P,V=nt*-O+V*P,ut=$*-O+ut*P,X=Z,K=z,nt=D),A=hn(-C,V),y=A*fs,A&&(P=Math.cos(-A),O=Math.sin(-A),Z=W*P-F*O,z=L*P-G*O,D=C*P-V*O,ut=N*O+ut*P,W=Z,L=z,C=D),A=hn(L,W),f=A*fs,A&&(P=Math.cos(A),O=Math.sin(A),Z=W*P+L*O,z=X*P+K*O,L=L*P-W*O,K=K*P-X*O,W=Z,X=z),g&&Math.abs(g)+Math.abs(f)>359.9&&(g=f=0,y=180-y),p=Ht(Math.sqrt(W*W+L*L+C*C)),m=Ht(Math.sqrt(K*K+nt*nt)),A=hn(X,K),_=Math.abs(A)>2e-4?A*fs:0,v=ut?1/(ut<0?-ut:ut):0),i.svg&&(Z=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!J0(Gi(t,Bt)),Z&&t.setAttribute("transform",Z))),Math.abs(_)>90&&Math.abs(_)<270&&(n?(p*=-1,_+=f<=0?180:-180,f+=f<=0?180:-180):(m*=-1,_+=_<=0?180:-180)),e=e||i.uncache,i.x=u-((i.xPercent=u&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=c-((i.yPercent=c&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=Ht(p),i.scaleY=Ht(m),i.rotation=Ht(f)+a,i.rotationX=Ht(g)+a,i.rotationY=Ht(y)+a,i.skewX=_+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Ee]=fh(l)),i.svg||(i.xOffset=i.yOffset=0),i.force3D=Me.force3D,i.renderTransform=i.svg?oC:X0?Q0:nC,i.uncache=0,i},fh=function(t){return(t=t.split(" "))[0]+" "+t[1]},Kc=function(t,e,i){var s=pe(e);return Ht(parseFloat(e)+parseFloat(Fr(t,"x",i+"px",s)))+s},nC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Q0(t,e)},gs="0deg",go="0px",ys=") ",Q0=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,u=i.rotationY,c=i.rotationX,d=i.skewX,p=i.skewY,m=i.scaleX,f=i.scaleY,g=i.transformPerspective,y=i.force3D,_=i.target,b=i.zOrigin,v="",S=y==="auto"&&t&&t!==1||y===!0;if(b&&(c!==gs||u!==gs)){var E=parseFloat(u)*an,I=Math.sin(E),A=Math.cos(E),P;E=parseFloat(c)*an,P=Math.cos(E),o=Kc(_,o,I*P*-b),a=Kc(_,a,-Math.sin(E)*-b),h=Kc(_,h,A*P*-b+b)}g!==go&&(v+="perspective("+g+ys),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(S||o!==go||a!==go||h!==go)&&(v+=h!==go||S?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+ys),l!==gs&&(v+="rotate("+l+ys),u!==gs&&(v+="rotateY("+u+ys),c!==gs&&(v+="rotateX("+c+ys),(d!==gs||p!==gs)&&(v+="skew("+d+", "+p+ys),(m!==1||f!==1)&&(v+="scale("+m+", "+f+ys),_.style[Bt]=v||"translate(0, 0)"},oC=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,u=i.skewY,c=i.scaleX,d=i.scaleY,p=i.target,m=i.xOrigin,f=i.yOrigin,g=i.xOffset,y=i.yOffset,_=i.forceCSS,b=parseFloat(o),v=parseFloat(a),S,E,I,A,P;h=parseFloat(h),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,h+=u),h||l?(h*=an,l*=an,S=Math.cos(h)*c,E=Math.sin(h)*c,I=Math.sin(h-l)*-d,A=Math.cos(h-l)*d,l&&(u*=an,P=Math.tan(l-u),P=Math.sqrt(1+P*P),I*=P,A*=P,u&&(P=Math.tan(u),P=Math.sqrt(1+P*P),S*=P,E*=P)),S=Ht(S),E=Ht(E),I=Ht(I),A=Ht(A)):(S=c,A=d,E=I=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Fr(p,"x",o,"px"),v=Fr(p,"y",a,"px")),(m||f||g||y)&&(b=Ht(b+m-(m*S+f*I)+g),v=Ht(v+f-(m*E+f*A)+y)),(s||n)&&(P=p.getBBox(),b=Ht(b+s/100*P.width),v=Ht(v+n/100*P.height)),P="matrix("+S+","+E+","+I+","+A+","+b+","+v+")",p.setAttribute("transform",P),_&&(p.style[Bt]=P)},aC=function(t,e,i,s,n){var o=360,a=re(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?fs:1),l=h-s,u=s+l+"deg",c,d;return a&&(c=n.split("_")[1],c==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),c==="cw"&&l<0?l=(l+o*k0)%o-~~(l/o)*o:c==="ccw"&&l>0&&(l=(l-o*k0)%o-~~(l/o)*o)),t._pt=d=new we(t._pt,e,i,s,l,VE),d.e=u,d.u="deg",t._props.push(i),d},q0=function(t,e){for(var i in e)t[i]=e[i];return t},hC=function(t,e,i){var s=q0({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,u,c,d,p,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Bt]=e,a=mo(i,1),ms(i,Bt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Bt],o[Bt]=e,a=mo(i,1),o[Bt]=l);for(h in rr)l=s[h],u=a[h],l!==u&&n.indexOf(h)<0&&(p=pe(l),m=pe(u),c=p!==m?Fr(i,h,l,m):parseFloat(l),d=parseFloat(u),t._pt=new we(t._pt,a,h,c,d-c,Wc),t._pt.u=m||0,t._props.push(h));q0(a,s)};Te("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});ph[t>1?"border"+r:r]=function(a,h,l,u,c){var d,p;if(arguments.length<4)return d=o.map(function(m){return sr(a,m,l)}),p=d.join(" "),p.split(d[0]).length===5?d[0]:p;d=(u+"").split(" "),p={},o.forEach(function(m,f){return p[m]=d[f]=d[f]||d[(f-1)/2|0]}),a.init(h,p,c)}});var ty={name:"css",register:Uc,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,u,c,d,p,m,f,g,y,_,b,v,S,E,I,A;Dc||Uc(),this.styles=this.styles||U0(t),A=this.styles.props,this.tween=i;for(f in e)if(f!=="autoRound"&&(u=e[f],!(Le[f]&&C0(f,e,i,s,t,n)))){if(p=typeof u,m=ph[f],p==="function"&&(u=u.call(i,s,t,n),p=typeof u),p==="string"&&~u.indexOf("random(")&&(u=ao(u)),m)m(this,t,f,u,i)&&(I=1);else if(f.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(f)+"").trim(),u+="",Pr.lastIndex=0,Pr.test(l)||(g=pe(l),y=pe(u)),y?g!==y&&(l=Fr(t,f,l,y)+y):g&&(u+=g),this.add(a,"setProperty",l,u,s,n,0,0,f),o.push(f),A.push(f,0,a[f]);else if(p!=="undefined"){if(h&&f in h?(l=typeof h[f]=="function"?h[f].call(i,s,t,n):h[f],re(l)&&~l.indexOf("random(")&&(l=ao(l)),pe(l+"")||l==="auto"||(l+=Me.units[f]||pe(sr(t,f))||""),(l+"").charAt(1)==="="&&(l=sr(t,f))):l=sr(t,f),d=parseFloat(l),_=p==="string"&&u.charAt(1)==="="&&u.substr(0,2),_&&(u=u.substr(2)),c=parseFloat(u),f in Li&&(f==="autoAlpha"&&(d===1&&sr(t,"visibility")==="hidden"&&c&&(d=0),A.push("visibility",0,a.visibility),Nr(this,a,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),f!=="scale"&&f!=="transform"&&(f=Li[f],~f.indexOf(",")&&(f=f.split(",")[0]))),b=f in rr,b){if(this.styles.save(f),v||(S=t._gsap,S.renderTransform&&!e.parseTransform||mo(t,e.parseTransform),E=e.smoothOrigin!==!1&&S.smooth,v=this._pt=new we(this._pt,a,Bt,0,1,S.renderTransform,S,0,-1),v.dep=1),f==="scale")this._pt=new we(this._pt,S,"scaleY",S.scaleY,(_?tn(S.scaleY,_+c):c)-S.scaleY||0,Wc),this._pt.u=0,o.push("scaleY",f),f+="X";else if(f==="transformOrigin"){A.push(Ee,0,a[Ee]),u=rC(u),S.svg?Vc(t,u,0,E,0,this):(y=parseFloat(u.split(" ")[2])||0,y!==S.zOrigin&&Nr(this,S,"zOrigin",S.zOrigin,y),Nr(this,a,f,fh(l),fh(u)));continue}else if(f==="svgOrigin"){Vc(t,u,1,E,0,this);continue}else if(f in j0){aC(this,S,f,d,_?tn(d,_+u):u);continue}else if(f==="smoothOrigin"){Nr(this,S,"smooth",S.smooth,u);continue}else if(f==="force3D"){S[f]=u;continue}else if(f==="transform"){hC(this,u,t);continue}}else f in a||(f=ln(f)||f);if(b||(c||c===0)&&(d||d===0)&&!ZE.test(u)&&f in a)g=(l+"").substr((d+"").length),c||(c=0),y=pe(u)||(f in Me.units?Me.units[f]:g),g!==y&&(d=Fr(t,f,l,y)),this._pt=new we(this._pt,b?S:a,f,d,(_?tn(d,_+c):c)-d,!b&&(y==="px"||f==="zIndex")&&e.autoRound!==!1?HE:Wc),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=KE);else if(f in a)iC.call(this,t,f,l,_?_+u:u);else if(f in t)this.add(t,f,l||t[f],_?_+u:u,s,n);else if(f!=="parseTransform"){pc(f,u);continue}b||(f in a?A.push(f,0,a[f]):A.push(f,1,l||t[f])),o.push(f)}}I&&L0(this)},render:function(t,e){if(e.tween._time||!kc())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:sr,aliases:Li,getSetter:function(t,e,i){var s=Li[e];return s&&s.indexOf(",")<0&&(e=s),e in rr&&e!==Ee&&(t._gsap.x||sr(t,"x"))?i&&D0===i?e==="scale"?JE:jE:(D0=i||{})&&(e==="scale"?$E:QE):t.style&&!ac(t.style[e])?YE:~e.indexOf("-")?zE:Pc(t,e)},core:{_removeProperty:ms,_getMatrix:Zc}};Se.utils.checkPrefix=ln,Se.core.getStyleSaver=U0,function(r,t,e,i){var s=Te(r+","+t+","+e,function(n){rr[n]=1});Te(t,function(n){Me.units[n]="deg",j0[n]=1}),Li[s[13]]=r+","+t,Te(i,function(n){var o=n.split(":");Li[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Te("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Me.units[r]="px"}),Se.registerPlugin(ty);var ey=Se.registerPlugin(ty)||Se;ey.core.Tween;const bs=new dt;class lC{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,bs),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=bs.right>t.left&&bs.left<t.right&&bs.bottom>t.top&&bs.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(bs):e.getBounds(!0,bs);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}var mh={exports:{}};mh.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",u="[object Boolean]",c="[object Date]",d="[object Error]",p="[object Function]",m="[object GeneratorFunction]",f="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Promise]",v="[object Proxy]",S="[object RegExp]",E="[object Set]",I="[object String]",A="[object Symbol]",P="[object Undefined]",O="[object WeakMap]",W="[object ArrayBuffer]",L="[object DataView]",C="[object Float32Array]",N="[object Float64Array]",X="[object Int8Array]",K="[object Int16Array]",Z="[object Int32Array]",z="[object Uint8Array]",D="[object Uint8ClampedArray]",F="[object Uint16Array]",G="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,$=/^\[object .+?Constructor\]$/,ut=/^(?:0|[1-9]\d*)$/,nt={};nt[C]=nt[N]=nt[X]=nt[K]=nt[Z]=nt[z]=nt[D]=nt[F]=nt[G]=!0,nt[a]=nt[h]=nt[W]=nt[u]=nt[L]=nt[c]=nt[d]=nt[p]=nt[f]=nt[g]=nt[_]=nt[S]=nt[E]=nt[I]=nt[O]=!1;var Ct=typeof ei=="object"&&ei&&ei.Object===Object&&ei,Rt=typeof self=="object"&&self&&self.Object===Object&&self,_t=Ct||Rt||Function("return this")(),Y=t&&!t.nodeType&&t,tt=Y&&!0&&r&&!r.nodeType&&r,et=tt&&tt.exports===Y,k=et&&Ct.process,xt=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),gt=xt&&xt.isTypedArray;function Mt(T,R){for(var x=-1,w=T==null?0:T.length,M=0,U=[];++x<w;){var ht=T[x];R(ht,x,T)&&(U[M++]=ht)}return U}function Ut(T,R){for(var x=-1,w=R.length,M=T.length;++x<w;)T[M+x]=R[x];return T}function De(T,R){for(var x=-1,w=T==null?0:T.length;++x<w;)if(R(T[x],x,T))return!0;return!1}function pi(T,R){for(var x=-1,w=Array(T);++x<T;)w[x]=R(x);return w}function Md(T){return function(R){return T(R)}}function xn(T,R){return T.has(R)}function Mo(T,R){return T==null?void 0:T[R]}function _n(T){var R=-1,x=Array(T.size);return T.forEach(function(w,M){x[++R]=[M,w]}),x}function fi(T,R){return function(x){return T(R(x))}}function Wh(T){var R=-1,x=Array(T.size);return T.forEach(function(w){x[++R]=w}),x}var Bh=Array.prototype,Pd=Function.prototype,vn=Object.prototype,Or=_t["__core-js_shared__"],Po=Pd.toString,ke=vn.hasOwnProperty,Lo=function(){var T=/[^.]+$/.exec(Or&&Or.keys&&Or.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Go=vn.toString,Uh=RegExp("^"+Po.call(ke).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xh=et?_t.Buffer:void 0,Tn=_t.Symbol,ki=_t.Uint8Array,Es=vn.propertyIsEnumerable,Ld=Bh.splice,Oi=Tn?Tn.toStringTag:void 0,Zh=Object.getOwnPropertySymbols,Vh=Xh?Xh.isBuffer:void 0,Cs=fi(Object.keys,Object),No=dr(_t,"DataView"),Oe=dr(_t,"Map"),Fo=dr(_t,"Promise"),Do=dr(_t,"Set"),ko=dr(_t,"WeakMap"),Is=dr(Object,"create"),Gd=gi(No),mi=gi(Oe),Nd=gi(Fo),Fd=gi(Do),Dd=gi(ko),Kh=Tn?Tn.prototype:void 0,Oo=Kh?Kh.valueOf:void 0;function Ie(T){var R=-1,x=T==null?0:T.length;for(this.clear();++R<x;){var w=T[R];this.set(w[0],w[1])}}function kd(){this.__data__=Is?Is(null):{},this.size=0}function Od(T){var R=this.has(T)&&delete this.__data__[T];return this.size-=R?1:0,R}function Wd(T){var R=this.__data__;if(Is){var x=R[T];return x===i?void 0:x}return ke.call(R,T)?R[T]:void 0}function Bd(T){var R=this.__data__;return Is?R[T]!==void 0:ke.call(R,T)}function Ud(T,R){var x=this.__data__;return this.size+=this.has(T)?0:1,x[T]=Is&&R===void 0?i:R,this}Ie.prototype.clear=kd,Ie.prototype.delete=Od,Ie.prototype.get=Wd,Ie.prototype.has=Bd,Ie.prototype.set=Ud;function fe(T){var R=-1,x=T==null?0:T.length;for(this.clear();++R<x;){var w=T[R];this.set(w[0],w[1])}}function Xd(){this.__data__=[],this.size=0}function Zd(T){var R=this.__data__,x=Sn(R,T);if(x<0)return!1;var w=R.length-1;return x==w?R.pop():Ld.call(R,x,1),--this.size,!0}function Vd(T){var R=this.__data__,x=Sn(R,T);return x<0?void 0:R[x][1]}function Kd(T){return Sn(this.__data__,T)>-1}function Hd(T,R){var x=this.__data__,w=Sn(x,T);return w<0?(++this.size,x.push([T,R])):x[w][1]=R,this}fe.prototype.clear=Xd,fe.prototype.delete=Zd,fe.prototype.get=Vd,fe.prototype.has=Kd,fe.prototype.set=Hd;function ur(T){var R=-1,x=T==null?0:T.length;for(this.clear();++R<x;){var w=T[R];this.set(w[0],w[1])}}function Wo(){this.size=0,this.__data__={hash:new Ie,map:new(Oe||fe),string:new Ie}}function Yd(T){var R=Cn(this,T).delete(T);return this.size-=R?1:0,R}function wn(T){return Cn(this,T).get(T)}function Bo(T){return Cn(this,T).has(T)}function zd(T,R){var x=Cn(this,T),w=x.size;return x.set(T,R),this.size+=x.size==w?0:1,this}ur.prototype.clear=Wo,ur.prototype.delete=Yd,ur.prototype.get=wn,ur.prototype.has=Bo,ur.prototype.set=zd;function cr(T){var R=-1,x=T==null?0:T.length;for(this.__data__=new ur;++R<x;)this.add(T[R])}function Hh(T){return this.__data__.set(T,i),this}function jd(T){return this.__data__.has(T)}cr.prototype.add=cr.prototype.push=Hh,cr.prototype.has=jd;function Wi(T){var R=this.__data__=new fe(T);this.size=R.size}function Jd(){this.__data__=new fe,this.size=0}function Yh(T){var R=this.__data__,x=R.delete(T);return this.size=R.size,x}function $d(T){return this.__data__.get(T)}function Qd(T){return this.__data__.has(T)}function qd(T,R){var x=this.__data__;if(x instanceof fe){var w=x.__data__;if(!Oe||w.length<e-1)return w.push([T,R]),this.size=++x.size,this;x=this.__data__=new ur(w)}return x.set(T,R),this.size=x.size,this}Wi.prototype.clear=Jd,Wi.prototype.delete=Yh,Wi.prototype.get=$d,Wi.prototype.has=Qd,Wi.prototype.set=qd;function tp(T,R){var x=Rn(T),w=!x&&Zo(T),M=!x&&!w&&Rs(T),U=!x&&!w&&!M&&il(T),ht=x||w||M||U,ft=ht?pi(T.length,String):[],yt=ft.length;for(var ot in T)(R||ke.call(T,ot))&&!(ht&&(ot=="length"||M&&(ot=="offset"||ot=="parent")||U&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||Xo(ot,yt)))&&ft.push(ot);return ft}function Sn(T,R){for(var x=T.length;x--;)if(An(T[x][0],R))return x;return-1}function ep(T,R,x){var w=R(T);return Rn(T)?w:Ut(w,x(T))}function As(T){return T==null?T===void 0?P:y:Oi&&Oi in Object(T)?np(T):In(T)}function zh(T){return Br(T)&&As(T)==a}function jh(T,R,x,w,M){return T===R?!0:T==null||R==null||!Br(T)&&!Br(R)?T!==T&&R!==R:ip(T,R,x,w,jh,M)}function ip(T,R,x,w,M,U){var ht=Rn(T),ft=Rn(R),yt=ht?h:Bi(T),ot=ft?h:Bi(R);yt=yt==a?_:yt,ot=ot==a?_:ot;var vt=yt==_,Ft=ot==_,At=yt==ot;if(At&&Rs(T)){if(!Rs(R))return!1;ht=!0,vt=!1}if(At&&!vt)return U||(U=new Wi),ht||il(T)?Jh(T,R,x,w,M,U):$h(T,R,yt,x,w,M,U);if(!(x&s)){var oe=vt&&ke.call(T,"__wrapped__"),me=Ft&&ke.call(R,"__wrapped__");if(oe||me){var qe=oe?T.value():T,ti=me?R.value():R;return U||(U=new Wi),M(qe,ti,x,w,U)}}return At?(U||(U=new Wi),sp(T,R,x,w,M,U)):!1}function En(T){if(!el(T)||hp(T))return!1;var R=Ui(T)?Uh:$;return R.test(gi(T))}function Uo(T){return Br(T)&&Wr(T.length)&&!!nt[As(T)]}function rp(T){if(!lp(T))return Cs(T);var R=[];for(var x in Object(T))ke.call(T,x)&&x!="constructor"&&R.push(x);return R}function Jh(T,R,x,w,M,U){var ht=x&s,ft=T.length,yt=R.length;if(ft!=yt&&!(ht&&yt>ft))return!1;var ot=U.get(T);if(ot&&U.get(R))return ot==R;var vt=-1,Ft=!0,At=x&n?new cr:void 0;for(U.set(T,R),U.set(R,T);++vt<ft;){var oe=T[vt],me=R[vt];if(w)var qe=ht?w(me,oe,vt,R,T,U):w(oe,me,vt,T,R,U);if(qe!==void 0){if(qe)continue;Ft=!1;break}if(At){if(!De(R,function(ti,Ms){if(!xn(At,Ms)&&(oe===ti||M(oe,ti,x,w,U)))return At.push(Ms)})){Ft=!1;break}}else if(!(oe===me||M(oe,me,x,w,U))){Ft=!1;break}}return U.delete(T),U.delete(R),Ft}function $h(T,R,x,w,M,U,ht){switch(x){case L:if(T.byteLength!=R.byteLength||T.byteOffset!=R.byteOffset)return!1;T=T.buffer,R=R.buffer;case W:return!(T.byteLength!=R.byteLength||!U(new ki(T),new ki(R)));case u:case c:case g:return An(+T,+R);case d:return T.name==R.name&&T.message==R.message;case S:case I:return T==R+"";case f:var ft=_n;case E:var yt=w&s;if(ft||(ft=Wh),T.size!=R.size&&!yt)return!1;var ot=ht.get(T);if(ot)return ot==R;w|=n,ht.set(T,R);var vt=Jh(ft(T),ft(R),w,M,U,ht);return ht.delete(T),vt;case A:if(Oo)return Oo.call(T)==Oo.call(R)}return!1}function sp(T,R,x,w,M,U){var ht=x&s,ft=Qh(T),yt=ft.length,ot=Qh(R),vt=ot.length;if(yt!=vt&&!ht)return!1;for(var Ft=yt;Ft--;){var At=ft[Ft];if(!(ht?At in R:ke.call(R,At)))return!1}var oe=U.get(T);if(oe&&U.get(R))return oe==R;var me=!0;U.set(T,R),U.set(R,T);for(var qe=ht;++Ft<yt;){At=ft[Ft];var ti=T[At],Ms=R[At];if(w)var wb=ht?w(Ms,ti,At,R,T,U):w(ti,Ms,At,T,R,U);if(!(wb===void 0?ti===Ms||M(ti,Ms,x,w,U):wb)){me=!1;break}qe||(qe=At=="constructor")}if(me&&!qe){var sl=T.constructor,nl=R.constructor;sl!=nl&&"constructor"in T&&"constructor"in R&&!(typeof sl=="function"&&sl instanceof sl&&typeof nl=="function"&&nl instanceof nl)&&(me=!1)}return U.delete(T),U.delete(R),me}function Qh(T){return ep(T,rl,op)}function Cn(T,R){var x=T.__data__;return ap(R)?x[typeof R=="string"?"string":"hash"]:x.map}function dr(T,R){var x=Mo(T,R);return En(x)?x:void 0}function np(T){var R=ke.call(T,Oi),x=T[Oi];try{T[Oi]=void 0;var w=!0}catch{}var M=Go.call(T);return w&&(R?T[Oi]=x:delete T[Oi]),M}var op=Zh?function(T){return T==null?[]:(T=Object(T),Mt(Zh(T),function(R){return Es.call(T,R)}))}:up,Bi=As;(No&&Bi(new No(new ArrayBuffer(1)))!=L||Oe&&Bi(new Oe)!=f||Fo&&Bi(Fo.resolve())!=b||Do&&Bi(new Do)!=E||ko&&Bi(new ko)!=O)&&(Bi=function(T){var R=As(T),x=R==_?T.constructor:void 0,w=x?gi(x):"";if(w)switch(w){case Gd:return L;case mi:return f;case Nd:return b;case Fd:return E;case Dd:return O}return R});function Xo(T,R){return R=R??o,!!R&&(typeof T=="number"||ut.test(T))&&T>-1&&T%1==0&&T<R}function ap(T){var R=typeof T;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?T!=="__proto__":T===null}function hp(T){return!!Lo&&Lo in T}function lp(T){var R=T&&T.constructor,x=typeof R=="function"&&R.prototype||vn;return T===x}function In(T){return Go.call(T)}function gi(T){if(T!=null){try{return Po.call(T)}catch{}try{return T+""}catch{}}return""}function An(T,R){return T===R||T!==T&&R!==R}var Zo=zh(function(){return arguments}())?zh:function(T){return Br(T)&&ke.call(T,"callee")&&!Es.call(T,"callee")},Rn=Array.isArray;function qh(T){return T!=null&&Wr(T.length)&&!Ui(T)}var Rs=Vh||cp;function tl(T,R){return jh(T,R)}function Ui(T){if(!el(T))return!1;var R=As(T);return R==p||R==m||R==l||R==v}function Wr(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function el(T){var R=typeof T;return T!=null&&(R=="object"||R=="function")}function Br(T){return T!=null&&typeof T=="object"}var il=gt?Md(gt):Uo;function rl(T){return qh(T)?tp(T):rp(T)}function up(){return[]}function cp(){return!1}r.exports=tl}(mh,mh.exports);var uC=mh.exports;const iy=Fn(uC);var cC=Object.defineProperty,dC=(r,t,e)=>t in r?cC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,B=(r,t,e)=>(dC(r,typeof t!="symbol"?t+"":t,e),e);class Je{constructor(t){B(this,"parent"),B(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var pC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ry={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-u)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(pC)})(ry);const sy=ry.exports;function gh(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return sy[r]}else return sy[t]}const fC={removeOnInterrupt:!1,ease:"linear",time:1e3};class mC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"startX"),B(this,"startY"),B(this,"deltaX"),B(this,"deltaY"),B(this,"keepCenter"),B(this,"startWidth",null),B(this,"startHeight",null),B(this,"deltaWidth",null),B(this,"deltaHeight",null),B(this,"width",null),B(this,"height",null),B(this,"time",0),this.options=Object.assign({},fC,e),this.options.ease=gh(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new lt(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new lt(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const gC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class yC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"left"),B(this,"top"),B(this,"right"),B(this,"bottom"),B(this,"underflowX"),B(this,"underflowY"),B(this,"ease"),B(this,"toX"),B(this,"toY"),this.options=Object.assign({},gC,e),this.ease=gh(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new lt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new lt(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new lt(0,0),bottomRight:new lt(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const bC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class xC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"last"),B(this,"noUnderflow"),B(this,"underflowX"),B(this,"underflowY"),this.options=Object.assign({},bC,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new lt(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const _C={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class vC extends Je{constructor(t,e={}){super(t),B(this,"options"),this.options=Object.assign({},_C,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const TC={friction:.98,bounce:.8,minSpeed:.01},Dr=16;class wC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"x"),B(this,"y"),B(this,"percentChangeX"),B(this,"percentChangeY"),B(this,"saved"),B(this,"timeSinceRelease"),this.options=Object.assign({},TC,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Dr/o*(Math.pow(n,s/Dr)-Math.pow(n,i/Dr)),this.x*=Math.pow(this.percentChangeX,t/Dr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Dr/o*(Math.pow(n,s/Dr)-Math.pow(n,i/Dr)),this.y*=Math.pow(this.percentChangeY,t/Dr)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const SC={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class EC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"moved"),B(this,"reverse"),B(this,"xDirection"),B(this,"yDirection"),B(this,"keyIsPressed"),B(this,"mouse"),B(this,"underflowX"),B(this,"underflowY"),B(this,"last"),B(this,"current"),B(this,"windowEventHandlers",[]),this.options=Object.assign({},SC,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new lt(this.last.x,this.last.y),world:this.parent.toWorld(new lt(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new lt(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const CC={speed:0,acceleration:null,radius:null};class IC extends Je{constructor(t,e,i={}){super(t),B(this,"options"),B(this,"target"),B(this,"velocity"),this.target=e,this.options=Object.assign({},CC,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const u=Math.cos(a)*this.velocity.x,c=Math.sin(a)*this.velocity.y,d=Math.abs(u)>Math.abs(n)?i:e.x+u,p=Math.abs(c)>Math.abs(o)?s:e.y+c;this.parent.moveCenter(d,p),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,u=Math.abs(h)>Math.abs(n)?i:e.x+h,c=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(u,c),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const AC={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class RC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"reverse"),B(this,"radiusSquared"),B(this,"left"),B(this,"top"),B(this,"right"),B(this,"bottom"),B(this,"horizontal"),B(this,"vertical"),this.options=Object.assign({},AC,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const MC={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class PC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"active",!1),B(this,"pinching",!1),B(this,"moved",!1),B(this,"lastCenter"),this.options=Object.assign({},MC,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new lt(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let u=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));u=u===0?u=1e-10:u;const c=(1-a/u)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=c),this.isAxisY()&&(this.parent.scale.y+=c),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const p=this.parent.toGlobal(h);this.parent.x+=(l.x-p.x)*this.options.factor,this.parent.y+=(l.y-p.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const LC={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class GC extends Je{constructor(t,e,i,s={}){super(t),B(this,"options"),B(this,"ease"),B(this,"x"),B(this,"y"),B(this,"percent"),B(this,"snapping"),B(this,"deltaX"),B(this,"deltaY"),B(this,"startX"),B(this,"startY"),this.options=Object.assign({},LC,s),this.ease=gh(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const u=this.ease(e.time,0,1,this.options.time);s=o+h*u,n=a+l*u}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const NC={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class FC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"ease"),B(this,"xScale"),B(this,"yScale"),B(this,"xIndependent"),B(this,"yIndependent"),B(this,"snapping"),this.options=Object.assign({},NC,e),this.ease=gh(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const DC={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class kC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"smoothing"),B(this,"smoothingCenter"),B(this,"smoothingCount"),B(this,"keyIsPressed"),this.options=Object.assign({},DC,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class OC{constructor(t){B(this,"viewport"),B(this,"clickedAvailable"),B(this,"isMouseDown"),B(this,"last"),B(this,"wheelFunction"),B(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.eventMode="static",this.viewport.forceHitArea||(this.viewport.hitArea=new dt(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new lt;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const yo=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class WC{constructor(t){B(this,"plugins"),B(this,"list"),B(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=yo.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=yo.indexOf(t);n!==-1&&yo.splice(n,1),yo.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of yo)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const BC={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:ye.shared,allowPreserveDragOutside:!1};class UC extends Xt{constructor(t){super(),B(this,"moving"),B(this,"screenWidth"),B(this,"screenHeight"),B(this,"threshold"),B(this,"input"),B(this,"plugins"),B(this,"zooming"),B(this,"lastViewport"),B(this,"options"),B(this,"_dirty"),B(this,"_forceHitArea"),B(this,"_hitAreaDefault"),B(this,"_pause"),B(this,"tickerFunction"),B(this,"_worldWidth"),B(this,"_worldHeight"),B(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...BC,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new OC(this),this.plugins=new WC(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new dt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new dt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new lt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new lt(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new lt(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new lt(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new FC(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new lt(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new dt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new EC(this,t)),this}clamp(t){return this.plugins.add("clamp",new xC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new wC(this,t)),this}bounce(t){return this.plugins.add("bounce",new yC(this,t)),this}pinch(t){return this.plugins.add("pinch",new PC(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new GC(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new IC(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new kC(this,t)),this}animate(t){return this.plugins.add("animate",new mC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new vC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new RC(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function yh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function XC(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Hc(r){let t,e,i;r.length!==2?(t=yh,e=(a,h)=>yh(r(a),h),i=(a,h)=>r(a)-h):(t=r===yh||r===XC?r:ZC,e=r,i=r);function s(a,h,l=0,u=a.length){if(l<u){if(t(h,h)!==0)return u;do{const c=l+u>>>1;e(a[c],h)<0?l=c+1:u=c}while(l<u)}return l}function n(a,h,l=0,u=a.length){if(l<u){if(t(h,h)!==0)return u;do{const c=l+u>>>1;e(a[c],h)<=0?l=c+1:u=c}while(l<u)}return l}function o(a,h,l=0,u=a.length){const c=s(a,h,l,u-1);return c>l&&i(a[c-1],h)>-i(a[c],h)?c-1:c}return{left:s,center:o,right:n}}function ZC(){return 0}function VC(r){return r===null?NaN:+r}const KC=Hc(yh).right;Hc(VC).center;const HC=KC,YC=Math.sqrt(50),zC=Math.sqrt(10),jC=Math.sqrt(2);function bh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=YC?10:n>=zC?5:n>=jC?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?bh(r,t,e*2):[a,h,l]}function JC(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?bh(t,r,e):bh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function Yc(r,t,e){return t=+t,r=+r,e=+e,bh(r,t,e)[2]}function zc(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?Yc(t,r,e):Yc(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function jc(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function ny(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function bo(){}var xo=.7,xh=1/xo,un="\\s*([+-]?\\d+)\\s*",_o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ni="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$C=/^#([0-9a-f]{3,8})$/,QC=new RegExp(`^rgb\\(${un},${un},${un}\\)$`),qC=new RegExp(`^rgb\\(${Ni},${Ni},${Ni}\\)$`),tI=new RegExp(`^rgba\\(${un},${un},${un},${_o}\\)$`),eI=new RegExp(`^rgba\\(${Ni},${Ni},${Ni},${_o}\\)$`),iI=new RegExp(`^hsl\\(${_o},${Ni},${Ni}\\)$`),rI=new RegExp(`^hsla\\(${_o},${Ni},${Ni},${_o}\\)$`),oy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};jc(bo,vo,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ay,formatHex:ay,formatHex8:sI,formatHsl:nI,formatRgb:hy,toString:hy});function ay(){return this.rgb().formatHex()}function sI(){return this.rgb().formatHex8()}function nI(){return py(this).formatHsl()}function hy(){return this.rgb().formatRgb()}function vo(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=$C.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?ly(t):e===3?new Ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?_h(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?_h(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=QC.exec(r))?new Ce(t[1],t[2],t[3],1):(t=qC.exec(r))?new Ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tI.exec(r))?_h(t[1],t[2],t[3],t[4]):(t=eI.exec(r))?_h(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=iI.exec(r))?dy(t[1],t[2]/100,t[3]/100,1):(t=rI.exec(r))?dy(t[1],t[2]/100,t[3]/100,t[4]):oy.hasOwnProperty(r)?ly(oy[r]):r==="transparent"?new Ce(NaN,NaN,NaN,0):null}function ly(r){return new Ce(r>>16&255,r>>8&255,r&255,1)}function _h(r,t,e,i){return i<=0&&(r=t=e=NaN),new Ce(r,t,e,i)}function oI(r){return r instanceof bo||(r=vo(r)),r?(r=r.rgb(),new Ce(r.r,r.g,r.b,r.opacity)):new Ce}function Jc(r,t,e,i){return arguments.length===1?oI(r):new Ce(r,t,e,i??1)}function Ce(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}jc(Ce,Jc,ny(bo,{brighter(r){return r=r==null?xh:Math.pow(xh,r),new Ce(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?xo:Math.pow(xo,r),new Ce(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ce(xs(this.r),xs(this.g),xs(this.b),vh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:uy,formatHex:uy,formatHex8:aI,formatRgb:cy,toString:cy}));function uy(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}`}function aI(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}${_s((isNaN(this.opacity)?1:this.opacity)*255)}`}function cy(){const r=vh(this.opacity);return`${r===1?"rgb(":"rgba("}${xs(this.r)}, ${xs(this.g)}, ${xs(this.b)}${r===1?")":`, ${r})`}`}function vh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function xs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function _s(r){return r=xs(r),(r<16?"0":"")+r.toString(16)}function dy(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new ui(r,t,e,i)}function py(r){if(r instanceof ui)return new ui(r.h,r.s,r.l,r.opacity);if(r instanceof bo||(r=vo(r)),!r)return new ui;if(r instanceof ui)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new ui(o,a,h,r.opacity)}function hI(r,t,e,i){return arguments.length===1?py(r):new ui(r,t,e,i??1)}function ui(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}jc(ui,hI,ny(bo,{brighter(r){return r=r==null?xh:Math.pow(xh,r),new ui(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?xo:Math.pow(xo,r),new ui(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Ce($c(r>=240?r-240:r+120,s,i),$c(r,s,i),$c(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new ui(fy(this.h),Th(this.s),Th(this.l),vh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=vh(this.opacity);return`${r===1?"hsl(":"hsla("}${fy(this.h)}, ${Th(this.s)*100}%, ${Th(this.l)*100}%${r===1?")":`, ${r})`}`}}));function fy(r){return r=(r||0)%360,r<0?r+360:r}function Th(r){return Math.max(0,Math.min(1,r||0))}function $c(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const Qc=r=>()=>r;function lI(r,t){return function(e){return r+e*t}}function uI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function cI(r){return(r=+r)==1?my:function(t,e){return e-t?uI(t,e,r):Qc(isNaN(t)?e:t)}}function my(r,t){var e=t-r;return e?lI(r,e):Qc(isNaN(r)?t:r)}const gy=function r(t){var e=cI(t);function i(s,n){var o=e((s=Jc(s)).r,(n=Jc(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=my(s.opacity,n.opacity);return function(u){return s.r=o(u),s.g=a(u),s.b=h(u),s.opacity=l(u),s+""}}return i.gamma=r,i}(1);function dI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function pI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function fI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=ed(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function mI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function wh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function gI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=ed(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var qc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,td=new RegExp(qc.source,"g");function yI(r){return function(){return r}}function bI(r){return function(t){return r(t)+""}}function xI(r,t){var e=qc.lastIndex=td.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=qc.exec(r))&&(s=td.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:wh(i,s)})),e=td.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?bI(h[0].x):yI(t):(t=h.length,function(l){for(var u=0,c;u<t;++u)a[(c=h[u]).i]=c.x(l);return a.join("")})}function ed(r,t){var e=typeof t,i;return t==null||e==="boolean"?Qc(t):(e==="number"?wh:e==="string"?(i=vo(t))?(t=i,gy):xI:t instanceof vo?gy:t instanceof Date?mI:pI(t)?dI:Array.isArray(t)?fI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?gI:wh)(r,t)}function _I(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function vI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Sh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function cn(r){return r=Sh(Math.abs(r)),r?r[1]:NaN}function TI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function wI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var SI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Eh(r){if(!(t=SI.exec(r)))throw new Error("invalid format: "+r);var t;return new id({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Eh.prototype=id.prototype;function id(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}id.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function EI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var yy;function CI(r,t){var e=Sh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(yy=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+Sh(r,Math.max(0,t+n-1))[0]}function by(r,t){var e=Sh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const xy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:vI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>by(r*100,t),r:by,s:CI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function _y(r){return r}var vy=Array.prototype.map,Ty=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function II(r){var t=r.grouping===void 0||r.thousands===void 0?_y:TI(vy.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?_y:wI(vy.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(c){c=Eh(c);var d=c.fill,p=c.align,m=c.sign,f=c.symbol,g=c.zero,y=c.width,_=c.comma,b=c.precision,v=c.trim,S=c.type;S==="n"?(_=!0,S="g"):xy[S]||(b===void 0&&(b=12),v=!0,S="g"),(g||d==="0"&&p==="=")&&(g=!0,d="0",p="=");var E=f==="$"?e:f==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",I=f==="$"?i:/[%p]/.test(S)?o:"",A=xy[S],P=/[defgprs%]/.test(S);b=b===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function O(W){var L=E,C=I,N,X,K;if(S==="c")C=A(W)+C,W="";else{W=+W;var Z=W<0||1/W<0;if(W=isNaN(W)?h:A(Math.abs(W),b),v&&(W=EI(W)),Z&&+W==0&&m!=="+"&&(Z=!1),L=(Z?m==="("?m:a:m==="-"||m==="("?"":m)+L,C=(S==="s"?Ty[8+yy/3]:"")+C+(Z&&m==="("?")":""),P){for(N=-1,X=W.length;++N<X;)if(K=W.charCodeAt(N),48>K||K>57){C=(K===46?s+W.slice(N+1):W.slice(N))+C,W=W.slice(0,N);break}}}_&&!g&&(W=t(W,1/0));var z=L.length+W.length+C.length,D=z<y?new Array(y-z+1).join(d):"";switch(_&&g&&(W=t(D+W,D.length?y-C.length:1/0),D=""),p){case"<":W=L+W+C+D;break;case"=":W=L+D+W+C;break;case"^":W=D.slice(0,z=D.length>>1)+L+W+C+D.slice(z);break;default:W=D+L+W+C;break}return n(W)}return O.toString=function(){return c+""},O}function u(c,d){var p=l((c=Eh(c),c.type="f",c)),m=Math.max(-8,Math.min(8,Math.floor(cn(d)/3)))*3,f=Math.pow(10,-m),g=Ty[8+m/3];return function(y){return p(f*y)+g}}return{format:l,formatPrefix:u}}var Ch,wy,Sy;AI({thousands:",",grouping:[3],currency:["$",""]});function AI(r){return Ch=II(r),wy=Ch.format,Sy=Ch.formatPrefix,Ch}function RI(r){return Math.max(0,-cn(Math.abs(r)))}function MI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(cn(t)/3)))*3-cn(Math.abs(r)))}function PI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,cn(t)-cn(r))+1}function Ey(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function LI(r){return function(){return r}}function GI(r){return+r}var Cy=[0,1];function dn(r){return r}function rd(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:LI(isNaN(t)?NaN:.5)}function NI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function FI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=rd(s,i),n=e(o,n)):(i=rd(i,s),n=e(n,o)),function(a){return n(i(a))}}function DI(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=rd(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=HC(r,a,1,i)-1;return n[h](s[h](a))}}function Iy(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function kI(){var r=Cy,t=Cy,e=ed,i,s,n,o=dn,a,h,l;function u(){var d=Math.min(r.length,t.length);return o!==dn&&(o=NI(r[0],r[d-1])),a=d>2?DI:FI,h=l=null,c}function c(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return c.invert=function(d){return o(s((l||(l=a(t,r.map(i),wh)))(d)))},c.domain=function(d){return arguments.length?(r=Array.from(d,GI),u()):r.slice()},c.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},c.rangeRound=function(d){return t=Array.from(d),e=_I,u()},c.clamp=function(d){return arguments.length?(o=d?!0:dn,u()):o!==dn},c.interpolate=function(d){return arguments.length?(e=d,u()):e},c.unknown=function(d){return arguments.length?(n=d,c):n},function(d,p){return i=d,s=p,u()}}function Ay(){return kI()(dn,dn)}function OI(r,t,e,i){var s=zc(r,t,e),n;switch(i=Eh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=MI(s,o))&&(i.precision=n),Sy(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=PI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=RI(s))&&(i.precision=n-(i.type==="%")*2);break}}return wy(i)}function WI(r){var t=r.domain;return r.ticks=function(e){var i=t();return JC(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return OI(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,u=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);u-- >0;){if(l=Yc(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Ry(){var r=Ay();return r.copy=function(){return Iy(r,Ry())},Ey.apply(r,arguments),WI(r)}function BI(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const sd=new Date,nd=new Date;function $t(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>$t(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(sd.setTime(+n),nd.setTime(+o),r(sd),r(nd),Math.floor(e(sd,nd))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Ih=$t(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Ih.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?$t(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Ih),Ih.range;const nr=1e3,$e=nr*60,or=$e*60,ar=or*24,od=ar*7,My=ar*30,ad=ar*365,pn=$t(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*nr)},(r,t)=>(t-r)/nr,r=>r.getUTCSeconds());pn.range;const hd=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*nr)},(r,t)=>{r.setTime(+r+t*$e)},(r,t)=>(t-r)/$e,r=>r.getMinutes());hd.range,$t(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*$e)},(r,t)=>(t-r)/$e,r=>r.getUTCMinutes()).range;const ld=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*nr-r.getMinutes()*$e)},(r,t)=>{r.setTime(+r+t*or)},(r,t)=>(t-r)/or,r=>r.getHours());ld.range,$t(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*or)},(r,t)=>(t-r)/or,r=>r.getUTCHours()).range;const To=$t(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*$e)/ar,r=>r.getDate()-1);To.range;const ud=$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ar,r=>r.getUTCDate()-1);ud.range,$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ar,r=>Math.floor(r/ar)).range;function vs(r){return $t(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*$e)/od)}const Ah=vs(0),Rh=vs(1),UI=vs(2),XI=vs(3),fn=vs(4),ZI=vs(5),VI=vs(6);Ah.range,Rh.range,UI.range,XI.range,fn.range,ZI.range,VI.range;function Ts(r){return $t(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/od)}const Py=Ts(0),Mh=Ts(1),KI=Ts(2),HI=Ts(3),mn=Ts(4),YI=Ts(5),zI=Ts(6);Py.range,Mh.range,KI.range,HI.range,mn.range,YI.range,zI.range;const cd=$t(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());cd.range,$t(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const hr=$t(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());hr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),hr.range;const ws=$t(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());ws.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),ws.range;function jI(r,t,e,i,s,n){const o=[[pn,1,nr],[pn,5,5*nr],[pn,15,15*nr],[pn,30,30*nr],[n,1,$e],[n,5,5*$e],[n,15,15*$e],[n,30,30*$e],[s,1,or],[s,3,3*or],[s,6,6*or],[s,12,12*or],[i,1,ar],[i,2,2*ar],[e,1,od],[t,1,My],[t,3,3*My],[r,1,ad]];function a(l,u,c){const d=u<l;d&&([l,u]=[u,l]);const p=c&&typeof c.range=="function"?c:h(l,u,c),m=p?p.range(l,+u+1):[];return d?m.reverse():m}function h(l,u,c){const d=Math.abs(u-l)/c,p=Hc(([,,g])=>g).right(o,d);if(p===o.length)return r.every(zc(l/ad,u/ad,c));if(p===0)return Ih.every(Math.max(zc(l,u,c),1));const[m,f]=o[d/o[p-1][2]<o[p][2]/d?p-1:p];return m.every(f)}return[a,h]}const[JI,$I]=jI(hr,cd,Ah,To,ld,hd);function dd(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function pd(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function wo(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function QI(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=So(s),u=Eo(s),c=So(n),d=Eo(n),p=So(o),m=Eo(o),f=So(a),g=Eo(a),y=So(h),_=Eo(h),b={a:Z,A:z,b:D,B:F,c:null,d:ky,e:ky,f:vA,g:PA,G:GA,H:bA,I:xA,j:_A,L:Oy,m:TA,M:wA,p:G,q:V,Q:Vy,s:Ky,S:SA,u:EA,U:CA,V:IA,w:AA,W:RA,x:null,X:null,y:MA,Y:LA,Z:NA,"%":Zy},v={a:$,A:ut,b:nt,B:Ct,c:null,d:By,e:By,f:OA,g:zA,G:JA,H:FA,I:DA,j:kA,L:Uy,m:WA,M:BA,p:Rt,q:_t,Q:Vy,s:Ky,S:UA,u:XA,U:ZA,V:VA,w:KA,W:HA,x:null,X:null,y:YA,Y:jA,Z:$A,"%":Zy},S={a:O,A:W,b:L,B:C,c:N,d:Fy,e:Fy,f:fA,g:Ny,G:Gy,H:Dy,I:Dy,j:uA,L:pA,m:lA,M:cA,p:P,q:hA,Q:gA,s:yA,S:dA,u:rA,U:sA,V:nA,w:iA,W:oA,x:X,X:K,y:Ny,Y:Gy,Z:aA,"%":mA};b.x=E(e,b),b.X=E(i,b),b.c=E(t,b),v.x=E(e,v),v.X=E(i,v),v.c=E(t,v);function E(Y,tt){return function(et){var k=[],xt=-1,gt=0,Mt=Y.length,Ut,De,pi;for(et instanceof Date||(et=new Date(+et));++xt<Mt;)Y.charCodeAt(xt)===37&&(k.push(Y.slice(gt,xt)),(De=Ly[Ut=Y.charAt(++xt)])!=null?Ut=Y.charAt(++xt):De=Ut==="e"?" ":"0",(pi=tt[Ut])&&(Ut=pi(et,De)),k.push(Ut),gt=xt+1);return k.push(Y.slice(gt,xt)),k.join("")}}function I(Y,tt){return function(et){var k=wo(1900,void 0,1),xt=A(k,Y,et+="",0),gt,Mt;if(xt!=et.length)return null;if("Q"in k)return new Date(k.Q);if("s"in k)return new Date(k.s*1e3+("L"in k?k.L:0));if(tt&&!("Z"in k)&&(k.Z=0),"p"in k&&(k.H=k.H%12+k.p*12),k.m===void 0&&(k.m="q"in k?k.q:0),"V"in k){if(k.V<1||k.V>53)return null;"w"in k||(k.w=1),"Z"in k?(gt=pd(wo(k.y,0,1)),Mt=gt.getUTCDay(),gt=Mt>4||Mt===0?Mh.ceil(gt):Mh(gt),gt=ud.offset(gt,(k.V-1)*7),k.y=gt.getUTCFullYear(),k.m=gt.getUTCMonth(),k.d=gt.getUTCDate()+(k.w+6)%7):(gt=dd(wo(k.y,0,1)),Mt=gt.getDay(),gt=Mt>4||Mt===0?Rh.ceil(gt):Rh(gt),gt=To.offset(gt,(k.V-1)*7),k.y=gt.getFullYear(),k.m=gt.getMonth(),k.d=gt.getDate()+(k.w+6)%7)}else("W"in k||"U"in k)&&("w"in k||(k.w="u"in k?k.u%7:"W"in k?1:0),Mt="Z"in k?pd(wo(k.y,0,1)).getUTCDay():dd(wo(k.y,0,1)).getDay(),k.m=0,k.d="W"in k?(k.w+6)%7+k.W*7-(Mt+5)%7:k.w+k.U*7-(Mt+6)%7);return"Z"in k?(k.H+=k.Z/100|0,k.M+=k.Z%100,pd(k)):dd(k)}}function A(Y,tt,et,k){for(var xt=0,gt=tt.length,Mt=et.length,Ut,De;xt<gt;){if(k>=Mt)return-1;if(Ut=tt.charCodeAt(xt++),Ut===37){if(Ut=tt.charAt(xt++),De=S[Ut in Ly?tt.charAt(xt++):Ut],!De||(k=De(Y,et,k))<0)return-1}else if(Ut!=et.charCodeAt(k++))return-1}return k}function P(Y,tt,et){var k=l.exec(tt.slice(et));return k?(Y.p=u.get(k[0].toLowerCase()),et+k[0].length):-1}function O(Y,tt,et){var k=p.exec(tt.slice(et));return k?(Y.w=m.get(k[0].toLowerCase()),et+k[0].length):-1}function W(Y,tt,et){var k=c.exec(tt.slice(et));return k?(Y.w=d.get(k[0].toLowerCase()),et+k[0].length):-1}function L(Y,tt,et){var k=y.exec(tt.slice(et));return k?(Y.m=_.get(k[0].toLowerCase()),et+k[0].length):-1}function C(Y,tt,et){var k=f.exec(tt.slice(et));return k?(Y.m=g.get(k[0].toLowerCase()),et+k[0].length):-1}function N(Y,tt,et){return A(Y,t,tt,et)}function X(Y,tt,et){return A(Y,e,tt,et)}function K(Y,tt,et){return A(Y,i,tt,et)}function Z(Y){return o[Y.getDay()]}function z(Y){return n[Y.getDay()]}function D(Y){return h[Y.getMonth()]}function F(Y){return a[Y.getMonth()]}function G(Y){return s[+(Y.getHours()>=12)]}function V(Y){return 1+~~(Y.getMonth()/3)}function $(Y){return o[Y.getUTCDay()]}function ut(Y){return n[Y.getUTCDay()]}function nt(Y){return h[Y.getUTCMonth()]}function Ct(Y){return a[Y.getUTCMonth()]}function Rt(Y){return s[+(Y.getUTCHours()>=12)]}function _t(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var tt=E(Y+="",b);return tt.toString=function(){return Y},tt},parse:function(Y){var tt=I(Y+="",!1);return tt.toString=function(){return Y},tt},utcFormat:function(Y){var tt=E(Y+="",v);return tt.toString=function(){return Y},tt},utcParse:function(Y){var tt=I(Y+="",!0);return tt.toString=function(){return Y},tt}}}var Ly={"-":"",_:" ",0:"0"},ne=/^\s*\d+/,qI=/^%/,tA=/[\\^$*+?|[\]().{}]/g;function It(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function eA(r){return r.replace(tA,"\\$&")}function So(r){return new RegExp("^(?:"+r.map(eA).join("|")+")","i")}function Eo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function iA(r,t,e){var i=ne.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function rA(r,t,e){var i=ne.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function sA(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function nA(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function oA(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Gy(r,t,e){var i=ne.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Ny(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function aA(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function hA(r,t,e){var i=ne.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function lA(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Fy(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function uA(r,t,e){var i=ne.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Dy(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function cA(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function dA(r,t,e){var i=ne.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function pA(r,t,e){var i=ne.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function fA(r,t,e){var i=ne.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function mA(r,t,e){var i=qI.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function gA(r,t,e){var i=ne.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function yA(r,t,e){var i=ne.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function ky(r,t){return It(r.getDate(),t,2)}function bA(r,t){return It(r.getHours(),t,2)}function xA(r,t){return It(r.getHours()%12||12,t,2)}function _A(r,t){return It(1+To.count(hr(r),r),t,3)}function Oy(r,t){return It(r.getMilliseconds(),t,3)}function vA(r,t){return Oy(r,t)+"000"}function TA(r,t){return It(r.getMonth()+1,t,2)}function wA(r,t){return It(r.getMinutes(),t,2)}function SA(r,t){return It(r.getSeconds(),t,2)}function EA(r){var t=r.getDay();return t===0?7:t}function CA(r,t){return It(Ah.count(hr(r)-1,r),t,2)}function Wy(r){var t=r.getDay();return t>=4||t===0?fn(r):fn.ceil(r)}function IA(r,t){return r=Wy(r),It(fn.count(hr(r),r)+(hr(r).getDay()===4),t,2)}function AA(r){return r.getDay()}function RA(r,t){return It(Rh.count(hr(r)-1,r),t,2)}function MA(r,t){return It(r.getFullYear()%100,t,2)}function PA(r,t){return r=Wy(r),It(r.getFullYear()%100,t,2)}function LA(r,t){return It(r.getFullYear()%1e4,t,4)}function GA(r,t){var e=r.getDay();return r=e>=4||e===0?fn(r):fn.ceil(r),It(r.getFullYear()%1e4,t,4)}function NA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+It(t/60|0,"0",2)+It(t%60,"0",2)}function By(r,t){return It(r.getUTCDate(),t,2)}function FA(r,t){return It(r.getUTCHours(),t,2)}function DA(r,t){return It(r.getUTCHours()%12||12,t,2)}function kA(r,t){return It(1+ud.count(ws(r),r),t,3)}function Uy(r,t){return It(r.getUTCMilliseconds(),t,3)}function OA(r,t){return Uy(r,t)+"000"}function WA(r,t){return It(r.getUTCMonth()+1,t,2)}function BA(r,t){return It(r.getUTCMinutes(),t,2)}function UA(r,t){return It(r.getUTCSeconds(),t,2)}function XA(r){var t=r.getUTCDay();return t===0?7:t}function ZA(r,t){return It(Py.count(ws(r)-1,r),t,2)}function Xy(r){var t=r.getUTCDay();return t>=4||t===0?mn(r):mn.ceil(r)}function VA(r,t){return r=Xy(r),It(mn.count(ws(r),r)+(ws(r).getUTCDay()===4),t,2)}function KA(r){return r.getUTCDay()}function HA(r,t){return It(Mh.count(ws(r)-1,r),t,2)}function YA(r,t){return It(r.getUTCFullYear()%100,t,2)}function zA(r,t){return r=Xy(r),It(r.getUTCFullYear()%100,t,2)}function jA(r,t){return It(r.getUTCFullYear()%1e4,t,4)}function JA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?mn(r):mn.ceil(r),It(r.getUTCFullYear()%1e4,t,4)}function $A(){return"+0000"}function Zy(){return"%"}function Vy(r){return+r}function Ky(r){return Math.floor(+r/1e3)}var gn,Hy;QA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function QA(r){return gn=QI(r),Hy=gn.format,gn.parse,gn.utcFormat,gn.utcParse,gn}function qA(r){return new Date(r)}function tR(r){return r instanceof Date?+r:+new Date(+r)}function Yy(r,t,e,i,s,n,o,a,h,l){var u=Ay(),c=u.invert,d=u.domain,p=l(".%L"),m=l(":%S"),f=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),_=l("%b %d"),b=l("%B"),v=l("%Y");function S(E){return(h(E)<E?p:a(E)<E?m:o(E)<E?f:n(E)<E?g:i(E)<E?s(E)<E?y:_:e(E)<E?b:v)(E)}return u.invert=function(E){return new Date(c(E))},u.domain=function(E){return arguments.length?d(Array.from(E,tR)):d().map(qA)},u.ticks=function(E){var I=d();return r(I[0],I[I.length-1],E??10)},u.tickFormat=function(E,I){return I==null?S:l(I)},u.nice=function(E){var I=d();return(!E||typeof E.range!="function")&&(E=t(I[0],I[I.length-1],E??10)),E?d(BI(I,E)):u},u.copy=function(){return Iy(u,Yy(r,t,e,i,s,n,o,a,h,l))},u}function eR(){return Ey.apply(Yy(JI,$I,hr,cd,Ah,To,ld,hd,pn,Hy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Co(r,t,e){this.k=r,this.x=t,this.y=e}Co.prototype={constructor:Co,scale:function(r){return r===1?this:new Co(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new Co(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Co.prototype;function zy(r){return r.mode==="temporal"||r.mode==="left-aligned"?iR(r):rR(r)}function iR({domain:r,range:t}){return eR().domain(r).range(t)}function rR({domain:r,range:t}){return Ry().domain(r).range(t)}function fd(r){return{mode:pt.horizontal,range:uM(),domain:cM(r)}}function sR(){return{mode:pt.vertical}}let yn=null;async function nR(){const r=await Id();jy(r.start_time),bt.on("layoutSettingsUpdated",()=>jy(r.start_time))}function oR(){yn=null}async function Io(){return yn||await Ze("scaleCreated")}async function jy(r){await Di();const t=yn?"scaleUpdated":"scaleCreated",e=fd(r);yn=zy(e),bt.emit(t,yn)}let Fe=null,md=null;async function aR(){const r=await Ve(),t=await sc();Fe=new UC({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Fe.zIndex=1,Fe.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),r.stage.addChild(Fe),bt.emit("viewportCreated",Fe),bt.on("applicationResized",dR),bt.on("scaleUpdated",()=>Ph()),uR()}function hR(){Fe=null,md=null}async function gd({animate:r}={}){const t=await Qe(),e=await be(),i=t.getChildByName(_p);if(!i)throw new Error("Nodes container not found");const s=e.styles.guideTextSize+e.styles.guideTextTopPadding;mR();const{x:n,y:o,width:a,height:h}=i.getLocalBounds(),l=a+e.styles.columnGap*2,u=h+e.styles.rowGap*2+s*2,c=t.findFit(l,u);!a||!h||t.animate({position:{x:n+a/2,y:o+h/2-s},scale:Math.min(c,1),time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{bd(),Ph()}})}async function Qe(){return Fe||await Ze("viewportCreated")}function Jy(r){iy(md,r)||(md=r,bt.emit("viewportDateRangeUpdated",r))}function lR({xOffset:r,yOffset:t}){if(!Fe)return;const{x:e,y:i}=Fe.transform.position;Fe.setTransform(e+r,i+t,Fe.transform.scale.x,Fe.transform.scale.y)}async function uR(){const r=await Qe();Ph(),r.on("moved",()=>Ph())}async function Ph(){const r=await $y();r&&Jy(r)}async function $y(){const r=await Qe(),t=await Io(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function cR(r){const t=await $y(),e=await Di();if(r===void 0||e.isDependency()||iy(r,t))return;const i=await Qe(),s=await Io(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;Jy(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function dR(){const r=await Ve(),t=await Qe(),e=await sc(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),lR({xOffset:a,yOffset:h})}class yd{constructor(){dp(this,"status","visible");dp(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Fi=null,ci=null,lr=null,di=null;async function pR(){const r=await Qe(),t=await Ve();Fi=new lC({toggle:"renderable"}),ci=new yd,di=new yd,lr=new yd,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2;di==null||di.toggle(e),ci==null||ci.toggle(i),lr==null||lr.toggle(s),Fi==null||Fi.cull(t.renderer.screen),r.dirty=!1}}),bt.emit("cullCreated",Fi),bt.emit("labelCullCreated",ci),bt.emit("edgeCullCreated",di),bt.emit("toggleCullCreated",lr)}function fR(){Fi=null,ci==null||ci.clear(),ci=null,di==null||di.clear(),di=null,lr==null||lr.clear(),lr=null}async function bd(){const r=await Qe();r.dirty=!0}function mR(){Fi&&Fi.uncull()}async function Qy(){return Fi||await Ze("cullCreated")}async function gR(){return di||await Ze("edgeCullCreated")}async function qy(){return ci||await Ze("labelCullCreated")}async function tb(){const r=await Di(),t=await be();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ey.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{bd()}})}return{animate:e}}let Lh=new Map;function yR(){Lh=new Map}async function xd(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Lh.has(e))return Lh.get(e);const i=await r(...t);return Lh.set(e,i),i}async function bR({size:r,stroke:t=1,radius:e=0}){const i=await Ve(),s=new eo;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new dt(0,0,r,r),resolution:10})}async function eb(r){return await xd(bR,[r])}var Gh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Gh||{});function ib(){const r=new ie;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await eb(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function xR(){const r=await Ve(),t=new eo;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t)}async function _d(){return await xd(xR,[])}function vd(r,t){return Array.from({length:r},(e,i)=>t(i))}const _R=8,vR=2;async function TR(){const r=await be(),t=await Qy(),e=await gR(),{animate:i}=await tb(),s=new Xt,{element:n,render:o}=await ib(),a=await _d(),h=vd(20,()=>new lt),l=new iS(a,h);let u=!1;s.name=Rb,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function c(){return await o({size:10,rotate:Gh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,f){const g=p(f);u||await c();for(const[y,_]of h.entries()){const{x:b,y:v}=g[y];i(_,{x:b,y:v},!u)}i(s,{x:m.x,y:m.y},!u),i(n,{x:f.x-_R,y:f.y},!u),u=!0}function p({x:m,y:f}){const g=[],y={x:0,y:0},_={x:m-vR,y:f},b={x:rb(y.x,{source:y,target:_}),y:y.y},v={x:rb(_.x,{source:y,target:_},!0),y:_.y};for(const[S]of h.entries()){if(S===h.length-1){g[S]=_;continue}const E=wR(S,{source:y,target:_,sourceBezier:b,targetBezier:v});g[S]=E}return g}return{element:s,render:c,setPosition:d}}function rb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function wR(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,u=n.y+(o.y-n.y)*e,c=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,p=a+(l-a)*e,m=h+(u-h)*e,f=l+(c-l)*e,g=u+(d-u)*e,y=p+(f-p)*e,_=m+(g-m)*e;return{x:y,y:_}}function Td(){const r=new Xt,t=new ie,e=new ie,i=new ie,s=new ie,n=new ie,o=new ie,a=new ie,h=new ie;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(p){const{radius:m=0,color:f="#fff",stroke:g,width:y,height:_}=p,b=Math.min(y,_),v=m*2>b?b/2:m,E=await eb({size:v,radius:m,stroke:g}),I=await _d();return u({texture:E,width:y,height:_,size:v}),c({texture:I,width:y,height:_,size:v,stroke:g}),d(f),r}function u({texture:p,width:m,height:f,size:g}){t.texture=p,e.texture=p,i.texture=p,s.texture=p,t.position.set(0,0),e.position.set(m-g,0),i.position.set(0,f-g),s.position.set(m-g,f-g)}function c({texture:p,size:m,width:f,height:g,stroke:y}){const _=Math.max(g-m*2,0),b=Math.max(f-m*2,0);a.texture=p,n.texture=p,o.texture=p,h.texture=p,n.position.set(0,m),n.height=_,n.width=y,o.position.set(f-y,m),o.height=_,o.width=y,a.position.set(m,0),a.width=b,a.height=y,h.position.set(m,g-y),h.width=b,h.height=y}function d(p){t.tint=p,e.tint=p,i.tint=p,s.tint=p,a.tint=p,n.tint=p,o.tint=p,h.tint=p}return{element:r,render:l}}var sb={exports:{}};(function(r){(function(){function t(f,g){document.addEventListener?f.addEventListener("scroll",g,!1):f.attachEvent("scroll",g)}function e(f){document.body?f():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),f()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),f())})}function i(f){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(f)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(f,g){f.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(f){var g=f.g.offsetWidth,y=g+100;return f.j.style.width=y+"px",f.i.scrollLeft=y,f.h.scrollLeft=f.h.scrollWidth+100,f.l!==g?(f.l=g,!0):!1}function o(f,g){function y(){var b=_;n(b)&&b.g.parentNode!==null&&g(b.l)}var _=f;t(f.h,y),t(f.i,y),n(f)}function a(f,g,y){g=g||{},y=y||window,this.family=f,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,u=null,c=null;function d(f){return l===null&&(p(f)&&/Apple/.test(window.navigator.vendor)?(f=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!f&&603>parseInt(f[1],10)):l=!1),l}function p(f){return c===null&&(c=!!f.document.fonts),c}function m(f,g){var y=f.style,_=f.weight;if(u===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}u=b.style.font!==""}return[y,_,u?f.stretch:"","100px",g].join(" ")}a.prototype.load=function(f,g){var y=this,_=f||"BESbswy",b=0,v=g||3e3,S=new Date().getTime();return new Promise(function(E,I){if(p(y.context)&&!d(y.context)){var A=new Promise(function(O,W){function L(){new Date().getTime()-S>=v?W(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),_).then(function(C){1<=C.length?O():setTimeout(L,25)},W)}L()}),P=new Promise(function(O,W){b=setTimeout(function(){W(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([P,A]).then(function(){clearTimeout(b),E(y)},I)}else e(function(){function O(){var V;(V=X!=-1&&K!=-1||X!=-1&&Z!=-1||K!=-1&&Z!=-1)&&((V=X!=K&&X!=Z&&K!=Z)||(h===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=h&&(X==z&&K==z&&Z==z||X==D&&K==D&&Z==D||X==F&&K==F&&Z==F)),V=!V),V&&(G.parentNode!==null&&G.parentNode.removeChild(G),clearTimeout(b),E(y))}function W(){if(new Date().getTime()-S>=v)G.parentNode!==null&&G.parentNode.removeChild(G),I(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(X=L.g.offsetWidth,K=C.g.offsetWidth,Z=N.g.offsetWidth,O()),b=setTimeout(W,50)}}var L=new i(_),C=new i(_),N=new i(_),X=-1,K=-1,Z=-1,z=-1,D=-1,F=-1,G=document.createElement("div");G.dir="ltr",s(L,m(y,"sans-serif")),s(C,m(y,"serif")),s(N,m(y,"monospace")),G.appendChild(L.g),G.appendChild(C.g),G.appendChild(N.g),y.context.document.body.appendChild(G),z=L.g.offsetWidth,D=C.g.offsetWidth,F=N.g.offsetWidth,W(),o(L,function(V){X=V,O()}),s(L,m(y,'"'+y.family+'",sans-serif')),o(C,function(V){K=V,O()}),s(C,m(y,'"'+y.family+'",serif')),o(N,function(V){Z=V,O()}),s(N,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(sb);var SR=sb.exports;const ER=Fn(SR),nb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},ob={resolution:4,chars:li.ASCII},ab="sans-serif",hb={inter:RR(nb.inter)};let wd=!1;async function CR(){const r=Object.values(nb);await Promise.all(r.map(t=>IR(t))),wd=!0,bt.emit("fontsLoaded",hb)}async function IR(r){const{fontFamily:t,...e}=r,i=new ER(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${ab}`),li.from(t,{fontFamily:ab,...e},ob);return}li.from(t,r,ob)}function AR(){wd=!1}async function lb(){return wd?hb:await Ze("fontsLoaded")}function RR(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new MS(s,i)}async function ub(){const{inter:r}=await lb(),t=await qy(),e=r("");t.add(e);async function i(s){return e.text=s,await e}return{element:e,render:i}}async function MR({height:r,radius:t}){const e=await Ve(),i=new eo;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new dt(0,0,t,r),resolution:10})}async function PR(r){return await xd(MR,[r])}function LR(){const r=new ie,t=new ie;async function e(i){const s=await PR(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function Sd(){const r=await _d();return new ie(r)}async function cb(){const r=new Xt,t=await Sd(),{left:e,right:i,render:s}=await LR();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:u,visible:c}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=c,t.width=l,t.height=h.height,t.x=u,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),u=o(h.capRight,h.radius);let c=0;l&&(c+=h.radius),u&&(c+=h.radius);const d=Math.max(h.width-c,0),p=d>0,m=l?h.radius:0;return{width:d,visible:p,x:m}}return{element:r,render:n}}async function GR(){const r=await be(),t=await qy(),e=new Xt,{element:i,render:s}=await ib(),{element:n,render:o}=await cb(),{element:a,render:h}=await Td();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",c),e.on("mouseout",d);async function u({inside:p,isOpen:m}){l=p;const f={size:10,stroke:2,rotate:m?Gh.Up:Gh.Down},g=await s(f),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},_=await o(y);_.alpha=p?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=p?0:1;const v={y:_.height/2,x:_.width/2},S=f.size/4;return g.x=v.x,g.y=m?v.y+S:v.y-S,e}function c(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:u}}let bn=null,Nh=!1;async function NR(){const r=await Qe();r.on("click",()=>Ed(null)),r.on("drag-start",()=>{Nh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Nh=!1})})}function FR(){bn=null,Nh=!1}function Ed(r){if(Nh||Cd(r))return;if(bn=r,r===null){bt.emit("nodeSelected",null);return}const{id:t,kind:e}=r;bt.emit("nodeSelected",{id:t,kind:e})}function Cd(r){return(r==null?void 0:r.id)===(bn==null?void 0:bn.id)}function DR(){return bn}const Fh=4,kR=2;async function db(){const r=await be(),t=await Di(),e=new Xt,{element:i,render:s}=await cb(),{element:n,render:o}=await Td();e.addChild(i),n.position.set(-Fh,-Fh);async function a(u){const{background:c="#fff"}=r.styles.node(u),{nodeHeight:d,nodeRadius:p}=r.styles,m=l(u,p),f=u.state_type!=="RUNNING"||t.isDependency();return await s({width:m,height:d,radius:p,background:c,capRight:f}),await h(u,m,d),i}async function h(u,c,d){if(!Cd(u)){e.removeChild(n);return}e.addChild(n),await o({stroke:kR,radius:r.styles.nodeBorderRadius,width:c+Fh*2,height:d+Fh*2,color:r.styles.nodeSelectedBorderColor})}function l(u,c){const d=Ad();if(pt.isTemporal()||pt.isLeftAligned()){const p=u.start_time,m=u.end_time??new Date,g=Tp(m,p)/jo*d;return Math.max(g,c*2)}return d}return{element:e,render:a}}class pb extends Xt{updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function OR(r){const t=new pb,e=await be(),{element:i,render:s}=await db(),{element:n,render:o}=await ub(),{element:a,render:h,getSize:l,stopWorker:u}=await _b(),{element:c,render:d}=await GR(),{element:p,render:m}=await Td(),{start:f,stop:g}=await Wg(r.id,L=>{h(L)});let y=r,_=!1;t.addChild(p),t.addChild(i),t.addChild(n),t.addChild(c),c.on("click",L=>{L.stopPropagation(),v()}),a.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},a.on("rendered",()=>{bd(),O()});async function b(L){return y=L,await s(L),await A(),await P(L),await S(L),t}async function v(){_?await I():await E()}async function S(L){const{background:C="#fff"}=e.styles.node(L),N=4,{width:X,height:K}=l(),Z=K+e.styles.nodeHeight+e.styles.nodesPadding*2+N*2,z=e.styles.nodeHeight,D=_?-N:N,F=Math.max(i.width,X),G=_?F+N*2:i.width-N*2;(await m({width:G,height:_?Z:z,stroke:_?2:1,radius:e.styles.nodeBorderRadius,color:C})).position.set(D,D)}async function E(){_=!0,t.addChild(a),await Promise.all([f(),b(y)]),O()}async function I(){_=!1,t.removeChild(a),u(),await Promise.all([g(),b(y)]),O()}async function A(){const L=e.styles.nodeToggleSize,C=e.styles.nodeHeight-L,N=i.width>L,X=await d({inside:N,isOpen:_});return X.x=N?C/2:i.width+e.styles.nodePadding,X.y=C/2,X}async function P(L){const C=await o(L.label),N=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,X=e.styles.nodePadding,K=c.x+c.width+X,Z=i.width+X,z=i.width>K+C.width+X,D=e.styles.nodeHeight/2-C.height/2,F=z?K:Math.max(Z,K);return C.position={x:F,y:D},C.tint=z?N:e.styles.textDefault,C}function O(){S(y);const L=W();t.emit("resized",L)}function W(){const L=l(),C=_?L.height+e.styles.nodesPadding*2:0,N=_?L.width:0;return{height:e.styles.nodeHeight+C,width:Math.max(N,t.width)}}return{kind:"flow-run",element:t,bar:i,render:b}}async function WR(){const r=await be(),t=new pb,{element:e,render:i}=await ub(),{element:s,render:n}=await db();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,u=s.width>l+e.width+l,c=u?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:c,y:d},e.tint=u?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}async function BR(){const r=await Ve(),t=await Qe(),e=await Di(),i=await be(),{inter:s}=await lb(),n=new Xt,o=await Sd();n.addChild(o);const a=s("");n.addChild(a);let h=await Io(),l,u;bt.on("scaleUpdated",f=>h=f),r.ticker.add(()=>{e.disableGuides||(m(),n.height!==r.screen.height&&d())});function c(f,g){l=f,u=g,d(),p(f)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function p(f){a.text=u(f),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function m(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:c}}class fb extends Error{constructor(){super("Layout is not temporal")}}function UR(r){return r.toLocaleTimeString()}function mb(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function XR(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function ZR(r){return r.getHours()===0&&r.getMinutes()===0?`${Dh.date(r)}
1176
+ ${mb(r)}`:mb(r)}const Dh={timeBySeconds:UR,timeByMinutesWithDates:ZR,date:XR},Qt={seconds:"seconds",minutes:"minutes",date:"date"},Ao={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},Et={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},gb=[{ceiling:Et.second*4,increment:Et.second,labelFormat:Qt.seconds},{ceiling:Et.second*8,increment:Et.second*5,labelFormat:Qt.seconds},{ceiling:Et.second*13,increment:Et.second*10,labelFormat:Qt.seconds},{ceiling:Et.second*20,increment:Et.second*15,labelFormat:Qt.seconds},{ceiling:Et.second*45,increment:Et.second*30,labelFormat:Qt.seconds},{ceiling:Et.minute*4,increment:Et.minute,labelFormat:Qt.minutes},{ceiling:Et.minute*8,increment:Et.minute*5,labelFormat:Qt.minutes},{ceiling:Et.minute*13,increment:Et.minute*10,labelFormat:Qt.minutes},{ceiling:Et.minute*28,increment:Et.minute*15,labelFormat:Qt.minutes},{ceiling:Et.hour*1.24,increment:Et.minute*30,labelFormat:Qt.minutes},{ceiling:Et.hour*3,increment:Et.hour,labelFormat:Qt.minutes},{ceiling:Et.hour*8,increment:Et.hour*2,getAnchor:Ao.day,labelFormat:Qt.minutes},{ceiling:Et.hour*13,increment:Et.hour*6,getAnchor:Ao.day,labelFormat:Qt.minutes},{ceiling:Et.hour*22,increment:Et.hour*12,getAnchor:Ao.day,labelFormat:Qt.minutes},{ceiling:Et.day*4,increment:Et.day,getAnchor:Ao.day,labelFormat:Qt.date},{ceiling:Et.week*2,increment:Et.week,getAnchor:Ao.week,labelFormat:Qt.date},{ceiling:1/0,increment:Et.week*4,labelFormat:Qt.date}],VR=300;async function KR(){const r=await Qe(),t=await Di(),e=new Xt,i=new Map;let s=await Io();bt.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:p,labelFormat:m}=a(),f=c(d,p);u(f,m)}catch(d){if(d instanceof fb)return;console.error(d)}}async function o(){const d=[];vd(30,async p=>{const m=BR();d.push(m);const f=await m;e.addChild(f.element),i.set(p,f)}),await Promise.all(d)}function a(){const d=r.left-VR,p=s.invert(d),m=s.invert(d+260/r.scale.x);if(!(p instanceof Date)||!(m instanceof Date))throw new fb;const f=m.getTime()-p.getTime(),{increment:g,getAnchor:y,labelFormat:_}=h(f);return{anchor:y(p),increment:g,labelFormat:l(_)}}function h(d){const p=gb.find(m=>m.ceiling>d)??gb[0];return p.getAnchor||(p.getAnchor=m=>Math.floor(m.getTime()/p.increment)*p.increment),p}function l(d){switch(d){case Qt.minutes:return Dh.timeByMinutesWithDates;case Qt.date:return Dh.date;default:return Dh.timeBySeconds}}function u(d,p){const m=new Map(i.entries()),f=Array.from(m.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(m.has(g)){const _=m.get(g);i.set(g,_),_.render(new Date(g),p);continue}const y=m.get(f.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),p),i.set(g,y)}}function c(d,p){return vd(30,m=>d+p*m)}return{element:e,render:n}}async function HR(){const r=await Ve(),{element:t,render:e}=await KR();r.stage.addChild(t),e(),bt.on("viewportDateRangeUpdated",()=>e()),bt.on("layoutSettingsUpdated",()=>e()),bt.on("configUpdated",()=>e())}function ZM(){}const YR=80;async function zR(){const r=await Ve(),t=await Qe(),e=await Di(),i=await be(),s=await Sd();let n=await Io();bt.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.styles.playheadWidth,s.height=r.stage.height,s.tint=i.styles.playheadColor,s.position.x=n(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(s.position.x>0&&s.position.x<r.screen.width)||!(s.position.x>r.screen.width-YR))return;const u=t.left;t.zoomPercent(-.1,!0),t.left=u}return{element:s,render:o}}async function jR(){const r=await Ve(),t=await Id(),{element:e,render:i}=await zR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),bt.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function VM(){}function JR({stage:r,props:t}){DS(),aR(),nR(),HR(),iM(),jR(),XS(),CR(),NS(r),HS(t),pR(),hM(),NR()}function $R(){bt.clear();try{kS(),hR(),oR(),FS(),rM(),YS(),ZS(),AR(),fR(),lM(),FR(),yR()}catch(r){console.error(r)}}async function QR(r){const t=await be(),e=await Ve(),i=await Qy(),{animate:s}=await tb(),{element:n,render:o,bar:a}=await g(r);let h=r,l=null,u=!1,c=!1;i.add(n),n.eventMode="static",n.cursor="pointer",n.name=Ab,n.on("click",b=>{b.stopPropagation(),Ed(h)}),r.end_time||p(),bt.on("nodeSelected",()=>{const b=Cd(r);b!==u&&(u=b,o(h))});async function d(b){h=b;const v=y(b);return v===l||(l=v,await o(b),b.end_time&&m()),n}function p(){e.ticker.add(f)}function m(){e.ticker.remove(f)}function f(){d(r)}async function g(b){const{kind:v}=b;switch(v){case"task-run":return await WR();case"flow-run":return await OR(b);default:const S=v;throw new Error(`switch does not have case for value: ${S}`)}}function y(b){const v=b.end_time??new Date;return[b.state_type,v.getTime(),pt.horizontal,pt.horizontalScaleMultiplier,t.styles.colorMode].join("-")}function _({x:b,y:v}){s(n,{x:b,y:v},!c),c=!0}return{element:n,render:d,bar:a,setPosition:_}}function yb({gap:r=0,minimum:t=0}={}){const e=new Map;function i(u){const c=e.get(u)??[];return Math.max(...c.values(),j.toValue(t))+j.toValue(r)}function s(u){let c=0;for(let d=0;d<u;d++)c+=i(d);return c}function n(u){return s(u+1)-j.toValue(r)}function o({axis:u,nodeId:c,offset:d}){const p=e.get(u)??new Map;p.set(c,d),e.set(u,p)}function a({axis:u,nodeId:c}){let d,p;for(const[m,f]of e.entries())if(f.has(c)){d=m,p=f.get(c);break}d===u||d===void 0||p===void 0||(h({axis:d,nodeId:c}),o({axis:u,nodeId:c,offset:p}))}function h({axis:u,nodeId:c}){var d;(d=e.get(u))==null||d.delete(c)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function qR(r){throw new Error(`switch does not have case for value: ${r}`)}const bb="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS1sKTooZT1uPT09Q258fG49PT1udD9uOmV0LHQ9bixyPW4pO2Z1bmN0aW9uIG8odSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcm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eXBlOiJsYXlvdXQiLGxheW91dDp7bWF4Um93OmksbWF4Q29sdW1uOmEscG9zaXRpb25zOm99fSl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLXNkX0hraDUwLmpzLm1hcAo=",xb=typeof window<"u"&&window.Blob&&new Blob([atob(bb)],{type:"text/javascript;charset=utf-8"});function tM(r){let t;try{if(t=xb&&(window.URL||window.webkitURL).createObjectURL(xb),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:application/javascript;base64,"+bb,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function eM(r){const t=new tM;return t.onmessage=r,t}async function _b(){const r=new Map,t=new Map,e=new Xt,i=new Xt,s=await be();let n=null;const o=yb({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=yb({gap:()=>s.styles.columnGap,minimum:()=>Ad()});let h=null,l=null;e.name=_p,bt.on("layoutUpdated",()=>{o.clear(),a.clear()}),bt.on("layoutSettingsUpdated",()=>{l&&e.parent&&u(l),C()}),bt.on("nodeSelected",()=>{C()});async function u(D){c(),l=D,h=null,await Promise.all([p(D),f(D)]),y(D)}function c(){n||(n=eM(W))}function d(){n&&(n.terminate(),n=null)}async function p(D){const F=[];for(const G of D.nodes.values())F.push(m(G));await Promise.all(F)}async function m(D){const{render:F}=await v(D);return await F(D)}async function f(D){if((await Di()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const G=[];for(const[V,{children:$}]of D.nodes)for(const{id:ut}of $)G.push(g(V,ut));await Promise.all(G)}async function g(D,F){const G=`${D}_${F}`;if(t.has(G))return;const V=await TR();t.has(G)||(t.set(G,V),i.addChild(V.element))}function y(D){if(!n)throw new Error("Layout worker not initialized");const F=new Map;for(const[G,{element:V}]of r)F.set(G,V.width);n.postMessage({type:"layout",data:D,widths:F,horizontalSettings:fd(D.start_time),verticalSettings:sR()})}function _(){if(h)for(const[D,F]of t){const[G,V]=D.split("_"),$=h.positions.get(G),ut=h.positions.get(V),nt=r.get(G);if(!$||!ut){console.warn(`Could not find edge in layout: Skipping ${D}`);continue}if(!nt){console.warn(`Could not find parent node in nodes: Skipping ${G}`);continue}const Ct=nt.bar.width,Rt=E($),_t={x:Rt.x+Ct,y:Rt.y+s.styles.nodeHeight/2},Y=E(ut),tt={x:Y.x-_t.x,y:Y.y-_t.y+s.styles.nodeHeight/2};F.setPosition(_t,tt)}}function b(){if(h){for(const[D,F]of r){const G=h.positions.get(D);if(!G){console.warn(`Could not find node in layout: Skipping ${D}`);continue}const V=E(G);F.setPosition(V),o.updateNodeAxis({nodeId:D,axis:G.y}),a.updateNodeAxis({nodeId:D,axis:G.column})}_(),e.emit("rendered"),e.emit("resized",O())}}async function v(D){const F=r.get(D.id);if(F)return F;const G=await QR(D);return G.element.on("resized",V=>S(D.id,V)),r.set(D.id,G),e.addChild(G.element),G}function S(D,F){if(!h)return;const G=r.get(D),V=h.positions.get(D);!G||!V||(o.setOffset({nodeId:D,axis:V.y,offset:F.height}),a.setOffset({nodeId:D,axis:V.column,offset:F.width}),b())}function E(D){const F=o.getTotalOffset(D.y);return{x:I(D),y:F}}function I(D){return pt.isDependency()?a.getTotalOffset(D.column):D.x}function A(){return h?o.getTotalValue(h.maxRow):0}function P(){if(!h||!l)return 0;if(pt.isDependency())return a.getTotalValue(h.maxColumn);const D=fd(l.start_time),F=zy(D),G=F(l.end_time??new Date),V=F(l.start_time);return G-V}function O(){return{width:P(),height:A()}}function W({data:D}){const{type:F}=D;switch(F){case"layout":L(D);return;default:qR(F)}}function L(D){h=D.layout,b()}async function C(){const D=await Di(),F=DR();if(!F||D.disableEdges){N([]);return}const G=Z(F.id);N(G)}function N(D){X(D),K(D)}function X(D){for(const[F,{element:G}]of r){if(D.length===0||D.includes(F)){G.alpha=1;continue}G.alpha=s.styles.nodeUnselectedAlpha}}function K(D){for(const[F,{element:G}]of t){const[V,$]=F.split("_");if(D.length===0||D.includes(V)&&D.includes($)){G.alpha=1;continue}G.alpha=s.styles.nodeUnselectedAlpha}}function Z(D){const F=z(D,"parents"),G=z(D,"children");return[D,...F,...G]}function z(D,F){const G=l==null?void 0:l.nodes.get(D);if(!G)return[];const V=[];for(const{id:$}of G[F])V.push($),V.push(...z($,F));return V}return{element:e,stopWorker:d,getSize:O,render:u}}let Ro=null,kr=null,Ss=null;async function iM(){const r=await Qe(),t=await be(),{element:e,render:i}=await _b();r.addChild(e),e.alpha=0;const s=await Wg(t.runId,async n=>{const o=kr?"runDataUpdated":"runDataCreated";kr=n,bt.emit(o,kr),await Di(),i(n)});bt.on("configUpdated",()=>{kr&&i(kr)}),Ss=e,Ro=s.stop,Ss.once("rendered",()=>sM()),bt.on("layoutUpdated",()=>nM()),s.start()}function rM(){Ro==null||Ro(),Ro=null,Ss=null,kr=null}async function Id(){return kr||await Ze("runDataCreated")}function sM(){gd(),ye.shared.addOnce(()=>{Ss&&(Ss.alpha=1)})}async function nM(){if(!Ss)return;const r=await be();Ss.once("rendered",()=>{setTimeout(()=>{gd({animate:!0})},r.animationDuration)})}function oM(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function aM({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(Nb(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap,a=.5;return e.size*o*a*s/(n*20)}async function hM(){const r=await Id(),t=await be(),e=await Ve(),i=e.view.width/e.view.height,s=aM(r,t,i);kh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(pt.disableAnimations=!0),oM(r.nodes)>t.disableEdgesThreshold&&(pt.disableEdges=!0)}function lM(){pt.horizontal="temporal",pt.vertical="nearest-parent",pt.horizontalScaleMultiplierDefault=0,pt.horizontalScaleMultiplier=0,pt.disableAnimations=!1,pt.disableEdges=!1,pt.disableGuides=!1}const pt=j.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableEdges:!1,disableGuides:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"},isLeftAligned(){return this.horizontal==="left-aligned"}});async function Di(){return Rd()?pt:await Ze("layoutSettingsCreated")}function Ad(){return pt.isDependency()?200:20*pt.horizontalScaleMultiplier}function uM(){return[0,Ad()]}function cM(r){if(pt.isDependency())return[0,1];const t=r,e=Pb(t,1);return[t,e]}function kh(r,t=!1){if(pt.horizontalScaleMultiplier===r)return;const e=Oh();pt.horizontalScaleMultiplier=r,t&&(pt.horizontalScaleMultiplierDefault=r),e()}function dM(){kh(pt.horizontalScaleMultiplierDefault)}function pM(r){if(pt.horizontal===r)return;const t=Oh();pt.horizontal=r,pt.disableGuides=pt.isDependency()||pt.isLeftAligned(),t()}function fM(r){if(pt.vertical===r)return;const t=Oh();pt.vertical=r,t()}function mM(r){if(pt.disableEdges===r)return;const t=Oh();pt.disableEdges=r,t()}function Oh(){const r=Rd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=pt;return()=>{Rd()&&bt.emit(r,pt),(t!==pt.horizontal||e!==pt.vertical)&&bt.emit("layoutUpdated")}}function Rd(){return pt.horizontalScaleMultiplier!==0}function vb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const gM={class:"flex items-center gap-2"},yM=j.defineComponent({__name:"RunGraphSettings",setup(r){const t=[Zi.positions.topRight,Zi.positions.bottomRight,Zi.positions.topLeft,Zi.positions.bottomLeft],e=[{label:"Temporal dependency",value:"temporal_nearest-parent"},{label:"Temporal sequence",value:"temporal_waterfall"},{label:"Dependency grid",value:"dependency_nearest-parent"},{label:"Sequential grid",value:"dependency_waterfall"},{label:"Comparative duration",value:"left-aligned_duration-sorted"}],i=j.computed({get(){return`${pt.horizontal}_${pt.vertical}`},set(l){const[u,c]=l.split("_");pM(u),fM(c)}}),s=j.computed({get(){return pt.disableEdges},set(l){mM(l)}});function n(){const u=pt.horizontalScaleMultiplier*1.25;kh(u)}function o(){const l=Math.abs(-.75),u=pt.horizontalScaleMultiplier*l;kh(u)}pr.useKeyDown(["-","="],a);function a(l){if(!(vb(l.target)||l.metaKey||l.ctrlKey))switch(l.key){case"-":o();break;case"=":n();break}}function h(){dM()}return(l,u)=>{const c=j.resolveComponent("p-radio-group"),d=j.resolveComponent("p-label"),p=j.resolveComponent("p-divider"),m=j.resolveComponent("p-checkbox"),f=j.resolveComponent("p-overflow-menu");return j.openBlock(),j.createBlock(j.unref(Zi.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:j.withCtx(({toggle:g})=>[j.createVNode(j.unref(Zi.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:g},null,8,["onClick"])]),default:j.withCtx(()=>[j.createVNode(f,{class:"run-graph-settings__menu"},{default:j.withCtx(()=>[j.createVNode(d,{label:"Layout"},{default:j.withCtx(()=>[j.createVNode(c,{modelValue:i.value,"onUpdate:modelValue":u[0]||(u[0]=g=>i.value=g),options:e},{label:j.withCtx(({option:g})=>[j.createTextVNode(j.toDisplayString(g.label),1)]),_:1},8,["modelValue"])]),_:1}),j.unref(pt).isTemporal()||j.unref(pt).isLeftAligned()?(j.openBlock(),j.createElementBlock(j.Fragment,{key:0},[j.createVNode(p),j.createVNode(d,{label:"Scaling"},{default:j.withCtx(()=>[j.createElementVNode("div",gM,[j.createVNode(j.unref(Zi.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:o}),j.createVNode(j.unref(Zi.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:n}),j.createVNode(j.unref(Zi.PButton),{small:"",onClick:h},{default:j.withCtx(()=>[j.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):j.createCommentVNode("",!0),j.createVNode(p),j.createVNode(m,{modelValue:s.value,"onUpdate:modelValue":u[1]||(u[1]=g=>s.value=g),label:"Hide dependency arrows"},null,8,["modelValue"])]),_:1})]),_:1})}}}),bM={class:"run-graph__actions"},xM=j.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=j.ref(),s=j.ref(!1),n=j.computed({get(){return e.fullscreen??s.value},set(u){s.value=u,t("update:fullscreen",u)}});j.watch(()=>e.selected,u=>Ed(u)),bt.on("nodeSelected",u=>t("update:selected",u)),j.watch(()=>e.viewport,u=>cR(u));const o=j.computed(()=>({root:{"run-graph--fullscreen":n.value}}));bt.on("viewportDateRangeUpdated",u=>t("update:viewport",u));function a(){gd({animate:!0})}function h(){n.value=!n.value}j.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");JR({stage:i.value,props:e})}),j.onBeforeUnmount(()=>{$R()}),pr.useKeyDown(["c","f","Escape"],l);function l(u){if(!(vb(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(u,c)=>{const d=j.resolveComponent("p-button");return j.openBlock(),j.createElementBlock("div",{class:j.normalizeClass(["run-graph",o.value.root])},[j.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),j.createElementVNode("div",bM,[j.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),j.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),j.createVNode(yM)])],2)}}}),Tb=["flow-run","task-run"];function _M(r){return Tb.includes(r)}ae.RunGraph=xM,ae.isRunGraphNodeType=_M,ae.runGraphNodeKinds=Tb,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"})});
1177
1177
  //# sourceMappingURL=graphs.umd.js.map